> 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/app-management/app-billing/external-billing-events/sample-flows.md ## Article Content: # External Billing Events API: Sample Flows This article presents possible use cases and sample flows that you may encounter when working with external billing events. This can be a helpful jumping off point as you plan your app's implementation. > **Important:** These examples are only for Partner Billed Apps that process payments outside the Wix Billing system, using their own payment provider. If you use an external pricing page but Wix processes your payments, use the [Billing API](https://dev.wix.com/docs/api-reference/app-management/app-billing/billing/introduction.md) instead. ## Report external billing events with an access token Use this flow when you have an app instance ID and can generate an access token for authentication. To report external billing events using an access token: 1. If you don't have an access token, call [Create Access Token](https://dev.wix.com/docs/rest/app-management/oauth-2/create-access-token.md) and pass your [app instance ID](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances.md#get-the-app-instance-id) in the request. 2. Call [Report External Billing Event](https://dev.wix.com/docs/rest/app-management/app-billing/external-billing-events/report-external-billing-event.md) and pass the access token as the `Authorization` header. 3. Specify the billing event details in the method parameters: ```json "event": { "created_date": "2025-04-07T08:01:31Z", "gross_revenue": "120", "net_revenue": "100", "wix_share": "20", "billing_type": "CHARGE" } ``` 1. The response contains the app and instance IDs extracted from the access token. It also echoes any parameters that you passed in the method call: ```json "event": { "app_id": "cc59f2e7-7a40-4cbf-a78a-ac6e83d17e96", "instance_id": "7dd21ebc-a097-43ac-8763-2806daee84a1", "gross_revenue": "120", "net_revenue": "100", "wix_share": "20", "created_date": "2025-04-07T08:02:31Z", "billing_type": "CHARGE" } ``` ## Report external billing events with an API key Use this flow when an access token cannot be generated but you still need to report a billing event. For example, if a Wix user uninstalls your app, you won't be able to generate access tokens for that app instance afterward. To report external billing events using an [API key](https://dev.wix.com/docs/api-reference/articles/authentication/api-keys/about-api-keys.md): 1. Create a new API key in the [API key manager](https://manage.wix.com/account/api-keys) of the Wix account that owns your app. This key must have the account-level `Manage Custom Apps` permission. 2. When you call Report External Billing Event, pass the API key as the `Authorization` header. In addition, pass your account ID in the `wix-account-ID` header. Your account ID will be listed within the [API key manager](https://manage.wix.com/account/api-keys). 3. Specify your app ID and the billing event details in the method parameters.