Kotlin with Node Backend
Integrate hyper SDK to your Kotlin App using hyperswitch-node
Last updated
Was this helpful?
Integrate hyper SDK to your Kotlin App using hyperswitch-node
Last updated
Was this helpful?
Android 6.0 (API level 23) and above
8.5+
8.8+
Follow the section.
To start integrating the Hyperswitch SDK, add the following classpath to the buildscript
block of your project-level build.gradle
file:
Add the following plugin to the plugins
block of your app-level build.gradle
file:
Next, implement the HyperInterface
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
Set up the SDK using your publishable key. This is essential for initializing a PaymentSession
:
Note:
PaymentSession needs to be initialised 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 the client_secret
returned by your server. The PaymentSession
will use this secret to complete the payment process.
Initialise Payment Session
Initialise the payment session with the client_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:
Please retrieve the payment status from the Hyperswitch 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.
Present the Payment Page
Create a configuration object to customize the payment sheet and present the payment page:
Congratulations! You have successfully integrated the Hyperswitch Android SDK into your app. You can now customize the payment sheet to match the look and feel of your app.