Apple Pay is working fine in simulator but after upgrading Xcode to 10.4, it stopped working.
- The Apple Pay popup appears.
After click on pay with passcode, it hides without authenticating the payment.
The method
- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didAuthorizePayment:(PKPayment *)payment completion:(void (^)(PKPaymentAuthorizationStatus))completion {}
is not called.
Code:
NSString *merchantIdentifier = [STPPaymentConfiguration sharedConfiguration].appleMerchantIdentifier;
PKPaymentRequest *paymentRequest = [Stripe paymentRequestWithMerchantIdentifier:merchantIdentifier country:@"US" currency:currencyCode];
paymentRequest.paymentSummaryItems = @[
[PKPaymentSummaryItem summaryItemWithLabel:@"Fancy Hat" amount:[NSDecimalNumber decimalNumberWithString:amount]],
// The final line should represent your company;
// it'll be prepended with the word "Pay" (i.e. "Pay iHats, Inc $50")
[PKPaymentSummaryItem summaryItemWithLabel:@"iHats, Inc" amount:[NSDecimalNumber decimalNumberWithString:amount]],
];
if ([Stripe canSubmitPaymentRequest:paymentRequest]) {
// Setup payment authorization view controller
PKPaymentAuthorizationViewController *paymentAuthorizationViewController = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:paymentRequest];
paymentAuthorizationViewController.delegate = self;
// Present payment authorization view controller
FlutterViewController* controller = (FlutterViewController* )[[UIApplication sharedApplication].keyWindow rootViewController];
[controller presentViewController:paymentAuthorizationViewController animated:YES completion:nil];
}