Kotlin with Node Backend
Integrate hyper SDK to your Kotlin App using payswitcher-node
Last updated
Integrate hyper SDK to your Kotlin App using payswitcher-node
Last updated
Android 5.0 (API level 21) and above
7.3.1
7.5.1+
payswitcher-node
libraryInstall the package and import it in your code
Before creating a payment, import the payswitcher-node
dependencies and initialize it with your API key.
Add an endpoint on your server that creates a Payment. Creating a Payment helps to establish the intent of the customer to start a payment. It also helps to track the customerβs payment lifecycle, keeping track of failed payment attempts and ensuring the customer is only charged once. Return the client_secret
obtained in the response to securely complete the payment on the client.
Add the following maven repository to the settings.gradle file
Add payswitcher-android to the dependencies block of your build.gradle file to install the SDK
Implement the HyperInterface to your CheckoutActivity
Setup the SDK with your publishable key
Fetch a payment by requesting your server for a payment as soon as your view is loaded. Store a reference to the client_secret
returned by the server; the Payment Sheet will use this secret to complete the payment later.
Create a PaymentSheet instance using the client_secret
retrieved from the previous step. Present the payment page from your view controller and use the PaymentSheet.Configuration struct for customising your payment page.
Handle the payment result in the completion block and display appropriate messages to your customer based on whether the payment fails with an error or succeeds.
Congratulations! Now that you have integrated the Android SDK, you can customise the payment sheet to blend with the rest of your app.