Requirements
- Android 6.0 (API level 23) and above
- Android Gradle Plugin 8.5+
- Gradle 8.8+
- AndroidX
1. Setup the Server
2. Build Checkout Page on Your App
2.1 Add the Buildscript Classpath
To start integrating the Pesaswap SDK, add the following classpath to thebuildscript block of your project-level build.gradle file:
2.2 Add the Plugin
Add the following plugin to theplugins block of your app-level build.gradle file:
2.3 Implement the HyperInterface
Next, implement theHyperInterface in your CheckoutActivity. This involves extending FragmentActivity and implementing the HyperInterface:
Note :
PaymentSession is designed to work with AndroidX activities. Ensure that your CheckoutActivity extends FragmentActivity or its subclass from the AndroidX library.2.4 Setup the SDK and Fetch a Payment
Set up the SDK using your publishable key. This is essential for initializing aPaymentSession:
Note : PaymentSession needs to be initialized in onCreate method of your
FragmentActivity. Note : For an open-source setup, use the following parameters:
Fetch a Payment
Request your server to fetch a payment as soon as your view is loaded. Store theclient_secret returned by your server. The PaymentSession will use this secret to complete the payment process.
3. Complete the Payment on Your App
Initialize Payment Session
Initialize the payment session with theclient_secret:
Handle Payment Result
Handle the payment result in the completion block. Display appropriate messages to your customer based on the outcome of the payment: Important : Please retrieve the payment status from the Pesaswap backend to get the terminal status of the payment. Do not rely solely on the status returned by the SDK, as it may not always reflect the final state of the transaction.