Mobile Tokenization
Our mobile SDKs for tokenization make it simple to accept payments inside any iOS or Android app. With these two libraries, we take on the responsibility of PCI compliance by removing the need to send sensitive payment card data to your servers. Simply use the tools to tokenize payment cards and we'll store the payment card number in our secure vault. Next, we'll return a token that you can use to associate to an Application
. Once associated with an Application
you can use it to process payments.
Android SDK
Step 1: Installation
In the root module, make sure jcenter()
is listed inside the repositories section. In the module, add this line to its build.gradle
inside the dependencies section.
implementation 'com.payment.android:sdk:1.4'
Step 2: Instantiate Instrument Class
Create an Instrument
and pass it the card number, expiration year, and expiration month.
Instrument instrument = new Instrument(cardNumber, paymentType, expirationYear, expirationMonth);
Instrument instrument = new Instrument("4111111111111111", "PAYMENT_CARD", "2022", "12");
Arguments
Field | Type | Description |
---|---|---|
cardNumber |
String, required | Payment card account number |
paymentType |
String, required | Use "Payment_CARD" |
expirationYear |
Int, required | 4-digit expiration year |
expirationMonth |
Int, required | Expiration month (e.g. 12 for December) |
Step 3: Instantiate PaymentsSDK Class
Next, create a PaymentsSDK
object and pass it either a sandbox or a live endpoint. In the second argument you will need to pass the Application ID.
PaymentsSDK paymentsSDK = new PaymentsSDK(apiEndpoint, applicationId);;
PaymentsSDK paymentsSDK = new PaymentsSDK(https://finix.sandbox-payments-api.com, APgPDQrLD52TYvqazjHJJchM);;
Arguments
Field | Type | Description |
---|---|---|
apiEndpoint |
string, required | Sandbox or Live API endpoint (e.g. https://finix.sandbox-payments-api.com for Sandbox) |
applicationId |
string, required | ID of Application |
Step 4: Tokenize Payment Card
Lastly, you will tokenize the payment card from that you received from step two by passing it to the Tokenize
function.
Token token = paymentsSDK.Tokenize(instrument);
iOS SDK
Step 1: Import Payments SDK
Import the Payments SDK with with CocoaPods by adding pod 'PaymentsSDK', '~> 1.0.7'
to the Podfile
Step 2: Import Library
Import PaymentsSDK by running import PaymentsSDK
import PaymentsSDK
Step 3: Initialize Tokenizer Class
First, initiate Tokenizer
class and pass it a sandbox or live endpoint. In addition to the endpoint, you need to pass the Application ID to the Tokenizer
function.
let tokenizer = Tokenizer(
host: apiEndpoint,
applicationId: applicationId)
let tokenizer = Tokenizer(
host: https://finix.sandbox-payments-api.com,
applicationId: APgPDQrLD52TYvqazjHJJchM)
Arguments
Field | Type | Description |
---|---|---|
apiEndpoint |
string, required | Sandbox or Live API endpoint (e.g. https://finix.sandbox-payments-api.com for Sandbox) |
applicationId |
string, required | ID of Application |
Step 4: Tokenize Payment Card
Lastly, pass the card number, payment type, expiration month and year to the createToken
function.
tokenizer.createToken(
cardNumber: cardNumber,
paymentType: paymentType,
expirationMonth: expirationMonth,
expirationYear: expirationYear) { (token, error) in
guard let token = token else {
print(error!.localizedDescription)
return
}
print(token.id)
print(token.fingerprint)
}
tokenizer.createToken(
cardNumber: "4111111111111111",
paymentType: "PAYMENT_CARD",
expirationMonth: 12,
expirationYear: 2021) { (token, error) in
guard let token = token else {
print(error!.localizedDescription)
return
}
print(token.id)
print(token.fingerprint)
}
Arguments
Field | Type | Description |
---|---|---|
cardNumber |
string, required | Payment card account number |
paymentType |
string, required | Use "Payment_CARD" |
expirationYear |
integer, required | 4-digit expiration year |
expirationMonth |
integer, required | Expiration month (e.g. 12 for December) |