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

And*_* R. 7 node.js stripe-payments

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

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

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

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

Error: No such payment_intent: pi_yyy
Run Code Online (Sandbox Code Playgroud)

Gio*_*gio 14

就我而言,当确认 PaymentIntent 而不将 stripeAccount 传递给 Stripe 时,我在浏览器中看到 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,{
  ...
})
Run Code Online (Sandbox Code Playgroud)

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


小智 8

对于那些仍然对这个问题感到疑惑的人,

这些错误通常是由 API 密钥不匹配或尝试访问不同帐户上存在的对象引起的。仔细检查来自同一帐户的控制台的publishableKey和secret key 。