PKAddPassPaymentRequest not able to send a Request

谁说胖子不能爱 提交于 2019-12-04 02:03:52

问题


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.


回答1:


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

}


来源:https://stackoverflow.com/questions/50436058/pkaddpasspaymentrequest-not-able-to-send-a-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!