How to change the price

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
 return wixPay.createPayment({
            items: items,
            amount: totalItems,
        .catch((err) => {
 let errorMsg = err;

export function checkout_click(event) {
let userInfo = {firstName, lastName, email, phone};
  createMyPayment(cart, userInfo)
    .then( (payment) => {
    } );


Why not get the price from the cart just like the name?

name: cart[i].name,
price: cart[i].price //price being the fieldKey

You can refer to this forum post on processing custom payments.

Good luck!