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 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 and pass your app instance ID in the request.

  2. Call Report External Billing Event and pass the access token as the Authorization header.

  3. Specify the billing event details in the method parameters:

    Copy
  4. 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:

    Copy

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:

  1. Create a new API key in the API key manager 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.
  3. Specify your app ID and the billing event details in the method parameters.
Did this help?