Error Hashes not matching. Testing


#1

I keep getting the error on mobile payments," Hashes not matching (code provided below)"
I have used the same cod exactly as in the docs
I am running version 1,0.9
I have tried new keys, new intergration to no avail.

indent preformatted text by 4 spaces

const { Paynow } = require(“paynow”);
let paynow = new Paynow(
process.env.INTEGRATION_ID,
process.env.INTEGRATION_KEY
);

const processPayment = (ecocashNumber, product, productPrice) => {
let payment = paynow.createPayment(“Invoice 1”, process.env.AUTH_EMAIL);
payment.add(“Bananas”, 2.5);
payment.add(“Apples”, 1.0);

paynow
.sendMobile(payment, 0777111111, “ecocash”)
.then(function (response) {
if (response.success) {

    let instructions = response.instructions; 
    let pollUrl = response.pollUrl;

    console.log(instructions);
  } else {
    console.log(response.error);
  }
})
.catch((ex) => {
  // Ahhhhhhhhhhhhhhh
  // *freak out*
  console.log("Your application has broken an axle", ex);
});

}
KINDLY ASSIST


#2

on your auth email , make sure you are putting the email you used for signing up or for logging in , not any email. that would solve your issue


#3

I am only using the same email,
Its still not working


#4

ok , can you post your full code here so that i can have a closer look at it . maybe i will also send how i did it so that you can have a look at it


#6

I have just had a successful test using 0771111111 as test number


#7

Hi mkawara. This also worked for me, but how do I then make it work with any number?


#8

Just about any error results in hashes not match, i t is not only invalid credentials
I just found out
paynow.resultUrl = “http://example.com/gateways”;

paynow.returnUrl = “http://example.com/return?gateway=paynow&merchantReference=1234”; if you do not have this while testing it will result in hashes no mathc error (even though they claim this is not required for mobile payments""

also ake sure you are using the designated test numbers


#9

Actually there is a bug. If paynow responds with Status=Error, the SDK tries to equate “Error” with “error”. A simple conversion to lower case does the trick. I have a fix for this and other issues with the SDK on https://www.npmjs.com/package/better-paynow