> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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/app-management/app-billing/custom-charges-service-plugin/sample-flows.md

## Article Content:

# Custom Charges Service Plugin: Sample Use Cases & Flows

This article shares some possible use cases your app could support, as well as
a sample flow that could support each use case. This can be a helpful jumping
off point as you plan your app's implementation.

## Support app upgrades

Every time a customer upgrades an instance of your app, Wix
retrieves an initial charge limit from your app. Wix displays this limit to the
customer in the checkout page of the upgrade process. This helps customers
understand how much they may have to pay maximally for using your app per
billing cycle.

To support app upgrades:

1. Wix calls [Get Charge Limit](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/get-charge-limit.md).
2. Return the initial charge limit that your app is allowed to charge the customer per billing cycle.
3. Wix displays the limit to the customer for approval. Note that your app can't change this limit later, but customers are able to increase it themselves.

## Bill a customer

Your app can add custom charges to an invoice that Wix sends to a customer
at the end of the billing cycle.

To bill a customer:

1. Wix calls [List charges](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges.md). Note that Wix sends `{"intent": "CREATE_INVOICE"}` to actually create an invoice with the charges you return. For other purposes, Wix sends `{"intent": "DISPLAY_ONLY"}`.
2. Return up to 5 charges that Wix adds to the invoice.
3. In case Wix accepts your charges, Wix calls [Invoice Created Event](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/invoice-created-event.md) and sends the invoice to the customer.

## Get notified when an app instance is canceled

Currently, you can't receive notifications when a payment for an
invoice has failed. If that happens, Wix sends an email to the customer and
retries to collect the payment several times. In case all retries fail, Wix
cancels the app instance. Your app could get notified in this situation, and
you could reach out to the customer.

To receive notifications when an app instance is canceled:

1. Sign up for the [Paid Plan Auto Renewal Cancelled Webhook](https://dev.wix.com/docs/api-reference/app-management/app-instance/paid-plan-auto-renewal-cancelled.md) of the App Instance API.
2. Listen to the webhook. Wix sends `{"cancelReason": "FAILED_PAYMENT"}` in case an app instance is canceled due to a failed payment.
3. Reach out to the relevant customer.