An error occured while initiating transaction Error: Hashes do not match! on live site


#1

The site is live not in testing mode:

here is my code

async function makePayment(id, products, method, number, res, mobile) {
const payment = paynow.createPayment(
Invoice ${id},
"sbj.premacart@gmail.com"
);

products.map((product) => {
payment.add(product.title, product.price * product.quantiy);
});

if (mobile) {
try {
const response = await paynow.sendMobile(
payment,
number,
method
);
if (response && response.success) {
console.log(response);
res.send(response);
} else {
console.log(response);
res.send(response);
}
} catch (e) {
console.log(e);
}
} else {
paynow.send(payment).then((response) => {
// Check if request was successful
if (response.success) {
// Get the link to redirect the user to, then use it as you see fit
let link = response.redirectUrl;
console.log(“successs \n\n\n\n\n\n\n\n\n”);
console.log(response);

    res.send(response);
  }
});

}
}


#2

Good day,

Did the integration work before, if so, when did you start getting the error?

Please try to regenerate your integration key, which usually fixes hash mismatch issues rather quickly. Also, make sure that the application is using the correct key and id, try logging it to make sure.


#3

The intergration worked before and even if I were to change the and comment out

products.map((product) => {
payment.add(product.title, product.price * product.quantiy);
});

and replace it with the default

payment.add(“Bananas”, 2.5);
payment.add(“Apples”, 3.4);

and use one of your test numbers, it works perfectly fine

What’s even confusing is, if I were to do a regular transaction(not mobile) it also returns Hashes do not match but if I use the Bananas and Apples, it works! and Actually shows the page were a user picks a payment method instead of the test mode screen


#4

oh and yes, I already tried regenerating a new integration key, nothing changed

another odd thing is

in the above screenshot, it says Testing at the very beginning but goes on to say site is live

the integration ID is 15718 and name is LocalPayments


#5

Hmm, this is interesting.

  1. What happens if you use the test products i.e payment.add(“Bananas”, 2.5); and then use an actual mobile number not one of the test numbers?
  2. Can you do a printout of the products that you’re adding when you map your products?

From what you mention, its likely that there is an issue with one or more of your product name/prices