> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/sample-flows.md

## Article Content:

# Google Subscriptions: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Check whether an account can purchase Business Email for a domain

Before sending a customer to checkout for Business Email, you can confirm that their account can purchase it for the domain, and find out how many seats they can buy. This avoids a checkout that fails later, for example because the domain already has a Business Email package.

To check whether an account can purchase Business Email for a domain:

1. Call [Is Eligible](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/is-eligible.md) with the domain in `domainName` and the Business Email product type ID in `productTypeId`.
1. If the response's `result.eligible` object is returned, the account can purchase Business Email for the domain. Use `result.eligible.seats` as the maximum number of seats to offer at checkout.
1. If `result.notEligible` is returned instead, read `result.notEligible.reasons` and show the customer why they can't purchase Business Email for the domain. For example, `domainNotOwnedByUser` means the domain belongs to a different account.

## Show a Google Workspace's users and storage usage

If your app shows an account's Business Email in its own interface, you can list the mailboxes on a domain and how much of the Google Workspace's storage they use.

To show a Google Workspace's users and storage usage:

1. Call [Query Premium Assets](https://dev.wix.com/docs/api-reference/account-level/premium/premium-platform/core-services/premium-asset-v2/query-premium-assets.md) to find the account's Business Email asset for the domain. Save the asset's ID.
1. Call [Retrieve Users by Domain](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/retrieve-users-by-domain.md) with the domain in `domainName`. Show each user's `primaryEmail` and `name`, and use `admin` to mark the administrators.
1. Call [Get Storage Usage](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/get-storage-usage.md), and specify the asset ID you saved in step 1 as `googleWorkspacePremiumId`.
1. If `usedMb` and `quotaMb` are returned, show the storage used out of the pooled quota, and use `asOfDate` to show when the numbers are from. If they aren't returned, show that storage usage isn't available yet.

## Set up the first administrator after a Business Email purchase

After a customer purchases Business Email, the Google Workspace needs an administrator before its mailboxes can be used. If your app handles the purchase, it can also collect the administrator's details and complete the setup.

To set up the first administrator after a Business Email purchase:

1. Call [Query Premium Assets](https://dev.wix.com/docs/api-reference/account-level/premium/premium-platform/core-services/premium-asset-v2/query-premium-assets.md) to find the account's new Business Email asset for the domain. Save the asset's ID.
1. Collect the administrator's user name, first name, last name, and password, and the customer's contact details: alternate email address, contact name, organization name, and country.
1. Call [Setup Administrator](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-user-v1/setup-administrator.md), and specify the asset ID you saved in step 1 as `googleWorkspacePremiumId`, along with the details you collected. Save the returned `primaryEmail`.
1. Call [List Users](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-user-v1/list-users.md) with the same `googleWorkspacePremiumId`, and confirm the administrator's `primaryEmail` appears in `users`.