I work for a bank and I am working on a project that programmatically add a user’s credit/bank card to their apple wallet. The card has been issued by our bank.
Our app already has the entitlement com.apple.developer.payment-pass-provisioning. I am able to populate the config and call PKAddPaymentPassViewController. The modal loads correctly and once the user clicks next I get a response with the certificates, nonce, and nonceSignature.
I am now trying to call the PKAddPaymentPassRequest which requires the fields activationData, encryptedPassData, wrappedKey, ephemeralPublicKey
I’m reading the documentation here
https://developer.apple.com/documentation/passkit/pkaddpaymentpassrequest?language=objc
My understanding is the app will need to pass the certificates, nonce, and nonceSignature to our api which then uses those certificates to encrypt the credit card info etc. Our api will respond with activationData, encryptedPassData, wrappedKey, ephemeralPublicKey and then the app can call PKAddPaymentPassRequest with that data to complete the process.
I am not sure where to start with the api side. How can I use the certificates to properly produce the required encrypted strings? What is the json format for a payment pass? There's lots of examples of different passes but no a payment pass.
Is there any example code that takes the certificates and produces the encryptedPassData and the other fields? I see there’s some pass example code on developer.apple.com but there is not any example code for a payment pass.
This question is the closest I could find to what I am asking. There's some comments asking about server side implementation but the answers are not clear
You can add a credit card into apple wallet by creating .pkpass on the server-side
and download that file on the ios side it will add to the ios wallet
Here is the code to download the .pkpass (passbook file) from server with completion handler and show pkpassviewcontroller for further adding into the apple wallet.
https://github.com/flexible-agency/php-pkpass