mobile: iOS/Swift integration

The easiest way to start accepting payments on iOS devices using ProcessOut is to use the ProcessOut iOS SDK. The SDK will take care of tokenizing your customers’ card numbers, so that you can send those generated tokens to your backend and process payments ↗.

See our Android integration guide ↗ to handle Android devices as well.


The ProcessOut iOS SDK is available on iOS 8.0+.

ProcessOut is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ProcessOut'

and run in your terminal:

pod install

You’ll then be able to import ProcessOut in your code base and configure the SDK with your ProcessOut API credentials.

import UIKit
import ProcessOut

class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, 
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // You can find your project ID in your dashboard
        ProcessOut.Setup(projectId: "test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x")
        // Your application code goes here
        return true

Tokenize a card

Once all set up, you’ll be able to tokenize the card numbers. The returned token is a simple string.

let card = ProcessOut.Card(cardNumber: "4242424242424242", expMonth: 11, expYear: 19, cvc: nil, name: "NAME")
ProcessOut.Tokenize(card: card, metadata: [:], completion: {(token, error) -> Void in
    if error != nil {
        switch error! {
        case .BadRequest(let message, let code):
            print(message, code)
        case .InternalError:
            print("An internal error occured")
        case .MissingProjectId:
            print("Check your app delegate file")
        case .NetworkError:
            print("Request could not go through")
    } else {
        // Send token to your backend to charge the customer

Next steps

You’re all set! You can now send the newly created token to your backend to:

If you’re currently setting up payments for your mobile application, you’re also most likely developping it for the Android platform as well. We have a very similar SDK available for Android devices, available here ↗. Feel free to check it out!