最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论