17

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
Andi R.
  • 597
  • 2
  • 5
  • 13
  • 23
    Since you are using `stripe-account` header when creating the paymentIntent, you will need to set the same in the frontend using Stripe.js like. `var stripe = Stripe('pk_test_xxxx', {stripeAccount: 'acct_xxxxx'});` – wsw Aug 23 '19 at 11:10
  • The 'acct_xxxxx' is the account of the vendor, not the platform (my account), right? (I'm using direct charges) – Andi R. Aug 23 '19 at 11:25
  • yes, in Stripe's term, should be the connected account ID which will be your vendor's account id connected to your platform account – wsw Aug 23 '19 at 16:09
  • 3
    @wsw You should have written the answer instead of a comment. – Anand Patel Aug 30 '19 at 07:43
  • 2
    I got this error (No such payment_intent: pi_xxxxxx) when the publishable key didn't match the one on my profile. Basically I have 2 stripe accounts (tst and dev). I used the dev's secret key and tst's publishable key by mistakes. So make sure you use the right key pair. from: https://github.com/stripe/stripe-terminal-js-demo/issues/72#issuecomment-604693063 – Jaspal Feb 20 '21 at 05:25

4 Answers4

12

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

Giorgio
  • 13,129
  • 12
  • 48
  • 75
7

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.

Bharat
  • 71
  • 1
  • 3
2

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,
    });
Oleg Khalidov
  • 5,108
  • 1
  • 28
  • 29
0

I had the same error and it was because I'd discounted the payment amount to below what stripe will accept (I made it free with a coupon in WooCommerce).

This may help someone out there