views:

5568

answers:

17

It seems the only way to stay "in app" is to give them a UIWebView of the paypal mobile site and let them complete the transaction there, otherwise the user would need to use their API key.

Does this sound right and has anyone got or seen any sample code? I have to think this is a common piece of code.

Thanks, Corey

UPDATE: Will Apple allow this? It is a charity app, so I am assuming there is no issue.

Re-UPDATE: I assumed wrong. Apple will not allow payments directly within apps using paypal. You have to re-direct to a web interface.

A: 

Will apple let an app that does this onto the appstore? I suspect with firmware 3 allowing apps to take app store payments the answer is no. You should check.

benlumley
+7  A: 

Re-Update: As answered below this code may still be useful for the purchase of physical goods


Update:

Although this code works, App Store terms won't allow you to use this code within an app.


Original Answer:

I figured this out after some heavy API research. Below is a method that creates an HTTP POST to send to Paypal and makes an NSURLRequest. You can fill in the appropriate string format variables. I used HTTP Client to check what I was doing.

- (void)sendPayPalRequestPOST{

perfomingSetMobileCheckout=YES;
recordResults = FALSE;

NSString *parameterString = [NSString stringWithFormat:@"USER=%@&PWD=%@&SIGNATURE=%@&VERSION=57.0&METHOD=SetMobileCheckout&AMT=%.2f&CURRENCYCODE=USD&DESC=%@&RETURNURL=%@", userName, password, signature, self.donationAmount, @"Some Charge", returnCallURL];

NSLog(parameterString);

NSURL *url = [NSURL URLWithString:paypalUrlNVP];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]];

[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]];


NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if( theConnection ){
 webData = [[NSMutableData data] retain];
    [self displayConnectingView];

}else{
 NSLog(@"theConnection is NULL");
}

}

After this you need to parse the response, grab the session key and create a UIWebView to take them to the mobile paypal site. Paypal lets you specify a "return URL" which you can make anything you want. Just keep checking the UIWebview in the delegate method for this address and then you know the transaction is complete.

Then you send one more HTTP Post (similar to the one above) to Paypal to finalize the transaction. You can find the API information in the Paypal Mobile Checkout API docs.

Corey Floyd
A: 

How to try with that above piece of code. I could not get this NSURL *url = [NSURL URLWithString:paypalUrlNVP];

what is this value paypalUrlNVP?

ashish
It is a constant representing the Paypal url for nvp callsAlso, this is best placed as a comment to my answer. Since this is not an answer to the question.
Corey Floyd
He has 11 rep, so no commenting allowed.
Hawker
A: 

Don't bother doing this. Apple will never allow an app that goes around the App Store for payments.

St3fan
+1  A: 

When you say "I assumed wrong" about Apple allowing charitable donations within an app, can you provide any more information? I'm working on an app and there's a requirement to allow charitable donations...I haven't been able to find anything from Apple strictly forbidding it, but I haven't been able to find an app that allows charitable donations in the store, either.

(I struggled with whether to post this here and not as a new top-level question, but you're the first person I've come across with direct knowledge about the charitable giving within an iPhone app question).

Thanks for the update Corey. We're not using PayPal, but I'm still expecting to be rejected. I've seen a number of apps that allow you to enter a credit card to buy something (or even just run through a random credit card transaction), but never to donate.Thanks again, and good luck with your app.
A: 

How do apps like fandango process payments on the iphone? It doesnt seem to redirect to a webpage. is there any approved way of processing a transaction 100% in your app?

Thanks

A: 

But then, how does the Amazon App allows for people to buy things within the App ? I don't think they're using in-app purchase, giving 30% commission away to apple...

Ben G
UPDATE : In-App purchase clearly states against selling real-world goods through it. I guess amazon was allowed to use its own "in-app" payment system within their own app. I wonder if Apple would allow that for smaller business
Ben G
A: 

I've been tasked with building a membership app for the not-for-profit for whom I work. We currently use a web application for this work, and it uses Paypal to process the membership fees.

Is there a way to use the Paypal app as an intermediary through which payments can be processed?

Since Apple processes in-app payments of some sort through the App Store, is that a viable mechanism?

I'm really new to Cocoa Touch programming, so I'm really wallowing in info overload. If there is an easy solution that I've missed, please forgive me. If there are links, I'd appreciate pointing me in the right direction.

Gregory Hill
Gregory did you ever get an answer to this as I am in exactly the same situation with a potential client
tigermain
+1  A: 

Apple will allow custom checkouts for physical purchases. I talked with them at the iPhone Tech Talks in London and they said that they will not support physical purchases with In App Purchase as they would have to deal with refunds, etc. They also referred to existing apps that have custom checkouts.

Chris Milne
A: 

So, can someone summarize if PayPal can be used in iPhone applications in some way? It seems that it's prohibited to use it directly making an HTTP request. But what if I collect some data from native iPhone interface and then redirect the user to UIWebView which has only one button "Buy now". Pressing the button redirects the user to paypal site where he completes the order.

Will Apple allow this scenario??? Really need this.

Dmitry
You will need to read the SDK agreement and/or send a question to the developer program to be sure. When dancing around the edges of the SDK agreement, you are always taking a chance.
Corey Floyd
A: 
  1. I have a web-based service that you consume through an app. Think Skype In/Out; something similar. You need the app to use the service, but the service also requires serious server infrastructure. I want to allow people to purchase credit into the account to use the service. I want to use PayPal Mobile for this. Will Apple allow this? I'm trying it anyway, but wanted to know if anyone has experience with a similar situation.

  2. To use PayPal Mobile, do you have to sign up Website Payament Standard or Pro or something else? I dont see any PayPal merchant option to "setup" my mobile service.

  3. Also can the setmobilecheckout and dopaymentmobilecheckout be called server-to-server or do they have to be from the client page.

thanks

jayandro
+1  A: 

Try to follow this link . I believe it would help you.

It's very simple to understand. The link has very simple flow & easy variable names

http://helpmesolve.blogspot.com/

sugar
A: 

The PayPal mobile sdk library can be used inside the iphone app itself and the in app purchase experience that way is achievable.

There are some apps that are live on the appstore that way, one thing that I stumbled upon was Baublet.

arun
A: 

does anyone know if paypal integration will work for non physical purchases? I am developing an app. speechtrans.com and it will allow users to purcahse transcriptions of voice recognition for speech to speech translation. Do I have to re-write this to use Apple's in app payment system, or can i stick with paypal?

yan auerbach
A: 

Is it not possible using Paypal's Mobile Payment Library?

https://www.x.com/community/ppx/xspaces/mobile/mep?view=overview

Vivian Spencer
A: 

Apple accepted one of our apps with Paypal integration (without using In-App Purchase), however a second and different app that uses PayPal integration was rejected. Apple claims that I must submit it as an In-App Purchase app. However that doesn't make sense, when they accepted another app with PayPal integration that did NOT have In-App Purchase!

Apple is very frustrating, as I have waited over 14 days now to get rejected and now have to wait another 10 or so days to get accepted (if they even allow it to go through again).

IF WE'RE NOT ALLOWED TO USE PAYAPAL'S INTEGRATION, THEY SHOULD NOT GIVE IT TO DEVELOPERS!!!!!

Matt
You can use non-in-app-purchasing payment when you sell physical goods (books, tickets, cars - whatever), bit once you want to sell some in-app addition/service you have to use the in-app purchasing. What do both of your apps sell?
Michael Kessler
+1  A: 

bingo!

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

NR4TR