确认条带的付款意图时,代码= 50“无此付款意图”

Kel*_*ite 4 payment payment-gateway stripe-payments swift

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

错误Domain = com.stripe.lib代码= 50“没有这样的付款意图:pi_1ElaQpFSNNCQ7y59” UserInfo = {com.stripe.lib:ErrorMessageKey =没有这样的付款意图:pi_1ElaQpFSNNCQ7y59,com.stripe.lib:StripeErrorCodeKey = resource_missing,com。 :StripeErrorTypeKey = invalid_request_error,com.stripe.lib:ErrorParameterKey = intent,NSLocalizedDescription =否这种付款方式: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
    }
}
})
Run Code Online (Sandbox Code Playgroud)

Kau*_*hal 12

如果您正在使用stripe connect(直接收费)功能,您需要stripeAccount在前端创建条带实例时传递条带连接帐户 id( )。见下面的例子

var stripe = Stripe(STRIPE_PUBLIC_KEY, { stripeAccount: "{{ connected_account }}" });
Run Code Online (Sandbox Code Playgroud)


小智 5

我在JS api上也遇到过类似的问题(“无此付款方式”)。我的错误是,我用stripe.handleCardPayment,而不是stripe.handleCardSetupclient_secret一个SetupIntent的。