Accept in-person card payments on Android devices using the merchant’s own acquiring bank, while orders, statuses and webhooks are managed through the Truust API.
Overview
Truust supports card-present (in-person) payments through theTAP_* payin types. Instead of sending the buyer a payment link, the merchant collects the payment on site: the buyer taps their card (or phone/wallet) on an Android device and the result is reported back to Truust.
Truust never reads the card itself. The card is captured by the acquiring bank’s certified payment app installed on the same Android device. The Truust Checkout app acts as the bridge: it receives the order from Truust, launches the bank app with the amount and the merchant credentials, and reports the result back to Truust. From that point the order follows the same lifecycle and webhooks as any online payment.
Each account (merchant) contracts its own card-present gateway directly with its bank, exactly as it does with an online gateway such as Redsys. An account can have online and card-present gateways at the same time, and decide for each order whether to send a payment link or collect it in person.
Payment Methods
TAP_PHONE and TAP_PAY are the methods currently available for the Comercia (CaixaBank) acquiring network. Availability of every TAP_* type depends on your platform configuration. Contact Truust support to confirm which ones can be enabled for your accounts.How It Works
The Truust Checkout app and the bank payment app run on the same Android device.- Your system creates the order for the amount to collect, assigning it to the manager logged in on the device that will collect the payment.
- Your system creates a payin with the card-present type. The payin is created in
CREATEDstatus and stays pending until the device reports a result. - Truust sends a push notification to the Truust Checkout app logged in with that manager.
- The Truust Checkout app asks for confirmation and launches the bank payment app with the amount and the gateway credentials configured in the account.
- The buyer taps their card on the device (and enters the PIN if requested).
- The bank app returns the result to the Truust Checkout app.
- The Truust Checkout app reports the result to Truust, which confirms or denies the payin.
- Truust notifies your system through webhooks.
Setup Options
A card-present integration relies on four pieces:
How you combine them depends on whether you need to send each payment to a specific device.
The Truust Checkout app works with a single account: the first one linked to the manager it logs in with. A manager linked to several accounts can only collect payments for one of them on a device.
Shared setup
The simplest setup: the account has one card-present gateway, and any of its managers can log in to the Truust Checkout app on any device. You create the order and the payin with the card-present type, and the payment is collected from the order detail in the app, on whichever device the merchant chooses. Every device collects with the same bank credentials, and Truust does not route the payment to any device in particular.Per-device setup
When your system must send each payment to a specific device, without anyone looking for the order in the app, give every device its own identity:- A gateway per device, with the credentials of that device’s bank terminal.
- A service account per device: a manager created only for that device (e.g.
reception-1@clinic.example), that represents the device and not a person.
- It creates the order with the
X-Truust-Managerheader, set to the email of the device’s service account. Truust assigns the order to it only if it belongs to the account that owns the API token. Otherwise the header is ignored and the order is created unassigned, so no device will receive it. - It creates the payin with the
gateway_idof the device’s gateway (see Step 5). - Truust sends a push notification to the device logged in with that service account, and the device launches the bank app with the credentials of that gateway.
- Not shared between devices. Truust keeps, for every manager, only the device it last logged in from: push notifications and the availability heartbeat (
last_alive) follow the last login. If two devices log in with the same service account, only the last one receives payment requests. - Not shared between accounts. Since the app works with the first account of the manager, a service account linked to two accounts would not receive the payments of the other one. Use a different email for each service account of each account.
Push notifications to the Truust Checkout app are enabled per platform. Contact Truust support to confirm they are active for your platform before going live.
Prerequisites
- A Truust account with the
TAP_*type in its list of allowed gateways (see Step 1). - Card-present credentials provided by the merchant’s acquiring bank (merchant number, terminal number and activation code for
TAP_PHONE). - An Android device with:
- The Truust Checkout app (provided by Truust as an APK, optionally with your own look & feel).
- The bank payment app: Smartphone TPV for
TAP_PHONE, the In-Store Payment service forTAP_PAY, or Dojo Pocket forTAP_DOJO. - NFC enabled (for
TAP_PHONEandTAP_DOJO).
- A valid API token (see Authentication).
Step 1: Allow the Gateway
A gateway type can only be created on an account if it is included in the account’sallowed_gateways. You can set it when creating the account:
GET /2.0/accounts/me).
Step 2: Configure the Gateway
Register the credentials provided by the bank withPOST /2.0/accounts/gateways. The gateway is linked to the account that owns the API token used in the Authorization header, so no account id is required.
For
TAP_PHONE the Truust Checkout app registers the Smartphone TPV app automatically with these credentials the first time a payment is launched. The merchant does not need to log in manually in the bank app. If the credentials in the gateway are wrong, the payment will fail with a registration error even if the bank app has a session open.Step 3: Create the Managers
The Truust Checkout app logs in with a manager of the account. In the per-device setup, create one service account per device (e.g.reception-1@clinic.example, cabin-2@clinic.example), so that each order can be sent to a specific device and its availability can be tracked individually.
uuid, which you can use later to check whether the device is online (see Device Availability).
Step 4: Create the Order
Create the order withPOST /2.0/orders and send the X-Truust-Manager header with the email of the manager logged in on the device that will collect the payment. The order is assigned to that manager, and that device will receive the payment request.
Step 5: Create the Payin
Create the payin with the card-present type:gateway_id to choose the gateway of the device that will collect the payment.
The payin is created in CREATED status. The device logged in with the manager assigned to the order receives a push notification, shows the payment details and, once accepted, opens the bank payment app so the buyer can tap their card.
The payment can also be retried from the order detail in the Truust Checkout app, for example if the device was offline when the push notification was sent.
Step 6: Receive the Result
The bank app applies a timeout of 40 seconds for the buyer to present the card. After that, every payin ends in one of two final states, and Truust notifies you through webhooks:- Confirmed means the payment has been registered correctly and the order can be considered paid.
- Denied means there was an error or a timeout. The order remains open and a new payin can be created to try again.
Refunds
Card-present refunds also require the card to be physically present, and it must be the same card used for the original payment.- Request the refund through the API with
POST /2.0/payins/{id}/refund, or from the order detail in the Truust Checkout app. - The refund is created in
CREATEDstatus and Truust sends a push notification to the device logged in with the manager assigned to the order. - The Truust Checkout app opens the bank payment app in refund mode, with the original transaction reference.
- The buyer taps the same card. The 40-second timeout also applies.
- The device reports the result and Truust notifies you.
Webhooks
For a card-present integration we recommend subscribing at least to the following events (see Webhooks):
The payload includes the account the order belongs to, so a single endpoint can serve all your accounts. If you manage many accounts under the same platform, Truust can configure your webhook URLs at platform level so that every new account sends notifications automatically.
Device Availability
Since card-present payments are synchronous, it is useful to know whether the collecting device is available before sending a payment to it. While the manager is logged in on the device and the Truust Checkout app is in the foreground, the app reports a heartbeat to Truust every minute. The last heartbeat is available in thelast_alive property of the manager (YYYY-MM-DD hh:mm:ss):
last_alive is older than ~2 minutes, consider the device unavailable (phone off, app closed or in the background, no connectivity) and show an error to your user instead of sending the payment.
Sandbox
- Truust provides a sandbox APK of the Truust Checkout app and test gateway credentials for the bank app.
- Without physical test cards, the bank’s card simulator app can be used. Simulated cards can occasionally fail; if so, try again with another test card.
- To complete a refund in sandbox, use the same test card used for the payment.
