Invalid checksum in paytm payment gateway subscription api. NodeJs, ExpressJs

Viewed 15

I am trying to initiate subscription api in paytm payment gateway but it is showing invalid checksum. Someone pls help. These are the params that i am passing for subscription. Callback Response: [Object: null prototype] { ORDERID: 'TEST_1663489118608', MID: 'hgUOjr70796901152921', TXNAMOUNT: '233.00', CURRENCY: 'INR', STATUS: 'TXN_FAILURE', RESPCODE: '330', RESPMSG: 'Invalid checksum', BANKTXNID: '' } 18 Sep 13:48:40 - checksum not found Checksum Result => false

  params['requestType'] = 'NATIVE_SUBSCRIPTION';
  params['MID'] = config.PaytmConfig.mid;
  params['WEBSITE'] = config.PaytmConfig.website;
  params['ORDER_ID'] = 'TEST_'  + new Date().getTime();
  params['subscriptionAmountType'] = "FIX";
  params['subscriptionFrequency']= "2";
  params['subscriptionFrequencyUnit'] = "MONTH";
  params['subscriptionExpiryDate']  = "2031-05-20";
  params['subscriptionEnableRetry'] = "1";
  params['CUST_ID'] = paymentDetails.customerId;
  params['TXN_AMOUNT'] = paymentDetails.amount;
  params['CALLBACK_URL'] = 'http://localhost:4000/callbackUrl';
  params['EMAIL'] = paymentDetails.customerEmail;
  params['MOBILE_NO'] = paymentDetails.customerPhone;


  checksum_lib.genchecksum(params, config.PaytmConfig.key, function (err, checksum) {
      var txn_url = "https://securegw-stage.paytm.in/theia/processTransaction"; // for staging
      // var txn_url = "https://securegw.paytm.in/theia/processTransaction"; // for production

      console.log("checksum value",checksum)
      var form_fields = "";
      for (var x in params) {
          form_fields += "<input type='hidden' name='" + x + "' value='" + params[x] + "' >";
      }
      form_fields += "<input type='hidden' name='CHECKSUMHASH' value='" + checksum + "' >";

      res.writeHead(200, { 'Content-Type': 'text/html' });
      res.write('<html><head><title>Merchant Checkout Page</title></head><body><center><h1>Please do not refresh this 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.end();
  });
0 Answers
Related