#San_jen
1 messages · Page 1 of 1 (latest)
Can you share the request ID (req_xxx) that returned you this error? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_nQI2kxcPG6vnTD
I'll be away for an hr, I'll reply once get back if you have any questions
What I want is pass customer id somehow and tax rate along with the checkoutsession create
Customer parameter only accepts string with cus_xxx format. However, your request sent an array string in the customer parameter
Could you share the code how you create the checkout session?
It's likely that you set the incorrect customer value in the code
Here's the backend code
export async function createcheckout(customerid, line_items, shiprate, sessionid) {
const stripe = require('stripe')(apiKey);
const session = await stripe.checkout.sessions.create({
cancel_url: 'https://example.com/failure',
line_items: line_items,
customer: customerid,
mode: 'payment',
automatic_tax: {
enabled: true,
},
shipping_options:[{
shipping_rate: shiprate
}],
success_url: 'https://sotansy.wixsite.com/sotansy/checkout-session-success?orderid=' +sessionid,
});
return session;
}
where did you set customer?
Sorry edited that
frontend
createCustomer(customer)
.then((id) => {
console.log(id);
customerId = id;
createcheckout(customerId , stripeLineitems, stripship, item._id)
Could you console log the customer ID before stripe.checkout.sessions.create()? What value did you get?