Hello everyone! I’m trying to change the price of an item to 300 ($300) but when I did, the checkout button didn’t work. The payment modal did not show up; nothing happened. I changed it back to 1 and it worked. Can someone please help me? Thanks! Below is my code.
// Filename: backend/pay.jsw (web modules need to have a .jsw extension)
import wixData from 'wix-data';
import wixPay from 'wix-pay-backend';
export async function createMyPayment(cart, userInfo) {
let items = [];
let totalItems = 0;
for (var i = 0; i < cart.length; i++) {
let item = {
name: cart[i].name,
price: 1 // I need to change this to 300
}
items.push(item);
totalItems++;
}
return wixPay.createPayment({
items: items,
amount: totalItems,
userInfo
})
.catch((err) => {
let errorMsg = err;
});
}
export function checkout_click(event) {
let userInfo = {firstName, lastName, email, phone};
createMyPayment(cart, userInfo)
.then( (payment) => {
wixPay.startPayment(payment.id);
} );
}