This page explains how you can integrate Credit/Debit Cards in the Custom Checkout solution to collect payment from your customers. You can fetch the large database of around 200 million cards saved with Paytm users accounts and present them on your payment page. This allows the users to make quick and easy payments using their saved cards without the need of entering the complete card details.
Credit/Debit Cards Integration
Demo
Integration Steps
This section explains the integration steps to process payment through a new Debit/Credit Card or saved cards with a user's Paytm account. Make sure you have followed the Pre-requisites and Integration Steps mentioned on the Paytm Custom checkout page.
Paytm user's Saved Cards
In case you want to show Paytm user’s saved cards on your checkout page, follow the steps below:
- User selects Paytm for payment on your checkout page and enters their Paytm registered mobile number.
- You call the Send OTP API to verify their account and then Paytm triggers the OTP on a mobile number passed in the request.
- To validate the OTP entered by a user, you call the Validate OTP API.
- Your backend server calls the Fetch Payment Options API using the transaction token received in a response to Initiate transaction API request.
- You receive the Paytm user’s saved credit and debit cards In response to Fetch Payment Options API. In the response, you also receive the card type, issuing bank, and current success rate on that card.
Note:
a. For maestro cards, CVV and Expiry Date are not required for any transaction.
b. You can consume the success rate of the card and intimate a user so they could choose any other payment method. - User selects the saved card of its Paytm account, enters the required details like CVV and clicks the Pay button, at which point you call the Process Transaction API.
Note: You can hit the Process Transaction API either through Form post or JSON based. Using JSON based integration, you can also collect OTP for 2FA on your page for major banks.
Postman Collection - Payment processing through Cards
This postman collection lets you quickly understand the flow integration for payment processing through credit/debit cards. This will help you to understand and test the APIs with sample request/response on integration environment for both new and paytm user’s saved credit/debit cards integration.
To set up the environment for using the Postman Collection, click here.
- You hit the Process Transaction API as an HTML form post through the client. Paytm processes the transaction and redirects the user to the bank page to complete the payment by entering the OTP. Please refer to the sample request/response below:
<form method="post" type="redirect" action="https://securestage.paytmpayments.com/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="CREDIT_CARD" /> <input type="text" name="cardInfo" value="1159332987||111|" /> <input type="text" name="AUTH_MODE" value="otp" /> <input type="submit" /> </form>
- After the user completes the transaction on the bank page, Bank redirects the user back to Paytm which in turn redirects the user back on your payment confirmation page.
- You receive the transaction status on the Callback URL. Please refer to the sample response here.
- 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.
- Validate the transaction response via server-side request using theTransaction 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.
- After the transaction status verification, you show final payment status to the user.
New Credit/Debit Card
In case you want to integrate payment with new Credit/Debit Cards on your checkout page, follow the steps below:
- User selects the Credit/Debit Card on your checkout page and starts entering the card details. As soon as the first 6 digits are entered, you call the Fetch Bin Detail API to get the BIN details of the card.
- Paytm validates the card and returns the BIN details like the card type (VISA, Master, AMEX etc.), issuing bank, and the current success rate of bin.
Note:
a. For maestro cards, CVV and Expiry Date are not required for any transaction.
b. You can consume the success rate of the card and intimate a user so they could choose any other payment method. - User clicks Pay to proceed for checkout and you call the Process Transaction API.
You can hit the Process Transaction API either through Form post or JSON based. Using JSON based integration, you can also collect OTP for 2FA on your page for major banks.
- You hit the Process Transaction API as an HTML form post through the client. Paytm processes the transaction and redirects the user to the bank page to complete the payment by entering the OTP. Refer to the sample request/response below:
<form method="post" type="redirect" action="https://securestage.paytmpayments.com/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="DEBIT_CARD" /> <input type="text" name="cardInfo" value="|5129670406454327|983|122025" /> <input type="text" name="AUTH_MODE" value="otp" /> <input type="submit" /> </form>
- After the user completes the transaction on the bank page, bank redirects the user back to Paytm which in turn redirects the user back on your payment confirmation page.
- You receive the transaction status on the Callback URL. Please refer to the sample response here.
- 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.
- 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.
- After the transaction status verification, you show 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).
- You can view the staging transaction details in the “Test Data” mode on your dashboard.
- 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.