• Callback Response
  • Getting Started
    • Mobile Integration (Android/IOS)
      Enterprise Solutions
      Retail Solutions
      Accept Payments
      Process Payments
      Disbursals
      API References
      Refunds
      Guides
      Other links
      Mini Program Platform
  • Features for Investments PG
  • paytmPayment JS API

    Use Case


    This method can be used to invoke paytm payment option, user will be able to see all the available payment options, after successful transaction client side will receive the callback.


    Request Attributes

    Content format: JSON

    ParameterDescriptionRequiredExample Value
    amountAmount to be paid by customer in INRYes1.00
    orderIdUnique reference ID for a transaction which is generated by merchant and sent in the requestyes0071490615
    txnTokenIt is the security token generated by Initiate Transaction API for a transaction. It is valid for 15 minutes.Yesfe795335ed3049c78a57271075f2199e1526969112097
    midThis is a unique identifier provided to every merchant by PaytmYesABCdj00008000000

    Response Attributes

    Once the payment is done, the response callback is received, which can be in either of the two formats:

    • {"data": false} if no response string was generated by the internal payment mechanism, due to an unknown reason.
    • {"data": ""} if some unknown error occured.
    • {"data": <RESULT_STRING>} if a response string was successfully generated

    Note: If the value against "data" key is a string, it should be parsed into a json to obtain the response attributes detailed below. In this case, the json thus parsed contains fields indicating whether the payment succeeded or failed (along with the reason for failure).

    Success:

    ParameterDescriptionExample Value
    ORDERIDUnique reference ID for a transaction which is generated by merchant and sent in the request0071490615
    MIDThis is a unique identifier provided to every merchant by PaytmABCdj00008000000
    TXNIDThis is a unique Paytm transaction ID that is issued by Paytm for each transaction20191001111212800110168390621570
    TXNAMOUNTOrder value of the transaction in INR. Merchant should validate this amount against that send in transaction request payload. In case the amount does not match, merchant should not provide the services to customer. This is needed to avoid request and response tampering possible at the time of transaction.1.00
    PAYMENTMODEThe payment mode used by customer for transaction
    Credit card – CC
    Debit card - DC
    Net banking - NB
    UPI - UPI
    Paytm wallet – PPI
    Postpaid - PAYTMCC
    UPI
    TXNDATEDate and Time of transaction in the format "yyyy-MM-dd HH:mm:ss.S"Example: "2015-11- 02 11:40:46.0"2019-10-01 11:44:57.0
    STATUSThis contains the transaction status and has only three values: TXN_SUCCESS, TXN_FAILURE and PENDINGTXN_SUCCESS
    RESPCODECodes refer to a particular reason of payment failure/success.01
    RESPMSGDescription message is linked with each respcodeTxn Success
    GATEWAYNAMEGateway used by Paytm to process the transactions. By paymodes, the details are provided below
    Credit, Debit cards, UPI - Gateway used to process the transaction. For example, if HDFC gateway has been used to process SBI credit card transactions, the value will be HDFC
    Net banking - Netbanking transactions are not routed via gateway. Hence issuing bank name is passed in this field Paytm Wallet - The value will be 'WALLET' Paytm Postpaid - The value will be 'PAYTMCC'
    HDFC
    BANKNAMEName of issuing bank of the payment instrument used by customer. For Credit Cards, Debit Cards, Netbanking - Name of the issuing bank.
    Example in case customer uses SBI's credit card, the value will be "SBI”.For Paytm Wallet, value will be Wallet.
    In case of UPI, this parameter will not be present in the response.
    HDFC
    BANKTXNIDThe transaction ID sent by the bank. In case of Paytm proprietary instruments too, there is unique reference number generated by Paytm's system. In case the transaction does not reach the bank, this will be NULL or empty string. Primary reason for this is user dropping out of the payment flow before the transaction reaches to bank servers5583250
    TXNTYPEThe value of this parameter is "SALE" for the payment.SALE
    REFUNDAMTTotal cumulative refund amount against this transaction. For example for a transaction. with order value as INR 100, there has been two refunds of INR 20 & INR 30 historically, then REFUNDAMT will be INR 50.0.00
    CHECKSUMHASHSecurity parameter to avoid tampering. Verified using server side checksum utility provided by Paytm. Utilities to generate checksumhash is available here68mwQa9x8uRPPCIDyH

    Error Responses:

    ParameterDescriptionExample Value
    error.codeError code2
    error.messageError messageFailed to login

    Error Codes

    RESPCODESTATUSRESPMSG
    01TXN_SUCCESSTxn Success
    -2FAILUREFailed to login!
    2FAILUREInsufficient parameters
    227TXN_FAILUREYour payment has been declined by your bank. Please contact your bank for any queries. If money has been deducted from your account, your bank will inform us within 48 hrs and we will refund the same.
    235TXN_FAILUREWallet balance Insufficient, bankName=WALLET
    295TXN_FAILUREYour payment failed as the UPI ID entered is incorrect. Please try again by entering a valid VPA or use a different method to complete the payment.
    334TXN_FAILUREInvalid Order ID
    400PENDINGTransaction status not confirmed yet.
    401TXN_FAILUREYour payment has been declined by your bank. Please contact your bank for any queries. If money has been deducted from your account, your bank will inform us within 48 hrs and we will refund the same.
    402PENDINGLooks like the payment is not complete. Please wait while we confirm the status with your bank.
    810TXN_FAILURETxn Failed


    Request CodeResponse JSON
    
                const requestObject={
                       "amount": "1.00",
                       "orderId": "0071490615",
                       "txnToken":    "fe795335ed3049c78a57271075f2199e1526969112097",
                       "mid": "ABCdj00008000000",
                }
    
                function ready (callback) {
                     // call if jsbridge is injected
                  if(window.JSBridge) {
                       callback && callback();
                       } else{
                        // listen to jsbridge ready event
                        document.addEventListener('JSBridgeReady', callback, false);
                        }}
    ready(function () {  JSBridge.call('paytmPayment',requestObject,   function(result) {    console.log(JSON.stringify(result))   }); });