We are integrating Apple Pay in our App and successfully done setup, and getting back Payment Token but still it shows Payment not completed error.
-(IBAction)btnApplePayClicked:(id)sender
{
if([PKPaymentAuthorizationViewController canMakePayments]) {
NSLog(@"Woo! Can make payments!");
PKPaymentRequest *request = [[PKPaymentRequest alloc] init];
PKPaymentSummaryItem *widget1 = [PKPaymentSummaryItem summaryItemWithLabel:@"Widget 1"
amount:[NSDecimalNumber decimalNumberWithString:@"0.99"]];
PKPaymentSummaryItem *widget2 = [PKPaymentSummaryItem summaryItemWithLabel:@"Widget 2"
amount:[NSDecimalNumber decimalNumberWithString:@"1.00"]];
PKPaymentSummaryItem *total = [PKPaymentSummaryItem summaryItemWithLabel:@"Grand Total"
amount:[NSDecimalNumber decimalNumberWithString:@"1.99"]];
request.paymentSummaryItems = @[widget1, widget2, total];
request.countryCode = @"US";
request.currencyCode = @"USD";
request.supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa];
request.merchantIdentifier = @"merchant.com.*******";
request.merchantCapabilities = PKMerchantCapability3DS;
PKPaymentAuthorizationViewController *paymentPane = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
paymentPane.delegate = self;
[self presentViewController:paymentPane animated:TRUE completion:nil];
} else {
NSLog(@"This device cannot make payments");
}
}
- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
didAuthorizePayment:(PKPayment *)payment
completion:(void (^)(PKPaymentAuthorizationStatus status))completion
{
NSLog(@"Payment was authorized: %@", payment); //receiving Payment token
}
- (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller
{
NSLog(@"Finishing payment view controller");
[controller dismissViewControllerAnimated:TRUE completion:nil];
}
Test Card in Sandbox environment
FPAN: 4761 1200 1000 0492
Expiration Date: 11/2022
CVV: 533
After receiving Payment token what should we do? Any ideas/suggestions would be helpful. Thank you