#stilo01
1 messages · Page 1 of 1 (latest)
hey
The amount is an integer. So $100 is represented in the API as 10000
Can you share more context? What does your code look like?
this is the code
app.post('/create-checkout-session', async (req, res) => {
let pricedatainputted = +req.body.price;
console.log(pricedatainputted); // is 2000
const session = await stripe.checkout.sessions.create({
line_items: [{
price_data: {
currency: 'eur',
product_data: {
name: req.body.price + ' sugar spoons',
},
unit_amount: pricedatainputted,
},
quantity: 1,
}],
mode: 'payment',
ui_mode: 'embedded',
return_url: 'localhost:8080/checkout/return?session_id={CHECKOUT_SESSION_ID}'
});
res.send({clientSecret: session.client_secret});
});
Do you have a request ID for the Checkout Session you've created with that code?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
what do you mean
the error is quite long
So you got an API error. You can view that in your Dashboard logs. Those logs have a Request ID. I need the request ID
Can you copy/paste the Request ID? I'd rather not have to type it out if I can help it
Also, you many want to fix the return_url before trying to fix the amount. Having successful requests will make it much easier to debug the amount issue
Can you create another Checkout Session with a valid URL, then post that Request ID?
can I do localhost:8080/complete?
Yup, I believe so, as long as it's in test mode.
It needs to be the full URL though --> http://localhost:8080/complete