Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

applepay

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.

like image 256
PashaN Avatar asked Oct 13 '25 11:10

PashaN


1 Answers

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.

like image 119
Nerdhappy Avatar answered Oct 15 '25 04:10

Nerdhappy