POSTpaytmPayment JS API
Use Case
This method can be used to invoke the Paytm payment option, user will be able to see all the available payment options, after a successful transaction client-side will receive the callback.
Request Attributes
Content Format: JSON
PARAMETER | DESCRIPTION |
---|---|
amount mandatory |
Amount to be paid by the customer in INR Example: 1.00 |
orderId mandatory |
Unique reference ID for a transaction which is generated by merchant and sent in the request Example: 0071490615 |
txnToken mandatory |
It is the security token generated by Initiate Transaction API for a transaction. It is valid for 15 minutes. Example: fe795335ed3049c78a57271075f2199e1526969112097 |
mid mandatory |
This is a unique identifier provided to every merchant by Paytm Example: ABCdj00008000000 |
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": } 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
PARAMETER | DESCRIPTION |
---|---|
ORDERID |
Unique reference ID for a transaction generated by the merchant and sent in the request Example: 0071490615 |
MID |
Unique identifier provided to every merchant by Paytm Example: ABCdj00008000000 |
TXNID |
Unique Paytm transaction ID issued by Paytm for each transaction Example: 20191001111212800110168390621570 |
TXNAMOUNT |
Order value of a transaction in INR. The merchant should validate this amount against that send in the transaction request payload. In case the amount does not match, the merchant should not provide the services to the customer. It is required to avoid request and response tampering possible at the time of transaction. Example: 1.00 |
PAYMENTMODE |
Payment mode used by the customer for a transaction - Credit Card - CC - Debit card - DC - Net banking - NB - UPI - UPI - Paytm wallet - PPI - Postpaid - PAYTMCC Possible Value: UPI |
TXNDATE |
Date and Time of transaction in the format "yyyy-MM-dd HH:mm:ss.S" Example: 2019-10-01 11:44:57.0 |
STATUS |
It shows the transaction status and has only three values: TXN_SUCCESS, TXN_FAILURE and PENDING Example: TXN_SUCCESS |
RESPCODE |
Particular reason for payment failure/success. Example: 01 |
RESPMSG |
Description message is linked with each respcode Example: Txn Success |
GATEWAYNAME |
Gateway used by Paytm to process the transactions.
|
BANKNAME |
Name of issuing bank of the payment instrument used by customer.
|
BANKTXNID |
Transaction ID sent by the bank. In case of Paytm proprietary instruments too, there is a unique reference number generated by Paytm's system. In case the transaction does not reach the bank, this value will be NULL or empty string. The primary reason for this is the user dropping out of the payment flow before the transaction reaches bank servers. Example: 5583250 |
TXNTYPE |
The value for this parameter is "SALE" for the payment. Example: SALE |
REFUNDAMT |
Total cumulative refund amount against this transaction. For example, for a transaction with an order value as INR 100, there have been two refunds of INR 20 & INR 30 historically, then REFUNDAMT will be INR 50. Example: 0.00 |
CHECKSUMHASH |
Security parameter to avoid tampering. Verified using server-side checksum utility provided by Paytm. Utilities to generate checksumhash is available here. Example: 68mwQa9x8uRPPCIDyH |
Error Responses
PARAMETER | DESCRIPTION |
---|---|
error.code |
Error code Example: 2 |
error.message |
Error message Example: Failed to login |
Error Codes
RESPCODE | STATUS | RESPMSG |
---|---|---|
01 | TXN_SUCCESS | Txn Success |
-2 | FAILURE | Failed to login! |
2 | FAILURE | Insufficient parameters |
227 | TXN_FAILURE | Your 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. |
235 | TXN_FAILURE | Wallet balance Insufficient, bankName=WALLET |
295 | TXN_FAILURE | Your 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. |
334 | TXN_FAILURE | Invalid Order ID |
400 | PENDING | Transaction status not confirmed yet. |
401 | TXN_FAILURE | Your 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. |
402 | PENDING | Looks like the payment is not complete. Please wait while we confirm the status with your bank. |
810 | TXN_FAILURE | Txn Failed |
const requestObject = {
"amount": "1.00",
"orderId": "0071490615",
"txnToken": "fe795335ed3049c78a57271075f2199e1526969112097",
"mid": "ABCdj00008000000"
}
function ready(callback) {
if (window.JSBridge) {
callback && callback();
} else {
document.addEventListener('JSBridgeReady', callback, false);
}
}
ready(function() {
JSBridge.call('paytmPayment', requestObject,
function(result) {
console.log(JSON.stringify(result))
});
});