Search code examples
typescriptgoogle-cloud-firestorepayment-gatewaypaytm

Type script node js - paytmchecksum undefined - generateSignature


I am getting below error while integrating paytmchecksum.

{"severity":"ERROR","message":"Unhandled error TypeError: Cannot read properties of undefined (reading 'generateSignature'

Code:

import {PaytmChecksum} from "paytmchecksum";

const checksum = await PaytmChecksum
      .generateSignature(JSON.stringify(paytmParams.body), stagingMerchantKey);

//This code works with below js code require statement:


const PaytmChecksum = require(
 "./../../../node_modules/paytmchecksum/PaytmChecksum.js");

But I need to deploy code on firebase firestore and need code in ts module format, please help.


Solution

  • rather than using : import {PaytmChecksum} from "paytmchecksum";

    use below format: import PaytmChecksum from "paytmchecksum";

    it worked. thanks Marc Anthony B