PayTM支付网关与Angular Universal的集成

时间:2020-05-17 14:29:27

标签: node.js angular express payment-gateway paytm

我正在尝试将Paytm付款网关集成到我的通用项目中。

问题是,当我尝试运行支付网关Url时,我看到Please wait! Do not refresh the page,而不是带我去支付门户,它立即重定向到callback网址

我在/payment中添加了server.ts路线

下面是代码,

  server.get('/payment', (req, res) => {
    let params = {}
    params['MID'] = 'xxx',
      params['WEBSITE'] = 'WEBSTAGING',
      params['CHANNEL_ID'] = 'WEB',
      params['INDUSTRY_TYPE_ID'] = 'Retail',
      params['ORDER_ID'] = 'ORD0001',
      params['CUST_ID'] = 'CUST0011',
      params['TXN_AMOUNT'] = '100',
      params['CALLBACK_URL'] = 'http://localhost:' + port + '/callback',
      params['EMAIL'] = 'xxx@gmail.com',
      params['MOBILE_NO'] = 'xxxx'

    checksum_lib.genchecksum(params, 'xxx', function (err, checksum) {
      let txn_url = "https://securegw-stage.paytm.in/order/process"

      let form_fields = ""
      for (let x in params) {
        form_fields += "<input type='hidden' name='" + x + "' value='" + params[x] + "'/>"

      }

      form_fields += "<input type='hidden' name='CHECKSUMHASH' value='" + checksum + "' />"

      var html = '<html><body><center><h1>Please wait! Do not refresh the page</h1></center><form method="post" action="' + txn_url + '" name="f1">' + form_fields + '</form><script type="text/javascript">document.f1.submit()</script></body></html>'
      res.writeHead(200, { 'Content-Type': 'text/html' })
      res.write(html)
      res.end()
    })
  })

2 个答案:

答案 0 :(得分:0)

似乎您在多个请求中传递了相同的订单ID。对于每个付款请求,Orderid应该是唯一的。

答案 1 :(得分:0)

您可以通过引用回调URL的请求正文中的RESPCODE和RESPMSG来检查问题(由于回调是发布请求)。另外,您的订单ID必须不同。