> 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通知（取引）** に記載されているように [プッシュ通知の処理](/nfc-wallet-sdk-ios/ja/get-started/configuration/4.-push-notifications/handle-push-notifications.md#process-tns-notifications-transactions).

### 取引を取得

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

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

* 取引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 {
            // 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 dynamically by asking a question.

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

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

The question should be specific, self-contained, and written in natural language.
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.
