Is there a way to know when CANCEL is pressed in the Apple Pay view

扶醉桌前 提交于 2019-12-23 23:24:00

问题


Is there a way to know when CANCEL is pressed in the Apple Pay view? I tried to look for a delegate, but didn't find one.


回答1:


If you have the PKPaymentAuthorizationViewControllerDelegate methods setup, you can catch the cancel in this method:

    - (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller

I set a boolean (applePaymentDidSucceed) to FALSE before I call Apple Pay, then set it to true if the "PKPaymentAuthorizationStatus" in this method is true:

    - (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
                   didAuthorizePayment...

if ( ! applePaymentDidSucceed), the user cancelled.




回答2:


Yes there is!

You can use session.oncancel event

More info here: - https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession - https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778029-oncancel




回答3:


You will get an error. There are several error codes defined, one is for the user cancelling the payment, another for a user having paid purchases disabled in their settings, and all kinds of other errors (for example, you can't make purchases without internet access).

So no particular case for cancellation, just an error.



来源:https://stackoverflow.com/questions/37169121/is-there-a-way-to-know-when-cancel-is-pressed-in-the-apple-pay-view

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!