> 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-apple-transit/card-based-ticketing-cbt/lifecycle-management/park-from-device.md).

# Park from Device

The device-initiated parking workflow is triggered when the user removes the card from Apple Wallet. Since this action is performed directly on the device, it's guaranteed that the device is online.

This section provides an overview of the workflow, including detailed steps, sequence diagrams, and potential error scenarios.

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

Below are the high level steps of the device initiated parking workflow:

1. **Card Removal**: The user selects the transit card and taps 'Remove Card' to initiate the removal process.
2. **Unlink Card**: Apple notifies D1 Transit platform that the user wants to remove the transit card from his device. Since it's CBT, a park session is started.
3. **Park Card**: Apple device connects to D1 Transit platform in order to read the content of the applet instance, so Transit Issuer can save the card state on backend side.

### Sequence diagram <a href="#sequence-diagram" id="sequence-diagram"></a>

#### Unlink card <a href="#unlink-card" id="unlink-card"></a>

When the user selects the transit card for removal, Apple initiates a managePass API call to D1 Transit platform with the action **unlink** to indicate the intention to delete the card.

#### Park card <a href="#park-card" id="park-card"></a>

In CBT ecosystems, the applet instance is not deleted rigth away. Device connects to D1 Transit platform in order to execute commands that can be used for reading and updating applet content.

D1 Transit sends **getDigitalCardBundleCommands** to Transit Issuer to fetch the commands that shall be returned and executed on device side.

Several round trips may occur to complete the park session.

Once the park session is completed, the applet instance is deleted from the device.

<figure><img src="/files/Qe25IsEzUYZ1w6Ic18QP" 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/implement-apple-transit/card-based-ticketing-cbt/lifecycle-management/park-from-device.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.
