search

Paytm Wallet and Postpaid Integration

This page explains the steps to integrate the Paytm Wallet and Paytm Postpaid in the Custom Checkout solution to collect payment from your customer. Users can select any of these sources for payment subject to their balance availability.

Demo

Integration Steps

Paytm user has the flexibility to make payments via different sources like Wallet and Postpaid.

This section explains the integration steps to process payment through any of these payment sources. Before you begin the integration, make sure you follow  the Pre-requisites and Integration Steps.

  1. User selects Paytm for payment on your checkout page and enters their Paytm registered mobile number. 
  2. You call the Send OTP API to verify their account and then Paytm triggers the OTP to the mobile number passed in the request.
  3. To validate the OTP entered by a user, you call the Validate OTP API. You may also hit the Fetch balance Info API to check the balance available in user's Paytm Wallet and Postpaid. Here also you will get status of accounts in response and you can show only active accounts for the users to choose from.
  4. After the user selects a payment source, let's say Paytm Wallet and clicks Pay to proceed for checkout, you call the Process Transaction API to process the transaction.

    Note: You can hit the Process Transaction API either through Form Post or JSON based.

Postman Collection - Payment processing through Paytm Wallet

This postman collection lets you quickly understand the flow integration for payment processing through paytm wallet. This will help you to understand and test the APIs with sample request/response on integration environment for Paytm Wallet and Postpaid integration.
 

Run in Postman


