Paytm Pre-Auth Payment
Paytm Pre-Auth is a one-click payment experience for your website or mobile app enabling payments via a user’s Paytm account. Your customers just need to authorize and link their Paytm account with your application once and enjoy superfast checkout every time after that.
Paytm Pre-Auth is ideal for cases where the delivery of service or order fulfilment is not immediate. You can block the order amount from customer’s Paytm account and debit it later when the order is complete, ensuring successful order placement and payment post delivery.
Demo of Paytm Pre-Auth
Overview of payment processing via Paytm Pre-Auth
- User visits your website or mobile application
- You ask the user to link her Paytm account for seamless payments
- You initiate the account linking process using Send OTP API and Validate OTP API
- Once user account is successfully linked, Paytm shares the user SSO_TOKEN with you
- User adds goods/services into the shopping/order cart
- You calculate the total amount and call the Paytm Check Balance API
- Paytm returns if the user has sufficient balance for the transaction. If not, you initiate the Add Money process with the differential amount
- Call the Paytm Pre-auth API to block the amount from user account
- Paytm blocks the amount in user’s account and returns the Preauth ID
- You proceed with the order/service fulfillment
- Once the fulfillment is done, call the Capture API with the final amount to capture the amount from user's Paytm account
- Notify the payment status to user
Steps in processing payments via Paytm Pre-Auth
STEP 1: Get your authentication keys
- Client ID: A unique alphanumeric identifier issued by Paytm for your account
- Client Secret: A unique alphanumeric key issued by Paytm for your account
- MID: A unique merchant identifier issued by Paytm for your account
- Merchant Key: This is a unique secret key used to secure encryption of every request. This needs to be kept on server side and should not be shared with anyone.
STEP 2: Link a user’s Paytm account with your application
Demo of Paytm Account Linking
Use the following APIs to link a user’s Paytm account, validate the linked account and remove a linked account
Link user’s Paytm Account
- Send OTP API: Send user’s email ID or 10-digit mobile number to Paytm. We will send an OTP to the user’s mobile number to continue with authorization
- Verify OTP API: Accept the OTP entered by user, verify it and receive the
user token. The validity of the token will always be verified by your Paytm
Client IDthat is provided by Paytm
Validate account linking
- Validate Token API: Validate and fetch user information
Remove account linking
Revoke Access API: Used for expiring user’s token. This is required when a customer deletes/delink his/her account or logs in with a new mobile number in your application
STEP 3: Check Balance and Add Money
You must ensure user has enough balance to pay for the order by calling the Check Balance API.
Call the check balance API with the amount required for the order
Paytm validates if given amount exists in any Paytm proprietary payment instrument (Paytm Balance and Paytm Postpaid)
If any of the proprietary payment instruments don’t have sufficient balance then API returns the differential Amount.For example: A user has Rs. 100 in her Paytm Wallet, Rs. 150 in Paytm Postpaid and transaction amount for the order is Rs. 220. In this case, no payment method has sufficient funds so the API returns the differential amount (transaction amount - wallet amount), Rs. 120 that is. You have to prompt the user to add money in her Wallet.
In case user needs to add money to pay for an order, you initiate the Add Money process
STEP 4: Debit amount from user’s Paytm account and confirm transaction
Now that you have ensured that your customer has enough balance to pay for the order, you can proceed with actual payment flow as described hereunder -
- Call the Pre-auth API to block the amount in user’s Paytm account
- Once the service or order delivery is complete, call the Capture API to debit the final amount
- If the order or service delivery is cancelled for some reason, call the Release API to release the blocked amount from user’s Paytm account
- Check status of any transaction by calling Transaction Status API with TXNTYPE=CAPTURE/RELEASE/PREAUTH
STEP 5: Managing Refunds
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
Attempt a test transaction using test paymodes credentials
Ensure you re-verify transaction response with Transaction Status API via server to server call in payment flow and not separately as a one time activity
See the transaction details in “Test Data” mode on your dashboard
Once the test transaction is complete, move your code to live environment with production account details, which you would have received from Paytm.
In case of any issues with integration, please get in touch.