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

ccwasden picture ccwasden · Oct 24, 2014 · Viewed 9.3k times · Source

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:

enter image description here

Answer

ccwasden picture ccwasden · Oct 24, 2014

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.