我在做R & D如何在iOS App中集成PayPal/Apple Pay支付模块。如何在iOS App中集成PayPal/Apple Pay支付模块?
For example in my app i want to integrate PayPal/Apple pay for payment, then what should I do ? What are the process.
如果任何人都可以指导如何做到这一点。请给我建议的步骤。 任何参考链接也欢迎。
我在做R & D如何在iOS App中集成PayPal/Apple Pay支付模块。如何在iOS App中集成PayPal/Apple Pay支付模块?
For example in my app i want to integrate PayPal/Apple pay for payment, then what should I do ? What are the process.
如果任何人都可以指导如何做到这一点。请给我建议的步骤。 任何参考链接也欢迎。
这取决于您已经集成的付款解决方案。 贝宝将支持账户余额或信用卡/借记卡/银行账户的资金来源。虽然与PayPal钱包不同,Apple Pay/Apple钱包中没有“余额”的功能,纯粹用于卡片标记(您在电子钱包应用中设置的卡片)。
在这个用例中,您的应用程序不一定要检查钱包中是否有$ 20(PayPal或Apple Pay),而是它将启动付款请求,并从支付网关获取响应以处理订单
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : @"YOUR_CLIENT_ID_FOR_PRODUCTION",
PayPalEnvironmentSandbox : @"AeB0tbkw-z4Ys3NvxekUZxnVNk26WXRodQBETFG4x-HtQAuqBf5k4edWOn2zia_l8RWBFJGEUNSVWJWg"}];
return YES;
}
@In terface MyCart:UITableViewController
@property(nonatomic,strong,readwrite)PayPalConfiguration * payPalConfig;
在.m文件- (void)viewDidLoad {
NSString *[email protected]"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);
}
贝宝 - 下面是完整的建议贝宝的示例代码https://developer.paypal.com
,PayPal Developer Guide和Sample code
苹果收费 - 你可以检查一下苹果的demo code
我希望你正在寻找它。 :)
@Florence,请访问此链接:https://developer.paypal.com/developer/applications/(需要先登录您的LIVE PayPal帐户),然后在那里创建一个APP,获取这两个沙箱的clientID并在该页面的实时环境然后 –
我已经这样做了,但它给了我一个错误 clang:错误:链接器命令失败,退出代码1(使用-v看到调用) –
这不是一个PayPal API响应,你可能在你的问题中添加确切的异常堆栈 –