2

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.

S P Balu Kommuri
  • 890
  • 10
  • 28

2 Answers2

2

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];

  • Hii. I want to call the apple wallet from ios app when the user wants to store the card details into apple wallet. so i got the nil value in addPaymentPassVC .let addPaymentPassVC = PKAddPaymentPassViewController.init(requestConfiguration: config!, delegate: self). So i got the Fatal error: Unexpectedly found nil while unwrapping an Optional value. do you have any idea about it – vijju Aug 06 '18 at 09:59
1

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

S P Balu Kommuri
  • 890
  • 10
  • 28
  • 1
    hii. I want to display apple wallet to save the card details of the user when the user clicks the add cards button in ios app. How to do it. could please give some idea about it – vijju Jun 25 '18 at 04:11
  • r you trying to add a card from your App? Then you have to use the above code with the initialization of `PKAddPaymentPassRequestConfiguration`. – S P Balu Kommuri Jun 27 '18 at 05:48
  • yaa. can i implement it same as in swift. I am using swift – vijju Jun 27 '18 at 05:50
  • ya, you can but I implement in objective C – S P Balu Kommuri Jun 27 '18 at 05:55
  • I have another doubt that is when user clicks the button is it open the apple wallet or the user details are stored in wallet? – vijju Jun 28 '18 at 03:25
  • Can someone please tell me how to get the docs for adding card to wallet from my iOS app? Is this any private document ? – Alfred Jul 09 '18 at 13:40
  • Yes, those are confidential Apple guys only send after requesting with the proper requirement. – S P Balu Kommuri Jul 10 '18 at 04:07
  • When the user clicks the add cards button is it redirects to apple wallet or can we display the cards fields to the user? is there any URL to launch the apple wallet when the user clicks the add cards button – vijju Jul 16 '18 at 06:06
  • https://stackoverflow.com/a/50475819/3767902 go through this answer. @vijju – S P Balu Kommuri Jul 16 '18 at 10:25
  • Hii Balu. For adding the card details of user from my ios app can we need to get the permission from apple or it is not required? We are not card issuers. Only we can processing the payments. do you know any idea about it? Please give some idea. – vijju Aug 07 '18 at 03:33
  • Hi vijju. It you want to use this In App-Provisioning feature you need to request Apple to enable the Payment pass provisioning entitlement. Otherwise you cannot able to proceed. – S P Balu Kommuri Aug 08 '18 at 11:33