> 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/ja/implement-nfc-wallet/make-payment/get-transaction-history.md).

# トランザクション履歴を取得する

## 概要

取引履歴では、あなたの **デジタルウォレットアプリケーション** サポート：

* 取引通知
* 取引履歴の更新

{% hint style="warning" %}
オンボーディング中に、プログラム構成で取引履歴が有効になっていることを確認してください。
{% endhint %}

## SDK の統合

### 取引通知

取引通知をサポートするには、処理してください **TNS通知（取引）** に記載されているように [プッシュ通知の処理](/nfc-wallet-sdk-android/ja/get-started/configuration/5.-push-notifications/handle-push-notifications.md).

### 取引履歴を取得する

`MGTransactionHistoryService.refreshHistory(...)` はNFCウォレットのバックエンドから取引記録を取得します。

共通ブランド（コ・バッジ）カードをサポートする場合は、を受け取るオーバーロードを使用してください `transactionRecordType` プライマリまたは補助の記録を取得するため。

取引記録には次の情報が含まれます：

* 取引ID
* 取引日
* 取引タイプ
* 取引状況
* 通貨コード
* 金額および表示金額
* 加盟店名
* 加盟店種別
* 加盟店郵便番号
* 端末ID
* 加盟店ID
* プライマリまたは補助カードインジケータ（コ・バッジカードの場合）

取引履歴の制限は決済ネットワークによって異なります：

* 時間ウィンドウ（例：過去30日間の取引）。
* 最大件数（例：直近10件の取引）。

#### 実装

デジタルカードの取引履歴を取得するには：

1. 対応するを取得します **デジタルカードID**.

   参照してください [デジタルカードの表示](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/manage-digital-cards/display-digital-cards.md#tokenized-card-id-versus-digital-card-id).
2. アクセストークンを取得してください。

   参照してください [アクセストークンを取得する](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/manage-digital-cards/get-an-access-token.md).
3. （オプション）を提供します `transactionRecordType` :

   `PRIMARY` または `AUXILIARY` コ・バッジカードで使用され、で提供されます [プッシュ通知の処理](/nfc-wallet-sdk-android/ja/get-started/configuration/5.-push-notifications/handle-push-notifications.md).
4. 呼び出す `MGTransactionHistoryService.refreshHistory(...)` を呼び出し、次を実装します `TransactionHistoryListener`:
   1. `onSuccess`

      SDKが取引を正常に取得したときにトリガーされます。コールバックはを提供します `List<MGTransactionRecord>`.

      それぞれの `MGTransactionRecord` は取引記録を表します。
   2. `onError`

      SDKが取引履歴を取得できないときにトリガーされます。エラーの詳細についてはを使用してください。 `MobileGatewayError` エラーの詳細については。

次のコードスニペットは取引記録を取得する方法を示します：

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

```java
// 以前に初期化された値。
String digitalCardId = "...";
String accessToken = "...";

// 取引履歴サービスを取得します。
MobileGatewayManager mgClient = MobileGatewayManager.INSTANCE;
MGTransactionHistoryService transactionHistoryService = mgClient.getTransactionHistoryService();

// 取引履歴を取得します。
transactionHistoryService.refreshHistory(
        accessToken,
        digitalCardId,
        null,
        new TransactionHistoryListener() {

            @Override
            public void onSuccess(
                    List<MGTransactionRecord> records,
                    String digitalCardId,
                    String timeStamp) {
                // 成功。
                // 各MGTransactionRecordは1件の取引の詳細を保持します。
                // フィールドレベルの詳細はAPIリファレンスを参照してください。
            }

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