簡體   English   中英

Stripe Connect PaymentIntent 錯誤:沒有這樣的 payment_intent

[英]Stripe Connect PaymentIntent error: No such payment_intent

我在我的 API 中使用 stripe connect,我想更新和處理現有的 paymentIntent。 paymentIntent 創建成功使用 NodeJS 條帶 package

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

這成功返回了一個 paymentIntent object,其中包含 id ('pi_yyy')、client_secret ('pi_yyy_secret_zzz')、status ('requires_payment_method') 和更多字段。

但是,當使用返回的支付意圖id進一步更新支付意圖或在前端調用stripe.createPaymentMethod時,會返回錯誤:

Error: No such payment_intent: pi_yyy

在我的例子中,我在沒有將 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

對於那些仍然想知道這個問題的人,

這些錯誤通常是由 API 密鑰不匹配或嘗試訪問不同帳戶上存在的對象引起的。 同一個帳戶的控制台仔細檢查您的可發布密鑰和密鑰。

就我而言,我必須明確指定付款意向帳戶:

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

我有同樣的錯誤,這是因為我將付款金額打折到低於 stripe 接受的金額(我在 WooCommerce 中使用優惠券免費提供)。

這可能會幫助那里的人

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM