Skip to content

adamkuipers/stripe-ios

 
 

Repository files navigation

Stripe iOS SDK

Travis CocoaPods Carthage compatible CocoaPods CocoaPods

The Stripe iOS SDK make it easy to collect your users' credit card details inside your iOS app. By creating tokens, Stripe handles the bulk of PCI compliance by preventing sensitive card data from hitting your server (for more, see our article about PCI compliance).

We also offer seamless integration with Apple Pay that will allow you to securely collect payments from your customers in a way that prevents them from having to re-enter their credit card information.

Requirements

Our SDK is compatible with iOS apps supporting iOS 6 and above. It requires Xcode 6.3+ and the iOS 8 SDK to build the source.

Integration

We've written a guide that explains everything from installation, to creating payment tokens, to Apple Pay integration and more.

Example apps

There are 2 example apps included in the repository:

  • Stripe iOS Example (Simple) shows a minimal Swift integration with our iOS SDK.
  • Stripe iOS Example (Custom) demonstrates 2 different ways of collecting your user's payment details: via Apple Pay, and STPPaymentCardTextField, a native credit card UI form component we provide. It also uses our ApplePayStubs library to demonstrate how the Apple Pay flow appears in the iOS simulator (normally Apple Pay requires a device to use). It, too, uses a small example backend to make charges.

Getting started with the Simple iOS Example App

Note: all the example apps require Xcode 6.4 to build and run.

Before you can run the app, you need to provide it with your Stripe publishable key.

  1. If you haven't already, sign up for a Stripe account (it takes seconds). Then go to https://dashboard.stripe.com/account/apikeys.
  2. Replace the stripePublishableKey constant in ViewController.swift (for the Simple app) or Constants.m (for the Custom app) with your Test Publishable Key.
  3. Head to https://github.com/stripe/example-ios-backend and click "Deploy to Heroku" (you may have to sign up for a Heroku account as part of this process). Provide your Stripe test secret key for the STRIPE_TEST_SECRET_KEY field under 'Env'. Click "Deploy for Free".
  4. Replace the backendChargeURLString variable in the example iOS app with the app URL Heroku provides you with (e.g. "https://my-example-app.herokuapp.com")

After this is done, you can make test payments through the app (use credit card number 4242 4242 4242 4242, along with any cvc and any future expiration date) and then view them in your Stripe Dashboard!

Running the tests

  1. Open Stripe.xcworkspace
  2. Choose the "iOS Tests" or "OS X Tests" scheme
  3. Run Product -> Test

Migrating from older versions

See MIGRATING.md

About

Stripe bindings for iOS and OS X

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 97.1%
  • Swift 1.9%
  • Other 1.0%