> 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 historial de transacciones

## Resumen

El historial de transacciones permite a su **aplicación de billetera digital** soportar:

* 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 [Manejar notificaciones push](/nfc-wallet-sdk-android/es/get-started/configuration/5.-push-notifications/handle-push-notifications.md).

### Recuperar historial de transacciones

`MGTransactionHistoryService.refreshHistory(...)` recupera registros de transacciones desde el backend de la Billetera NFC.

Si admite tarjetas con 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
* Monto y monto para mostrar
* Nombre del comerciante
* Tipo de comerciante
* Código postal del comerciante
* ID del terminal
* ID del comerciante
* Indicador de tarjeta primaria o auxiliar (para tarjetas con doble marca)

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

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

#### Implementación

Para recuperar el historial de transacciones de una tarjeta digital:

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

   Ver [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.

   Ver [Obtener 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` :

   `PRIMARIA` o `AUXILIAR` uso en tarjetas con doble marca y proporcionado en [Manejar notificaciones push](/nfc-wallet-sdk-android/es/get-started/configuration/5.-push-notifications/handle-push-notifications.md).
4. Llamar `MGTransactionHistoryService.refreshHistory(...)` e implementa `TransactionHistoryListener`:
   1. `onSuccess`

      Se activa cuando el SDK recupera con éxito las transacciones. La devolución de llamada proporciona una `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 muestra cómo recuperar los registros de transacciones:

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

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

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

// Obtener 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 detalles a nivel de campo.
            }

            @Override
            public void onError(String digitalCardId, MobileGatewayError error) {
                // Maneje 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.
