AePS Gateway Integration (Android)
Prerequisites
- Minimum Android SDK version of your app should be 21 (Android Lollipop 5.0) or later.
STEP 1: Add library in your Android project
Add jitpack in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add Eko AePS Gateway library to your app build.gradle file at the end of other dependencies:
Dependencies {
...
implementation 'com.github.ekoindia:gateway-android-sdk:1.2.1'
}
STEP 2: Configure & Launch AePS Activity
int AEPS_REQUEST_CODE = 10923;
// Set a value to AEPS_REQUEST_CODE
Intent intent = new Intent(this, EkoPayActivity.class);
Bundle bundle = new Bundle();
//Initialize all unknown variables and replace all dummy values
bundle.putString("environment", "uat");
bundle.putString("product","aeps");
bundle.putString("secret_key_timestamp", secret_key_timestamp);
bundle.putString("secret_key", secret_key);
bundle.putString("developer_key", "becbbce45f79c6f5109f848acd540567");
bundle.putString("initiator_id", "9962981729");
bundle.putString("callback_url", callback_url);
bundle.putString("callback_url_custom_headers", callback_url_custom_headers); //optional
bundle.putString("callback_url_custom_params", callback_url_custom_params); //optional
bundle.putString("user_code", "20810200");
bundle.putString("initiator_logo_url", initiator_logo_url);
bundle.putString("partner_name" , "PARTNER Name INC");
bundle.putString("language" , "en");
intent.putExtras(bundle);
startActivityForResult(intent, AEPS_REQUEST_CODE);
For description on above parameters, check section Configuration Parameters
Callback custom Headers and Params:
callback_ul_custom_headers and callback_url_custom_params must be first converted into onject in JAVA and then convert this object into string and then pass along with other parameters
STEP 3: Handle Final Response
AePS library uses the callback URL to send the response of every transaction.
Read post-transaction confirmation section for understanding on how to handle response using callback URL
Capture response of every transaction from callback URL
When the user navigates from AePS Activity to partner’s Activity two cases can occur
Case 1: AePS transaction is performed by the user on AePS SDK
Lastest transaction details will be sent to partner’s Activity
Case 2: No AePS transaction is performed by the user on AePS SDK
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == AEPS_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) { //user taps CLOSE button after transaction -- case 1
String response = data.getStringExtra("result");
//--------- response is transaction data
} else if(resultCode == Activity.RESULT_CANCELED) { // user presses back button
if (data == null) {
//------ If user pressed back without transaction -- case 2
} else {
String response = data.getStringExtra("result");
if (response!=null && !response.equalsIgnoreCase("")) {
//------ If there is some error in partner parameters, response is that error
//------ when user performs the transaction, response is transaction data -- case 1
} else {
}
}
}
}
}
This SDK is tested and working fine till Android 11
Changes for Integration on Android 11 :
Project Updates
#########################################################################################################
Updates :SDK versions -
compileSdkVersion 30
minSdkVersion 21
targetSdkVersion 30Gradle Versions -
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip (on gradle.properties)
classpath 'com.android.tools.build:gradle:4.1.3' (on project level gradle)#########################################################################################################
Solution :Add query parameter to enable rd services in android 11 devices
<intent> <action android:name="android.intent.action.SEND" /> <data android:mimeType="image/jpeg" /> </intent>
For the android integration, we recommend you to integrate the above SDK mentioned as per document and do not create a webview wrapper for our website version in order to avoid any inconsitent issues.
We do not provide any support in case you integrate the webview instead of integrating the SDK
Production Migration
On migration to the production environment set environment parameter to "production" and make sure that all values used are relevant to production environment. Make sure to check AePS production checklist
Updated almost 3 years ago
Backend Server-side Integration for AePS