When I create a checkout.session with stripe the returned data.payment_intent is null I filled in every required field and the payment works. But without the payment_intent.
const url = await stripe.checkout.sessions
.create(
{
line_items: [
{
price_data: {
product_data: {
name: productName,
description: productDescription,
images: [
'randomimage-url',
],
},
currency: 'eur',
unit_amount: priceInCents,
},
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: feeAmount,
setup_future_usage: 'on_session'
},
mode: 'payment',
success_url: 'http://localhost:3000/payment',
cancel_url: 'http://localhost:3000',
},
{
stripeAccount: stripeExpressUserId,
}
)
When I create a checkout.session with stripe the returned data.payment_intent is null I filled in every required field and the payment works. But without the payment_intent.
const url = await stripe.checkout.sessions
.create(
{
line_items: [
{
price_data: {
product_data: {
name: productName,
description: productDescription,
images: [
'randomimage-url',
],
},
currency: 'eur',
unit_amount: priceInCents,
},
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: feeAmount,
setup_future_usage: 'on_session'
},
mode: 'payment',
success_url: 'http://localhost:3000/payment',
cancel_url: 'http://localhost:3000',
},
{
stripeAccount: stripeExpressUserId,
}
)
Share
Improve this question
asked Aug 17, 2022 at 18:19
KaanDevKaanDev
791 silver badge8 bronze badges
1
- used apiVersion: '2022-08-01', – KaanDev Commented Aug 17, 2022 at 18:22
1 Answer
Reset to default 10This is expected behavior with API version 2022-08-01
.
A change was made with this API version so that a Payment Intent is not created when a Checkout Session is initially created, but is instead created when the Checkout Session is confirmed.
You can read more about this and the other changes introduced with this API version here: https://stripe./docs/upgrades#2022-08-01