Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
941 views
in Technique[技术] by (71.8m points)

objective c - PKAddPassPaymentRequest not able to send a Request

I'm Developing Apple Pay Card Provisioning Apple Pay In-App Provisioning Card I got this continuing this functionality getting the nonce & nonceSignatures from Apple server after getting this trying to send PKAddPassPaymentRequest in the below formate not getting anything is the format is correct what I'm sending

PKAddPaymentPassRequest *request = [[PKAddPaymentPassRequest alloc] init];
request.encryptedPassData =[@"XXXXXXXXXXX" dataUsingEncoding:NSUTF8StringEncoding];
request.activationData =[@"XXXXXXXXXXX" dataUsingEncoding:NSUTF8StringEncoding];
request.ephemeralPublicKey =[@"XXXXXXXXXXX" dataUsingEncoding:NSUTF8StringEncoding];

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...