Skip to content
Advertisement

stripe checkout.session returned data.payment_intent is null

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,
    }
  )

Advertisement

Answer

This 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.com/docs/upgrades#2022-08-01

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement