> 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/kdobsunochikettingucbt/worettonopurobijoningunopurodakuto.md).

# ウォレットのプロビジョニング後の運賃プロダクト購入

Walletのポストプロビジョニング運賃商品購入ワークフローは、ユーザーがWalletアプリを通じて開始します。主な目的は、ユーザーが運賃商品を購入または更新し、それをApple Wallet内の交通カードにシームレスに適用して即座に利用できるようにすることです。

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

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

**運賃商品の選択**：ユーザーは購入したい運賃商品を選択します。オプションには、既存残高へのストアドバリューの追加や通勤プランの購入／更新などが含まれる場合があります。

**支払い**：ユーザーが選択した運賃商品の購入を承認すると、Payment Managerが支払いを処理します。

**アプレット更新とWallet表示の更新**：CBTの文脈では、アプレットコンテンツを更新する必要があります。"applet update"の意図を持つupdateBundleリクエストを受け取ると、Appleデバイスはアプレットコンテンツデータを更新するために実行されるコマンドを取得するよう要求します。

新しい商品の購入の場合、Walletの表示を更新する必要があります。"pass update"の意図を持つupdateBundleリクエストを受け取ると、AppleはD1 Transitからカードの詳細を含むプロビジョニングバンドルを要求します。

#### Fare Product Selection <a href="#fare-product-selection" id="fare-product-selection"></a>

**Error Scenarios**

**Renewal not permitted**

Apple Wallet includes a "renew" button for fare products, which becomes available based on the Transit Issuer's business rules. For instance, a monthly pass might be eligible for renewal only within a window that starts 3 days before its expiration and ends 3 days after expiration.

When the user selects the "renew" button, if the cohabitation rule engine determines that renewal options are not allowed due to business rules, D1 Transit must notify Apple by returning a response with an empty cardActions array. This indicates that no renewal actions are available for the selected card.

**Purchase not permitted**

If the cohabitation rule engine determines that no products are available to purchase due to business rules, D1 Transit must notify Apple by returning a response with an empty cardActions array. This indicates that no purchase actions are available for the selected card.

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

#### Payment <a href="#payment" id="payment"></a>

Upon the user authorizing the payment, a performPayment API call is triggered and sent to D1 Transit platform, which sends a purchaseProducts request to Transit Issuer. Transit Issuer is responsible for ensuring the payment request is processed by the PSP.

After processing, the outcome of the transaction is communicated back to the Apple. If the payment is successfully processed, D1 Transit returns a Purchase object with its state set to complete.

**Error scenarios**

When a payment failure or timeout occurs, Apple Wallet displays a red exclamation mark to the user. The user can retry the payment using the same or a different payment sheet, with either the same or a different payment credential.

**retry with same payment sheet**

In this case, the same orderId will be used. Transit issuer needs to check the status of the payment linked to that orderId. It's possible that the existing payment was successfully processed by the PSP, but due to a delay, the previous attempt timed out.

**retry with a different payment sheet**

Here, a new orderId is generated for this new payment request.

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

#### アプレット更新とWallet表示の更新 <a href="#applet-update-and-wallet-display-update" id="applet-update-and-wallet-display-update"></a>

運賃商品を正常に購入または更新した後、D1 TransitはintentionTypeパラメータをupdateAppletに設定してupdateBundle APIリクエストを行うことでAppleに通知します。

updateBundleリクエストを受け取ると、Appleはデバイスに対して"redirect"コマンドを開始します。デバイスはアプレットデータコンテンツを更新するために実行されるコマンドを取得するためにD1 Transitに接続します。このやり取りは複数回の往復になることがあります。

アプレットデータが更新されると、D1 Transitはバンドルデータが正常に更新されたことをTransit イシュアに通知します。

購入された新しい商品については、バンドルデータ更新の成功通知を受け取った後、Transit イシュアはWallet表示を更新するためにD1 TransitプラットフォームにhandleEventを送信します。

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

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

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

**エラーシナリオ**

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

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

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

すべての再試行が尽きてもgetProvisioningBundleリクエストがまだ受け取られない場合、Thalesはさらなる調査と解決のためにAppleに連絡して問題をエスカレーションします。

この統合はABTを使用しているため、カードに紐づく運賃商品はサーバー上に保存されます。したがって、バンドルの更新が失敗した場合に顧客に返金する必要はないはずです。

**タイムアウト後に受信したプロビジョニングバンドルリクエスト**

getProvisioningBundleリクエストがタイムアウト後に受信された場合、D1 TransitはまずtriggeringRequestIdentifierが以前にタイムアウトしたupdateBundleのrequestIdentifierに関連しているかを確認します。リクエストがタイムアウトしたupdateBundleに関連している場合、D1 TransitはAppleに対してHTTP 200ステータスを返し、statusCodeをHTTP 500に設定します。この応答はカードに対してこれ以上の更新は必要ないことをAppleに通知します

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

<figure><img src="/spaces/SokLBgfEhZisVFcUdPiW/files/DkUhIEBzJDaLYNhqz0Uk" 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/kdobsunochikettingucbt/worettonopurobijoningunopurodakuto.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.
