As a custom charges provider, you can integrate with Wix to allow a merchant to manage what customers must pay to use an app. This includes regularly recurring base prices, installation and usage fees, and any other custom charges.
The integration is done via an app in the Wix App Market and by implementing the Custom Charges service plugin. After the app is installed on a site, Wix triggers a call to your service when specific actions are taken on the site. Refer to each function's description for details about those actions.
Using the service plugin, you can design your app to:
It’s important to note the following points before starting to code:
Before you can implement the Custom Charges service plugin, it's essential to set up Usage-Based Pricing for the app in the Wix Developers Center. Note that you have to submit a request to enable Usage-Based Pricing. Keep in mind that Usage-Based Pricing is currently in Alpha, this means it's still in development and may change in the future.
AUD
, BRL
, CAD
, EUR
, GBP
, ILS
, INR
, JPY
, MXN
, PLN
, RUB
, TRY
, USD
. Wix may add more currencies in the future.instanceId
instead of the subscriptionId
to track usage and billing for apps.Follow these steps to begin implementing your service plugin.
You can implement this service plugin with the following frameworks:
To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can configure your plugin in the Wix Dev Center. For details, see Custom Charges Extension Configuration.
Use customCharges.provideHandlers()
to define the following handler functions that implement your custom business logic. Make sure you define all required functions.
Function | Required |
---|---|
chargeLimitUpdatedEvent() | Yes |
chargesRejectedEvent() | Yes |
getChargeLimit() | Yes |
invoiceCreatedEvent() | Yes |
listCharges() | Yes |
Below is an example for implementing the Custom Charges service plugin in your code.
This is the basic code structure for implementing the Custom Charges service plugin with the Wix CLI:
This is the basic code structure for implementing a self-hosted Custom Charges service plugin:
To configure and customize your service plugin, you need to provide important details in the plugin.json
configuration file.
If you created your service plugin extension with the CLI, required fields are automatically populated for you.
Base part of your integration's deployment URI for the Custom Charges SPI.
For example "https://provider.example.com"
, if Wix should call your
integration at https://provider.example.com/v1/charge-limit
for the
Get Charge Limit method.