I am unable to test apple pay integration with my sandbox account.
When using a simulator with any test apple pay card an error is throw indicating that I am using my production ApplicationID as opposed to my sandbox ApplicationID. This is not the case. This is thrown as an error in the PKPaymentAuthorizationControllerDelegate didAuthorizePayment function meaning that no payment nonce is generated at this point.
When using a real device with a valid apple pay card, the application recognises that I am using the correct (sandbox) ApplicationID and (sandbox) MerchantID and therefore shows the prompt to proceed with payment. However, when during processing of the payment, an error is thrown stating that my Apple Pay Processing Certificate is invalid.
I have followed the troubleshooting steps to revoke any active MerchantID’s and recreated the sandbox certificate over three times with completely new MerchantID’s but the error continues to show.
I am sure that the apple pay certificate created on my apple developer account is indeed active, and is definitely the same certificate that is linked to the square developer portal.
I’m wondering if there is some sort of delay between linking the certificate to square, and it becoming usable in the application, or if I have missed something along the way. I have attached a screenshot for reference of the error that is thrown when using a real device.
There shouldn’t be any delay with the certificate. Have you confirmed that the old invalid certificate is fully removed from the project and the valid one is correctly added? Also do you have multiple applications and are you added the certificate from the correct app?
Yes. All old merchant certificates were removed from my developer console completely. (I was previously using braintree for payment but I think square is the way to go!). I added two brand new identifiers and certificates when I began my square integration, one for sandbox and one for production.
Xcode indicates that the new certificates are valid and included through the Capabilities tab in the project info (screenshot attached). I only have one application on my apple developer account so I cant imagine that the certificate could be from a separate app.
I’ve attached some additional images to confirm that the certificate is ACTIVE and that it is the same certificate linked to my sandbox square account.
It is now working. I swapped over to the production credentials to see if it was just an issue with sandbox and I was able to retrieve the payment nonce from my apple pay card.
When I switched back to the sandbox environment the payment nonce was received. I’m certain that my credentials were correct in both the app delegate and PKPaymentRequest before the swap so I’m not sure what the issue was in the end.
My one guess is that it was to do with the breakpoints that I had set up in apple pay payment process affecting the timing of some of the backend requests.
Either way it is now working as expected. I currently have both certificated enabled in the app settings.