SDK based integration

SDK based integration for All-in-One payment solution allows you to integrate the SDK in your native apps for both Android and iOS apps. The integration lets your customers make seamless payments with Paytm regardless of Paytm app being installed on device or not.


This SDK supports the following flows:

  • App Invoke Flow: In case the Paytm app is installed, it will be launched to complete the transaction and give the result back to the merchant app.

  • Redirection Flow: In case the Paytm app is not installed, All-in-One SDK will open web-view to process transaction and give result to the merchant.

Overview of payment processing via SDK based integration

Note: This page describes the integration steps for integrating All-in-One payment solution for one time payment. In case you want to integrate the same for recurring payments, please refer to the

  1. On your mobile app, the user adds goods/services into the shopping/order cart and proceeds to checkout. You call the Initiate Transaction API from your backend to generate the transaction tokens.

    Within the Initiate Transaction API, you also get an option to include single or multiple payment sources for the users, thus allowing you to make your own payment page with multiple payment sources.

  2. Launch Paytm All-in-One SDK with the transaction token received in step 1.

  3. If Paytm app is installed on user's phone, the payment will be completed on Paytm app using the user's saved credentials else transaction will be processed via web view within the All-in-One SDK(Paytm hosted redirection flow).

  4. Paytm processes the transaction with the user’s bank and returns transaction response to your app.

  5. You call the Transaction Status API to verify the transaction response.

  6. Notify the payment status to the user and proceed with the order/service fulfilment.


Flow diagram for payment processing via SDK based integration



Before you begin the integration, make sure you follow the steps below:

  1. Create an account on Paytm as a merchant. Click how to create an account.

  2. Get the merchant ID and merchant key for the integration environment after creating the account.

  3. Go through the checksum logic to understand how to generate and validate the checksum.

  4. Get the staging android or iOS Paytm app for integration testing on the merchant staging environment.

Integration Steps for SDK based integration

  1. Add Dependencies for All-in-One SDK

    1. Add the line below to ‘repositories’ section of your project level build.gradle file.

      maven {
          url ""
    2. Add the line below to ‘dependencies’ section of your app build.gradle.

      implementation 'com.paytm.appinvokesdk:appinvokesdk:1.5.4'

      Note: To help you with the integration, we have provided a sample merchant app integrated with this SDK. To get the sample app, please click here.

      Please refer to the table below for other supported versions.

      appinvokesdk version Features Status
      com.paytm.appinvokesdk:appinvokesdk:1.5.4 OTP Auto Read Bug Fixes Published
      com.paytm.appinvokesdk:appinvokesdk:1.5.3 PlayStore app rejection handled - insecure encryption in EasyPay Available on request
      1. Redirection page bug fixes

      2. Subscription support added

      Available on request
    3. Download the paytm staging app from here and install it. Login on the staging app with credentials 7777777777 and static otp 888888.
  2. Call the Initiate Transaction API from your backend to generate Transaction Token.
    In case you want to allow/show specific payment sources, pass the enablePaymode param in the Initiate Transaction API as depicted below. This feature will enable you to create your own cart payment page with multiple payment sources. Please refer to the Initiate Transaction API documentation for all possible payment sources that can be enabled.

    For Example, if you want to enable UPI as the only paymode, then pass the parameters below within the Initiate Transaction API.
    "enablePaymentMode" : [{
    If you want to use only UPI Intent within All-in-One SDK, pass the below params:
    "enablePaymentMode" : [{
  3. Create an order object as following, passing the mandatory parameters.
    PaytmOrder paytmOrder = new PaytmOrder(orderid, mid, txnToken, amount, callbackurl)
    Attributes Description Mandatory



    Unique reference ID for a transaction which is generated by merchant Special characters allowed in Order ID are: "@" "-" "_" ".". Yes



    This is a unique identifier provided to every merchant by Paytm. MID is part of your account credentials and is different on staging and production environment. Yes



    Transaction token in response to the Initiate Transaction API request (Note - pass same order Id in SDK which was used for initiateTransaction). Yes



    Amount in INR payable by the customer. Should contain digits up to two decimal points. The amount should not include any separator like (",") Yes



    On completion of the transaction, Paytm Payment Gateway will send the response on this URL. This URL should be same as passed in callbackURL of Initiate Transaction API. It can be a dynamic or static response URL as mentioned below:
    • Staging Environment: "<order_id>"
    • Production Environment: "<order_id>"
  4. Create object of TransactionManager class and pass PaytmOrder object created in step 2 along with callback interface to receive results for redirection (webview flow).
    TransactionManager transactionManager = new TransactionManager(paytmOrder, new PaytmPaymentTransactionCallback() // code statement);
  5. Start the transaction passing requestCode to listen for All-in-One SDK flow in onActivityResult.
    transactionManager.startTransaction(this, requestCode);
  6. Getting payment status result.
    1. App Invoke flow i.e. if a transaction is processed via Paytm app

      For App Invoke, the result will be delivered via onActivityResult in your activity. Merchant has to pass request code while calling TransactionManager.startTransaction.
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          if (requestCode == ActivityRequestCode && data != null) {
          Toast.makeText(this, data.getStringExtra("nativeSdkForMerchantMessage") + data.getStringExtra("response"), Toast.LENGTH_SHORT).show();
    2. Redirection Flow (Paytm app is not installed on the user’s device)

      For redirection flow, the status of Payment will be delivered via PaytmPaymentTransactionCallback. This interface has multiple methods as given below to get an error or completion status of the transaction.
      public void onTransactionResponse(Bundle inResponse) {
          /*Display the message as below */
          Toast.makeText(getApplicationContext(), "Payment Transaction response " + inResponse.toString(), Toast.LENGTH_LONG).show();

      Sample Response

          "indent_size": "4",
          "indent_char": " ",
          "max_preserve_newlines": "5",
          "preserve_newlines": true,
          "keep_array_indentation": false,
          "break_chained_methods": false,
          "indent_scripts": "normal",
          "brace_style": "collapse",
          "space_before_conditional": true,
          "unescape_strings": false,
          "jslint_happy": false,
          "end_with_newline": false,
          "wrap_line_length": "0",
          "indent_inner_html": false,
          "comma_first": false,
          "e4x": false,
          "indent_empty_lines": false
  7. Paytm provides payment response on both Callback URL and Webhook URL. Please click here for more details.

On completion of your integration

Post completion of integration on your staging environment, do a complete transaction from order summary page on your website or mobile app.

  1. Attempt a test transaction using the test paymodes credentials.
  2. Ensure you re-verify transaction response with Transaction Status API (OR Fetch Subscription Status API in case of subscription payments) via server to server call in payment flow and not separately as a one-time activity.
  3. See the transaction details in the "Test Data” mode on your dashboard.

Once the test transaction is complete, move your code to live environment with production account details. Note that production accounts details are available after you have activated your account on the dashboard. Lastly, it's recommended that you read about Managing Refunds and late payment notifications In case of any issues with integration, please get in touch.