Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to Integrate Paytm Test API in Node.js ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Paytm stands for Pay through mobile is used for online transactions. We can integrate it with our node.js application using Paytm developer API.

This API can be used for testing as well as for development purposes.  There are two methods for doing so: Test API and Production API. Production API will only work when the Merchant account is linked to a bank account. In this article, we will implement using Test API.

Setting up the environment:

Initialize NPM package: 

npm init -y

Installing dependencies:

npm install express ejs



const express= require('express');
var app= express();
var bodyParser= require('body-parser');
const ejs= require('ejs');
app.use(express.static(__dirname + '/views'));
app.engine('html', require('ejs').renderFile);
app.set("view engine", "html"); 
app.set("views", __dirname + "/views"); 
app.use('/', require('./routes/server'));
let port = process.env.PORT || 1234;
    console.log("Server is started");

  • Create routes in /routes/server.js file:
  • Create views in /views folder
  • Connect views in app.js file
app.use('/', require('./routes/server'));
  • For integrating Paytm, go to in web mode and click “Accept Payments“:

  • Choose the “Developer” option:

  • Log in/Sign up with your Paytm account:

  • After login, the developer dashboard will be displayed. After this, click Developer Settings:

  • Use your Merchant ID, Merchant KEY in the node.js application.
    • There are two methods for doing this:
      • Test API: In testing mode.
      • Production API: In production mode. Production mode is active only when the Merchant account is linked to his bank account.

  • After creating an application, run the server and Enter details like Name, Email, mobile, amount, etc.

  • In the next step, click proceeds to payment, and you will receive an OTP on your mobile number. Enter the OTP and process and your transaction will be done

  • We can also pay using a Credit card, Debit card, and net banking.

  • Place config.js file in /routes/Paytm/ folder with your mid and key.

File Name : config.js


var PaytmConfig = {
    mid: "YOUR MERCHANT ID",
    website: "WEBSTAGING",
  module.exports.PaytmConfig = PaytmConfig;

Complete code is available on

My Personal Notes arrow_drop_up
Last Updated : 26 May, 2021
Like Article
Save Article
Similar Reads
Related Tutorials