To set up the environment for using the Postman Collection, click  here.

  1. You hit the Process Transaction API as an HTML form post through the client. The sample request/response for the different Paytm payment sources are explained below:
    1. Wallet - User selects Wallet and in case of sufficient balance, payment is completed immediately. Please refer to the sample request/response below:
      <form method="post" type="redirect" action="https://securegw-stage.paytm.in/theia/api/v1/processTransaction?mid=INTEGR7769XXXXXX9383&orderId=ORDERID_98765" >
          <input type="text" name="mid" value="INTEGR7769XXXXXX9383" />
          <input type="text" name="orderId" value="ORDERID_98765" />
          <input type="text" name="txnToken" value="f0bed899539742309eebd8XXXX7edcf61588842333227" />
          <input type="text" name="paymentMode" value="BALANCE" />
          <input type="text" name="AUTH_MODE" value="otp" />
          <input type="submit" />
      </form>
    2. Postpaid- User selects Postpaid and in case of sufficient limit, payment is completed immediately. Please refer to the sample request/response below:
      <form method="post" type="redirect" action="https://securegw-stage.paytm.in/theia/api/v1/processTransaction?mid=INTEGR7769XXXXXX9383&orderId=ORDERID_98765" >
          <input type="text" name="mid" value="INTEGR7769XXXXXX9383" />
          <input type="text" name="orderId" value="ORDERID_98765" />
          <input type="text" name="txnToken" value="f0bed899539742309eebd8XXXX7edcf61588842333227" />
          <input type="text" name="paymentMode" value="PAYTM_DIGITAL_CREDIT" />
         <input type="text" name="AUTH_MODE" value="3D" />
          <input type="submit" />
      </form>
  2. You receive the transaction status on a Callback URL. Please refer to the sample response here.
  3. Prior to verifying the payment, you must validate the checksumhash received in response to the Process Transaction API. To verify it, use the Paytm library with all the parameters in key-value pairs on the merchant server.
  4. Validate the transaction response via server-side request using the Transaction Status API. You must verify the order Id and the amount with your DB entries and consider the status as the final status of the transaction in all cases.
  5. After the transaction status verification, you show final payment status to the user.
  1. You hit the Process Transaction API as a JSON request from the client or backend server. The sample request/response for the different Paytm payment sources are explained below:
    1. Wallet - User selects Wallet and in case of sufficient balance payment is completed immediately. Please refer to the sample request/response below:

      Request

      curl -X POST 'https://securegw-stage.paytm.in/theia/api/v1/processTransaction?mid=INTEGR7769XXXXXX9383&orderId=ORDERID_98765'\
      --header 'Content-Type: application/json' \
      --data '{"head":{"txnToken":"f0bed899539742309eebd8XXXX7edcf61588842333227"},"body":{"requestType":"NATIVE","mid":"INTEGR7769XXXXXX9383","orderId":"ORDERID_98765","paymentMode":"BALANCE","authMode":"otp"}}'

      Response

      {
          "head": {
              "responseTimestamp": "1595583455513",
              "version": "v1"
          },
          "body": {
              "resultInfo": {
                  "resultStatus": "S",
                  "resultCode": "0000",
                  "resultMsg": "Success",
                  "retry": false
              },
              "txnInfo": {
                  "BANKNAME": "WALLET",
                  "BANKTXNID": "62909810",
                  "CHECKSUMHASH": "Y6xCbNoZSV8gy+q1OoOFo077zjS0UT0BbBTzLinN69p4hOd7per9Dq7T2xSa1Nm4WIoOO99pXknDEyYvl54ZYfL3imvy0EVlQu0pfRH4gl8=",
                  "CURRENCY": "INR",
                  "GATEWAYNAME": "WALLET",
                  "MID": "INTEGR7769XXXXXX9383",
                  "ORDERID": "ORDERID_98765",
                  "PAYMENTMODE": "PPI",
                  "RESPCODE": "01",
                  "RESPMSG": "Txn Success",
                  "STATUS": "TXN_SUCCESS",
                  "TXNAMOUNT": "1.00",
                  "TXNDATE": "2020-07-24 15:06:31.0",
                  "TXNID": "f0bed899539742309eebd8XXXX7edcf61588842333227"
              },
              "callBackUrl": "https://merchant.com/callback/"
          }
      }
    2. Postpaid - User selects Postpaid and in case of sufficient limit, payment is completed immediately. Please refer to the sample request/response below:

      Request

      curl -X POST 'https://securegw-stage.paytm.in/theia/api/v1/processTransaction?mid=INTEGR7769XXXXXX9383&orderId=ORDERID_98765' \
      --header 'Content-Type: application/json' \
      --data '{"head":{"txnToken":"f0bed899539742309eebd8XXXX7edcf61588842333227"},"body":{"requestType":"NATIVE","mid":"INTEGR7769XXXXXX9383","orderId":"ORDERID_98765","paymentMode":"PAYTM_DIGITAL_CREDIT","authMode":"3D"}}'

      Response

      {
          "head": {
              "responseTimestamp": "1597817084408",
              "version": "v1"
          },
          "body": {
              "resultInfo": {
                  "resultStatus": "S",
                  "resultCode": "0000",
                  "resultMsg": "Success",
                  "retry": false
              },
              "txnInfo": {
                  "BANKNAME": "PAYTMCC",
                  "BANKTXNID": "14120200819119258215",
                  "CHECKSUMHASH": "Z+3eW9BGU6mI4Yg4Fy5MDdOQVpHGvbdAvl/zYnvhi+VpuLfDPu0hZHXjn1Yh0Hsg7jJOKowqrqytJcujFufi/r823ArbPi6q9+Ef+oyRwOs=",
                  "CURRENCY": "INR",
                  "GATEWAYNAME": "PAYTMCC",
                  "MID": "INTEGR7769XXXXXX9383",
                  "ORDERID": "ORDERID_98765",
                  "PAYMENTMODE": "Paytm Postpaid",
                  "RESPCODE": "01",
                  "RESPMSG": "Txn Success",
                  "STATUS": "TXN_SUCCESS",
                  "TXNAMOUNT": "1.00",
                  "TXNDATE": "2020-08-19 11:34:37.0",
                  "TXNID": "202005081112128XXXXXX68470101509706"
              },
              "callBackUrl": "http://localhost/paytmkit/callback.php"
          }
      }
  2. You receive the transaction status on a Callback URL. Please refer to the sample response here.
  3. Prior to verifying the payment, you must validate the checksumhash received in response to the Process Transaction API. To verify it, use the Paytm library with all the parameters in key-value pairs on the merchant server.
  4. Validate the transaction response via server-side request using the Transaction Status API. You must verify the order Id and amount with your DB entries and consider the status as the final status of the transaction in all cases.
  5. After the transaction status verification, you show the final payment status to the user.

Post integration steps

Post completion of integration in your staging environment, it is mandatory to test the Paytm Payment Sources integration on your website/app before moving into the live environment with production account details (received from Paytm team)

  1. You can view the staging transaction details in the “Test Data” mode on your dashboard.
  2. You must ensure to re-verify the transaction response with Transaction Status API via server to server call for payment flow and not as a one-time activity.

Post successful testing in your staging environment, move your code to the live environment with production account details. These credentials will be available after you activate your business account with Paytm on the Merchant Dashboard.

Paytm recommends you to read about Managing Refunds and late payment notifications for a better understanding of the integration.

For any issues with the integration, refer to Get in touch.