swift - Code=50 “No such payment_intent” 确认 Stripe 付款意图时

标签 swift stripe-payments payment-gateway payment

使用此方法确认付款意图时出现以下错误STPAPIClient.shared().confirmPaymentIntent()

Error Domain=com.stripe.lib Code=50 "No such payment_intent: pi_1ElaQpFSNNCQ7y59" UserInfo={com.stripe.lib:ErrorMessageKey=No such payment_intent: pi_1ElaQpFSNNCQ7y59, com.stripe.lib:StripeErrorCodeKey=resource_missing, com.stripe.lib:StripeErrorTypeKey=invalid_request_error, com.stripe.lib:ErrorParameterKey=intent, NSLocalizedDescription=No such payment_intent: pi_1ElaQpFSNNCQ7y59}

我正在执行的代码:

STPAPIClient.shared().confirmPaymentIntent(with: paymentIntentParams, completion: { (paymentIntent, error) in

if let error = error {

    // handle error

} else if let paymentIntent = paymentIntent {

    // see below to handle the confirmed PaymentIntent

    if paymentIntent.status == .requiresAction {

        guard let redirectContext = STPRedirectContext(paymentIntent: paymentIntent, completion: { clientSecret, redirectError in

            // Fetch the latest status of the Payment Intent if necessary
            STPAPIClient.shared().retrievePaymentIntent(withClientSecret: clientSecret) { paymentIntent, error in

                // Check paymentIntent.status
            }

        })else{

            // This PaymentIntent action is not yet supported by the SDK.
            return;
        }
        redirectContext.startRedirectFlow(from: self)

    }else{
         // Show success message
    }
}
})

最佳答案

如果您使用stripe connect(直接收费)功能,您需要在前端创建 stripe 实例时传递 stripe 连接帐户 ID(stripeAccount)。请参阅下面的示例

var stripe = Stripe(STRIPE_PUBLIC_KEY, { stripeAccount: "{{ connected_account }}" });

关于swift - Code=50 “No such payment_intent” 确认 Stripe 付款意图时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56610256/

相关文章:

express - 将 Stripe webhooks 与 graphql-yoga 和 Prisma 结合使用

javascript - 延迟加载 strip - 导致未定义的错误

api - 通过 API POSTMAN 在 Stripe 中创建卡片 token

重定向支付网关magento2

android - 适用于 Android 的 Billdesk 支付网关集成

ios - 在前后摄像头之间切换

swift - “ fatal error :在展开可选值时意外发现nil”是什么意思?

swift - 如何在 PromiseKit 中使用带有 throws 返回值的方法

ios - Swift 3 更新错误 - 在展开可选值时意外发现 nil

magento - 在第 3 方支付网关后需要帮助返回 Magento 和更新订单状态