How To Accept Credit Cards In Your iOS Apps Using Stripe

Discussion of the official tutorials published on raywenderlich.com. Please only discuss the official tutorials here - for general questions, use the General Discussion forum instead.

How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby rwenderlich » Fri Mar 29, 2013 11:00 am

This is the official thread to discuss the following blog post: How To Accept Credit Cards In Your iOS Apps Using Stripe
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
User avatar
rwenderlich
Site Admin
 
Posts: 2262
Joined: Thu Dec 23, 2010 4:14 pm
Has thanked: 28 times
Been thanked: 381 times

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby marciokoko » Sun Mar 31, 2013 4:07 pm

What would you say are the pros and cons vs PayPal?
--------------
"Stay Hungry, Stay Foolish!"
Mars
santiapps.com
@santiapps
MBA-2011-iPhone5s-iPad3
User avatar
marciokoko
Forum Subject Matter Expert
 
Posts: 2390
Joined: Wed Jun 08, 2011 9:37 pm
Has thanked: 4 times
Been thanked: 339 times

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby samwize » Mon Apr 01, 2013 4:58 am

What kind of apps that use Stripe would Apple allow?

I remember they have strict policy with payment methods, allowing their own IAP and rejecting apps that use Paypal/etc. Unless that changed.
samwize
n00b
 
Posts: 1
Joined: Mon Apr 01, 2013 4:53 am
Has thanked: 0 time
Been thanked: 0 time

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby clapollo » Mon Apr 01, 2013 6:53 pm

samwize wrote:What kind of apps that use Stripe would Apple allow?

I remember they have strict policy with payment methods, allowing their own IAP and rejecting apps that use Paypal/etc. Unless that changed.


Apple's In-App Purchases are only for digital content that is delivered through your app. If you were creating an app that let people buy t-shirts, for example, you could not use IAPs. In that case, you would use something like Stripe, PayPal, etc.

-Chris LP
User avatar
clapollo
Subscriber since Jan 26, 2014
Editor
 
Posts: 651
Joined: Sat Mar 02, 2013 6:23 pm
Has thanked: 2 times
Been thanked: 172 times

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby Romyilano » Tue Apr 09, 2013 11:58 pm

First, thank you for writing this helpful tutorial!

Second - you might have problems following this tutorial because Stripe updatied their iOS Code... so you'll get an error if you import PKView.h
This has been replaced by STPView.h with different methods as well.

If anyone could help the author update the tutorial I'd appreciate it! I might give it a shot--

hugs,

Romy
Romyilano
Subscriber since Mar 30, 2014
n00b
 
Posts: 3
Joined: Fri Sep 07, 2012 9:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby Beyond 2021 » Thu Apr 11, 2013 10:22 am

Thanks a million for such a wonderful tutorial. I really do appreciate the time and effort.
I am getting an error with this block of code in RWStripeViewController.m when I try to "performStripeOperation".

[Stripe createTokenWithCard:self.stripeCard
publishableKey:STRIPE_TEST_PUBLIC_KEY
success:^(STPToken* token) {
[self postStripeToken:token.tokenId];
} error:^(NSError* error) {
[self handleStripeError:error];
}];
"No known class method for selector 'createTokenWithCard:publishableKey:success:error:"
Please let me know what I am missing. I realized that my methods in stripe.h are slightly different

+ (NSString *)defaultPublishableKey;
+ (void)setDefaultPublishableKey:(NSString *)publishableKey;

+ (void)createTokenWithCard:(STPCard *)card publishableKey:(NSString *)publishableKey operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)createTokenWithCard:(STPCard *)card publishableKey:(NSString *)publishableKey completion:(STPCompletionBlock)handler;

+ (void)createTokenWithCard:(STPCard *)card operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)createTokenWithCard:(STPCard *)card completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId publishableKey:(NSString *)publishableKey operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId publishableKey:(NSString *)publishableKey completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId completion:(STPCompletionBlock)handler;
@end


Thanks Again! :)
Beyond 2021
Baby Hacker
 
Posts: 6
Joined: Sun Dec 16, 2012 10:54 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby clapollo » Fri Apr 12, 2013 3:07 pm

Ok, it looks like the Stripe code is changing quite a bit in the git repo. And to make matters worse, it looks like the zip file you can download doesn't have the correct code in it.

