Skip to main content

Use as Middleware on Routes

caution

Routes Must be defined as similar to the CALLBACK_URL in Paytm Instance During setup

index.js
const paytm = require("./instance/paytm.js)


app.post("/paynow", paytm.InitializeTransaction);
app.post("/callback", (req, res) => {
console.log(req.body);
// write your own code
res.end()
});

OR

routes.js
const express = require('express')
const router = express.Router()
const paytm = require("./instance/paytm)

router.post("/paynow", paytm.InitializeTransaction);
router.post("/callback", (req, res) => {
console.log(req.body);
// write your own code
res.end()
});

See Output on CallBack Response of Output