Introduction

In our new approach to our mobile SDKs, Android & iOS SDK we want to ensure better security and have a better developer experience.

With the new SDKs, all transactions are started from your server, using your secret key (sk_live_13213), then completed on the mobile app using the public API key (pk_live_123132) and the transaction access_code. The benefit is that you keep your secret key away from the client side, which is a secure standard practice.

Mobile developers don’t have to design a custom card interface, since the SDK already provides this. The old SDKs required developers to create their own input fields, then parse the user input to the Paystack SDK to create a transaction.

<aside> 🔖 The SDKs currently supports card payments only, since we don’t allow direct submission of cards to our APIs. You’ll need to design interfaces for other payment channels.

</aside>

Installing the SDK

To install the Paystack Android SDK, you’ll need to follow the steps below:

Minimum requirements

In the dependencies block of your app-level build.gradle file, add the following line:

dependencies {
		// Other dependencies
	implementation("com.paystack.android:paystack-ui:0.0.5")
}

Initialize the SDK

To initialize the SDK on your app, you need to pass your public key to the build method.

val paystack = Paystack.builder().setPublicKey("pk_{your-public-key}").build()
Paystack.builder
    .setPublicKey("pk_{your-public-key}")  
    .build()

Create a payment sheet

The PaymentSheet component, is needed to launch the SDKs user interface in an apps Activity. It takes two arguments, the activity it’ll be rendered in and a callback function that’s called when the transaction completes.