Apple Pay 在 Swift 中无法与 Stripe 合作
Apple Pay is not working with Stripe in Swift
在我的代码中,一切都是根据 stripe apple pay documentation 完成的,但是如果用户从 paymentContext!.pushPaymentOptionsViewController()
中点击 Apple Pay 按钮,则没有任何反应。它只是弹出 PaymentOptionsViewController()
。
这是我用来显示支付选项视图控制器的代码,
let customerContext = STPCustomerContext(keyProvider: MyAPIClient())
paymentContext = STPPaymentContext(customerContext: customerContext)
paymentContext!.hostViewController = self
paymentContext!.paymentAmount = 500
paymentContext!.delegate = self
paymentContext!.pushPaymentOptionsViewController()
它确实在支付选项视图控制器中显示了苹果支付按钮。 Here是问题的视频演示。
but if user clicks on Apple Pay button from
paymentContext!.pushPaymentOptionsViewController() nothing happens
这很正常,也很正常。这只是用户选择他们想要使用 Apple Pay 作为他们的支付选项。实际的 Apple Pay 会话发生在您的应用程序调用 paymentContext.requestPayment()
时,您通常会在用户点击您应用程序中的付款按钮时执行此操作(在 PaymentOptionsViewController 关闭后)。
https://stripe.com/docs/mobile/ios/basic#submit-payment
Finally, when your user is ready to pay (e.g., they tap the Buy
button) call requestPayment on your payment context. 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.
在我的代码中,一切都是根据 stripe apple pay documentation 完成的,但是如果用户从 paymentContext!.pushPaymentOptionsViewController()
中点击 Apple Pay 按钮,则没有任何反应。它只是弹出 PaymentOptionsViewController()
。
这是我用来显示支付选项视图控制器的代码,
let customerContext = STPCustomerContext(keyProvider: MyAPIClient())
paymentContext = STPPaymentContext(customerContext: customerContext)
paymentContext!.hostViewController = self
paymentContext!.paymentAmount = 500
paymentContext!.delegate = self
paymentContext!.pushPaymentOptionsViewController()
它确实在支付选项视图控制器中显示了苹果支付按钮。 Here是问题的视频演示。
but if user clicks on Apple Pay button from paymentContext!.pushPaymentOptionsViewController() nothing happens
这很正常,也很正常。这只是用户选择他们想要使用 Apple Pay 作为他们的支付选项。实际的 Apple Pay 会话发生在您的应用程序调用 paymentContext.requestPayment()
时,您通常会在用户点击您应用程序中的付款按钮时执行此操作(在 PaymentOptionsViewController 关闭后)。
https://stripe.com/docs/mobile/ios/basic#submit-payment
Finally, when your user is ready to pay (e.g., they tap the Buy button) call requestPayment on your payment context. 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.