javascript - stripe checkout.session returned data.payment_intent is null - Stack Overflow

When I create a checkout.session with stripe the returned data.payment_intent is nullI filled in every

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
Add a ment  | 

1 Answer 1

Reset to default 10

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742317354a4421106.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信