Android Native SDK: PortOne's Checkout
#
Integration:#
SDK Integration prerequisitesAdd PortOne SDK in dependency in build.gradle (:app)
Add Authorization key provided by PortOne in gradle.properties
Add the following snippets in build.gradle (:Project) or in settings.gradle to get access of the library.
Add the following snippets in build.gradle (:Project) to get access of the library.
Initialize the
PortOne
Instance in your checkout activity which will be used to access checkout methods. You will also require to pass the environmentAdd the following Intent Filter to the Activity to which you want the user to be navigated after completion of payment. Default is should be Checkout Activity. In the data tag there are two parameters
host
andscheme
whose values will be set according the redirection url.
#
Checkout :- Generate a jwt token with your client key and secret key.
Recomanded Library for generating jwt Token on frontend:
- Generate a Signture Hash to be added in payload.
- To checkout using webview, the following method has to be invoked with the required request body
- After the completion of checkout, app has to receive its payment status which has to be handled using intent and the received status will be passed to the updatePaymentStatus() method
- The following method has to be added on the checkout activity where the checkout action has performed to receive the checkout status after checkout completion the HashMap format.
- Things to be taken care while generating payload:
Mandatory params in payload:
If items are provided then please verify the values provided should match the total amount:
sum(items price * items quantity) + shipping charge - discount = amount
#
Example Integration:https://github.com/iamport-intl/chaiport-android-sdk-merchant-demo-app