So here are the steps I went through to fix it. I'll try to modify the tutorial when I can. (And I'll try to make the steps a bit cleaner in the tutorial.)

1. Instead of getting the zip file for the Stripe API, be sure to clone the repository so you definitely have the latest code. (I'll try attaching a zip of the Stripe API as it stands right now, just so people can follow the tutorial more easily.)

2. After you perform the step where you copy the Stripe folder into your project, open up the Stripe folder in the Project Inspector and then open the Vendor folder inside the Stripe folder. Now delete the folder named "PaymentKit Example". (When prompted, you can choose either "Remove References" or "Move to Trash"--it won't matter for the tutorial.)

3. Highlight the RWPuppies project in the Project Inspector, choose the Summary tab, and then scroll down to the section named "Linked Frameworks and Libraries". Click the + button and then add "QuartzCore.framework"

4. Finally, go to the line where you are getting the error and replace it with the following:

[Stripe createTokenWithCard:self.stripeCard
publishableKey:STRIPE_TEST_PUBLIC_KEY
completion:
^(STPToken* token, NSError* error)
{
if(error)
[self handleStripeError:error];
else
[self postStripeToken:token.tokenId];
}];

If everything worked out (and if I didn't forget anything in those steps), things should be working now.

Mind you, I only tested this to get it to compile. I haven't run it, so I'm not 100% sure this is correct. But I think this should do it.

Thanks to Romy and Beyond for finding those errors! Please let us know if you run into anything else. (Fingers crossed that you don't!)

-Chris LP
User avatar
clapollo
Subscriber since Jan 26, 2014
Editor
 
Posts: 651
Joined: Sat Mar 02, 2013 6:23 pm
Has thanked: 2 times
Been thanked: 172 times

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby pietrorea » Sat Apr 13, 2013 3:50 pm

marciokoko wrote:What would you say are the pros and cons vs PayPal?


Paypal:

*Pro: The "Pay with PayPal" logo and functionality is widely known and accepted, although less so on mobile.
*Pro: Paypal can easily accept any number of currencies and converts between them with ease.
*Pro: Paypal has a bunch of business solutions that Stripe does not, e.g. being able to receive payments in person using a smartphone (like Square).
*Con: Support has been very spotty for me. I've been on the phone with them hours at a time. Others may have had different experiences than me.
*Con: They are a giant behemoth of a company and will likely not launch new products or features as fast as Stripe. This is more about future-proofing your business.

Stripe:
*Pro: Very developer-centric. The documentation is great, the SDKs are really easy to work with and it seems like they optimize everything to make developers happy.
*Pro: IMHO, faster support. Note: I've only had to deal with integration issues instead of general customer service concerns. Still, everything was answered very quickly either via chat or e-mail.
*Con: At the moment, Stripe accounts will only work with one currency at a time (this may change in the future). If you want to support multiple currencies you either have to open a new account or get in touch with them.
*Con: They are a relatively new company whereas Paypal has been around for ages. Will Stripe be in business in 10 years? I think so, but it is still a riskier bet than Paypal.
pietrorea
iOS Tutorial Team Member
 
Posts: 15
Joined: Sat Dec 29, 2012 4:16 pm
Has thanked: 2 times
Been thanked: 0 time

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby mageroski » Mon Apr 29, 2013 11:02 am

I am trying to get this going.

I downloaded the example files. Then copied the stripe folder into Frameworks. I added the Quartzcore framework. Then added the changed code. I get the following error.

Lexical or Preprocessor issue

"PKView.h" not found.

STPView.h has a reference to it

Now I get this message. Do I need to install something for the pods?

ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mageroski
Baby Hacker
 
Posts: 6
Joined: Mon Apr 29, 2013 10:39 am
Has thanked: 0 time
Been thanked: 0 time

Re: How To Accept Credit Cards In Your iOS Apps Using Stripe

Postby pietrorea » Mon Apr 29, 2013 12:58 pm

You are using the newest version of the SDK. Does PKView come with the Stripe library? If so, have you included it in the target when you copied over the files?
pietrorea
iOS Tutorial Team Member
 
Posts: 15
Joined: Sat Dec 29, 2012 4:16 pm
Has thanked: 2 times
Been thanked: 0 time

Next

Return to Official Tutorials

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 6 guests