Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe Connect PaymentIntent error: No such payment_intent

I'm using stripe connect in my API, and I would like to update and process an existing paymentIntent. The paymentIntent creation is successful using the NodeJS stripe package

const paymentIntent = await stripe.paymentIntents.create(
      {
        payment_method_types: ["card"],
        amount: 1499, // in cents
        currency: "usd"
      },
      {
        stripe_account: "acct_xxx"
      }
    )

This successfully returns a paymentIntent object with id ('pi_yyy'), client_secret ('pi_yyy_secret_zzz'), status ('requires_payment_method') and more fields.

However, when using the returned payment intent id to further update the payment intent or calling stripe.createPaymentMethod on the frontend with the client_secret, an error is returned:

Error: No such payment_intent: pi_yyy
like image 460
Andi R. Avatar asked Aug 23 '19 10:08

Andi R.


3 Answers

In my case I saw Error: No such payment_intent: pi_yyy in the BROWSER when confirming a PaymentIntent without passing stripeAccount to Stripe. Make sure you're passing a stripeAccount:

//pass stripeAccount to Stripe when using Stripe Connect in the browser
let stripe = Stripe(stripePublishableKey, {
  stripeAccount: stripeAccountId,
})

let result = await stripe.confirmCardPayment(clientSecret,{
  ...
})

https://stripe.com/docs/connect/enable-payment-acceptance-guide

like image 186
Giorgio Avatar answered Oct 21 '22 10:10

Giorgio


For those who are still wondering with this issue,

These errors are usually caused by either a mismatch in API keys or by trying to access objects that exist on a different account. Double check your publishableKey and secret key from your console both from the same account.

like image 4
Bharat Avatar answered Oct 21 '22 11:10

Bharat


In my case, I got to explicitly specify the payment intent account:

 const refund = await stripe.refunds.create({
      payment_intent: stripe_payment_intent_id,
      reason: 'requested_by_customer',
    }, {
      stripeAccount: account_id,
    });
like image 1
Oleg Khalidov Avatar answered Oct 21 '22 09:10

Oleg Khalidov