> 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/renew-oda-certificates.md).

# ODA 証明書を更新する

## 概要

オフラインデータ認証（ODA）では、Visaの非接触型決済時にODA証明書が使用される場合があります。

決済が中断されないように、ODA証明書の有効期限が切れる前に更新してください。

{% hint style="info" %}
NFC Wallet SDKは、VisaのODA証明書の更新にのみ対応しています。
{% endhint %}

## SDKの統合

### 更新が必要かどうかを確認する

次の `DigitalCard` を使用して、デジタルカードがODAに対応しているかどうか、および証明書の有効期限が切れているかどうかを確認します：

* `DigitalCard.isODASupported: Bool`
* `DigitalCard.needsODARenewal: Bool`

```swift
guard let digitalCard = await digitalCardManager.digitalCard(forID: digitalCardID) else { return }
let isODASupported = await digitalCard.isODASupported
let needsODARenewal = await digitalCard.needsODARenewal

guard isODASupported else { return }
guard needsODARenewal else { return }

// 証明書を更新します。
```

この確認を実行します：

* NFC Wallet SDK の   初期化後。
* 決済後。
* カードをデフォルトに設定したとき。
* 接続が復旧したとき（オフライン → オンライン）。

### ODA証明書を更新する

次の `ODARenewalService` を使用して、VisaデジタルカードのODA証明書を更新します：

* `ODARenewalService.renewIfNeeded(digitalCardID: String, isForced: Bool)`

```swift
try await odaRenewalService.renewIfNeeded(digitalCardID: digitalCard.digitalCardID)
```

エンドユーザーの利便性を高めるため、次のような決まったタイミングで更新を実行してください：

* デフォルトカードの設定後。
* 決済の完了後。

{% hint style="info" %}
`renewIfNeeded()` は、 `digitalCard.isODASupported` と `digitalCard.needsODARenewal`.

の両方を確認します。個別に事前確認を行わなくても、直接呼び出すことができます。
{% endhint %}

{% hint style="warning" %}
`renewIfNeeded()` は、次の場合は何も行いません：

* 対象の `digitalCard` がVisaカードではない。
* `digitalCard.isODASupported` が `false`.
* `digitalCard.needsODARenewal` が `false`.

更新を強制するには、 `isForced` を `true` に設定します。次の場合でも更新されます： `digitalCard.needsODARenewal` が `false`:

```swift
try await odaRenewalService.renewIfNeeded(
    digitalCardID: digitalCard.digitalCardID,
    isForced: true
)
```

のデフォルト値は `isForced` です `false`.
{% endhint %}


---

# 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/renew-oda-certificates.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.
