1
votes

I am developing an App that allows a user to Add Cards a payment pass in the Wallet via the App. In order to do this, you must be request Apple to add the following entitlement

I'm also using "com.apple.developer.payment-pass-provisioning" these entitlements in my app Apple granted this entitlement for my team ID modified my provisioning profile with this entitlement enabled.

Trying to invoke the Add card screen in the Wallet app from My application using the below code

PKAddPaymentPassRequestConfiguration *request;
request.cardholderName  = @"xxxxxxxx";
request.primaryAccountSuffix = @"xxxx";
request.localizedDescription = @"This will add the card to Apple Pay";
request.primaryAccountIdentifier = @"test";
request.paymentNetwork = @"Test";

PKPassLibrary *libra;
[libra openPaymentSetup];

PKAddPaymentPassViewController *vc = [[PKAddPaymentPassViewController alloc] initWithRequestConfiguration:request delegate:self];
vc.delegate = self;
[self presentViewController:vc animated:YES completion:nil];

App is getting crash. with the error passing Nil value to the viewcontoller.

2
Your libra variable is nil because you need to initialise it with an instance of PKPassLibrary - Paulw11
Thanks, Paul it's working for me... - S P Balu Kommuri
Now i'm able to invoke Card scan page and passing card details and using PKAddPaymentPassRequestConfiguration its not prepopulating. Can you please tell me where i'm missing..... - S P Balu Kommuri
Do you aware how to Add Card-on-file from iTunes @Paulw11 - S P Balu Kommuri
@Paulw11 how to know my bank card is added or not in Apple Wallet. - S P Balu Kommuri

2 Answers

1
votes

First create PKAddPaymentPassRequestConfiguration using an encryption scheme. Then create PKAddPaymentPassViewController using this config. Update all required details in the config variable.

PKAddPaymentPassRequestConfiguration *config =[[PKAddPaymentPassRequestConfiguration alloc] initWithEncryptionScheme:PKEncryptionSchemeECC_V2];

1
votes

Have to Initialise the PKPassLibrary & PKPaymentPassRequestConfiguration replaced PKPassLibrary *libra; with PKPassLibrary *libra = [[PKPassLibrary alloc] init];