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

# 取引履歴を取得する

## 概要

取引履歴を利用すると、デジタルウォレットアプリで次の機能をサポートできます。

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

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

## SDKの統合

### 取引通知

取引通知をサポートするには、次の通知を処理します。 **TNS通知（取引）** で説明されているとおり、 [プッシュ通知の処理](https://docs.payments.thalescloud.io/nfc-wallet-sdk-ios/ja/get-started/configuration/4.-push-notifications/handle-push-notifications.md#process-tns-notifications-transactions).

### 取引の取得

`TransactionHistoryService` は、NFC Walletバックエンドから取引履歴と取引通知の詳細の両方を取得します。

取引レコードには次の情報が含まれます。

* 取引ID
* 取引日
* 取引種別
* 取引ステータス
* 通貨コード
* 金額と表示用金額
* 加盟店名
* 加盟店種別
* 加盟店の郵便番号
* 端末ID
* 加盟店ID
* メインカードまたは補助カードの識別情報（複数ブランド対応カードの場合）

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

* 期間（例：過去30日間の取引）。
* 件数の上限（例：直近10件の取引）。

次のコードスニペットは、取引レコードの取得方法を示しています。

```swift
func transactionHistory() async {
    do {
        let historyService = TransactionHistoryService()
        let records = try await historyService.records(forDigitalCardID: "DIGITAL_CARD_ID")

        for record in records {
            // Display record fields in your UI.
            _ = record.id
            _ = record.date
            _ = record.status
            _ = record.type
            _ = record.currencyCode
            _ = record.amount
            _ = record.displayAmount
            _ = record.merchantName
            _ = record.merchantType
            _ = record.merchantPostalCode
            _ = record.terminalID
            _ = record.merchantID
            _ = record.isAuxiliaryTransaction
        }
    } catch {
        if let error = error as? TransactionHistoryService.Error {
            // エラーを処理します。
        }
    }
}
```

複数ブランド対応カードの場合、 `isAuxiliaryTransaction` は、そのレコードが補助カードに属するかどうかを示します。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
