Integration Steps
Integration Guide for connecting to Jio Payment Solutions Limited Payment Gateway using JAVA Mobile SDK
Make sure that the prerequisites are met before initialization
SDK Integration
Step 1: Add SDK Dependency
If you have received a .aar SDK file, follow these steps to add the SDK to your project:
- Place the
jio_payments_sdk.aarfile into theapp/libs/directory. - Edit your
build.gradle (Module: app)file as follows:
repositories {
flatDir {
dirs 'libs'
}
dependencies {
implementation files('libs/jio_payments_sdk.aar')
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
api 'com.google.code.gson:gson:2.10.1' // or latest version
api 'com.fasterxml.jackson.core:jackson-databind:2.17.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation libs.androidx.appcompat
}
}
Step 2: Required Configurations
Android Permissions
Ensure the INTERNET permission is declared in AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
Enable Multidex (Optional)
If your app exceeds the 64K method limit, enable multidex support:
defaultConfig {
multiDexEnabled true
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
}
Trigger the Payment Checkout
Below is the sample application’s MainActivity file that can be used to initiate the payment:
public class MainActivityJava extends AppCompatActivity {
...
@Override
protected void onCreate(Bundle savedInstanceState) {
...
new JioPaySDK.Builder()
.setEnvironment(environmentConst)
.setAggregatorId(aggregatorId)
.setMerchantId(merchantId)
.setSecret(secretKey)
.setAmount(amount)
.setCustomerName(customerName)
.setCustomerEmailID(customerEmail)
.setMerchantName(merchantName)
.setMerchantImage(merchantImage)
.setMerchantTxnNo(merTxnId)
.setTimeout(timeout)
.setPaymentModeAllowed(modes) //"CARD", "NB", "UPI"
.build();
....
}
...
}Accepting response
// Using ActivityResult API for SDK response
private final ActivityResultLauncher<Intent> responseLauncher =
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
if (result.getResultCode() == Activity.RESULT_OK) {
Intent data = result.getData();
try {
JioPaymentResponse response = data.getParcelableExtra(JioPaySDK.RESPONSE);
showResponseDialog(response.getStatus(), response.getRawJsonResponse());
} catch (Exception e) {
showResponseDialog("N/A", "Response Not Available");
}
JioPaySDK.clearInstance();
}
});Understanding Payment Result Callback
After initiating a payment using the Jio Payment SDK, your application needs to be informed about the outcome-whether the payment was completed, or cancelled. This is where the PaymentResult class and its associated callback mechanism come into play.
Understand Callbacks by following the link
Updated 12 months ago

