iOS 应用中的 Paypal 集成

Posted

技术标签:

【中文标题】iOS 应用中的 Paypal 集成【英文标题】:Paypal integration in an iOS app 【发布时间】:2016-01-07 00:38:08 【问题描述】:

根据苹果指南 (https://developer.apple.com/appstore/resources/approval/guidelines.html) 我发现我们不应该使用 In App purchase 来购买/出售实物商品,我正在构建一个 ios 应用程序来购买/出售一些实物商品,

如果我在我的应用中使用 Paypal 和 authorize.net 支付网关来购买/销售实物商品,苹果会批准我的应用吗?

如果苹果允许我们使用这些第三方支付网关,苹果的份额是多少?苹果对每笔贝宝/信用卡交易收取多少百分比? (我知道 Apple 为应用内购买(IAP)收取 30% 这适用于 paypal/authorize.net 吗?)

【问题讨论】:

【参考方案1】:

没有什么可以说 100 % 确定 但是,是的,Apple 允许您使用自己的付款方式销售实物商品。

因此,您可以为此添加贝宝或任何其他您想要的。

就苹果份额而言,在这种情况下他们不会拿任何明星,但服务提供商(如贝宝)将根据他们的费用结构收取交易费用。

【讨论】:

【参考方案2】:
hear is the link that you can download demo :-https://github.com/kristianmandrup/paypal-billing-demo

and I was implement in my app 

#in AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

    [PayPalMobile initializeWithClientIdsForEnvironments:@PayPalEnvironmentProduction : @"YOUR_CLIENT_ID_FOR_PRODUCTION",
                                                           PayPalEnvironmentSandbox : @"AeB0tbkw-z4Ys3NvxekUZxnVNk26WXRodQBETFG4x-HtQAuqBf5k4edWOn2zia_l8RWBFJGEUNSVWJWg"];

    return YES;

#with your Controller

#in your .h File set delegate

@interface MyCart : UITableViewController

@property(nonatomic, strong, readwrite) PayPalConfiguration *payPalConfig;

#in your .m File

- (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;



#Code with purchase button event

-(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];



#PayPalPaymentDelegate methods

- (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);

【讨论】:

以上是关于iOS 应用中的 Paypal 集成的主要内容,如果未能解决你的问题,请参考以下文章

ios中的Titanium Paypal Live集成问题

iPhone sdk 中的 Paypal 集成

iOS 应用程序 + 服务器集成中的贝宝链式支付(或自适应)

iPhone应用程序中的PayPal集成[重复]

iPhone 原生应用中的 Paypal 集成

Android 中的 PayPal 集成