javascriptnode.jsreactjspayfort

"Invalid extra parameters : token_name" PAYFORT INTEGRATION


I am using Merchant Page 2.0 documentation as it was told by the payfort in the email. I am integrating payfort with nodejs. I am sending all the required parameters in the request body. the TOKENIZATION request was successful but the PURCHASE request is not. I am getting the respose "Invalid extra parameters : token_name". If you look at the documentation of the merchant page 2.0, you will find that token_name is a mandatory parameter.? Note: the problem is similar to payfort Invalid extra parameters. but this is solution for Php, and i need a solution for nodejs. below is my request

 new Promise(async (resolve, reject) => {
      await axios
        .post(
          "https://sbpaymentservices.payfort.com/FortAPI/paymentApi",
          {
            command: "PURCHASE",
            access_code: "some",
            merchant_identifier: "some",
            merchant_reference: "some",
            amount: 50000,
            currency: "AED",
            language: "en",
            customer_email: customer_email,
            customer_ip: "some ip address",
            token_name: 'somethoken',
            signature: newSignature,
          },
          {
            headers: {
              "Access-Control-Allow-Origin": "*",
              "content-type": "application/json",
            },
            // params: {

            // },
          }
        ).then((response)=>{

})

Plase responde as soon as possible as we are on a time frame Thanks in advance for your time and considration.


Solution

  • I dont know if it will help anyone but it was a stupid mistake. I was using tokanization endpoint for payment as well thats why it was occurring, once it was corrected, everything worked fine. I also got stuck at another stage where response was returning invalid token. After arranging a call with the payfort people, found out that the token is only valid for 8-10 minutes.