mobile: Android integration

The easiest way to start accepting payments on Android devices using ProcessOut is to use the ProcessOut Android 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 ↗.


The ProcessOut Android SDK is available on Android SDK 14+.

ProcessOut is available through Jitpack. To install it, simply add the following line to your build file:

allprojects {
    repositories {
        maven { url '' }

as well as this dependency in your build.gradle file:

dependencies {
    compile 'com.github.processout:processout-android:2.6'

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

// You can find your project ID in your dashboard
final ProcessOut client = new ProcessOut(this, 

Tokenize a card

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

// First create a card object containing the card details
Card card = new Card("Jeremy lejoux", "4242424242424242", 11, 19, "123");

// And then send the card data to ProcessOut to tokenize
client.tokenize(card, new TokenCallback() {
    public void onSuccess(String token) {
        // Send the card token to your backend for charging

    public void onError(Exception error) {
        Log.e("ProcessOut", error.toString());

Alternative payment methods

ProcessOut also supports alternative payment methods with a redirection flow.

First you’ll need to generate an invoice in your backend and retrieve that invoice ID in order to fetch all the active configurations available for that invoice. You’ll also need to provide this invoice with a specific return url of this form: yourapp://processout.return

curl -X POST \
    -u test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x:key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB \
    -d name="Awesome invoice" \
    -d amount="9.99" \
    -d currency=USD 
    -d return_url="yourapp://processout.return"
var ProcessOut = require("processout");
var client = new ProcessOut(

    name:     "Amazing item",
    amount:   "4.99",
    currency: "USD",
    return_url: "yourapp://processout.return"
}).then(function(invoice) {
    // invoice is our newly created resource

}, function(err) {
    // An error occured

import processout
client = processout.ProcessOut(

invoice = client.new_invoice().create({
    "name":     "Amazing item",
    "amount":   "4.99",
    "currency": "USD",
    "return_url": "yourapp://processout.return"
require "processout"
client =

invoice = client.invoice.create(
    name:     "Amazing item",
    amount:   "4.99",
    currency: "USD",
    return_url: "yourapp://processout.return"
$client = new \ProcessOut\ProcessOut(

$invoice = $client->newInvoice()->create(array(
    "name"     => "Amazing item",
    "amount"   => "4.99",
    "currency" => "USD"
    "return_url" => "yourapp://processout.return"
import ""
client := processout.New(

iv, err := client.NewInvoice().Create(processout.InvoiceCreateParameters{
    Invoice: &processout.Invoice{
        Name:     processout.String("Amazing item"),
        Amount:   processout.String("4.99"),
        Currency: processout.String("USD"),
        ReturnUrl: processout.String("yourapp://processout.return")

Then, you’ll be able to display your APM to your users.

final ProcessOut p = new ProcessOut(this, "test-proj_OET06P4r3J8A1jT1XnaEZjWNp6zKFBZ5");
p.listAlternativeMethods("invoice-id", new ListAlternativeMethodsCallback() {
    public void onSuccess(ArrayList<AlternativeGateway> gateways) {
        for (AlternativeGateway g :
            gateways) {
            // display the gateway to your user

    public void onError(Exception e) {

In order to use a specific alternative payment method configuration simply use its redirect method.

Then you’ll need to handle your customers returning to your app. To do so, add an intent-filter to your payment activity like so:

    android:theme="@style/AppTheme.NoActionBar" >
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    <intent-filter android:label="@string/processout_return">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="your_app"
            android:host="processout.return" />

This will ensure that your app catches all the your_app:// urls. Once done, you’ll be able to retrieve ProcessOut data from a return url:

protected void onCreate(Bundle savedInstanceState) {

    Intent intent = getIntent();
    Uri data = intent.getData();
    if (data == null)
    else {
        // Check if the activity has been opened from ProcessOut
        WebViewReturnAction returnAction = ProcessOut.handleProcessOutReturn(data);
        if (returnAction == null) {
            // Opening URI is not from ProcessOut
        } else {
            switch (returnAction.getType()) {
                case APMAuthorization:
                    // Value contains the APM token
                    if (returnAction.isSuccess())
                        Log.d("PROCESSOUT", returnAction.getValue());
                case ThreeDSVerification:   
                    // Value contains the invoice_id    
                    if (returnAction.isSuccess())   
                        Log.d("PROCESSOUT", returnAction.getValue());   

There are two cases where your app could be opened from a return URL: 1- From an Alternative Payment Method authorization request in which case a APM token is returned 2- From a ThreeDS1 check in which case the invoice ID is returned (please note that even when performing a 3DS2 challenge, in some cases if the 3DS2 is not supported a fallback to 3DS1 will be performed.)

In either case you should send these information back to your backend to create the charge.

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 iOS platform as well. We have a very similar SDK available for Apple’s devices, available here ↗. Feel free to check it out!