Android Bank Tokenization Guide


  • Android sdk version 21+
  • Omni Webpayments Token



To install,

  1. Add the JitPack repository to your build file

    allprojects {
        repositories {
            maven { url '' }
  2. Add the following line to your build.gradle file

    implementation 'com.github.fattmerchantorg:fattmerchant-android-sdk:v1.0.4'

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.

class MyApplication: Application() {
    override fun onCreate() {
		FattmerchantConfiguration.shared.webPaymentsToken = "mywebpaymentstoken"

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

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

Collect payment information

You first want to collect credit card information and populate a BankAccount object.

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

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.

var fattClient = FattmerchantClient(config)
fattClient.tokenize(bank) { (response) in
  client.tokenize(bank, object : FattmerchantClient.TokenizationListener {
            override fun onPaymentMethodCreated(paymentMethod: PaymentMethod) {
              // Success! You can now run a transaction with Fattmerchant using paymentToken as the PaymentMethod

            override fun onPaymentMethodCreateError(errors: String) {


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

val bankAccount = BankAccount.testBankAccount()

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

val 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.