#yony
1 messages · Page 1 of 1 (latest)
Hi
and other time we are getting StripeInvalidRequestError.
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
ok
req_qE22jm1cuEUgDS
The error logs say that the currency param is missing. but still show the same error when adding the currency param/field.
According to your request, you are sending just quantity without priceId
You need to debug your integration and check if price_id is null
I double-check and the nodejs server is correctly receiving the price_id.
price_xxxxxxxxxxxx
You need to double check, you are not sending that param for that request.
try log the whole object before sending it to Stripe APIs. something like:
const requestBody ={
customer_email: customer_email,
line_items: [
{
price: price_id,
quantity: 1,
},
],
mode: 'payment',
success_url: ${return_url}?success=true,
cancel_url: ${return_url}?canceled=true,
};
console.log(requestBody);
const session = await stripe.checkout.sessions.create(requestBody);
Ok thanks, checking this.
{
customer_email: 'efremmuse0@gmail.com',
line_items: [ { price: 'price_xxxxxxxxxxxxx', quantity: 1 } ],
mode: 'payment',
success_url: 'http://localhost:3000/onboarding?success=true',
cancel_url: 'http://localhost:3000/onboarding?canceled=true'
}
and share please the related requestId
req_6pqdzY9iQdI5pn
The requestId you are sharing and the logs you are sharing are not the same.
Search in your code where you are setting mode:subscription
that object log is for payment.
Ahh, ok. let me try again.
I tried again with mode:subscription but got similar error.
req_lEZRHORJ0oVZ7X
{
customer_email: 'efremmuse0@gmail.com',
line_items: [ { price: undefined, quantity: 1 } ],
mode: 'subscription',
success_url: 'http://localhost:3000/onboarding?success=true',
cancel_url: 'http://localhost:3000/onboarding?canceled=true'
}
requestId: 'req_4SKfTXaBE1jXLa',
What I meant is the log body you are sharing is different from the requestId. Please share both object log and the related requestId.
The second one is for both.
You see price: undefined so that's the issue.
Ahh, I see. somehow the priceid is not being sent from the front end.
thank you very much @blazing laurel
Welcome!