Skip to main content

Authorization History

Introduction

The Authorization history service exposes operations for retrieving customer's prepaid card authorizations:

  • Get full customer authorization history
  • Get a single authorization by ID

Use the following code to obtain an instance of AuthorizationHistoryService:

val authorizationHistory = Wallet.getInstance().getAuthorizationHistoryService()

Get Authorization History

Use getAuthorizationHistory method to retrieve a list of all user authorizations. Configure the filtering and pagination by providing an AuthorizationHistoryParameters object.

The result is an AuthorizationList object containing a list of Authorization objects and a PagingResultMeta object, used for pagination implementation.

AuthorizationHistoryParameters

ParameterData typeDescriptionExample
accountIdStringOptional. Filter authorizations by account ID."192837465"
limitIntOptional. Limit the number of results.20
offsetIntOptional. Specify the starting point for fetching results, indicating the number of items to skip.0
startDateCalendar/DateOptional. Filter authorizations created after the specified date and time.Calendar.getInstance()/Date()
endDateCalendar/DateOptional. Filter authorizations created before the specified date and time.Calendar.getInstance()/Date()
statusAuthorizationStatusOptional. Filter authorizations by status.AuthorizationStatus.APPROVED/.approved
cardIdStringOptional. Filter authorizations by card IDf16ba382-eb42-481a-b08f-c57bdc9aae24
val parameters = AuthorizationHistoryParameters(
accountId = "1234567890",
limit = null,
offset = null, // adjust the offset to the desired starting position
startDate = null,
endDate = null,
status = null,
cardId = null
)

try {
val authorizationList = authorizationHistory.getAuthorizationHistory(parameters)
Log.d(TAG, authorizationList.authorizations.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

You can achieve pagination by combining the limit and offset filters. For instance, implementing pagination with a page size of 10 results per page would involve configuring:

  • Page 1: limit=10, offset=0
  • Page 2: limit=10, offset=10
  • Page 3: limit=10, offset=20
val parameters = AuthorizationHistoryParameters(
accountId = "1234567890",
limit = 10,
offset = 20,
startDate = null,
endDate = null,
status = null,
cardId = null
)

Get Single Authorization

Use getAuthorization method to retrieve a specific user authorization by ID. The result is an Authorization object, containing amounts,fees, creation time, challenge type and other various authorization details.

try {
val authorization = authorizationHistory.getAuthorization("1234567890")
Log.d(TAG, authorization.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}