【问题标题】:Stripe Connect PaymentIntent error: No such payment_intentStripe Connect PaymentIntent 错误:没有这样的 payment_intent
【发布时间】:2019-12-28 16:41:36
【问题描述】:

我在我的 API 中使用条带连接,我想更新和处理现有的 paymentIntent。使用NodeJS条带包成功创建paymentIntent

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

这成功返回了一个带有 id ('pi_yyy')、client_secret ('pi_yyy_secret_zzz')、status ('requires_payment_method') 和更多字段的 paymentIntent 对象。

但是,当使用返回的支付意图 id 进一步更新支付意图或使用 client_secret 在前端调用 stripe.createPaymentMethod 时,会返回错误:

Error: No such payment_intent: pi_yyy

【问题讨论】:

  • 由于您在创建 paymentIntent 时使用了 stripe-account 标头,因此您需要在前端使用 Stripe.js 进行设置。 var stripe = Stripe('pk_test_xxxx', {stripeAccount: 'acct_xxxxx'});
  • acct_xxxxx 是厂商的账号,不是平台(我的账号),对吧? (我使用的是直接收费)
  • 是的,在 Stripe 的术语中,应该是连接的帐户 ID,它将是您的供应商的帐户 ID,连接到您的平台帐户
  • @wsw 你应该写答案而不是评论。
  • 当可发布密钥与我的个人资料中的密钥不匹配时,我收到此错误(没有这样的 payment_intent: pi_xxxxxx)。基本上我有 2 个条带帐户(tst 和 dev)。我错误地使用了 dev 的密钥和 tst 的可发布密钥。因此,请确保使用正确的密钥对。来自:github.com/stripe/stripe-terminal-js-demo/issues/…

标签: node.js stripe-payments


【解决方案1】:

在我的例子中,当我在没有将 stripeAccount 传递给 Stripe 的情况下确认 PaymentIntent 时,我在 BROWSER 中看到了 Error: No such payment_intent: pi_yyy。确保您传递的是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

【讨论】:

    【解决方案2】:

    就我而言,我必须明确指定付款意图帐户:

     const refund = await stripe.refunds.create({
          payment_intent: stripe_payment_intent_id,
          reason: 'requested_by_customer',
        }, {
          stripeAccount: account_id,
        });
    

    【讨论】:

      【解决方案3】:

      对于那些仍然想知道这个问题的人,

      这些错误通常是由 API 密钥不匹配或尝试访问不同帐户中存在的对象引起的。从同一帐户的控制台仔细检查您的可发布密钥和密钥。

      【讨论】:

        猜你喜欢
        • 2021-01-20
        • 2021-06-09
        • 2016-07-02
        • 2019-11-20
        • 1970-01-01
        • 2016-08-27
        • 2021-06-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多