您可以使用Stripe将ApplePay添加到iOS PhoneGap应用程序吗?
答案 0 :(得分:2)
以下是它的代码段。调用此方法将调用apple pay的控制器表
-(void)handlesApplePay
{
@try {
PKPaymentSummaryItem *paymentSummary = [PKPaymentSummaryItem summaryItemWithLabel:@"Credit Card" amount:[NSDecimalNumber decimalNumberWithString:@"20.00"]];
NSArray *summaryItem = [[NSArray alloc] initWithObjects:paymentSummary, nil];
//Creates the type of credit card it wil support
NSArray *supportPaymentType = [[NSArray alloc] initWithObjects:PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa, nil];
PKPaymentRequest *paymentRequest = [[PKPaymentRequest alloc]init];
//This is the merchant id you create from the provisioing profile page
//developer.apple.com
paymentRequest.merchantIdentifier = @"merchant.com.ApplePay";
paymentRequest.paymentSummaryItems = summaryItem;
paymentRequest.countryCode = @"EN";
paymentRequest.currencyCode = @"USD";
paymentRequest.supportedNetworks = supportPaymentType;
paymentRequest.merchantCapabilities = PKMerchantCapabilityEMV;
PKPaymentAuthorizationViewController *paymentAuthController = [[PKPaymentAuthorizationViewController alloc]initWithPaymentRequest:paymentRequest];
paymentAuthController.delegate = self;
[self presentViewController:paymentAuthController animated:YES completion:nil];
}
@catch (NSException *exception) {
}
}