---
title: Android inter-app integration
slug: android-inter-app-integration
createdAt: 2024-12-09T12:10:35.220Z
---

The CabCard driver app allows users to log in accept payments from an Android device.

The app can be installed from the [Google Play Store](https://play.google.com/store/apps/details?id=services.cabcard.driver).

## Inter-app integration

It is possible to initiate transactions and receive the transaction outcome from a third-party app using the Android Intents API. This is referred to as an inter-app integration. It is a lightweight integration suitable for data dispatch providers.

Although it can be used with no further integration, for best results integration with the CabCard Webhooks service and HTTP RESTful API is recommended.

An example app (React Native / Expo) [is provided here](https://github.com/ccs-group/cabcard-go-interapp-example).

The basic steps are:

1. Create an Intent, setting the package name to `services.cabcard.driver` and the classname to `services.cabcard.driver`
2. Specify the action as `transaction` by setting an Intent extra named "action" with value `transaction`
3. Compile the transaction parameters. This *must include*:

- `identifier`: a unique identifier (e.g. a UUID) for the intent
- `amount`: the transaction amount in currency minor units (pence), for example £10.56 (ten pounds and fifty-six pence) would be supplied as `1056`

1. Optionally you may also include the following transaction parameters:

- `reference`: a transaction reference which will be stored against the resulting transaction, for example a booking, trip or order ID (max 99 characters)
- `originator`: the name of your app, which will be displayed in the UI (max 20 characters)
- `currency`: the transaction currency ISO code (alphanumeric 3 characters), e.g. "GBP". Currently, only GBP is supported so this field will be ignored.
- `customerEmailAddress`: optional, used for convenient sending of receipts and e-com fallback
- `customerPhoneNumber`: optional, used for convenient sending of receipts and e-com fallback

This is a simplistic Java sample code example.

```java
public void takePayment() {
  Intent intent = new Intent();
  intent.setClassName("services.cabcard.driver", "services.cabcard.driver.MainActivity");

  // indicate that you want to start a transaction, using the "action" extra
  intent.putExtra("action", "transaction");

  // supply the transaction parameters as stringified JSON
  intent.putExtra("transaction", "{\"amount\":1644,\"currency\":\"GBP\",\"originator\":\"Your App Name\",\"reference\":\"Demo145\",\"identifier\":\"0c26fa5d-c06c-4f9a-9898-34bed866dd33\"}");

  if (intent.resolveActivity(getPackageManager()) != null) {
    startActivityForResult(intent);
  }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (resultCode == RESULT_OK) {
  // handle transaction result here
  }
}
```

