shurjoPay V2 Android SDK Integration
shurjoPay Online Payment API Integration Guide
implementation files("libs/sdk-name.aar")
implementation "com.squareup.retrofit2:retrofit:version"
implementation "com.squareup.retrofit2:converter-gson:version"
implementation "com.squareup.retrofit2:converter-scalars:version"
<uses-permission android:name="android.permission.INTERNET"/>
// TODO request data model setup
val data = RequiredData(
username,
password,
prefix,
currency,
amount,
orderId,
discountAmount,
discPercent,
customerName,
customerPhone,
customerEmail,
customerAddress,
customerCity,
customerState,
customerPostcode,
customerCountry,
returnUrl,
cancelUrl,
clientIp,
value1,
value2,
value3,
value4
)
// TODO response listener
object : PaymentResultListener {
override fun onSuccess(errorSuccess: ErrorSuccess) {
Log.d(TAG, "onSuccess: transactionInfo = ${errorSuccess.transactionInfo}")
Toast.makeText(
this@MainActivity, "onSuccess: transactionInfo = " +
errorSuccess.transactionInfo, Toast.LENGTH_LONG
).show()
}
//
override fun onFailed(errorSuccess: ErrorSuccess) {
Log.d(TAG, "onFailed: message = ${errorSuccess.message}")
Toast.makeText(this@MainActivity, errorSuccess.message, Toast.LENGTH_SHORT).show()
}
//
override fun onBackButtonListener(errorSuccess: ErrorSuccess): Boolean {
return true
}
}
// TODO payment request setup
ShurjoPaySDK.instance?.makePayment(
this,
Constants.SDK_TYPE_SANDBOX,
data,
object : PaymentResultListener {
override fun onSuccess(errorSuccess: ErrorSuccess) {
Log.d(TAG, "onSuccess: transactionInfo = ${errorSuccess.transactionInfo}")
Toast.makeText(
this@MainActivity, "onSuccess: transactionInfo = " +
errorSuccess.transactionInfo, Toast.LENGTH_LONG
).show()
}
override fun onFailed(errorSuccess: ErrorSuccess) {
Log.d(TAG, "onFailed: message = ${errorSuccess.message}")
Toast.makeText(this@MainActivity, errorSuccess.message, Toast.LENGTH_SHORT).show()
}
})
shurjoPay(V2) Android SDK Integration