> 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/transit-digitization/ja/apple-transit-no/akauntobsunochikettinguabt/apuripurobijoningunopurodakuto.md).

# アプリ内プロビジョニング後の運賃プロダクト購入

アプリ内ポストプロビジョニング運賃商品の購入ワークフローは、利用者が交通事業者のiOSアプリを直接操作して開始します。主な目的は、利用者がアプリ内で運賃商品を購入し、それがシームレスにApple Walletの交通カードに適用され即時使用できるようにすることです。

### ワークフロー <a href="#workflow" id="workflow"></a>

以下の高レベルの手順は、アプリ内ポストプロビジョニング運賃商品購入ワークフローの概要を示します：

1. **運賃商品の選択と支払い**：利用者は交通事業者のiOSアプリから購入したい運賃商品を選択します。既存残高へのストアドバリューの追加や運賃商品の購入／更新が含まれる場合があります。
2. **バンドル取得とWallet表示の更新**：updateBundle リクエストを受け取ると、Apple は D1 Transit からカード詳細を含むプロビジョニングバンドルの取得を要求します。\
   残高の更新や運賃商品の更新がある場合、D1 Transit は Apple Push Notification service（APNs）を使用して Apple Wallet に正しい値を反映させます。

#### 運賃商品の選択と支払い <a href="#fare-product-selection-and-payment" id="fare-product-selection-and-payment"></a>

ワークフローが開始される前に、利用者は交通事業者のiOSアプリ内で自身の交通カードに追加する有効な運賃商品を選択する必要があります。

運賃商品を選択すると、アプリは購入を完了するための支払いオプションを表示する必要があります。利用者は表示されたオプションから希望する支払い方法を選択できます。

**エラーシナリオ**

**購入または更新が許可されない**

ビジネスルール（例：カードの有効期限切れや対象外の運賃商品）により運賃商品の購入や更新が禁止されている場合、交通事業者のiOSアプリは利用者にそれを示さなければなりません。

#### バンドル取得とWallet表示の更新 <a href="#bundle-retrieval-and-wallet-display-update" id="bundle-retrieval-and-wallet-display-update"></a>

運賃商品を正常に購入または更新した後、Transit イシュアはカードアカウントのメタデータを更新する旨を D1 Transit にリクエストします。

D1 Transit は、intentionType パラメータを updatePass に設定して updateBundle API リクエストを行い、Apple に通知します。

Apple は updateBundle リクエストを受信すると、getProvisioningBundle リクエストを D1 Transit に対して行い、プロビジョニングバンドルを取得します。

バンドルが Apple に返されると、D1 Transit はそのバンドルが正常に更新されたことを Transit イシュアに通知します。

残高の更新については、Transit イシュアは handleEvent を使用して D1 Transit に通知します。Apple Push Notification service（APNs）が使用され、Apple Wallet に最新情報が反映されることを保証します。

**エラーシナリオ**

**Apple からプロビジョニングバンドル取得のリクエストがない**

D1 Transit は、updateBundle の応答を受け取ってから Apple からの getProvisioningBundle リクエストまでの間にタイムアウト期間を定義します。

このタイムアウト期間内に D1 Transit が getProvisioningBundle リクエストを受け取らない場合、D1 Transit は設定された再試行ポリシーを適用します。

すべての再試行が尽きても getProvisioningBundle リクエストがまだ受信されない場合、D1 Transit はその失敗を Transit イシュアに通知します。

**認証トークンが無効（未承認）**

カードがプロビジョニングされると、Apple は D1 Transit の transactionNotifications/register エンドポイントを呼び出してデバイスを取引用に登録します。これに対して D1 Transit は authenticationToken を返し、それがデバイスに保存されます。デバイスが有効期限切れの authenticationToken でリクエストを行った場合、D1 Transit は HTTP 401 ステータスを返し、デバイスは取引のために再登録する必要があります。

<figure><img src="/spaces/SokLBgfEhZisVFcUdPiW/files/ZRTsZ7ZhHSndMJayYwds" alt=""><figcaption></figcaption></figure>

<figure><img src="/spaces/SokLBgfEhZisVFcUdPiW/files/JttO5svCFHBDPLUGUzxH" alt=""><figcaption></figcaption></figure>


---

# 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/transit-digitization/ja/apple-transit-no/akauntobsunochikettinguabt/apuripurobijoningunopurodakuto.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.
