简体   繁体   中英

“Payment not completed” with Apple Pay - can't get token

I am implementing Apple Pay using PassKit, I am showing the dialog the proper way and handling the delegate methods, but every time I use touch Id to verify a purchase it says "Payment not completed" and never reaches my delegate method paymentAuthorizationViewController:didAuthorizePayment:completion: . I did all of these things fully to set up apple pay, but I cant seem to get a token back to send to my payment gateway.

PKPaymentRequest *request = [[PKPaymentRequest alloc] init];
self.paymentRequest = request;
request.countryCode = @"US";
request.currencyCode = @"USD";
request.supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa];
request.merchantCapabilities = PKMerchantCapabilityEMV;
request.merchantIdentifier = @"merchant.com.*******";
request.requiredShippingAddressFields = PKAddressFieldPostalAddress;
request.requiredBillingAddressFields = PKAddressFieldPostalAddress;

request.paymentSummaryItems = [self paymentSummaryItems];
self.paymentPane = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
self.paymentPane.delegate = self;
if (self.paymentPane) {
    [self presentViewController:self.paymentPane animated:TRUE completion:nil];
}

Here is what I am seeing, and the screen just stays there and says "Try Again" over and over:

在此输入图像描述

Finally got a token. I needed to enable 3DS as a payment processing capability:

request.merchantCapabilities = PKMerchantCapabilityEMV | PKMerchantCapability3DS;

That's what I get for copypasting someone else's code ( http://goo.gl/uvkl8F ). Strange because 3DS is 'required' according to the docs :

You must support 3DS; support of EMV is optional.

Why I have to explicitly state 3DS is supported by the merchant when it's required is beyond me.

确保您在Passbook上设置的信用卡已经过验证...否则,PKPaymentAuthorizationViewController将返回nil。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM