Skip to content

shurjopay-plugins/sp-plugin-usage-android-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shurjoPay(V2) Android SDK

shurjoPay(V2) Android SDK Integration

shurjoPay V2 Android SDK Integration

Integration documentation:

shurjoPay Online Payment API Integration Guide

Android Dependencies

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"

Android AndroidManifest

<uses-permission android:name="android.permission.INTERNET"/>

Request Data Model Setup:

// 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
)

Response Listener Setup:

// 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
    }
}

Payment Request Setup:

// 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

About

Android SDK for shurjoPay Payment gateway

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published