我可以在 iPhone/iPad 应用程序中使用 PayPal 吗?

发布于 2024-11-28 09:29:53 字数 214 浏览 0 评论 0原文

我正在开发一个应用程序,我想通过它出售一些活动门票。

我可以使用 PayPal 来实现此目的吗?Apple 是否会批准使用其他 StoreKit 框架的应用程序。

我搜索了这个主题,但找不到任何可能的解决方案。

一些搜索称可以使用 paypal,另一些则称 Apple 从未批准使用除 inAppPurchase 之外的支付网关的应用程序。

请帮我!

I am working on an application that through which I want to sell some event Tickets.

Can I use PayPal for this purpose, and will Apple approve the app using other that StoreKit Framework.

I searched on this topic, but I am not able to find any possible solution.

Some searches say that paypal can be used and the other say that Apple never approves an app using payment gateway other than inAppPurchase.

Please help me!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

污味仙女 2024-12-05 09:29:53

是的,您可以在您的应用程序中使用 PayPal 支付网关。您可以从以下链接查看完整的文档:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_documentation#mobile

在您的 .h 文件中添加以下代码

#import "PayPal.h"
#import "PayPalList.h"

typedef enum PaymentStatuses 
{
    PAYMENTSTATUS_SUCCESS,
    PAYMENTSTATUS_FAILED,
    PAYMENTSTATUS_CANCELED,
} PaymentStatus;

实现此委托方法“PayPalPaymentDelegate”

PayPalList *payPalList;
PaymentStatus status;

在您的 .m 文件中添加以下代码

#import "PayPalPayment.h"
#import "PayPalAdvancedPayment.h"
#import "PayPalAmounts.h"
#import "PayPalReceiverAmounts.h"
#import "PayPalAddress.h"
#import "PayPalInvoiceItem.h"
#define SPACING 3.

- (void)ButtonWithType:(PayPalButtonType)type withAction:(SEL)action 
{

    UIButton *btnPayWithPayPal = [[PayPal getInstance] getPayButtonWithTarget:self andAction:action andButtonType:type];

    CGRect frame;
    frame.origin.x = 60;
    frame.origin.y = 315;
    frame.size.width = 304;
    frame.size.height = 40;

    btnPayWithPayPal.frame = frame;
    [self.view addSubview:btnPayWithPayPal];
}

- (void)viewDidLoad
{
     [self ButtonWithType:BUTTON_194x37 withAction:@selector(simplePayment)];
}

#pragma mark -
#pragma mark PayPalPaymentDelegate methods

