Search code examples
paytm

What are the common practices of checking paytm transaction result?


As Paytm does not provide server side notification, what if user closed the app after payment before redirecting to the callback url, or simply failed to redirect due to network error etc.? How do we know if user has paid or not?


Solution

  • As per PayTM documentation. "As per secure practices, before marking transaction as success in system on receiving success response from Paytm, merchant should re-verify transaction status and amount of order by calling Paytm status query API from their back-end server."

    You should use below api (Staging)

    https://pguat.paytm.com/oltp/HANDLER_INTERNAL/getTxnStatus
    

    with below parameters

    https://pguat.paytm.com/oltp/HANDLER_INTERNAL/getTxnStatus?JsonData=
    {
        "MID":"MID",
        "ORDERID":"ORDERID",
        "CHECKSUMHASH":"CHECKSUMHASH"
    }
    

    This will give you response in json where you can find STATUS and check if your transaction was successful or not. and you can refund any payment made by user in case of failure transaction.

    {
    "TXNID" : "414709",
    "BANKTXNID" : "",
    "ORDERID" : "ORDER48886809916",
    "TXNAMOUNT" : "1.00",
    "STATUS" : "OPEN",
    "TXNTYPE" : "SALE",
    "GATEWAYNAME" : "",
    "RESPCODE" : "",
    "RESPMSG" : "",
    "BANKNAME" : "",
    "MID" : "klbGlV59135347348753",
    "PAYMENTMODE" : "CC",
    "REFUNDAMT" : "0.00",
    "TXNDATE" : "2015-11-02 11:40:46.0"
    }