Hey there! I'm currently working on setting up an online store using CommerceJs and NextJS, but I've encountered an issue when processing payments. The error message I'm receiving is:
"The given data was invalid." "type: unprocessable_entity" line_items.item_7RyWOwmK5nEa2V.quantity: ["Requested quantity is not available."]
I've attempted to adjust my code based on the documentation, but so far, I haven't had any success.
const orderData = {
line_items: {
item_7RyWOwmK5nEa2V: {
quantity: 1,
}
},
customer: {
firstname: 'John',
lastname: 'Doe',
email: '[email protected]'
},
shipping: {
name: 'John Doe',
street: '123 Fake St',
town_city: 'San Francisco',
county_state: 'US-CA',
postal_zip_code: '94103',
country: 'US'
},
fulfillment: {
shipping_method: 'ship_7RyWOwmK5nEa2V'
},
billing: {
name: 'John Doe',
street: '234 Fake St',
town_city: 'San Francisco',
county_state: 'US-CA',
postal_zip_code: '94103',
country: 'US'
},
payment: {
gateway: 'stripe',
stripe: {
payment_method_id: paymentMethod.id,
},
}
}