簡體   English   中英

Paypal在iOS應用中的集成

[英]Paypal integration in an iOS app

根據蘋果指南( https://developer.apple.com/appstore/resources/approval/guidelines.html ),我發現我們不應該使用In App Purchase來購買/出售實物商品,我正在構建一個iOS用於購買/出售一些實物商品的應用程序,

如果我在我的應用程序中使用Paypal並授權了.net支付網關購買/出售實物商品,蘋果會批准我的應用程序嗎?

如果蘋果允許我們使用這些第三方支付網關,那么蘋果份額是多少? 蘋果每筆Paypal /信用卡交易需要多少錢? (我知道Apple接受30%的應用內購買(IAP),這是否適用於paypal / authorize.net?)

沒有什么可以說是100%肯定的,但是可以,Apple允許您使用自己的付款方式出售實物商品。

因此,您可以為此添加paypal或任何其他想要的東西。

至於蘋果股份,在這種情況下他們不會拿任何星星,但是服務提供商(如貝寶)將根據其費用結構收取交易費用。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM