Adyen-for-platform icon

SCA for transaction history

Learn how to use our Authentication SDK to authenticate your users when they request their transaction history.

Each time a user in the European Economic Area (EEA) wants to check their transaction history, you must authenticate them using SCA. To do so:

  1. Check SCA eligibility
  2. Initiate a request for your user's transaction history using the sdkOutput that you got when you checked the device for SCA eligibility.
  3. Authenticate your user with the Authentication SDK.
  4. Get the transaction history using the sdkOutput from the authentication step.

Requirements

Check SCA eligibility

Before requesting the transaction history, you must check for SCA eligibility and initiate the process to authenticate your users.

The following tabs explain how to check for SCA eligibility and initiate authentication using Kotlin, Swift, or JavaScript.

To initiate authentication on an Android device:

To check if the Android device is eligible for SCA:

  1. Initiate the AdyenAuthentication class in your Activity or Fragment.

    Initiate authentication
    Expand view
    Copy link to code block
    Copy code
    Copy code
    private lateinit var adyenAuthentication: AdyenAuthentication
    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    adyenAuthentication = AdyenAuthentication(this)
    }
  2. Check if SCA is available on the device.

    Check SCA eligibility
    Expand view
    Copy link to code block
    Copy code
    Copy code
    lifecycleScope.launch {
    val availabilityResult: AvailabilityResult = adyenAuthentication.checkAvailability()
    if (availabilityResult is AvailabilityResult.Available) {
    availabilityResult.sdkOutput
    }
    }

    The function returns an sdkOutput.

  3. Pass the sdkOutput to your server.

You will use the sdkOutput when initiating a request for transaction history.

Initiate a request for the transaction history

To request the transaction history for the specified balance account:

  1. Make a GET /transactions request, specifying the following parameter in the header:

    Request header Description
    WWW-Authenticate SCA realm: Transaction.
    auth-param1: Base64-encoded value of sdkOutput you get when you initiate authentication..

    Provide the following query parameters:

    Parameter Description
    balanceAccountId Unique identifier of the balance account to get the transaction history for.
    createdSince Only include transactions that have been created on or after this point in time. The value must be in ISO 8601 format. For example, 2022-05-30T15:07:40Z.
    createdUntil Only include transactions that have been created on or before this point in time. The value must be in ISO 8601 format. For example, 2022-05-31T15:07:40Z.
    Request transaction history
    Expand view
    Copy link to code block
    Copy code
    Copy code
    curl https://balanceplatform-api-test.adyen.com/btl/v4/transactions?balanceAccountId=BA00000000000000000000002&createdSince=2022-05-30T15:07:40Z&createdUntil=2022-05-31T15:07:40Z \
    -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \
    -H 'content-type: application/json' \
    -H 'WWW-Authenticate: SCA realm="Transaction" auth-param1="eyJjaGFsbGVuZ2UiOiJiVlV6ZW5wek0waFNl..."' \
    -X GET \
    -d '{
    }'

    The response contains the following field in the header:

    • auth-param1: Base64-encoded blob of data.

    You will need auth-param1 when authenticating your user using the SDK.

    Response
    Expand view
    Copy link to code block
    Copy code
    Copy code
    {
    "type": "https://docs.adyen.com/errors/unauthorized",
    "title": "Unauthorized",
    "status": 401,
    "errorCode": "00_401"
    }
  2. Pass auth-param1 to the SDK as sdkInput.

Authenticate your user

To authenticate your user with the Authentication SDK:

  1. Trigger the SDK and pass the auth-param1 value from the previous step as sdkInput.

    Authenticate with SCA SDK
    Expand view
    Copy link to code block
    Copy code
    Copy code
    lifecycleScope.launch {
    if (adyenAuthentication.hasCredential("sdkInput")) {
    // Authenticate existing credential
    val authenticationResult: AuthenticationResult = adyenAuthentication.authenticate("sdkInput")
    when (authenticationResult) {
    is AuthenticationResult.AuthenticationSuccessful -> {
    authenticationResult.sdkOutput
    }
    is AuthenticationResult.Canceled -> {
    // User cancelled the authentication flow
    }
    is AuthenticationResult.Error -> {
    // Unexpected error
    authenticationResult.errorMessage
    }
    is AuthenticationResult.AuthenticationError -> {
    // FIDO API Error
    authenticationResult.authenticationError
    }
    }
    } else {
    // None of the existing credentials exist in this device
    }
    }

    If successful, the SDK generates a Base64-encoded sdkOutput data blob.

  2. Pass sdkOutput to your server.

Get the transaction history

To get the transaction history

  1. Make a GET /transactions request, specifying the following parameter in the request header.
Request header Description
WWW-Authenticate SCA realm: Transaction.
auth-param1: Base64-encoded value of sdkOutput you get when you initiate authentication.
Get user transaction history
Expand view
Copy link to code block
Copy code
Copy code
curl https://balanceplatform-api-test.adyen.com/btl/v4/transactions?balanceAccountId=BA00000000000000000000002&createdSince=2022-05-30T15:07:40Z&createdUntil=2022-05-31T15:07:40Z \
-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \
-H 'content-type: application/json' \
-H 'WWW-Authenticate: SCA realm="Transaction" auth-param1="CeCcEEJf2UPC7pB0K7AtEgLZX7cTvnqNznJF..."' \
-X GET \
-d '{
}'
  1. Use the content of the data array to present the transaction information to your user.
Response
Expand view
Copy link to code block
Copy code
Copy code
{
"data": [
{
"balancePlatform": "YOUR_BALANCE_PLATFORM",
"creationDate": "2023-08-10T14:51:20+02:00",
"id": "EVJN42272224222B5JB8BRC84N686ZEUR",
"accountHolder": {
"description": "Your description for the account holder",
"id": "AH00000000000000000000001"
},
"amount": {
"currency": "USD",
"value": -1000
},
"balanceAccount": {
"description": "Your description for the account holder",
"id": "BA00000000000000000000001"
},
"bookingDate": "2023-08-10T14:51:33+02:00",
"status": "booked",
"transfer": {
"id": "3JNC3O5ZVFLLGV4B",
"reference": "Your internal reference for the transfer"
},
"valueDate": "2023-08-10T14:51:20+02:00"
},
{
"balancePlatform": "YOUR_BALANCE_PLATFORM",
"creationDate": "2023-08-10T15:34:31+02:00",
"id": "EVJN4227C224222B5JB8G3Q89N2NB6EUR",
"accountHolder": {
"description": "Your description for the account holder",
"id": "AH00000000000000000000001"
},
"amount": {
"currency": "USD",
"value": 123
},
"balanceAccount": {
"description": "Your description for the account holder",
"id": "BA00000000000000000000001"
},
"bookingDate": "2023-08-10T15:34:40+02:00",
"status": "booked",
"transfer": {
"id": "48POO45ZVG11166J",
"reference": "Your internal reference for the transfer"
},
"valueDate": "2023-08-10T15:34:31+02:00"
}
],
"_links": {
"next": {
"href": "https://balanceplatform-api-test.adyen.com/btl/v4/transactions?balancePlatform=YOUR_BALANCE_PLATFORM&createdUntil=2023-08-20T13%3A07%3A40Z&createdSince=2023-08-10T10%3A50%3A40Z&cursor=S2B-c0p1N0tdN0l6RGhYK1YpM0lgOTUyMDlLXElyKE9LMCtyaFEuMj1NMHgidCsrJi1ZNnhqXCtqVi5JPGpRK1F2fCFqWzU33JTojSVNJc1J1VXhncS10QDd6JX9FQFl5Zn0uNyUvSXJNQTo"
}
}
}