> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/es/implement-nfc-wallet/make-payment/get-transaction-history.md).

# Obtener el historial de transacciones

## Resumen

El historial de transacciones permite a tu **aplicación de cartera digital** admitir:

* Notificaciones de transacciones
* Actualización del historial de transacciones

{% hint style="warning" %}
Durante la incorporación, confirme que el historial de transacciones está habilitado en la configuración de su programa.
{% endhint %}

## Integración del SDK

### Notificaciones de transacciones

Para admitir notificaciones de transacciones, procese **Notificaciones TNS (transacciones)** como se describe en [Gestionar notificaciones push](/nfc-wallet-sdk-android/es/get-started/configuration/5.-push-notifications/handle-push-notifications.md).

### Recuperar historial de transacciones

`MGTransactionHistoryService.refreshHistory(...)` recupera los registros de transacciones del backend de NFC Wallet.

Si admite tarjetas de doble marca, use la sobrecarga que acepta `transactionRecordType` para recuperar registros primarios o auxiliares.

El registro de transacción contiene la siguiente información:

* ID de transacción
* Fecha de la transacción
* Tipo de transacción
* Estado de la transacción
* Código de moneda
* Importe e importe de visualización
* Nombre del comerciante
* Tipo de comerciante
* Código postal del comerciante
* ID del terminal
* ID del comerciante
* Indicador de tarjeta principal o auxiliar (para tarjetas de doble marca)

Los límites del historial de transacciones dependen de la red de pago:

* Ventana de tiempo (por ejemplo, transacciones de los últimos 30 días).
* Número máximo (por ejemplo, las últimas 10 transacciones).

#### Implementación

Para recuperar el historial de transacciones de una tarjeta digital:

1. Obtenga el correspondiente **ID de tarjeta digital**.

   Consulte [Mostrar tarjetas digitales](/nfc-wallet-sdk-android/es/implement-nfc-wallet/manage-digital-cards/display-digital-cards.md#tokenized-card-id-versus-digital-card-id).
2. Obtenga un token de acceso.

   Consulte [Obtenga un token de acceso](/nfc-wallet-sdk-android/es/implement-nfc-wallet/manage-digital-cards/get-an-access-token.md).
3. (Opcional) Proporcione el `transactionRecordType` :

   `PRIMARIO` o `AUXILIAR` usar en tarjetas de doble marca y proporcionado en [Gestionar notificaciones push](/nfc-wallet-sdk-android/es/get-started/configuration/5.-push-notifications/handle-push-notifications.md).
4. Llamar a `MGTransactionHistoryService.refreshHistory(...)` e implemente `TransactionHistoryListener`:
   1. `onSuccess`

      Se activa cuando el SDK recupera correctamente las transacciones. La devolución de llamada proporciona un `List<MGTransactionRecord>`.

      Cada `MGTransactionRecord` representa un registro de transacción.
   2. `onError`

      Se activa cuando el SDK no puede recuperar el historial de transacciones. Use `MobileGatewayError` para obtener detalles del error.

El siguiente fragmento de código demuestra cómo recuperar los registros de transacciones:

{% code title="GetTransactionHistory.java" %}

```java
// Valores inicializados previamente.
String digitalCardId = "...";
String accessToken = "...";

// Obtenga el servicio de historial de transacciones.
MobileGatewayManager mgClient = MobileGatewayManager.INSTANCE;
MGTransactionHistoryService transactionHistoryService = mgClient.getTransactionHistoryService();

// Obtenga el historial de transacciones.
transactionHistoryService.refreshHistory(
        accessToken,
        digitalCardId,
        null,
        new TransactionHistoryListener() {

            @Override
            public void onSuccess(
                    List<MGTransactionRecord> records,
                    String digitalCardId,
                    String timeStamp) {
                // Éxito.
                // Cada MGTransactionRecord contiene detalles de una transacción.
                // Consulte la referencia de la API para obtener detalles a nivel de campo.
            }

            @Override
            public void onError(String digitalCardId, MobileGatewayError error) {
                // Maneja el error.
            }
        }
);
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/es/implement-nfc-wallet/make-payment/get-transaction-history.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
