简体   繁体   中英

getting StripeInvalidRequestError: No such payment_intent: 'pi_3LVwOn4IimzjyVut1GNg6Urh' when stripe.paymentIntents.confirm

I want to use OptionalHandle the Alipay redirect manually, but get StripeInvalidRequestError: No such payment_intent: 'pi_3LVwOn4IimzjyVut1GNg6Urh'

    const paymentIntent = await stripe.paymentIntents.create(
      {
        payment_method_types: ['alipay'],
        amount: 1000,
        currency: 'hkd',
        application_fee_amount: 0,
      },
      {
        stripeAccount: connectedStripeAccountId,
      },
    );

    const comfirmpaymentIntent = await stripe.paymentIntents.confirm(
      paymentIntent.id,
      {
        return_url: 'https://....',
      },
    );

You're creating a Direct Charge PaymentIntent on the Connect Account but when you're confirming that PaymentIntent you're using not passing the stripeAccount id the same way you did for the creation. What happens is that Stripe will try to look at the PaymentIntent in your Platform Account and it's not finding it. If you don't have a logic between creating the PaymentIntent and confirming it, you could always pass confirm: true param when creating the PaymentIntent .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM