> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/how-the-apps-work/screens/billing/subscription.md).

# Your subscription

{% hint style="info" %}
Draft, written by an agent and not yet checked by a person ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). Platforms: web. [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/screens/billing/subscription.md).
{% endhint %}

Site admins open Stripe's billing portal from the Site Console, to see the site's invoices, change the payment method or cancel the subscription.

* **Where:** web `/account/:id/subscription`, the last Site Console tab, "Your subscription" (web\_app\_v2 @ 0989b8e685, `src/app/pages/account-settings/account-settings.component.ts:191-198`, `src/app/pages/account-settings/account-settings.routes.ts:25`). The Site Console and its other tabs are described in [Site details](https://docs.snapfix.com/how-the-apps-work/screens/console/site-details.md).
* **Who:** the tab shows only to role "Admin", and only on a site whose `hasSubscribed` is true (`account-settings.component.ts:128`). The route lets in site admins and group admins (`authAdminGuard`), checked on the site stored as current, not the site in the URL. A group admin who types the address reaches the page, and on a site with a subscription the billing session call refuses them (see [States](#states)). A blocked site admin still gets a session.
* **Feature:** [Subscriptions](https://docs.snapfix.com/product/features/billing/subscriptions.md)

No live pass saw this page. The QA site has no subscription, so its Site Console shows no "Your subscription" tab, and typing the address ends on Site Details \[[ASK-135](https://github.com/snapfix/docs/blob/main/ASK.md#ask-135-which-qa-site-can-show-the-your-subscription-tab)] ([live notes](https://github.com/snapfix/docs/blob/main/notes/crawl/billing.md)). The rest of this page is from the code.

`hasSubscribed` comes from the site read ([`GET /v1/app/parents/{uuid}`](https://docs.snapfix.com/engineering-reference/api/console.md#get-v1appparentsuuid)): it is true when the site's newest `stripe_subscription` row says the payment succeeded or the subscription was updated, and Stripe returns that subscription. Only the sandbox Stripe webhook writes those rows; no route in these repos records a live subscription, so on production sites the tab shows only if something outside the repos does \[[ASK-142](https://github.com/snapfix/docs/blob/main/ASK.md#ask-142-who-records-live-stripe-subscriptions)].

## Layout

One card below the Site Console tabs, top to bottom:

1. The heading "Your Snapfix subscription" and the text "Manage your subscription details and download your invoices." (`public/i18n/en.json:1028`, `:1030`).
2. The button "Manage Subscriptions / View Invoices" (`:1031`), shown once the session call returns a link.

While the session call runs, a loading indicator (`app-snapfix-loading`) replaces the heading, the text and the button. The page shows no plan name, price, renewal date or invoice list: those are in Stripe's portal, which offers the invoice history, a change of payment method and cancelling the subscription ([Billing API](https://docs.snapfix.com/engineering-reference/api/billing.md#get-v1appparentsuuidcreate-session)).

## Inputs

None.

## Actions

| Action                                 | Who                                   | What happens                                                                                                                                                                                                                                                                                                                                                                                                                                  | API                                                                                                                                                                                                                                                                      |
| -------------------------------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Open the tab                           | Role "Admin"; group admins by address | The Site Console reads the site first, and that read decides whether the tab shows. If the site's `hasSubscribed` is false, the page goes to Site Details with a full page load and asks for no session (seen live on the QA site). Otherwise it asks for a billing portal session for the site (web\_app\_v2 @ 0989b8e685, `src/app/pages/account-settings/account-settings-subscription/account-settings-subscription.component.ts:47-71`). | [`GET /v1/app/parents/{uuid}`](https://docs.snapfix.com/engineering-reference/api/console.md#get-v1appparentsuuid), then [`GET /v1/app/parents/{uuid}/create-session`](https://docs.snapfix.com/engineering-reference/api/billing.md#get-v1appparentsuuidcreate-session) |
| "Manage Subscriptions / View Invoices" | Role "Admin"                          | Opens the portal in a new tab and logs the analytics event `account_view_invoice`.                                                                                                                                                                                                                                                                                                                                                            | None; the link came from the session call                                                                                                                                                                                                                                |

* The web keeps the session answer for each site until the page reloads, so opening the tab again shows the same link without a new call (`src/app/services/account/account-http/account-http.service.ts:119-129`).
* Each session call creates a new billing portal configuration at Stripe.
* The site read that the page starts from gives any signed-in user the site's Stripe customer ID and subscription \[[ASK-124](https://github.com/snapfix/docs/blob/main/ASK.md#ask-124-should-members-who-are-not-admins-see-the-sites-billing-details)]. For a site with a subscription, each such read also calls Stripe.

## States

* **Loading:** the loading indicator in the card until the session call ends.
* **Empty:** a site without a subscription never shows the card: the page goes to Site Details. A session answer that succeeds without a link shows the heading and the text with no button.
* **Error:** when the session call fails or answers with anything but success, the app's HTTP service shows the API's message in an alert, and the page goes to Site Details with a full page load (`account-settings-subscription.component.ts:50`, `:54`, `:58-60`; `src/app/services/http/http.service.ts:53-58`, `:243-248`). The reload removes the alert before it can be read. The API's messages are "Access denied" (not a site admin), "Account does not have a customer id" (no Stripe customer), "Failed to create session" and "Something went wrong" ([Billing API](https://docs.snapfix.com/engineering-reference/api/billing.md#get-v1appparentsuuidcreate-session)).
* **No permission:** the tab is hidden from everyone but role "Admin". A group admin who types the address goes to Site Details: at once on a site without a subscription, and through the "Access denied" error path on a site with one. Users who are neither role "Admin" nor a group admin never reach the page: the guard sends them to `/fix` (`src/app/services/auth/auth-guard/auth-admin/auth-admin.guard.ts:13-16`).
* **Offline (mobile):** not applicable; web only.

## Dialogs and sheets

* **Alert:** the API's message when the session call fails, followed at once by the move to Site Details (see [States](#states)).

The web's other subscription prompt is the free-limit dialog that a refused task status change opens on a free or churned site; it is described in [Task detail](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#subscription-limit). Its button "See subscriptions options" opens <https://snapfix.com/pricing> in a new tab, and only one such dialog opens at a time (`src/app/components/alert-dialog/alert-subscription-dialog/alert-subscription-dialog.component.html:15`, `src/app/services/alert/alert.service.ts:54-66`).

## Platform differences

The apps have no subscription tab. iOS sells plans in the app ([Choose plan](https://docs.snapfix.com/how-the-apps-work/screens/billing/choose-plan.md)); Android's Settings offers "Upgrade your Snapfix", which opens a contact sheet ([Settings](https://docs.snapfix.com/how-the-apps-work/screens/account/app-settings.md)).


---

# 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.snapfix.com/how-the-apps-work/screens/billing/subscription.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.
