I have add entitlement provided by apple:-
I am implementing as below:-
#import <UIKit/UIKit.h>
#import <PassKit/PassKit.h>
@interface RNPassKit : UIViewController
-(PKAddPaymentPassViewController*) returnCardInterface;
@end
------------------Implementaion file ------------
#import <PassKit/PassKit.h>
#import <React/RCTLog.h>
#import "RNAddPass.h"
@implementation RNPassKit
-(PKAddPaymentPassViewController*) returnCardInterface{
PKAddPaymentPassRequestConfiguration *request =
[[PKAddPaymentPassRequestConfiguration alloc]
initWithEncryptionScheme:PKEncryptionSchemeRSA_V2];
RCTLog(@"************* PKAddPaymentPassRequestConfiguration ***** %@",request);
request.cardholderName = @"SBR SML BS IVR XXXX";
request.primaryAccountSuffix = @"0511";
request.primaryAccountIdentifier = @"12345";
PKAddPaymentPassViewController *vc = [[PKAddPaymentPassViewController alloc] initWithRequestConfiguration:request delegate:self];
vc.delegate = self;
UIViewController *top = [UIApplication sharedApplication].keyWindow.rootViewController;
[top presentViewController:vc animated:YES completion:nil];
return vc;
}
(void)addPaymentPassViewController:(PKAddPaymentPassViewController *)controller
generateRequestWithCertificateChain:(NSArray<NSData *> *)certificates
nonce:(NSData *)nonce
nonceSignature:(NSData *)nonceSignature
completionHandler:(void (^)(PKAddPaymentPassRequest *request))handler {
RCTLogInfo(@"************* certificates **** ");
PKAddPaymentPassRequest *paymentPassRequest = [[PKAddPaymentPassRequest alloc] init];
// paymentPassRequest.encryptedPassData = [[NSData alloc]
// initWithBase64EncodedString:encryptedPassData options:0];
//
// paymentPassRequest.activationData = [activationData
// dataUsingEncoding:NSUTF8StringEncoding];
//
// paymentPassRequest.ephemeralPublicKey = [[NSData alloc]
// initWithBase64EncodedString:ephemeralPublicKey options:0];
handler(paymentPassRequest);
}
(void)addPaymentPassViewController:(nonnull PKAddPaymentPassViewController *)controller didFinishAddingPaymentPass:(nullable PKPaymentPass *)pass error:(nullable NSError *)error {
RCTLogInfo(@"************* didFinishAddingPaymentPass **** ");
[self dismissViewControllerAnimated:YES completion:nil];
}
@end
I am calling returnCardInterface method on click of "add to apple wallet button" where I can see "Add card to Apple Pay" UI with the prefilled details provided in PKAddPaymentPassRequestConfiguration object but click of Next it says "Contact you card issuer" and also not calling below method in which apple provides certificates, nonce and nonce signature:-
(void)addPaymentPassViewController:(PKAddPaymentPassViewController *)controller
generateRequestWithCertificateChain:(NSArray<NSData *> *)certificates nonce:(NSData *)nonce nonceSignature:(NSData *)nonceSignature completionHandler:(void (^)(PKAddPaymentPassRequest *request))handler
what am I missing, please correct me if I am wrong anywhere because according to documentation delegate method should be called on click of Next but it is not getting called??