,

Integrating PhonePe Payment Gateway with NodeJs and ExpressJs using PhonePe API

Posted by

PhonePe Payment Gateway Integration Using NodeJs | ExpressJs | PhonePe API Integration

PhonePe Payment Gateway Integration Using NodeJs

PhonePe is a popular payment gateway in India that allows merchants to accept online payments. In this article, we will walk you through the process of integrating the PhonePe payment gateway into your NodeJs application using ExpressJs and the PhonePe API.

Getting Started

Before we can begin integrating the PhonePe payment gateway into our application, we need to sign up for a PhonePe merchant account and obtain our merchant credentials. Once we have our merchant credentials, we can begin integrating the payment gateway into our application.

Setting Up ExpressJs

First, we need to create a new ExpressJs application or add the PhonePe payment gateway integration to an existing ExpressJs application. We can do this by installing the necessary dependencies and creating routes to handle the payment requests.

Integrating PhonePe API

Next, we need to integrate the PhonePe API into our application. This API allows us to interact with the PhonePe payment gateway and process payments on behalf of our customers. We can use the PhonePe API documentation to learn how to make API calls and handle responses.

Handling Payment Requests

Once we have set up our ExpressJs application and integrated the PhonePe API, we can start handling payment requests from our customers. We can create a payment form on our website that collects the necessary payment information and sends it to our ExpressJs application for processing.

Summary

Integrating the PhonePe payment gateway into your NodeJs application is a great way to accept online payments from your customers. By following the steps outlined in this article, you can easily set up the payment gateway in your application and start processing payments. Good luck!

0 0 votes
Article Rating
29 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@selvarajanr
5 months ago

How to use this technique in php instead of Nodejs?

@DevasheeshPillai
5 months ago

if i want to use custom amounts then i can take the value from front end and post it to a variable then use it here right??

@mohammedajmal4264
5 months ago

data: {
success: false,
code: 'TOO_MANY_REQUESTS',
message: 'Too many requests. Please try again.',
data: {}
}

i am getting this error , any idea ?

@jatinhemnani1029
5 months ago

how can we pass params from frontend before creating payment link and get it in redirect that same param?

@oldmoviesincolored
5 months ago

Can use please amke video on mulpitle payment gateway integration like visa and paytm in one like amazon website

@solaimfaisal
5 months ago

request failed with status code 429 im getting this error

@SahilSmarttechncia
5 months ago

thorow error 406 AxiosError: Request failed with status code 406

at settle (G:sahilredboxglobalstockTechVisualizationnode_modulesaxiosdistnodeaxios.cjs:1966:12)

at IncomingMessage.handleStreamEnd (G:sahilredboxglobalstockTechVisualizationnode_modulesaxiosdistnodeaxios.cjs:3065:11)

at IncomingMessage.emit (node:events:526:35)

at endReadableNT (node:internal/streams/readable:1359:12)

at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

at Axios.request (G:sahilredboxglobalstockTechVisualizationnode_modulesaxiosdistnodeaxios.cjs:3876:41)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

code: 'ERR_BAD_REQUEST',

please help

@rajamjenifern_0434
5 months ago

@GirishGaidhane
pls tell about how to clear the axios error 429

@rajamjenifern_0434
5 months ago

i used your code tha same error appear that code also

@rajamjenifern_0434
5 months ago

@thestandupcoder axios 429 error how to clear this error

@amardipbanerjee7982
5 months ago

Hi please help me. I copied your code from GitHub exactly as it is. It is continuously giving me axioserror 429

@vidyashet800
5 months ago

Hey, excellent Tutorial, However, after showing payment success screen It gives me this error {"message":"Request failed with status code 429","name":"AxiosError","stack":"AxiosError: Request failed with status code 429n at settle (C:\FitnEarn\phonePE\phonepeIntegration-main\node_modules\axios\dist\node\axios.cjs:1966:12)n at IncomingMessage.handleStreamEnd (C:\FitnEarn\phonePE\phonepeIntegration-main\node_modules\axios\dist\node\axios.cjs:3065:11)n at IncomingMessage.emit (node:events:524:35)n at endReadableNT (node:internal/streams/readable:1359:12)n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)n at Axios.request (C:\FitnEarn\phonePE\phonepeIntegration-main\node_modules\axios\dist\node\axios.cjs:3876:41)n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http"],"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json","Content-Type":"application/json","X-VERIFY":"1b5d72b3ccc2f51ec013ca5beda4c6d7fb4b47c203c3086ecbfd2d9a125a1a45###1","X-MERCHANT-ID":"g2pc5iyglvdysp47","User-Agent":"axios/1.6.8","Accept-Encoding":"gzip, compress, deflate, br"},"method":"get","url":"https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/status/PGTESTPAYUAT/g2pc5iyglvdysp47"},"code":"ERR_BAD_REQUEST","status":429}

@trunksop389
5 months ago

Can anyone help me it was working and now suddenly i am getting "Axios error : Request failed with status code 429". Can anyone resolve my issue?

@prabahemuprabahemu7572
5 months ago

Hi bro, I want platform charges calculation while select the payment mode (it may differ percentage wise + GST 18%) for my website with phonepe charges.
For Ex: if the customer pay 300 (phonepe charges some service charge for Rs.300 (based on payment mode) i want that calculation process both side (reverse calculation also)

@GirishGaidhane
5 months ago

bro pls help me i have continue this error ("AxiosError: Request failed with status code 400")

@cody-wq7zc
5 months ago

Thank you so much. I almost gave up on phonepe payment gateway integration in my website because I couldn't wrap my head around the whole flow of this. The documentation just made my head ache. You actually implementing everything really really helped, thanks a ton!

@user-kc7pd3nm2r
5 months ago

This is the best tutorial i have everseen. The reason I am saying this is he referred documentation throughout the video. Also the flow diagram was great.

@user-sq3os9ch7n
5 months ago

you are great bro "khuda cha banda"

@carandbikes1203
5 months ago

Hello

@carandbikes1203
5 months ago

How will that redirect will work for app