- (void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus 
{
    status = PAYMENTSTATUS_SUCCESS;
}

- (void)paymentFailedWithCorrelationID:(NSString *)correlationID andErrorCode:(NSString *)errorCode andErrorMessage:(NSString *)errorMessage 
{
    status = PAYMENTSTATUS_FAILED;
}

- (void)paymentCanceled 
{
    status = PAYMENTSTATUS_CANCELED;
}

- (void)paymentLibraryExit 
{
    UIAlertView *alert = nil;
    switch (status) {
        case PAYMENTSTATUS_SUCCESS:
            break;
        case PAYMENTSTATUS_FAILED:
            alert = [[UIAlertView alloc] initWithTitle:@"Order failed" 
                                               message:@"Your order failed. Touch \"Pay with PayPal\" to try again." 
                                              delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            break;
        case PAYMENTSTATUS_CANCELED:
            alert = [[UIAlertView alloc] initWithTitle:@"Order canceled" 
                                               message:@"You canceled your order. Touch \"Pay with PayPal\" to try again." 
                                              delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            break;
    }
    [alert show];
    [alert release];
}

- (PayPalAmounts *)adjustAmountsForAddress:(PayPalAddress const *)inAddress andCurrency:(NSString const *)inCurrency andAmount:(NSDecimalNumber const *)inAmount
                                    andTax:(NSDecimalNumber const *)inTax andShipping:(NSDecimalNumber const *)inShipping andErrorCode:(PayPalAmountErrorCode *)outErrorCode 
{
    //do any logic here that would adjust the amount based on the shipping address
    PayPalAmounts *newAmounts = [[[PayPalAmounts alloc] init] autorelease];
    newAmounts.currency = @"USD";
    newAmounts.payment_amount = (NSDecimalNumber *)inAmount;

    //change tax based on the address
    /*if ([inAddress.state isEqualToString:@"CA"]) {
        newAmounts.tax = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",[inAmount floatValue] * .1]];
    } else {
        newAmounts.tax = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",[inAmount floatValue] * .08]];
    }
    newAmounts.shipping = (NSDecimalNumber *)inShipping;*/

    //if you need to notify the library of an error condition, do one of the following
    //outErrorCode = AMOUNT_ERROR_SERVER;
    //outErrorCode = AMOUNT_ERROR_OTHER;

    return newAmounts;
}

#pragma mark -
#pragma mark Actions triggered by Pay with PayPal buttons

- (void)simplePayment 
{
        //optional, set shippingEnabled to TRUE if you want to display shipping
    //options to the user, default: TRUE
    [PayPal getInstance].shippingEnabled = TRUE;

    //optional, set dynamicAmountUpdateEnabled to TRUE if you want to compute
    //shipping and tax based on the user's address choice, default: FALSE
    [PayPal getInstance].dynamicAmountUpdateEnabled = TRUE;

    //optional, choose who pays the fee, default: FEEPAYER_EACHRECEIVER
    [PayPal getInstance].feePayer = FEEPAYER_EACHRECEIVER;

    //for a payment with a single recipient, use a PayPalPayment object
    PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];

    payment.recipient = [NSString stringWithFormat:@"%@",payPalList.strRecipientPayPalId];
    payment.paymentCurrency = [NSString stringWithFormat:@"%@",e_commerceAppDelegate.strProductCurrency];
    payment.merchantName = [NSString stringWithFormat:@"%@",payPalList.strPayPalMerchantName];
    payment.ipnUrl = [NSString stringWithFormat:@"%@",payPalList.strIpnUrl];

    //subtotal of all items, without tax and shipping
    payment.subTotal = [NSDecimalNumber decimalNumberWithString:stringsubtotal];

    //invoiceData is a PayPalInvoiceData object which contains tax, shipping, and a list of PayPalInvoiceItem objects
    payment.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];

    //invoiceItems is a list of PayPalInvoiceItem objects
    //NOTE: sum of totalPrice for all items must equal payment.subTotal
    //NOTE: example only shows a single item, but you can have more than one
    payment.invoiceData.invoiceItems = [NSMutableArray array];
    PayPalInvoiceItem *item = [[[PayPalInvoiceItem alloc] init] autorelease];
    item.totalPrice = payment.subTotal;

    //int i=0;

    for(i=0 ; i<[e_commerceAppDelegate.cartList count] ; i++)
    {
        cart = (Cart*)[e_commerceAppDelegate.cartList objectAtIndex:i];

        item.name = cart.proName;

        item.itemCount = [NSNumber numberWithInteger:cart.quantity];

        NSString *itemSingPrice = [NSString stringWithFormat:@"%.2f",cart.price];
        item.itemPrice = [NSDecimalNumber decimalNumberWithString:itemSingPrice];

        NSString *itemSubTotal = [NSString stringWithFormat:@"%.2f",cart.quantity*cart.price];
        item.totalPrice = [NSDecimalNumber decimalNumberWithString:itemSubTotal];

        [payment.invoiceData.invoiceItems addObject:item];

        item = [[[PayPalInvoiceItem alloc] init] autorelease];
    }

    NSScanner* scanner = [NSScanner localizedScannerWithString:e_commerceAppDelegate.strDeliveryCharges];
    NSDecimal decimal;
    [scanner scanDecimal:&decimal];
    NSDecimalNumber *decimalNumber = [NSDecimalNumber decimalNumberWithDecimal:decimal];

    payment.invoiceData.totalShipping = decimalNumber;

    [[PayPal getInstance] checkoutWithPayment:payment];

}

从您可以通过以下链接了解有关 PayPal 的信息

https://www.x.com/community/ppx/xspaces/mobile/mep

https://www.x.com/docs/DOC-2532

https://cms.paypal.com/cms_content/US/en_US/文件/developer/IPGuide.pdf

https://cms.paypal.com/cms_content/US/en_US/文件/developer/PP_MPL_Developer_Guide_and_Reference_Android.pdf

https://www.x.com/thread/45094

https://www.x.com/message/193751#193751

http://googlecheckout.blogspot.com/ 2010/06/pay-on-go-with-android- payment.html

https://chrome.google.com/webstore/detail/omomllobcfbllglbhpmafongpckhdcdn

Yes, you can use PayPal payment gateway with your application. You can see the complete documentation from the below link:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_documentation#mobile

Add following code in your .h File

#import "PayPal.h"
#import "PayPalList.h"

typedef enum PaymentStatuses 
{
    PAYMENTSTATUS_SUCCESS,
    PAYMENTSTATUS_FAILED,
    PAYMENTSTATUS_CANCELED,
} PaymentStatus;

Implement this delegate method "PayPalPaymentDelegate"

PayPalList *payPalList;
PaymentStatus status;

Add the following code in your .m File

#import "PayPalPayment.h"
#import "PayPalAdvancedPayment.h"
#import "PayPalAmounts.h"
#import "PayPalReceiverAmounts.h"
#import "PayPalAddress.h"
#import "PayPalInvoiceItem.h"
#define SPACING 3.

- (void)ButtonWithType:(PayPalButtonType)type withAction:(SEL)action 
{

    UIButton *btnPayWithPayPal = [[PayPal getInstance] getPayButtonWithTarget:self andAction:action andButtonType:type];

    CGRect frame;
    frame.origin.x = 60;
    frame.origin.y = 315;
    frame.size.width = 304;
    frame.size.height = 40;

    btnPayWithPayPal.frame = frame;
    [self.view addSubview:btnPayWithPayPal];
}

- (void)viewDidLoad
{
     [self ButtonWithType:BUTTON_194x37 withAction:@selector(simplePayment)];
}

#pragma mark -
#pragma mark PayPalPaymentDelegate methods

- (void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus 
{
    status = PAYMENTSTATUS_SUCCESS;
}

- (void)paymentFailedWithCorrelationID:(NSString *)correlationID andErrorCode:(NSString *)errorCode andErrorMessage:(NSString *)errorMessage 
{
    status = PAYMENTSTATUS_FAILED;
}

- (void)paymentCanceled 
{
    status = PAYMENTSTATUS_CANCELED;
}

- (void)paymentLibraryExit 
{
    UIAlertView *alert = nil;
    switch (status) {
        case PAYMENTSTATUS_SUCCESS:
            break;
        case PAYMENTSTATUS_FAILED:
            alert = [[UIAlertView alloc] initWithTitle:@"Order failed" 
                                               message:@"Your order failed. Touch \"Pay with PayPal\" to try again." 
                                              delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            break;
        case PAYMENTSTATUS_CANCELED:
            alert = [[UIAlertView alloc] initWithTitle:@"Order canceled" 
                                               message:@"You canceled your order. Touch \"Pay with PayPal\" to try again." 
                                              delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            break;
    }
    [alert show];
    [alert release];
}

- (PayPalAmounts *)adjustAmountsForAddress:(PayPalAddress const *)inAddress andCurrency:(NSString const *)inCurrency andAmount:(NSDecimalNumber const *)inAmount
                                    andTax:(NSDecimalNumber const *)inTax andShipping:(NSDecimalNumber const *)inShipping andErrorCode:(PayPalAmountErrorCode *)outErrorCode 
{
    //do any logic here that would adjust the amount based on the shipping address
    PayPalAmounts *newAmounts = [[[PayPalAmounts alloc] init] autorelease];
    newAmounts.currency = @"USD";
    newAmounts.payment_amount = (NSDecimalNumber *)inAmount;

    //change tax based on the address
    /*if ([inAddress.state isEqualToString:@"CA"]) {
        newAmounts.tax = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",[inAmount floatValue] * .1]];
    } else {
        newAmounts.tax = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",[inAmount floatValue] * .08]];
    }
    newAmounts.shipping = (NSDecimalNumber *)inShipping;*/

    //if you need to notify the library of an error condition, do one of the following
    //outErrorCode = AMOUNT_ERROR_SERVER;
    //outErrorCode = AMOUNT_ERROR_OTHER;

    return newAmounts;
}

#pragma mark -
#pragma mark Actions triggered by Pay with PayPal buttons

- (void)simplePayment 
{
        //optional, set shippingEnabled to TRUE if you want to display shipping
    //options to the user, default: TRUE
    [PayPal getInstance].shippingEnabled = TRUE;

    //optional, set dynamicAmountUpdateEnabled to TRUE if you want to compute
    //shipping and tax based on the user's address choice, default: FALSE
    [PayPal getInstance].dynamicAmountUpdateEnabled = TRUE;

    //optional, choose who pays the fee, default: FEEPAYER_EACHRECEIVER
    [PayPal getInstance].feePayer = FEEPAYER_EACHRECEIVER;

    //for a payment with a single recipient, use a PayPalPayment object
    PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];

    payment.recipient = [NSString stringWithFormat:@"%@",payPalList.strRecipientPayPalId];
    payment.paymentCurrency = [NSString stringWithFormat:@"%@",e_commerceAppDelegate.strProductCurrency];
    payment.merchantName = [NSString stringWithFormat:@"%@",payPalList.strPayPalMerchantName];
    payment.ipnUrl = [NSString stringWithFormat:@"%@",payPalList.strIpnUrl];

    //subtotal of all items, without tax and shipping
    payment.subTotal = [NSDecimalNumber decimalNumberWithString:stringsubtotal];

    //invoiceData is a PayPalInvoiceData object which contains tax, shipping, and a list of PayPalInvoiceItem objects
    payment.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];

    //invoiceItems is a list of PayPalInvoiceItem objects
    //NOTE: sum of totalPrice for all items must equal payment.subTotal
    //NOTE: example only shows a single item, but you can have more than one
    payment.invoiceData.invoiceItems = [NSMutableArray array];
    PayPalInvoiceItem *item = [[[PayPalInvoiceItem alloc] init] autorelease];
    item.totalPrice = payment.subTotal;

    //int i=0;

    for(i=0 ; i<[e_commerceAppDelegate.cartList count] ; i++)
    {
        cart = (Cart*)[e_commerceAppDelegate.cartList objectAtIndex:i];

        item.name = cart.proName;

        item.itemCount = [NSNumber numberWithInteger:cart.quantity];

        NSString *itemSingPrice = [NSString stringWithFormat:@"%.2f",cart.price];
        item.itemPrice = [NSDecimalNumber decimalNumberWithString:itemSingPrice];

        NSString *itemSubTotal = [NSString stringWithFormat:@"%.2f",cart.quantity*cart.price];
        item.totalPrice = [NSDecimalNumber decimalNumberWithString:itemSubTotal];

        [payment.invoiceData.invoiceItems addObject:item];

        item = [[[PayPalInvoiceItem alloc] init] autorelease];
    }

    NSScanner* scanner = [NSScanner localizedScannerWithString:e_commerceAppDelegate.strDeliveryCharges];
    NSDecimal decimal;
    [scanner scanDecimal:&decimal];
    NSDecimalNumber *decimalNumber = [NSDecimalNumber decimalNumberWithDecimal:decimal];

    payment.invoiceData.totalShipping = decimalNumber;

    [[PayPal getInstance] checkoutWithPayment:payment];

}

From the below links you can get idea for PayPal

https://www.x.com/community/ppx/xspaces/mobile/mep

https://www.x.com/docs/DOC-2532

https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf

https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_MPL_Developer_Guide_and_Reference_Android.pdf

https://www.x.com/thread/45094

https://www.x.com/message/193751#193751

http://googlecheckout.blogspot.com/2010/06/pay-on-go-with-android-payment.html

https://chrome.google.com/webstore/detail/omomllobcfbllglbhpmafongpckhdcdn

帅的被狗咬 2024-12-05 09:29:53

尽管 iPhone 中存在用于 Paypal 集成的 API,但根据 Apple 指南,它不会批准此类应用程序进入其 AppStore。
请参阅此处的 Apple 指南第 11.3 条 https://developer.apple.com/appstore/资源/批准/guidelines.html

Although there is an API existing for Paypal integration in iPhone but as per the Apple guidelines it'll not approve such apps for their AppStore.
See Apple guidelines clause 11.3 here https://developer.apple.com/appstore/resources/approval/guidelines.html

千寻… 2024-12-05 09:29:53

嗯,我认为这取决于。

虽然我确信苹果不会允许除应用内购买之外的任何其他内容,但我确实知道德国应用商店中至少有一款应用程序,它允许您在应用程序内购买电影院的门票。他们提供信用卡付款和许多其他服务,甚至不提供 IAP。

他们以某种方式到达了商店,所以我建议你提前和苹果谈谈,看看他们是否会批准你的商业模式。

如果购买的内容包含 100% 真实世界的对象或服务并且不会改变应用程序本身的行为或内容,他们可能会批准其他付款方式。

Well I think that depends.

Although I was sure Apple wouldn't allow anything else than In-App-Purchases, I do know at least one app in the german appstore, which allows you to purchase tickets to a movie theatre within the app. They offer payment via credit card and a number of other services, IAP isn't even available.

They made it to the store somehow, so I'd suggest you go ahead and talk to Apple beforehand and find out whether they'll approve your business model or not.

Maybe they approve other methods of payment if the purchase consists of 100% real-world objects or services and does not change the behaviour or content of the app itself.

酒与心事 2024-12-05 09:29:53

不,你不能。每个 iOS 应用都必须符合的商店审核指南为了获得苹果公司的通过,明确指出:
- 您不得使用“应用内购买 API (IAP) 以外的系统来购买内容、功能或服务”进行付款 (11.2)
- 不允许“使用[e] IAP 购买实体商品或在应用程序之外使用的商品和服务”

事实上,有一个 Paypal 的 API 用于此目的,但是,如上所述,使用它的应用程序将不会通过审核。

No, you can't. The Store Review Guidelines, which every iOS app must match in order to get passed by Apple, clearly states that:
- you are not allowed to use "a system other than the In-App Purchase API (IAP) to purchase content, functionality, or services" for payment (11.2)
- it is not permitted to "us[e] IAP to purchase physical goods or goods and services used outside of the App"

Indeed, there is an API from Paypal for this purpose, but, as stated above, Apps using it will not pass the Review.

笑叹一世浮沉 2024-12-05 09:29:53

有可能,但据我所知,Appstore 不允许使用 PayPal API。执行此操作的方法是将用户发送到将处理付款的网站。这里您可以使用 PHP API 为例。

It is possible, but the Appstore will not allow the use of the PayPal API as far as I know. The way to do this is to send the user to a website wich will handle the payment. Here you can use the PHP API for example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文