Sandbox Apple Pay Issues

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? :slightly_smiling_face:

Hi Bryan,

Thanks for the prompt reply!

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.

If you only load the one for the environment your going to use does it work? :slightly_smiling_face:

No, If only the production ID is enabled, it will prompt me with an error saying that there is no entitlement for the sandbox merchant id.

If only the sandbox ID is enabled, I am faced with the same error: ‘The Apple Pay processing certificate is invalid…’

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.

Was it working previously with both certificates? I checked with the team and they said it only works with one. :slightly_smiling_face:

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.

Thanks for your help!

Glad to hear it’s working! Thanks for the details of what you did to solve the issue. :slightly_smiling_face:

1 Like