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

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

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

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

以下の高レベルな手順は、ウォレットのプロビジョニング後運賃商品購入ワークフローの概要を示します：

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

**支払い**：ユーザーが選択した運賃商品の購入を承認すると、ペイメントマネージャーが支払いを処理します。

**更新されたバンドルの取得とウォレット表示の更新**：updateBundle リクエストを受信すると、Apple は D1 Transit からカード詳細を含むプロビジョニングバンドルを要求します。この手順は、運賃商品を購入または更新する場合にのみ必要です。\
D1 Transit は Apple Push Notification service (APNS) を使用して、Apple Wallet に新しい運賃商品情報を更新します。

残高の更新については、トランジットイシュアが D1 Transit に handleEvent を送信して APNS を通じた通知をトリガーし、Apple Wallet に新しい残高値を反映させます。

#### 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>

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

運賃商品を正常に購入または更新した後、トランジットイシュアは D1 Transit に handleEvent を送信し、D1 Transit は意図タイプ（intentionType）を updatePass に設定して updateBundle API リクエストを行い、Apple に通知します。

ただし、ユーザーがストアドバリュー残高を追加入金（トップアップ）した場合、更新されたバンドルを提供する必要はありません。

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

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

残高の更新については、トランジットイシュアが handleEvent を使用して D1 Transit に通知します。Apple Push Notification service (APNs) は、Apple Wallet が最新情報を反映することを確実にするために使用されます。

**エラーシナリオ**

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

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

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

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

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

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

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

**認証トークンの認可エラー**

カードがプロビジョニングされると、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/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.
