Commerce Connect - API Document
Steps to integrate Commerce Connect Android SDK are given below
- Server Side API to Create Session Token.
- Install FirstConnect Android SDK.
- Instantiate and Initialize Commerce Connect Android SDK.
- Handle Success and Failure Events.
Server Side API to Create Session Token
To do Payment Transaction, the merchant application should sign the contract with Commerce Connect and get the following details to initiate the payment process with FirstData
- Merchant ID
- Config ID (Page ID)
- AES Encryption KEY [Secret Key, Plain Text]
- Request Params based on the Merchant Payment Types – There are four different format of Request Params a. HOSTED PAGE INTEGRATION. b. MERCHANT PAYMENT MODE INTEGRATION. c. MERCHANT PAYMENT MODE BANK OR WALLET INTEGRATION. d. MERCHANT PAYMENT MODE CARD INTEGRATION.
{
"cardData": {
"cVV": "123",
"cardNumber": "4035874000424977",
"expMonth": "12",
"expYear": "24",
"nameOnCard": "Vishal Utekar",
"vaultCard": false
},
"bankData": {
"bankName": "State Bank Of India",
"firstPayBankCode": "SBOINB"
},
"customerDetails": {
"billingAddress": {
"city": "Mumbai",
"country": "country",
"state": "Maharashtra",
"stree2": "Sai Nagar",
"street1": "Ghodbandar Rode",
"zipcode": 400000
},
"customerId": "ABC1234",
"emailId": "abc@gmail.com",
"hostedIds": ["KRS1220ESFFTR8490"],
"mobileNo": "1234567890",
"name": {
"firstName": "ABC",
"lastName": "XYZ",
"middleName": "DEF",
"suffix": "ADX"
},
"shippingAddress": {
"city": "Mumbai",
"country": "country",
"state": "Maharashtra",
"stree2": "Sai Nagar",
"street1": "Ghodbandar Rode",
"zipcode": 400000
}
},
"integrationType": "MERCHANT_PAYMENT_MODE_CARD_INTEGRATION",
"paymentMethodType": "CREDITCARD",
"productData": {
"discountPrice": "0",
"price": "100",
"productDescription": "Water Bottle",
"productId": "P123",
"quantity": 1,
"shippingFee": "20",
"txnAmount": "120"
},
"resultURL": "/FirstPayL2Services/merchantSuccessPage.jsp",
"transactionDetails": {
"amount": "100",
"clientTransactionId": "123456",
"currencyCode": "INR",
"transactionType": "SALE"
}
}
From merchant app, we need to create an API which makes the below 2 API calls internally (HMAC, SESSION TOKEN) and return the SESSION TOKEN. For implementing this we have a separate implementation guide (WEB SDK INTEGRATION GUIDE).
NOTE: We are calling the API's from server side to ensure the security. Refer server side implementation.
Install Commerce Connect Android SDK
- Download the latest version of the Android SDK and place the firstpay-android-0.1.aar, razorpay-android-3.8.6.aar file inside the libs folder.
- Add the code given below to your project's top-level build.gradle file: This gives access to the SDK library.
- Add the following lines of code to your app's build.gradle file:
- Open /app/manifest/AndroidManifest.xml and add the following uses-permission element after the application element.
- Include the following proguard rule filesL:
implementation files('libs/FirstPaySDK.aar')
implementation files('libs/razorpay-android-3.8.6.aar')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// Navigation & Lifecycle arch
def nav_version_ktx = '2.2.0-beta01'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version_ktx"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version_ktx"
implementation "androidx.lifecycle:lifecycle-extensions:$nav_version_ktx"
// For android ui
def ui_component_version = "1.0.0"
implementation "androidx.recyclerview:recyclerview:$ui_component_version"
implementation "androidx.cardview:cardview:$ui_component_version"
implementation "androidx.gridlayout:gridlayout:$ui_component_version"
//Retrofit for Webservice
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
implementation "com.squareup.retrofit2:converter-moshi:2.4.0"
// For Kotlin Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
implementation 'com.google.code.gson:gson:2.8.5'
//Glide for image load
implementation 'com.github.bumptech.glide:glide:4.9.0'
uses-permission android:name="android.permission.INTERNET"/>
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
-dontwarn com.firstdata.fdsdk.**
-keep class com.firstdata.fdsdk.** {*;}
//The Firstpay SDK will perform the payment flow and the result will be given back to application's payment activity onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (resultCode) {
case FDConstants.FD_PAYMENT_SUCCESS:
String paymentSuccessResult = data.getStringExtra(FDConstants.FD_PAYMENT_RESULT);
break;
case FDConstants.FD_PAYMENT_FAILURE:
String paymentFailureResult = data.getStringExtra(FDConstants.FD_PAYMENT_RESULT);
break;
case FDConstants.FD_PAYMENT_USER_CANCELLED:
String paymentCancelledResult = data.getStringExtra(FDConstants.FD_PAYMENT_RESULT);
break;
}
}
Download
Commerce Connect Integration Pack | |
---|---|
Integration Commerce Connect Android SDK | Integration Pack Please Sign In to download |
Integration Pack
Please Sign In to download