Skip to main content
This guide walks you through integrating the TransactBridge Drop-in SDK into your Android app using an AAR file.

1. Download the AAR

Download dropin.aar file by clicking on the link below Download dropin.aar

2. Add the AAR to Your Project

  1. Create a libs directory: In your Android project’s app module, create a new folder named libs if it doesn’t already exist. The path should be app/libs/.
  2. Place the AAR file: Copy the dropin.aar file into the app/libs/ directory.
  3. Update build.gradle (Module: app):

3. Declare Required Dependencies

Our SDK relies on Gson for JSON serialization/deserialization, OkHttp and Volley for network requests. It’s crucial to include these as dependencies in your app/build.gradle to ensure compatibility and prevent runtime issues. Please use the exact versions specified by the SDK to avoid dependency conflicts.

4. Initialize the SDK

Initialize the SDK in your Application class or main Activity:

5. Add Terms & Conditions View

In your layout XML:
In your Activity or Fragment, obtain the unique ID:

6. List Available UPI Apps

7. Generate Billing Session (Backend)

Important: The generation of the billing session, including the billingSessionId and token, involves sensitive API keys (x-api-key, x-signature) that must not be exposed in your mobile application. This process should be handled securely on your backend server. Your mobile application should call your backend, which then communicates with TransactBridge to obtain these details. Your backend should make an API call to TransactBridge’s /billingSession/v1.0/generateBillingSession endpoint. The response from this endpoint will contain the billingSessionId and token which your backend should then securely relay to your mobile application.

8. Launch UPI Payment

9. Handling Payment Results

The PaymentResultListener provides callbacks for onSuccess, onFailure, and onCancel. Handle these outcomes appropriately:
  • onSuccess(PaymentResult result): The payment was successful. You should typically verify this status with your backend before confirming the order or service to the user. The result object contains details like transactionId.
  • onFailure(PaymentResult result): The payment failed. The result object will contain error details if available. Inform the user and guide them on next steps.
  • onCancel(): The user cancelled the payment flow. Inform the user that the payment was not completed.