Apple Pay and SCA

Hi there
Just saw an update to the SCA and Digital Wallets documentation. It states:

“If your application uses Apple Pay, the verify function should be called in the paymentAuthorizationViewControllerDidFinish method (and not in the didAuthorizePayment method) after the buyer dismisses Apple Wallet. Buyer verification won’t occur if the Apple Wallet overlay is being displayed.”

So, the verify function now needs to move to the paymentAuthorizationViewControllerDidFinish method when we are using Apple Pay and SCA?

So we would need to capture the nonce in the didAuthorizePayment method and then wait for the paymentAuthorizationViewControllerDidFinish to be called? If so in that method we don’t have access to the PKPaymentAuthorizationResult handler so we can’t send back success states to the Apple Pay controller, is that right?

Thanks for your help, Paul

With In-App Payments SDK, the documentation update you mentioned, you should call the verify function in the paymentAuthorizationViewControllerDidFinish method when using Apple Pay, as opposed to the didAuthorizePayment method. The flow will look like:

  1. Capture Nonce in didAuthorizePayment:

    • In the didAuthorizePayment method, capture the payment nonce that is generated when the Apple Pay transaction is authorized. This nonce represents a tokenized version of the payment information.
  2. Move Verification to paymentAuthorizationViewControllerDidFinish:

    • Move the verification process to the paymentAuthorizationViewControllerDidFinish method as instructed in the documentation.
  3. Send Success States:

    • In the paymentAuthorizationViewControllerDidFinish method, if the verification is successful, you should indeed send the success state back to the Apple Pay controller. However, as you’ve correctly observed, in this method, you won’t have direct access to the PKPaymentAuthorizationResult handler, as it is not provided by Square’s In-App Payments SDK.

To work around this, you might consider the following approach:

  • In the didAuthorizePayment method, capture the payment nonce and any necessary information.
  • Pass this information to a separate function or method in your application that performs the verification and handles success states.
  • In the verification method, you can handle the verification process and, upon success, send the success state back to your Apple Pay controller. You might need to manage the communication between the Apple Pay controller and your verification method in your application’s code.

This will allow you to to move the verification to the paymentAuthorizationViewControllerDidFinish method while still managing the verification process and sending success states effectively within your application. Please ensure that your app’s logic correctly manages these components to provide a smooth user experience with Apple Pay and Square’s In-App Payments SDK. :slightly_smiling_face:

Thanks for your detailed response @Bryan-Square, very helpful.

Yes, that’s the flow we were looking at but we came across one issue, to trigger the paymentAuthorizationViewControllerDidFinish method we need to call the completion method in the didAuthorizePayment method, we are currently sending success, and then calling verify and handling the success or failure when we send the tokens to the server in the paymentAuthorizationViewControllerDidFinish method. So as far as we can tell we can’t handle the success or failure completion method on the Apple Pay controller in paymentAuthorizationViewControllerDidFinish as it has already been called to trigger this method.

Any ideas?

Any thoughts on the above @Bryan-Square? Keen to get the code updated and live as we have been having SCA calls using Apple Pay failing for quite a while now and haven’t been able to diagnose the issue

@Bryan-Square any updates? Can you recreate the steps we have detailed?

18 days gone by and no response.

Can someone let us know if you are looking into this or if we have got the logic incorrect? As you can imagine its pretty frustrating, we reported the original issue with Apple Pay and SCA a while back (Testing Apple Pay and SCA - #5 by Bryan-Square) and didn’t get a follow up, instead stumbled across the change in the documentation and now again no reply to our question in nearly 3 weeks.