# Transactions History

For get transactions history list, the **getTransactionList** method of the library should be called. This function is used to get all transaction through the library.&#x20;

This function supports pagenation. The page value must be 0 for the first request and it must be incremented for each page until reacing the total pages.

* startDate and endDate must be in 'dd-MM-YYYY' format
* direction can be "DESC" or "ASC". The default value is "DESC".

```kotlin
PayContactlessEmbed.getInstance().getTransactionList(
    page: Int,
    size: Int?,
    direction: String?,
    transactionCode: String?,
    startDate: String?,
    endDate: String?,
    startAmount: Int?,
    endAmount: Int?,
    listener: TransactionListListener
)
```

### Method Parameters

| Field Name      | Data Type               | Required | Description                                                                            |
| --------------- | ----------------------- | -------- | -------------------------------------------------------------------------------------- |
| page            | Int                     | true     | Page number to retrieve (starting from 0 or 1 based on backend configuration).         |
| size            | Int                     | false    | Number of transactions per page. If null, the backend default page size is used.       |
| direction       | String                  | false    | Transaction direction filter (e.g., `SALE`, `REFUND`).                                 |
| transactionCode | String                  | false    | Filters transactions by a specific transaction reference code.                         |
| startDate       | String                  | false    | Start date for filtering transactions (format: `yyyy-MM-dd` or as defined by backend). |
| endDate         | String                  | false    | End date for filtering transactions (format: `yyyy-MM-dd` or as defined by backend).   |
| startAmount     | Int                     | false    | Minimum transaction amount filter (inclusive).                                         |
| endAmount       | Int                     | false    | Maximum transaction amount filter (inclusive).                                         |
| listener        | TransactionListListener | true     | Callback interface used to receive the transaction list or error response.             |

## **Transaction List Listener**

```java
public interface TransactionListListener {
    void onSuccess(TransactionList transactionList);
    void onFailure(Error error);
}
```

## **Transaction List Data**

```kotlin
data class TransactionList (
    var transactions: List<TransactionInfo>? = null
    var empty: Boolean? = null
    var first: Boolean? = null
    var last: Boolean? = null
    var number: Integer? = null
    var numberOfElements: Integer? = null
    var size: Integer? = null
    var totalElements: Integer? = null
    var totalPages: Integer? = null
)
```

<table><thead><tr><th width="359.3333333333333">Field Names</th><th>Descriptions</th><th>Sample Values</th></tr></thead><tbody><tr><td>transactions</td><td>list of transactions</td><td>Check <strong>Transaction Info Data</strong> section belo.</td></tr><tr><td>empty</td><td>is transaction list empty</td><td>false</td></tr><tr><td>first</td><td>is the first page of the transaction list</td><td>true</td></tr><tr><td>last</td><td>is the first page of the transaction list</td><td>false</td></tr><tr><td>number</td><td>current page number of the transcation list</td><td>0</td></tr><tr><td>numberOfElements</td><td>number of the element on the current page</td><td>10</td></tr><tr><td>totalElements</td><td>total number of the elements in the history</td><td>476</td></tr><tr><td>totalPages</td><td>total pages of the history</td><td>48</td></tr></tbody></table>

## **Transaction Info Data**

```kotlin
data class TransactionList (
    var id: Long? = null
    var transactionCode: String? = null
    var cardNumber: String? = null
    var amount: Double? = null
    var currency: String? = null
    var dateTime: String? = null
    var status: String? = null
    var modeOfTransaction: String? = null
)
```

<table><thead><tr><th width="305.3333333333333">Field Names</th><th>Descriptions</th><th>Sample Values</th></tr></thead><tbody><tr><td>id</td><td>a unique id of the transcation </td><td>'29481'</td></tr><tr><td>transactionCode</td><td>a unique code of the transaction. It is used for finding the transaction.</td><td>'3FFBA7849A383BEB'</td></tr><tr><td>cardNumber</td><td>masked pan of the card using in the transaction</td><td>'471688******6375'</td></tr><tr><td>amount</td><td>using amount value in the transaction</td><td>'8.00'</td></tr><tr><td>currency</td><td>using currency value in the transaction</td><td>'₦'</td></tr><tr><td>dateTime</td><td>transaction date time</td><td>'14-09-2023 11:18:28'</td></tr><tr><td>status</td><td>status info of the transaction</td><td>'SUCCESS' or 'FAILED'</td></tr><tr><td>modeOfTransaction</td><td>paymet method using in the transaction</td><td>'CARD', 'PAY_WITH_LINK',<br>'PAY_WITH_ACCOUNT'</td></tr></tbody></table>
