Setting up custom wallet in your website with Paytm gateway/UPI (Technical Details)

Adarsh Somani
4 min readSep 11, 2020
Photo by Emil Kalibradov on Unsplash

Many business allows customers to have advance credit in their account so they can use that to purchase goods and services without any hassle, like an amazon credit, this becomes very handy in retaining customers because it skips the process of paying every time.

Wallet can be recharged offline or through online payment, and then payment can integrated further into the application for various processes like generating an acknowledgment or start a shipping process.

Pre-requisites

Setting up an merchant account on paytm gateway

Once you setup, you will get test credentials and production credentials from gateway which can be integrated further.

Once you your credentials, it’s time setup your website .

You will need to provide a login and unique id to your customers, which will be used to track their current credit balance. And credit balance will be updated everytime against their details once they do recharge. You will also need to record name, phone number , email id to be able to integrate them with the gateway.

a. Unique Id

b. Phone number

c. Name

d. Email

e. Wallet Balance/Credit Balance (Start with zero)

Example Customer information Screen

Calling paytm gateway to collect payment and recharge wallet

Sample payment form on merchant website

After this you need to create a hashcode with your payment details, Paytm provides a checksum utility for each major programming language, where you need to pass the following to generate a unique code

a. Amount -> How much amount to pay

Rest of details should be pre-recorded in the system

b. Customer id -> unique id for customer

c. Phone number -> Phone number of customer

d. Unique payment code (Generate by your website) (e.g. It might be an invoice id)

e. Email id

f. Call back url (Paytm will call this url once payment is succeeded) -> It must be an api which can read data sent by paytm.

g. Merchant Id (Provided by paytm)

h. Merchant Key (Provided by paytm)

Config file with sample crendentials
Creating checksum with paytm’s checksum utility

More details about required fields are given here -> https://developer.paytm.com/docs/v1/payment-gateway/

Checksum utility will generate the unique hashcode, with which you need to call paytm’s API, Paytm will decode it and allows user to do the payment, You can find the checksum utility at following location:

https://developer.paytm.com/docs/server-sdk/

Once the unique code is generated, you need to call paytm’s provided api with this unique code, and you will be shown the payment page

Inline form to submit the checksum
Paytm’s payment screen

Once the payment is succeeded or failed, paytm will call the callback url with a new unique hashcode, which our website will decode again with the same checksum utility and read the response.

Read checksum sent by paytm

And based on the validation from above method , you can show the success message page.

Inline page to show success/failure response
Example payment success page

If the response is successful, You can show the success message to customer and it will also update client’s data with the new credit balance aka wallet is recharged, and you can show new balance to the client.

Show the wallet balance to client

For other questions, you can connect me on linkedin https://www.linkedin.com/feed/

--

--