如何在iOS应用程序中集成PayPal/Apple支付模块?
我正在研究如何在iOS应用程序中集成PayPal/Apple支付模块 例如,在我的应用程序中,我想集成PayPal/Apple pay For payment,那么我应该怎么做?过程是什么 如果有人能指导怎么做。请告诉我步骤。如何在iOS应用程序中集成PayPal/Apple支付模块?,ios,objective-c,iphone,paypal,applepay,Ios,Objective C,Iphone,Paypal,Applepay,我正在研究如何在iOS应用程序中集成PayPal/Apple支付模块 例如,在我的应用程序中,我想集成PayPal/Apple pay For payment,那么我应该怎么做?过程是什么 如果有人能指导怎么做。请告诉我步骤。 也欢迎任何参考链接。这取决于您集成的支付解决方案。 PayPal将支持账户余额或信用卡/借记卡/与账户链接的银行的资金来源。与PayPal钱包不同的是,Apple Pay/Apple钱包中没有“余额”功能,它仅与卡片标记(您在钱包应用程序中设置的卡片)一起工作 在这种情况
也欢迎任何参考链接。这取决于您集成的支付解决方案。 PayPal将支持账户余额或信用卡/借记卡/与账户链接的银行的资金来源。与PayPal钱包不同的是,Apple Pay/Apple钱包中没有“余额”功能,它仅与卡片标记(您在钱包应用程序中设置的卡片)一起工作
在这种情况下,您的应用程序不一定要检查钱包(PayPal或Apple Pay)中是否有20美元可用,而是会启动付款请求,并从支付网关获得响应以处理您的订单,这取决于您集成的支付解决方案。 PayPal将支持账户余额或信用卡/借记卡/与账户链接的银行的资金来源。与PayPal钱包不同的是,Apple Pay/Apple钱包中没有“余额”功能,它仅与卡片标记(您在钱包应用程序中设置的卡片)一起工作 在此用例中,您的应用程序不一定要检查钱包(PayPal或Apple Pay)中是否有20美元可用,相反,它会启动付款请求,并从支付网关获得响应,以在AppDelegate中处理您的订单 用你的控制器 在您的.h文件集中设置委托 @接口MyCart:UITableViewController @属性(非原子、强、读写)PayPalConfiguration*payPalConfig 在你的.m文件中 带有购买按钮事件的代码 PayPalPaymentDelegate方法 在AppDelegate中 用你的控制器 在您的.h文件集中设置委托 @接口MyCart:UITableViewController @属性(非原子、强、读写)PayPalConfiguration*payPalConfig 在你的.m文件中 带有购买按钮事件的代码 PayPalPaymentDelegate方法
https://developer.paypal.com
,以及https://developer.paypal.com
,以及我希望你正在找它。:) @Florence,访问此链接:(需要先使用您的LIVE PayPal帐户登录),然后在那里创建一个应用程序,在该页面中获取沙盒和LIVE环境的客户端ID,然后我完成了此操作,但它给了我一个错误提示:error:linker命令失败,退出代码为1(使用-v查看调用),这不是PayPal API响应,您可以在应用程序中添加确切的异常堆栈question@Florence,访问此链接:(需要先使用您的LIVE PayPal帐户登录),然后在那里创建一个应用程序,在该页面中获取沙盒和LIVE环境的客户端ID,然后我完成了此操作,但它给了我一个错误提示:error:linker命令失败,退出代码为1(使用-v查看调用)这不是PayPal API响应,您可以在问题中添加确切的异常堆栈嗨,@Chirag…我需要您的帮助…面临PayPal在ios中集成的一些问题…是的,很抱歉延迟重播。您能描述一下您的问题吗?嗨,@Chirag…我需要您的帮助…面临PayPal在ios中集成的一些问题…是的,很抱歉延迟重播你能描述一下你的问题吗?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : @"YOUR_CLIENT_ID_FOR_PRODUCTION",
PayPalEnvironmentSandbox : @"AeB0tbkw-z4Ys3NvxekUZxnVNk26WXRodQBETFG4x-HtQAuqBf5k4edWOn2zia_l8RWBFJGEUNSVWJWg"}];
return YES;
}
- (void)viewDidLoad {
NSString *environment=@"sandbox";
self.environment = environment;
[PayPalMobile preconnectWithEnvironment:environment];
_payPalConfig = [[PayPalConfiguration alloc] init];
_payPalConfig.acceptCreditCards = YES;
_payPalConfig.merchantName = @"ScanPay";
_payPalConfig.merchantPrivacyPolicyURL = [NSURL URLWithString:@"https://www.paypal.com/webapps/mpp/ua/privacy-full"];
_payPalConfig.merchantUserAgreementURL = [NSURL URLWithString:@"https://www.paypal.com/webapps/mpp/ua/useragreement-full"];
_payPalConfig.languageOrLocale = [NSLocale preferredLanguages][0];
_payPalConfig.payPalShippingAddressOption = PayPalShippingAddressOptionPayPal;
}
-(IBAction)btnCheckoutTapped
{
// UIAlertView *alt=[[UIAlertView alloc]initWithTitle:@"ScanPay" message:@"Under Development" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
// [alt show];
NSDecimalNumber *subtotal = [[NSDecimalNumber alloc]initWithDouble:Price];
// Optional: include payment details
NSDecimalNumber *shipping = [[NSDecimalNumber alloc] initWithString:@"0.00"];
NSDecimalNumber *tax = [[NSDecimalNumber alloc] initWithString:@"0.00"];
PayPalPaymentDetails *paymentDetails = [PayPalPaymentDetails paymentDetailsWithSubtotal:subtotal
withShipping:shipping
withTax:tax];
NSDecimalNumber *total = [[subtotal decimalNumberByAdding:shipping] decimalNumberByAdding:tax];
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = total;
payment.currencyCode = @"USD";
payment.shortDescription = @"You Pay";
payment.paymentDetails = paymentDetails; // if not including payment details, then leave payment.paymentDetails as nil
if (!payment.processable) {
// This particular payment will always be processable. If, for
// example, the amount was negative or the shortDescription was
// empty, this payment wouldn't be processable, and you'd want
// to handle that here.
}
// Update payPalConfig re accepting credit cards.
self.payPalConfig.acceptCreditCards = YES;
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
configuration:self.payPalConfig
delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment {
NSLog(@"PayPal Payment Success!");
[self ErrorWithString:@"PayPal Payment Success!"];
self.resultText = [completedPayment description];
//[self showSuccess];
[self sendCompletedPaymentToServer:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
[self dismissViewControllerAnimated:YES completion:nil];
ReceiptScreen *obj=[self.storyboard instantiateViewControllerWithIdentifier:@"ReceiptScreen"];
[self.navigationController pushViewController:obj animated:YES];
}
- (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController {
NSLog(@"PayPal Payment Canceled");
self.resultText = nil;
// self.successView.hidden = YES;
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark Proof of payment validation
- (void)sendCompletedPaymentToServer:(PayPalPayment *)completedPayment {
// TODO: Send completedPayment.confirmation to server
NSLog(@"Here is your proof of payment:\n\n%@\n\nSend this to your server for confirmation and fulfillment.", completedPayment.confirmation);
}