简体   繁体   English

Apple Pay 不适用于 Swift 中的 Stripe

[英]Apple Pay is not working with Stripe in Swift

In my code everything is done according to stripe apple pay documentation but if user clicks on Apple Pay button from paymentContext..pushPaymentOptionsViewController() nothing happens.在我的代码中,一切都是根据条纹 Apple Pay 文档完成的,但是如果用户从paymentContext..pushPaymentOptionsViewController()中单击 Apple Pay 按钮,则不会发生任何事情。 It just pop the PaymentOptionsViewController() .它只是弹出PaymentOptionsViewController() this is the code I'm using to show payment options view controller,这是我用来显示付款选项视图 controller 的代码,

            let customerContext = STPCustomerContext(keyProvider: MyAPIClient())
            paymentContext = STPPaymentContext(customerContext: customerContext)
            paymentContext!.hostViewController = self
            paymentContext!.paymentAmount = 500
            paymentContext!.delegate = self
            paymentContext!.pushPaymentOptionsViewController()

It does show the apple pay button in the payment options view controller.它确实在支付选项视图 controller 中显示了苹果支付按钮。 Here is the video demonstration of the problem. 是该问题的视频演示。

在此处输入图像描述

but if user clicks on Apple Pay button from paymentContext..pushPaymentOptionsViewController() nothing happens但是如果用户从 paymentContext..pushPaymentOptionsViewController() 中单击 Apple Pay 按钮,则不会发生任何事情

That's normal and how it's meant to work.这是正常的,它是如何工作的。 It's just the user selecting that they want to use Apple Pay as their payment option.只是用户选择他们想使用 Apple Pay 作为支付选项。 The actual Apple Pay session happens when your app calls paymentContext.requestPayment() , which you usually do when the user hits a payment button in your app(after the PaymentOptionsViewController has closed).实际的 Apple Pay session 发生在您的应用调用paymentContext.requestPayment()时,您通常会在用户点击应用中的支付按钮时执行此操作(在 PaymentOptionsViewController 关闭之后)。

https://stripe.com/docs/mobile/ios/basic#submit-payment https://stripe.com/docs/mobile/ios/basic#submit-payment

Finally, when your user is ready to pay (eg, they tap the Buy button) call requestPayment on your payment context.最后,当您的用户准备好付款时(例如,他们点击购买按钮)在您的付款上下文中调用 requestPayment。 It'll display any required UI (such as the Apple Pay dialog) and call the appropriate methods on its delegate as your user finishes their payment.它将显示任何所需的 UI(例如 Apple Pay 对话框)并在您的用户完成付款时调用其委托的适当方法。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM