Paystack SDK for iOS. Accept Payments on iOS
Objective-C Swift Shell Ruby

Paystack iOS SDK

CocoaPods Carthage compatible CocoaPods CocoaPods

The Paystack iOS SDK make it easy to collect your users' credit card details inside your iOS app. By creating tokens, Paystack handles the bulk of PCI compliance by preventing sensitive card data from hitting your server.

This library helps collect card details on iOS and OSX, getting a token. This shoulders the burden of PCI compliance by helping you avoid the need to send card data directly to your server. Instead you send to Paystack's server and get a token which you can charge once in your server-side code. This charge returns an authorization_code if successful. Subsequent charges can then be made using the authorization_code.


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

You will also need to add Keychain Sharing entitlements for your app.


We've written a guide that explains everything from installation, to charging cards and more.

Example app

There is an example app included in the repository:

  • Paystack iOS Example shows a minimal Swift integration with our iOS SDK using PSTCKPaymentCardTextField, a native credit card UI form component we provide. It uses a small example backend to make charges.

To build and run the example apps, open Paystack.xcworkspace and choose the appropriate scheme.

Getting started with the Simple iOS Example App

Note: The example app requires Xcode 7.0 to build and run.

Before you can run the app, you need to provide it with your Paystack public key.

  1. If you haven't already, sign up for a Paystack account (it takes seconds). Then go to
  2. Replace the paystackPublishableKey constant in ViewController.swift (for the Sample app) with your Test Public Key.

Additional Setup if you will be testing chargeToken

  1. Head to and click "Deploy to Heroku" (you may have to sign up for a Heroku account as part of this process). Provide your Paystack test secret key for the PAYSTACK_TEST_SECRET_KEY field under 'Env'. Click "Deploy for Free".
  2. Replace the backendChargeURLString variable in the example iOS app with the app URL Heroku provides you with (e.g. "")

Making a test Charge

After completing the steps required above, you can make test payments through the app (use credit card number 4123 4501 3100 1381, along with 883 as cvc and any future expiration date) and then view the payments in your Paystack Dashboard!

And the return value from the backend will be displayed in your Output window.

Misc. notes

Handling errors

See PaystackError.h for a list of error codes that may be returned from the Paystack API.