iOS Bank Tokenization Guide


  • Xcode 8+
  • iOS 9+
  • Omni Webpayments Token


Use CocoaPods to install the Fattmerchant iOS SDK.

  1. Install CocoaPods
  2. Add pod 'Fattmerchant' to your Podfile
  3. Run pod install

Create a PaymentMethod

To accept a payment, you’ll need to collect information from the customer and tokenize it to create an Omni PaymentMethod. You will then be able to use this PaymentMethod with Fattmerchant’s Omni API to run the transaction.


You’ll first need to setup the FattmerchantClient for usage. All you have to do here is set the webPaymentsToken field on the shared FattmerchantConfiguration. FattmerchantClient will then use that configuration by default.

import UIKit
import Fattmerchant

class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FattmerchantConfiguration.shared.webPaymentsToken = "mywebpaymentstoken"
    // ...
    return true

Alternatively, you may create a configuration object and pass it to the new FattmerchantApi instance as you need it.

var config = FattmerchantConfiguration("", "fattwars")
var client = FattmerchantClient(config)

Collect payment information

You first want to collect bank account information and populate a BankAccount object.

let bankAccount = BankAccount(personName = "Jim Parsnip",
	bankType = "savings",
	bankAccount = "9876543210",
	bankRouting = "021000021",
	addressZip = "32822")

Associate a Customer

If you want to associate a Customer with the new PaymentMethod, set the customerId on the CreditCard or BankAccount

let bankAccount = BankAccount(routingNumber: "021000021",
                              accountNumber: "38294738291937485",
                              bankHolderType: .personal,
                              accountType: .checking,
                              customerId: "somecustomerid")

Create the PaymentMethod

Once you have a BankAccount object, call the tokenize(:) method on FattmerchantClient object and pass a listener to be notified once tokenization is complete.

let fattClient = FattmerchantApi(webPaymentsToken: "mywebpaymentstoken")
fattClient.tokenize(bank) { (response) in
  if case let .success(paymentMethod) = response {
	  // You can now use `paymentMethod` with the Fattmerchant Omni API


If you’d like to try tokenization without real payment information, you can use the BankAccount.testBankAccount() methods to get a test bank account.

let bankAccount = BankAccount.testBankAccount()

If you want to test failures, you can use the following method

let failingBankAccount = BankAccount.failingTestBankAccount()

Or you can create the BankAccount object with the following testing payment information:

Bank routing & account numbers

Routing 021000021
Account 9876543210

To test failing bank accounts, use the given routing number and any other account number

Taking a Payment

Now that you have the token representing the payment method, you can use the POST /charge resource on the Omni API. this will allow you to create a transaction with the payment method. payment_method_id is a required field, where you will need to pass in the id of the payment method that you received from the tokenize(:) method.

//TODO: Go to all the way at the bottom