> ## Documentation Index
> Fetch the complete documentation index at: https://adyen-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Android Payments App

> Use our Payments app to enable Tap to Pay on your Android mobile devices without integrating our POS Mobile SDK.

If you want to accept Tap to Pay payments on your Android mobile device but do not want to integrate our POS Mobile SDK, you can download the Adyen Payments app from the Google Play store. You can then use the Payments app to connect your own POS app to the Adyen payments platform and authenticate payment requests in a compliant way.

This page explains how to build the Payments app solution. Before you begin, see [Understand the solutions](https://adyen-preview.mintlify.site/point-of-sale/mobile-android/understand.md#sdk-or-papp) to help you decide if the Payments app is the right solution for your situation.

## Requirements

Before you begin, take into account the following requirements, limitations, and preparations.

| Requirement | Description |
| - | - |
| **Integration type** | Your POS app must be integrated with [Terminal API](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api). The POS app can be installed on your mobile device or browser-based. |
| **[API credentials](https://adyen-preview.mintlify.site/development-resources/api-credentials.md)** | An API key specifically for the Adyen Payments app, with a [client key](https://adyen-preview.mintlify.site/development-resources/client-side-authentication#get-your-client-key) and the **Adyen Payments app role**. |
| **Hardware** | An Android commercial off-the-shelf (COTS) mobile device with an integrated NFC reader. Must not be a payment terminal. See [Android system requirements](https://adyen-preview.mintlify.site/point-of-sale/mobile-android/requirements.md) for the full hardware and software requirements. |
| **Limitations** | Take into account the following limitations: See the countries/regions, payment methods, and functionality that we [support](https://adyen-preview.mintlify.site/point-of-sale/ipp-mobile.md). Web-based POS apps are currently only supported in the US, the EU, and Australia. |
| **Setup steps** | Before you begin: Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to enable Tap to Pay on Android and to enable the **Adyen Payments app role** for your API key. Optionally also ask them to [enable unreferenced refunds](https://adyen-preview.mintlify.site/point-of-sale/basic-tapi-integration/refund-payment/unreferenced.md). Download the [Adyen Payments Test](https://play.google.com/store/apps/details?id=com.adyen.ipp.mobile.companion.test) app from the Google Play store. For testing, in your Customer Area order a [White-green](https://adyen-preview.mintlify.site/point-of-sale/testing-pos-payments/test-card-v3.md) Adyen test card. Or you can use a [Blue-green](https://adyen-preview.mintlify.site/point-of-sale/testing-pos-payments/test-card-v2.md) test card v2.4 or later, if you already have that. If your POS app is web-based: Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to enable receiving a [short response in the browser](#short-response). Configure your web server to use HTTPS and enforce a minimum security protocol of TLS 1.2 or higher |

## How it works

When building the various flows, you will use [Android App Links](https://developer.android.com/training/app-links) to call specific parts of the Android Payments app. To build an Android Payments app solution for Tap to Pay:

1. Build the [boarding flow](#board-the-app). The Payments app must be boarded on every Android mobile device where the app is installed.
2. Build the [payment flow](#app-transactions).

In addition, do the following:

* Build the [reboarding flow](#reboard-the-app). Reboarding enables you to switch to processing though a different store or merchant account using the same app instance and mobile device.
* Implement an API request to [revoke an app instance](#revoke-app-instance) for cases when the mobile device is defective, stolen, or no longer needed for payments.

## 1. Board the app

After you download the Payments app from the Google Play store to a mobile device, you need to board the Payments app on that device. Boarding is a three-step process:

1. [Check the boarding status](#check-boarding-status).\
   From your POS app, you call a link to check if the Payments app is boarded. If the Payments app is not boarded, you receive a "boarding request token".

2. [Authenticate the app instance](#authenticate-app-instance).\
   From your back-end, you send an API request that includes the boarding request token. In the response, you receive a one-time boarding token that is unique for the combination of Payments app instance and device.

3. [Finish boarding the app](#finish-boarding).\
   From your POS app, you call a link that includes the boarding token. The response confirms that the Payments app is now boarded, and includes an installation ID that you need to pass in your transaction requests.

### 1.1 Check the boarding status

To start the boarding flow, you call an App Link from your POS app to check if the Adyen Payments app is already boarded.

1. From your POS app, call the link. The App Link format is as follows:\
   `https://www.adyen.com/test/boarded?returnUrl=URLEncoder(your_scheme)`

   In this format:

   * `https://www.adyen.com/test/` is the test base URL.
   * `boarded` is the path to use for boarding checks.
   * `returnUrl` is the URL-encoded URL where you want to receive the response.

   The following example shows how you could build the App Link in your Kotlin project.

   **Build an App Link to check if the Payments app is boarded**

   ```kotlin theme={null}
   private fun createOnboardingCheckApplink(
       returnUrl: String,
   ): Uri {
       // Encode the returnUrl to ensure it is safe for use as a URL query parameter.
       val returnUrlEncoded = URLEncoder.encode(returnUrl, Charsets.UTF_8.name())
       return Uri.parse("${BuildConfig.APP_LINK_URL}/boarded").buildUpon()
           .appendQueryParameter("returnUrl", returnUrlEncoded)
           .build()
   }
   ```

   **App Link example**

   ```text theme={null}
   https://www.adyen.com/test/boarded?returnUrl=your-scheme-test%3A%2F%2Fyour_company.example.com%2Fonboarding
   ```

2. Check the response you receive at your `returnUrl` and decide what to do next:

   * If `boarded` is **true**: save the `installationId`, which you will need in your payment requests. You do not need to continue with the boarding process and you are ready to [make a payment](#app-transactions).
   * If `boarded` is **false**: pass the `installationId` and `boardingRequestToken` to your back-end and go to [step 2 of the boarding process](#authenticate-app-instance).

   The response consists of the URL-encoded base URL where you want to receive the response and the following parameters:

   | Parameter | Required | Type | Description |
   | - | - | - | - |
   | `boarded` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Boolean | Indicates if the app is boarded or not. |
   | `installationId` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | String | The unique identifier of the Payments app instance on the specific device.When creating Terminal API requests on your back-end, use this as the `POIID` in the `MessageHeader` of the request. |
   | `boardingRequestToken` | | String | The app token used to get the `boardingToken` from Adyen. |

> [tab] Response: Payments app is not boarded
>
> **Example response**
>
> ```text theme={null}
> {YOUR_SCHEME}%3A%2F%2Fyour_company.example.com%2Fonboarding?boarded=false&installationId=<INSTALLATION_ID>&boardingRequestToken=<BOARDING_REQUEST_TOKEN>
> ```

> [tab] Response: Payments app is boarded
>
> **Example response**
>
> ```text theme={null}
> {YOUR_SCHEME}%3A%2F%2Fyour_company.example.com%2Fonboarding?boarded=true&installationId=<INSTALLATION_ID>
> ```
>
> ### 1.2. Authenticate the app instance
>
> If you determined in [step 1 of the boarding process](#check-boarding-status) that the Payments app is not boarded yet or if you [initiated reboarding](#initiate-reboarding), you send a [Payments app API](https://docs.adyen.com/api-explorer/payments-app/latest/overview) request from your back-end to authenticate your app installation. In the response you receive a `boardingToken`.
>
> To authenticate the app:
>
> 1. Make a POST request to the endpoint corresponding to where you want to accept payments:
>
>    * To route transactions over a merchant account, use [/merchants/merchantId/generatePaymentsAppBoardingToken](https://docs.adyen.com/api-explorer/payments-app/latest/post/merchants/\(merchantId\)/generatePaymentsAppBoardingToken).
>    * To route transactions over a store, use [/merchants/merchantId/stores/storeId/generatePaymentsAppBoardingToken](https://docs.adyen.com/api-explorer/payments-app/latest/post/merchants/\(merchantId\)/stores/\(storeId\)/generatePaymentsAppBoardingToken).
>
>    The app will be configured to the merchant account or store specified in the path, and route all transactions over that merchant account or store. Ensure this aligns with your account structure.
>
>    Specify the following in the request:
>
>    * Path parameters:
>
>      | Parameters | Required | Description |
>      | - | - | - |
>      | `merchantId` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The unique identifier of the merchant account. |
>      | `storeId` | | The unique identifier of the store.The `storeId` is not the same as store `reference`. If you only know the [reference](https://docs.adyen.com/api-explorer/Management/latest/get/merchants/_merchantId_/stores#query-reference), you can use it to get the `storeId` with an API call. Request parameters: |
>
>      | Parameters | Required | Description |
>      | - | - | - |
>      | `boardingRequestToken` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The app token used to request a `boardingToken` from Adyen. You received the boarding request token in [step 1 of the boarding process](#check-boarding-status). |
>
>    **Create a boarding token request**
>
>    ```curl theme={null}
>    curl https://management-test.adyen.com/v1/merchants/{merchantId}/generatePaymentsAppBoardingToken \
>      -H 'x-API-key: ADYEN_API_KEY' \
>      -H 'content-type: application/json' \
>      -X POST \
>      -d '{
>        "boardingRequestToken": "BOARDING_REQUEST_TOKEN"
>    }'
>    ```
>
> 2. From the response, save the `boardingToken`, which you will need in the [last step of the boarding process](#finish-boarding).\
>    The response consists of the following parameters:
>
>    | Parameter | Type | Description |
>    | - | - | - |
>    | `installationId` | String | The unique identifier of the Payments app instance on the specific device. |
>    | `boardingToken` | String | The one-time token used to authenticate the app installation. Valid for one hour. |
>
>    **Create boarding token response**
>
>    ```json theme={null}
>    {
>      "installationId": "INSTALLATION_ID",
>      "boardingToken": "BOARDING_TOKEN"
>    }
>    ```
>
> ### 1.3. Finish boarding the app
>
> When you have received the `boardingToken` from Adyen, you need to send the boarding token to the Payments app to finish boarding the app and prepare for making payments.
>
> 1. From your POS app, call the link. The App Link format is as follows:
>
>    ```text theme={null}
>    https://www.adyen.com/test/board?boardingToken=Base64URL{APP_BOARDING_TOKEN}&returnUrl=URLEncoder(your_scheme)
>    ```
>
>    In this format:
>
>    * `https://www.adyen.com/test/` is the test base URL.
>    * `board` is the path to use for boarding requests.
>    * `boardingToken` is the token generated for this `installationId` in [step 2](#authenticate-app-instance) of the boarding process. This token must be Base64URL-encoded.
>    * `returnUrl` is the URL-encoded URL where you want to receive the onboarding result (the response).
>
>    The following example shows how you could build the App Link in your Kotlin project.
>
>    **Build an App Link to board the Payments app**
>
>    ```kotlin theme={null}
>    private fun createBoardingRequestApplink(
>        returnUrl: String,
>        boardingToken: String,
>    ): Uri {
>        // Encode the boarding token using Base64 URL encoding.
>        val encodedBoardingToken = Base64.getUrlEncoder().encodeToString(boardingToken.toByteArray())
>        // Encode the return URL to ensure it is safe for URL query parameters.
>        val encodedUrl = URLEncoder.encode(returnUrl, Charsets.UTF_8.name())
>
>        return Uri.parse("${BuildConfig.APP_LINK_URL}/board").buildUpon()
>            .appendQueryParameter("boardingToken", encodedBoardingToken)
>            .appendQueryParameter("returnUrl", encodedUrl)
>            .build()
>    }
>    ```
>
>    **App Link example**
>
>    ```text theme={null}
>    https://www.adyen.com/test/board?boardingToken=ZXlKaGJHY2lPaUpGVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnBZWFFpT2pFM05ERTROalkyT0RFMU9EWXNJbVY0Y0NJNk1UYzBNVGczTURJNE1UVTROaXdpYW1GaGMxVnpaWEpMWlhraU9pSjNjMTg0TXpZeU16RkFRMjl0Y0dGdWVTNVFZWGx0Wlc1MGMwMWhaR1ZGWVhONUlpd2liV1Z5WTJoaGJuUkJZMk52ZFc1MFEyOWtaU0k2SWsxcFkydE9kV2RuWlhSeklpd2lhVzV6ZEdGc2JHRjBhVzl1U1dRaU9pSkdOamxDUWprM05pMDJNRFkxTFRRME5URXRPVUZGTnkwMVFUaEJPVGsyUmpaQk1qa2lMQ0oxUTJGd2NFdGxlU0k2SWsxR2EzZEZkMWxJUzI5YVNYcHFNRU5CVVZsSlMyOWFTWHBxTUVSQlVXTkVVV2RCUlcxTmRqWmhTbTlSWkdabGFXbG5SWGRSVmxjMVlWSkJkM05ZZG1OaGMweGhTVk52ZGpnM05Hc3JUbEZFT0VsRVJXaDRLM1V5UTJkdVVVZDVXalpsU0RKNk5uWTJSVVpEU1U5VU5UWm5kbUpXV1VOeVozQjNQVDBpTENKaWRXNWtiR1ZKWkNJNkltTnZiUzVoWkhsbGJpNXBjSEF1bFc5aWFXeGxMbU52YlhCaGJtbHZiaTVrWlhZaUxDSnViMjVqWlNJNklrVjVTbkpFWkRGWE4zWjZiekJFVURraUxDSm9iM04wY3lJNmV5SmpiMjVtYVdkMWNtRjBhVzl1SWpvaWFIUjBjSE02THk5amFHVmphMjkxZEhCdmN5MTBaWE4wTG1Ga2VXVnVMbU52YlM5amFHVmphMjkxZEhCdmN5SjlMQ0owZVhCbElqb2lRazlCVWtSSlRrZGZWRTlMUlU0aWZRLkxXOS1mZ3g5V201dzVlMFlQdTNzRFAwbFZpNmQyQ21vRmpPQ0plcVlUQTl3ckM5NGNjeVJPaW0wbGJJeU9FbnJpSXVxMlVZWEJ2bGR2dmNPalVpeEhn&returnUrl=your-scheme-test%3A%2F%2Fyour_company.example.com%2Fonboardingresult
>    ```
>
> 2. Check the response and decide what to do next:
>
>    * If `boarded` is **true**: save the `installationId`. You need this when you [make a payment](#app-transactions). You do not need board the app again.
>    * If `boarded` is **false**: check the `error` and try again.
>
>    The response consist of the URL-encoded base URL where you want to receive the response and the following parameters:
>
>    | Parameter | Type | Description |
>    | - | - | - |
>    | `boarded` | Boolean | Indicates if the app is boarded or not. |
>    | `installationId` | String | The unique identifier of the Payments app instance on the specific device.When creating Terminal API requests on your back-end, use this as the `POIID` in the `MessageHeader` of the request. |
>    | `error` | String | Additional information in case an error occurred and `boarded` is **false**. |
>
>    **Example response**
>
>    ```text theme={null}
>    {YOUR_SCHEME}%3A%2F%2Fyour_company.example.com%2Fonboardingresult?boarded=true&installationId=APP_INSTALLATION_ID
>    ```
>
> ## 2. Make a transaction
>
> After the Payments app is boarded, you are ready to make transactions. To do this, you need to create a Terminal API request in Base64URL format and call the request as an App Link from your POS app. The boarded Payments app then communicates with Adyen, receives the response, and returns the response in Base64 format as part of an App Link to your POS app.
>
> To start a transaction from your POS app:
>
> 1. Create a Terminal API request with the `POIID` value set to the `installationId` value of the boarded Payments app.
>
>    * For a [payment](https://adyen-preview.mintlify.site/point-of-sale/basic-tapi-integration/make-a-payment#make-a-payment), [partial authorization](https://adyen-preview.mintlify.site/point-of-sale/partial-authorizations.md), [pre-authorization](https://adyen-preview.mintlify.site/point-of-sale/pre-authorisation.md), or [unreferenced refund](https://adyen-preview.mintlify.site/point-of-sale/basic-tapi-integration/refund-payment/unreferenced.md), create a [PaymentRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/payment).
>    * For a [referenced refund](https://adyen-preview.mintlify.site/point-of-sale/basic-tapi-integration/refund-payment/referenced.md), create a [ReversalRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal).
>
> 2. Encrypt the Terminal API request as described for a Terminal API integration with local communications.
>
>    1. [Set up a shared key](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/choose-your-architecture/local#set-up-shared-key) in your Customer Area or using Management API.
>
>    2. Either [write your own code](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/choose-your-architecture/local/protect.md) to encrypt and decrypt Terminal API messages, or [use a library](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/choose-your-architecture/local/protect-with-library.md).
>
>       The following example shows how you could encrypt Terminal API requests using the [Java library](https://github.com/Adyen/adyen-java-api-library) in a Kotlin project. We also have a [.NET library](https://github.com/Adyen/adyen-dotnet-api-library) and a [Node library](https://github.com/Adyen/adyen-node-api-library).
>
>       **Encrypt using Java library**
>
>       ```kotlin theme={null}
>       private fun encryptNexoRequest(
>               serviceId: String = UUID.randomUUID().toString(),
>               saleId: String = "AndroidSampleApp",
>               currency: String,
>               requestedAmount: BigDecimal,
>               installationId: String,
>           ): String {
>               // Create and set up the message header for the Terminal API request
>               val messageHeader = MessageHeader().apply {
>                   protocolVersion = "3.0"
>                   messageClass = MessageClassType.SERVICE
>                   messageCategory = MessageCategoryType.PAYMENT
>                   messageType = MessageType.REQUEST
>                   serviceID = serviceId
>                   saleID = saleId
>                   poiid = installationId
>               }
>
>               // Set up the security key with the values from the Customer Area or Management API
>               val securityKey = SecurityKey().apply {
>                   adyenCryptoVersion = 1
>                   keyIdentifier = BuildConfig.KEY_IDENTIFIER
>                   passphrase = BuildConfig.PASS_PHRASE
>                   keyVersion = BuildConfig.VERSION
>               }
>
>               // This function creates a Terminal API request and returns the serialized value
>               val nexoRequestJson = createNexoRequest(messageHeader = messageHeader, currency = currency, requestedAmount = requestedAmount)
>
>               // Encrypt the Terminal API request using the NexoCrypto class
>               // The first parameter is the serialized Terminal API request, and the second parameter is the message header
>               val encrypted = NexoCrypto(securityKey).encrypt(
>                   nexoRequestJson,
>                   messageHeader,
>               )
>
>               // Add the encryption response to the TerminalAPISecuredRequest
>               val terminalSecuredRequest = TerminalAPISecuredRequest()
>               terminalSecuredRequest.saleToPOIRequest = encrypted
>
>               // You can use your own serialization library to convert the encrypted request to JSON
>               // Ensure your serialization library properly handles HMAC and nonce properties:
>               // These properties are byte arrays, and they need to be serialized into Base64-encoded strings.
>               // If you use the Adyen Java library, it provides a specific Gson configuration for this purpose
>               val gson = TerminalAPIGsonBuilder.create()
>
>               // Adjust if using a different serialization library
>               return gson.toJson(terminalSecuredRequest)
>           }
>
>           // This function creates an example Terminal API request. Include additional fields as needed.
>           // You can use your own model and serialization library. This is just an example.
>           private fun createNexoRequest(
>               messageHeader: MessageHeader,
>               currency: String,
>               requestedAmount: BigDecimal,
>               transactionID: String = "SampleApp-AndroidTx",
>           ): String {
>
>               val saleTransactionID = TransactionIdentification().apply {
>                   timeStamp = getCurrentXMLGregorianCalendar()
>                   this.transactionID = transactionID
>               }
>
>               val saleData = SaleData().apply {
>                   this.saleTransactionID = saleTransactionID
>               }
>
>               val amountsReq = AmountsReq().apply {
>                   this.currency = currency
>                   this.requestedAmount = requestedAmount
>               }
>
>               val paymentTransaction = PaymentTransaction().apply {
>                   this.amountsReq = amountsReq
>               }
>
>               val paymentRequest = PaymentRequest().apply {
>                   this.saleData = saleData
>                   this.paymentTransaction = paymentTransaction
>               }
>
>               val saleToPOIRequest = SaleToPOIRequest().apply {
>                   this.messageHeader = messageHeader
>                   this.paymentRequest = paymentRequest
>               }
>
>               val terminalAPIRequest = TerminalAPIRequest().apply {
>                   this.saleToPOIRequest = saleToPOIRequest
>               }
>               val gson = TerminalAPIGsonBuilder.create()
>               return gson.toJson(terminalAPIRequest)
>           }
>
>           private fun getCurrentXMLGregorianCalendar(): XMLGregorianCalendar {
>               // Create a GregorianCalendar instance with UTC timezone
>               val calendar = GregorianCalendar().apply {
>                   time = Date()
>               }
>               calendar.timeZone = java.util.TimeZone.getTimeZone("UTC")
>               // Convert GregorianCalendar to XMLGregorianCalendar
>               return DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar)
>           }
>       ```
>
> 3. Encode the Terminal API request to Base64URL.
>
> 4. From your POS app, call the link. The App Link format is as follows:
>
>    ```text theme={null}
>    https://www.adyen.com/test/nexo?request=NexoRequest.Base64Url{Encryption{NexoRequest}}&returnUrl=URLEncoder(your_scheme)
>    ```
>
>    In this format:
>
>    * `https://www.adyen.com/test/` is the test base URL.
>    * `nexo` is the path to use for transactions.
>    * `request` is the Base64URL-encoded and encrypted Terminal API payment request.
>    * `returnUrl` is the URL-encoded URL where you want to receive the Terminal API response.
>
>    The following example shows how you could build the App Link in your Kotlin project.
>
>    **Build an App Link to initiate a payment**
>
>    ```kotlin theme={null}
>    private fun buildPaymentRequestApplink(
>        returnUrl: String,
>        encryptedTapiRequest: String,
>    ): Uri {
>        val returnUrlEncoded = URLEncoder.encode(returnUrl, Charsets.UTF_8.name())
>        val encoded = Base64.getUrlEncoder().encodeToString(encryptedTapiRequest.toByteArray())
>        return Uri.parse("${BuildConfig.APP_LINK_URL}/nexo").buildUpon()
>            .appendQueryParameter("request", encoded)
>            .appendQueryParameter("returnUrl", returnUrlEncoded).build()
>    }
>    ```
>
>    **App Link example**
>
>    ```text theme={null}
>    https://www.adyen.com/test/nexo?request=eyJTYWxlVG9QT0lSZXF1ZXN0Ijp7Ik1lc3NhZ2VIZWFkZXIiOnsiTWVzc2FnZUNhdGVnb3J5IjoiUGF5bWVudCIsIk1lc3NhZ2VDbGFzcyI6IlNlcnZpY2UiLCJNZXNzYWdlVHlwZSI6IlJlcXVlc3QiLCJQT0lJRCI6IkY2OUJCOTc2LTYwNjUtNDQ1MS05QUU3LTVBOEE5OTZGNkEyOSIsIlByb3RvY29sVmVyc2lvbiI6IjMuMCIsIlNhbGVJRCI6IkFuZHJvaWRTYW1wbGVBcHAiLCJTZXJ2aWNlSUQiOiI4NzE2MDg0NC02In0sIk5leG9CbG9iIjoiY3UrVGJwOHZWekIvZy9GWkZFMGJTWlpzUVh5Y1lWL3ZrM2ltZk9KbjhyTm1sQ1dEMkRnbS9qK2FQendIK3hXVDZhNU1JYjVSSlp5UkwrQmQ5c01SSStYYUFQYzBBTS9keWNXN2lTN0FJcGprUnZXNnV2OVlnUmdFbGl1NE1Nd1pkZndlNk11YzE1RGhqYko1SjVVc3VCSFFveHdDSjF5MTBSbTdlZUw3RXd1RlppZnU2OVBIWjB2U3ZxTytRL2doK0Eya1dVSThXSG5tTXAzWGlLL1JWdFp5WmJTaStSNkdFSVowVVVhYU85eW5TalpYZTBPTSs3YTdySXlqRmxQQkUvQS90SlRoVEtjZSs4YjZkc3JITFVLeVhmUFJjc1pGc1FUVk9ra2kvSkZnUjJqc2krZzZjUHJ4Y3oxVWpCRENGSTdiYk9pVjhKQ1pkdFlINnAxMUdpRXRJV1AzU2Qvb0ZDUkduK1lKelNRTGR2UFo0R2tHV3liZEoyb0ZaTEhrTmVXa0o1N29YN3RkcVNsajNrMjJCMzdzZ0p4STgzU3hielljRmQya2pQckFHOUpHOFNHL041M1JKTTNSY0lMK2Q1MndVM2MvRDl2TkNqYW01V2dOZldYT3cyeDFoNlR0L1lQNXdkdHFsTFpYNG55b3BKNndZMS9FZTBIUWIzVFJ0WEswWHBEbmphdGJkKzhWVm4xdGQxbmhDTDgzTDYxWXJRWUEyMG9XN25rOVI5dVY0ZDdnc0U2ZENGUzJMSmI4UytiYmVnd2szaGhJM0dRMEFJWHJpOG5ZaHhWNFF1M0o1dFJ3Unl4VDZYWW5oRnRDU3ZQTzNyY0VFcGpqeTZDTitBcHMrcVJrWWY0S1BnWkIyWU9mcnQrUlM1K080Tnp3OFkyOStaMCtHOVVJeHNLMVVIY1psWVFDTkFvOHNqRzdtalNDTm90Q2JTYk9BcVJIZmU5eXI1azRtdXZHenRzcUM4Y3R2aGRLeXpUQk5jTTJzR3NodzVJZis5TUJYRkR0WFJ1OFVFVEN3V2xDNnpNWXZreUphWHB6V2NOOVRJQ29HY2J4RkVMTWRBNjlVSjV2UktsNW9mTzd4UEhNSU9sSzBIYlpheElmeklJeDg1dGxPV2wzbUZnUCtJbzlDangrTXA4TklpaDJEeTkvVlE5L1NPeTVIeHFYYjRWb2JCNHdwUW91YXh0YzNuTEVLYktQaVZxd1R3PT0iLCJTZWN1cml0eVRyYWlsZXIiOnsiQWR5ZW5DcnlwdG9WZXJzaW9uIjoxLCJIbWFjIjoiT2N1aGMvVHJtaDlCL1FWQ2JmbFVsd3E0aTN3T2lKbkVTaC95RmovZDM1Zz0iLCJLZXlJZGVudGlmaWVyIjoidGhpcyIsIktleVZlcnNpb24iOjEyMywiTm9uY2UiOiJFK0VuRVFRUkFjc21YWlpMTng1c0lBPT0ifX19&returnUrl=your-scheme-test%3A%2F%2Fyour_company.example.com
>    ```
>
>    A Tap to Pay screen appears on the mobile device.
>
>    If the shopper does not present their payment method within 30 seconds, the payment request times out. If that happens, you need to make another payment request.
>
> 5. Use the response to show the payment result in your POS app. Select the tab *Receive full response* if your POS app is installed on your mobile device. Select the tab *Receive short response in browser* if you are using a browser-based POS app.

> [tab] Receive full response
>
> When your POS app is installed on the mobile device, you receive the full payment response. The response consist of the `returnUrl` you specified in the link, and the following parameters:
>
> | Parameter | Type | Description |
> | - | - | - |
> | `response` | String | Base64URL-encoded and encrypted Terminal API payment response. |
> | `error` | String | Additional information in case an error occurs. |
>
> **Response example**
>
> ```raw theme={null}
> {YOUR_SCHEME}://your_company.example.com?response=PAYMENT_RESPONSE
> ```
>
> 6. Decrypt the Terminal API response using the security key.
>
>    The following example shows how you could do that using the Adyen Java library in a Kotlin project.
>
>    **Decrypt using Java library**
>
>    ```kotlin theme={null}
>    private fun decryptNexoResponse(response: String): String {
>            // Decode the Base64 URL-encoded response string to retrieve the original encrypted Terminal API response
>            val decoded = String(Base64.getUrlDecoder().decode(response))
>
>            val securityKey = SecurityKey()
>            securityKey.adyenCryptoVersion = 1
>            securityKey.keyIdentifier = BuildConfig.KEY_IDENTIFIER
>            securityKey.passphrase = BuildConfig.PASS_PHRASE
>            securityKey.keyVersion = BuildConfig.VERSION
>            val gson = TerminalAPIGsonBuilder.create()
>            val data = gson.fromJson(decoded, TerminalAPISecuredResponse::class.java)
>            return NexoCrypto(securityKey).decrypt(data.saleToPOIResponse)
>        }
>    ```

> [tab] Receive short response in browser
>
> []()A web-based POS app requires a short payment response, because the full Terminal API response is too large for some browsers. The short response contains the result of the transaction, and a URL from which the full payment result can be retrieved.
>
> The short payment response is an App Link you receive from the Payments app with the following parameters:
>
> | Parameter | Type | Description |
> | - | - | - |
> | `response` | String | Base64URL-encoded and encrypted short payment response object, containing: `result`: Possible values: **Success**, **Partial**, or **Failure**. `url`: The URL to retrieve the full payment response from. When the transaction is cancelled, this field is returned empty. `errorCondition`: If `result` is **Failure** it contains the error reason. `traceParent`: If result is **Failure** it contains the trace that can be shared with our Support team for troubleshooting if the error is unclear |
> | `securityTrailer` | String | A Base64URL-encoded object containing information about the shared key used for the encryption. This information is needed to decode and decrypt the short response. |
>
> **Short response example**
>
> ```raw theme={null}
> {YOUR_SCHEME}://your_company.example.com?response=SHORT_PAYMENT_RESPONSE&securityTrailer=SECURITY_TRAILER
> ```
>
> * Decode the Base64URL from the `response` string. Note that the result is a Base64-encoded ciphertext.
>
>   **Decode Base64URL from the response**
>
>   ```kotlin theme={null}
>   val decodedBase64 = String(Base64.getUrlDecoder().decode(responseFromDeeplink))
>       decryptShortNexoResponse(securityTrailerModel, decoded)
>   ```
>
> * Decrypt the Base64-encoded ciphertext. The following example shows how you can do that using the Adyen Java library in a Kotlin project.
>
>   **Decrypt using Java library**
>
>   ```kotlin theme={null}
>   private fun decryptShortNexoResponse(securityTrailer: SecurityTrailer, nexoResponse: String): String {
>            val securityKey = SecurityKey()
>            securityKey.adyenCryptoVersion = 1
>            securityKey.keyIdentifier = BuildConfig.KEY_IDENTIFIER
>            securityKey.passphrase = BuildConfig.PASS_PHRASE
>            securityKey.keyVersion = BuildConfig.VERSION
>
>            val nexoModel = com.adyen.terminal.security.SaleToPOISecuredMessage()
>            nexoModel.nexoBlob = nexoResponse
>            nexoModel.securityTrailer = com.adyen.model.terminal.security.SecurityTrailer().apply {
>                hmac = Base64.getDecoder().decode(securityTrailer.hmac.toByteArray())
>                nonce = Base64.getDecoder().decode(securityTrailer.nonce.toByteArray())
>            }
>            return NexoCrypto(securityKey).decrypt(nexoModel)
>        }
>   ```
>
>   Below is an example of a short response in plaintext that contains the result and the URL to call to receive the full response.
>
>   **Short response in plain text**
>
>   ```text theme={null}
>   result=Success&url=https://checkoutpos-live.adyen.com/checkoutpos/v1/merchants/{merchantId}/paymentsApps/{installationId}/payments/{pspReference}
>   ```
>
> * Optionally, make a GET request to the URL your received in the short response to receive the full [payment response](https://adyen-preview.mintlify.site/point-of-sale/basic-tapi-integration/make-a-payment#payment-response).
>
> ## Reboard the app
>
> If you need to change the merchant account or store that you want to process payments for, you must reboard the app.
>
> As soon as you start the reboarding flow, the app loses the association with the merchant account or store that the app was previously boarded to. This means you cannot use the app/mobile device combination for payments until the reboarding process is completed. If an error occurs during the reboarding, you need to start the reboarding flow again.
>
> Reboarding is a three-step process that is the same as the initial boarding process, except for the first step of initiating the reboarding.
>
> 1. [Initiate reboarding](#initiate-reboarding).\
>    From your POS app, you call a link to force the app to start a new boarding process even though it is already boarded.
>
> 2. Authenticate the app instance.\
>    This step is exactly the same [as described under "Board the app"](#authenticate-app-instance).
>
> 3. Finish boarding the app.\
>    This step is exactly the same [as described under "Board the app"](#finish-boarding).
>
> ### Initiate reboarding
>
> To start the reboarding flow, you call an App Link from your POS app to force the Adyen Payments app to start a new boarding process.
>
> 1. From your POS app, call the link. The App Link format is as follows:\
>    `https://www.adyen.com/test/boarded?returnUrl=URLEncoder(your_scheme)&reboard=true`
>
>    In this format:
>
>    * `https://www.adyen.com/test/` is the test base URL.
>    * `boarded` is the path to use for boarding checks.
>    * `returnUrl` is the URL-encoded URL where you want to receive the response.
>    * `reboard` is a Boolean parameter that must be set to **true** to start the reboarding process.
>
>    The following example shows how you could build the App Link in your Kotlin project.
>
>    **Build an App Link to start reboarding**
>
>    ```kotlin theme={null}
>    private fun createReboardingCheckApplink(
>        returnUrl: String,
>    ): Uri {
>        // Encode the returnUrl to ensure it is safe for use as a URL query parameter.
>        val returnUrlEncoded = URLEncoder.encode(returnUrl, Charsets.UTF_8.name())
>        return Uri.parse("${BuildConfig.APP_LINK_URL}/boarded").buildUpon()
>            .appendQueryParameter("returnUrl", returnUrlEncoded)
>            .appendQueryParameter("reboard", "true") // Add this line for reboarding
>            .build()
>    }
>    ```
>
>    **App Link example**
>
>    ```text theme={null}
>    https://www.adyen.com/test/boarded?returnUrl=your-scheme-test%3A%2F%2Fyour_company.example.com%2Fonboarding&reboard=true
>    ```
>
> 2. Check the response you receive at your `returnUrl`, and Base64-decode the `data` string.
>
>    The response consists of the URL-encoded base URL where you want to receive the response and the following parameters:
>
>    | Parameter | Required | Type | Description |
>    | - | - | - | - |
>    | `boarded` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Boolean | Indicates if the app was previously boarded. If the app was not previously boarded, the value is **false** and the reboarding process will serve to board the app. |
>    | `installationId` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | String | The unique identifier of the Payments app instance on the specific device.When creating Terminal API requests on your back-end, use this as the `POIID` in the `MessageHeader` of the request. |
>    | `boardingRequestToken` | | String | The app token used to get the `boardingToken` from Adyen. |
>    | `data` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | String | A Base64-encoded JSON object with details of the previous boarding. |
>
>    When you Base64-decode the `data` string, this results in a JSON object with the following parameters:
>
>    | Parameter | Required | Type | Description |
>    | - | - | - | - |
>    | `date` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | String | Timestamp indicating when the reboarding started, in ISO-8601 UTC format. Example: **2025-11-10T17:34:48.123Z** |
>    | `reboarding` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | String | Indicates that this is a reboarding flow. Will be **true**. |
>    | `merchantAccountCode` | | String | The merchant account that the app was *previously* boarded to. Will be **null** if the app was not previously boarded. |
>    | `merchantStoreCode` | | String | The ID of the store that the app was *previously* boarded to. Will be **null** if the app was not previously boarded. |
>
>    **Example response after initiating reboarding**
>
>    ```text theme={null}
>    {YOUR_SCHEME}%3A%2F%2Fyour_company.example.com%2Fonboarding?boarded=false&installationId=<INSTALLATION_ID>&boardingRequestToken=<BOARDING_REQUEST_TOKEN>&data=<BASE64_ENCODED_DATA>
>    ```
>
> 3. Continue with the steps to authenticate and finish boarding the app. For instructions, see:
>
>    * [Authenticate the app instance](#authenticate-app-instance).
>    * [Finish boarding the app](#finish-boarding).
>
> ## Revoke app instance
>
> If your Android mobile device is defective, stolen, or you do not need it anymore for payments processing, you must stop the Payments app from processing transactions with Adyen. To do this, you make an API call to Adyen to revoke the specified `installationId`.
>
> To revoke a boarding token:
>
> 1. Optionally, make either a GET [/merchants/merchantId/paymentsApps](https://docs.adyen.com/api-explorer/payments-app/latest/get/merchants/\(merchantId\)/paymentsApps) or [/merchants/merchantId/stores/storeId/paymentsApps](https://docs.adyen.com/api-explorer/payments-app/latest/get/merchants/\(merchantId\)/stores/\(storeId\)/paymentsApps) request to retrieve the list of Payments app instances for a merchant account or a store. You can then use the `installationId` to revoke boarding tokens.
>
> 2. Make a POST [/merchants/merchantId/paymentsApps/installationId/revoke](https://docs.adyen.com/api-explorer/payments-app/latest/post/merchants/\(merchantId\)/paymentsApps/\(installationId\)/revoke) request specifying:
>
>    * As path parameters:
>
>    | Parameters | Required | Description |
>    | - | - | - |
>    | `installationId` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The unique identifier of the Payments app instance on the specific device. |
>    | `merchantId` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The unique identifier of the merchant account. |
>
>    **Revoke Payments app instance authentication**
>
>    ```curl theme={null}
>    curl https://management-test.adyen.com/v1/merchants/{merchantId}/paymentsApps/{installationId}/revoke \
>      -H 'x-API-key: ADYEN_API_KEY' \
>      -H 'content-type: application/json' \
>      -X POST \
>    ```
>
> 3. If successful, the response returns **200 OK**.
>
> 4. In the Payments app, go to **Settings** and select **Unregister** to revoke the app from the UI of your mobile device.
>
> ## Test your solution
>
> To make test transactions:
>
> 1. Make sure you are using the test version of the Payments app.
>
> 2. Initiate a test transaction using the following Adyen point-of-sale test cards to complete the payment:
>
>    * [White-green test card](https://adyen-preview.mintlify.site/point-of-sale/testing-pos-payments/test-card-v3.md)
>    * [Blue-green test card](https://adyen-preview.mintlify.site/point-of-sale/testing-pos-payments/test-card-v2.md) version **2.4** or later
>
>    The instructions are the same for both cards; see either of the pages mentioned above.
>
> ## Go live
>
> When you have finished testing your integration and are ready to go live:
>
> 1. If new to Adyen, get a [live account](https://adyen-preview.mintlify.site/get-started-with-adyen.md#apply-for-your-live-account). You need to have access to your organization's live Customer Area to generate an API credentials for the live environment.
>
> 2. In your [live Customer Area](https://ca-live.adyen.com/) generate a new API key with the **Adyen Payments app role** for use with the Adyen Payments app.
>
> 3. Download the [Adyen Payments](https://play.google.com/store/apps/details?id=com.adyen.ipp.mobile.companion.live) app from the Google Play store.
>
> 4. Contact us to enable Tap to Pay on Android, and optionally also enable unreferenced refunds.
>
> 5. Update your code to use the live URLs for App Links:
>
>    * `https://www.adyen.com/boarded`
>    * `https://www.adyen.com/board`
>    * `https://www.adyen.com/nexo`
>
> 6. Update your code to use the live Management API endpoints:
>    * `https://management-live.adyen.com`
>
> ## Verify app instance
>
> Adyen continuously checks if the app instance on your Android mobile device is authentic. This is to protect your integration against [man-in-the-middle](https://en.wikipedia.org/wiki/Man-in-the-middle_attack) attacks, eavesdropping, and tampering. You can also check this yourself manually using a different device and your email address.
>
> To verify the app instance, in the Payments app:
>
> 1. Go to **Settings** and tap **Verify app**.
> 2. Enter your email address and tap **Send email**.
> 3. Check your email on another device. You should have received an email with a 5-character code.
> 4. In the Payments app, if you received the email, tap **Continue**. If you did not receive the email, check the email address you entered, and tap **Resend email** and go back to step 2.
> 5. Under **Verify app**, check that the 5-character code on the screen matches the code you received in the email.
>
> If the app instance verification is successful, you can continue making payments with the Payments app. If the verification fails, Adyen automatically revokes the app instance. In this case, you need to [board the app again](#board-the-app) on that Android mobile device.
>
> ## Next steps
>
> > [card] [Manage your solution](https://adyen-preview.mintlify.site/point-of-sale/mobile-android/manage.md)
> >
> > **Required.** Make your solution available and keep the software up-to-date.
>
> > [card] [Checklists](https://adyen-preview.mintlify.site/point-of-sale/mobile-android/checklists.md)
> >
> > Get a list of what needs to be done to get started and go live with a Mobile solution.
>
> > [card] [Error handling](https://adyen-preview.mintlify.site/point-of-sale/mobile-android/troubleshooting.md)
> >
> > Resolve errors that appear on the mobile Android device.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.