> 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/implement-google-transit/account-based-ticketing-abt/wallet-post-provisioning-fare-product-purchase.md).

# Wallet Post Provisioning Fare Product Purchase

The Wallet Post-Provisioning Fare Product Purchase workflow is initiated by the user through the Wallet app. The primary goal is for the user to purchase or renew a fare product and have it seamlessly applied to his transit card in Google Wallet for immediate use.

### Workflow <a href="#workflow" id="workflow"></a>

The following high level steps outline the Wallet Post-Provisioning Fare Product Purchase workflow:

**Fare Product Selection**: The user selects the fare product they wish to purchase. Options may include adding stored value to an existing balance or purchasing/renewing a commute plan.

**Payment**: Once the user authorizes the purchase of the selected fare product, the Payment Manager processes the payment.

**Metadata Retrieval and Wallet Display Update**: Upon receiving a metadataUpdated request, Google requests the updated card metadata from D1 Transit.

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

**Error Scenarios**

**Purchase not permitted**

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

<figure><img src="https://1928701359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZoFRCpZeaDWwcHYhJY7B%2Fuploads%2Flsmw3VGdVBLUzhUJYPFt%2FSequence%20Diagram%20%E2%80%93%20%20Fare%20Product%20Selection.svg?alt=media&amp;token=d068ac57-f236-4f6c-831d-88138cd98bff" alt=""><figcaption></figcaption></figure>

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

Upon the user authorizing the payment, a purchaseProducts 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 Google.

<figure><img src="https://1928701359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZoFRCpZeaDWwcHYhJY7B%2Fuploads%2FDJeTNfH8wpNJlksi0B6L%2FSequence%20Diagram%20%E2%80%93%20%20Payment.svg?alt=media&amp;token=18c720f2-3a15-4044-94fd-00d0d19e825b" alt=""><figcaption></figcaption></figure>

#### Metadata Retrieval and Wallet Display Update <a href="#metadata-retrieval-and-wallet-display-update" id="metadata-retrieval-and-wallet-display-update"></a>

After successfully purchasing or renewing a fare product, Transit Issuer sends handleEvent to D1 Transit which then notifies Google with allProductMetadataUpdated API request.

Upon receiving the allProductMetadataUpdated request, Google retrieves the product metadata by making a getAllProductMetadata request to D1 Transit.

<figure><img src="https://1928701359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZoFRCpZeaDWwcHYhJY7B%2Fuploads%2FbgqJDMcqOK7sg6x2KWJk%2FSequence%20Diagram%20%E2%80%93%20%20Metadata%20Retrieval%20and%20Wallet%20Display%20Update.svg?alt=media&amp;token=0b468763-b84c-4b4d-94ca-d3830c9ce5df" 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 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/transit-digitization/implement-google-transit/account-based-ticketing-abt/wallet-post-provisioning-fare-product-purchase.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.
