encryptedPassData missing

Dear Apple Pay team,

We are having issues with adding some cards with the extension. Everything seems to go well, we can choose the credit card, and then it is failing, and we have absolutely no idea what could be wrong.

Debit card provisioning with the wallet works, provisioning with the app works, but provisioning some credit cards (some users can, some users cannot) doesnt work, and on the console the only thing we can observe is:

error Passbook PKAddPaymentPassRequest (0x123456): encryptedPassData missing

error Passbook [<private>] ProvisioningOperationComposer: Step 'generateCryptographicMaterial' failed with error Error Domain=PKProvisioningErrorDomain Code=4 UserInfo={NSLocalizedRecoverySuggestion=<private>, NSLocalizedDescription=<private>, NSLocalizedFailureReason=<private>}

Could this be some issue with base64 encoding? In app we just do Data(base64Encoding: , options: []) but in the wallet we saw there is a difference where we replace occurrences of _ with / and - with + (for urlSafe) and we add padding to the base64 string :

while (newBase64String.count %4 != 0 { newBase64String.append("=") }

for some obscure reason, this code was not implemented by me and I dont see the need to do this...

If that is prob not the case for our error, what could it be? how to debug it?

Answered by nargarus in 892306022

Thats a very good hint, I will bring it up with our team, it might be the backend is not sending us the info we need.

Thanks for your question! This log:

error Passbook PKAddPaymentPassRequest (0x123456): encryptedPassData missing

...is only emitted when the PKAddPaymentPassRequest.encryptedPassData property is nil, so this is likely not an encoding problem: the data simply isn't being set on the request.

I'd recommend stepping through with the debugger where your code sets this property, and seeing why it isn't getting fired. If you're not able to reproduce this locally, consider adding some additional logging in your extension to try and catch the problem at source.

Accepted Answer

Thats a very good hint, I will bring it up with our team, it might be the backend is not sending us the info we need.

encryptedPassData missing
 
 
Q