Have any of you seen the wix payment screen come up with only a $1.00 charge?
Wix-Website-Editor
I have set up a payment screen using the examples for createMyPayment in the backend pay.jsw and StartPayment on the front-end. 95% of the time the dollar amount is correct once the wix payment screen opens. 5% of the time if I use the autofill for FirstName LastName, email address, and phone number, the amount on the wix-payment screen is $1.00
I can’t say definitively that its the auto-fill that is the root cause.
The log from the code below always shows the correct amount: console.log('Pay.jsw: Amount: '.concat(Amount.toString()));
pay.jsw:
import wixPayBackend from ‘wix-pay-backend’;
export function createMyPayment(userInfo, txtProduct, Amount) {
console.log('Pay.jsw: Amount: '.concat(Amount.toString()));
return wixPayBackend.createPayment({
items: [{
name: txtProduct,
price: Number(Amount)
}],
amount: Number(Amount),
currency: 'USD',
userInfo
});
}
front-end payment code:
export function button59_click(event, $w) {
const firstName = $w(‘#inputFirstName’).value;
const lastName = $w(‘#inputLastName’).value;
const phone = ‘’
const email = ‘’
const countryCode = ‘USA’
let txtAmount = ‘0.00’;
txtAmount = $w(‘#inputAmount’).value;
let txtProduct = “Product1”;
console.log(Number(txtAmount));
console.log(txtProduct);
if (Number(txtAmount) <= 1.00)
{
return;
}
createMyPayment({ firstName, lastName, phone, email, countryCode }, txtProduct, Number(txtAmount))
.then((payment) => {
wixPay.startPayment(payment.id);
});
}