简体   繁体   English

Stripe Connect PaymentIntent 错误:没有这样的 payment_intent

[英]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.我在我的 API 中使用 stripe connect,我想更新和处理现有的 paymentIntent。 The paymentIntent creation is successful using the NodeJS stripe package paymentIntent 创建成功使用 NodeJS 条带 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.这成功返回了一个 paymentIntent object,其中包含 id ('pi_yyy')、client_secret ('pi_yyy_secret_zzz')、status ('requires_payment_method') 和更多字段。

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:但是,当使用返回的支付意图id进一步更新支付意图或在前端调用stripe.createPaymentMethod时,会返回错误:

Error: No such payment_intent: pi_yyy

In my case I saw Error: No such payment_intent: pi_yyy in the BROWSER when confirming a PaymentIntent without passing stripeAccount to Stripe.在我的例子中,我在没有将 stripeAccount 传递给 Stripe 的情况下确认 PaymentIntent 时,在BROWSER 中看到了 Error: No such payment_intent: pi_yyy。 Make sure you're passing a stripeAccount :确保您正在传递一个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 https://stripe.com/docs/connect/enable-payment-acceptance-guide

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.这些错误通常是由 API 密钥不匹配或尝试访问不同帐户上存在的对象引起的。 Double check your publishableKey and secret key from your console both from the same account .同一个帐户的控制台仔细检查您的可发布密钥和密钥。

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,
    });

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).我有同样的错误,这是因为我将付款金额打折到低于 stripe 接受的金额(我在 WooCommerce 中使用优惠券免费提供)。

This may help someone out there这可能会帮助那里的人

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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