Open In App

How to Integrate Paytm Test API in Node.js ?

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(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
  
app.use('/', require('./routes/server'));
  
let port = process.env.PORT || 1234;
  
app.listen(port,()=>{
    console.log("Server is started");
});

app.use('/', require('./routes/server'));

File Name : config.js




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

Complete code is available on https://github.com/singhteekam/Paytm_Integration


Article Tags :