Prerequisite: Get all entitlements and updated profiles. You can test push provisioning to producation only by testflight or appstore. You can request for sandbox env into your device from Apple. They can enable QA env in your device by installing a profile. Then you can test push provisioning in QA env as well.
Once you meet all requirements,
1. Create configuration and fill required details
PKAddPaymentPassRequestConfiguration *config=
[[PKAddPaymentPassRequestConfiguration alloc]
initWithEncryptionScheme:PKEncryptionSchemeECC_V2];
2. Create PKAddPaymentPassViewController and present it
self.addPaymentPassModal =
[[PKAddPaymentPassViewController alloc]
initWithRequestConfiguration:config delegate:self];
3. Implement delegate methods.
- (void)addPaymentPassViewController:(PKAddPaymentPassViewController *)controller
generateRequestWithCertificateChain:(NSArray<NSData *> *)certificates
nonce:(NSData *)nonce
nonceSignature:(NSData *)nonceSignature
completionHandler:(void(^)(PKAddPaymentPassRequest *request))handler {
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:(PKAddPaymentPassViewController *)controller
didFinishAddingPaymentPass:(nullable PKPaymentPass *)pass
error:(nullable NSError *)error {
//Will get called once push provisioning complete
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…