> 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

# GetMeteredBillingCharges

# Package: appBilling

# Namespace: Checkout

# Method link: https://dev.wix.com/docs/api-reference/app-management/app-billing/billing/get-metered-billing-charges.md

## Permission Scopes:
Manage Your App: SCOPE.DC.MANAGE-YOUR-APP

## Introduction

Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model.md#set-up-a-usage-based-business-model).

When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges.md) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.

> **Important:**
> This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.

> **Note:**
> This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).

---

## REST API

### Schema

```
 Method: getMeteredBillingCharges
 Description: Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model.md#set-up-a-usage-based-business-model).  When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges.md) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.  > **Important:** > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.  > **Note:** > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).
 URL: https://www.wixapis.com/apps/v1/metered-billing-charges
 Method: GET
 Method parameters:
   query param name: currency | type: currency | description: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.  | validation: format CURRENCY
   query param name: endDate | type: endDate | description: End of the period you want to retrieve the custom charges for in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | validation: format date-time
   query param name: startDate | type: startDate | description: Start of the period you want to retrieve the custom charges for in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | validation: format date-time
 Return type: GetMeteredBillingChargesResponse
  - name: charges | type: array<Charge> | description: List of retrieved custom charges.  
     - name: id | type: string | description: GUID of the custom charge. The GUID consists of 64 characters.  
     - name: description | type: string | description: Description of the custom charge.  
     - name: amount | type: string | description: Charge amount.  Min: `0.50`  | validation: format DECIMAL_VALUE, decimalValue {"gt":"0.00"}


```

### Examples

### GetMeteredBillingCharges
```curl
~~~cURL
curl -X GET \
 https://www.wixapis.com/apps/v1/metered-billing-charges \
 -H 'Authorization: <AUTH>' \
 -d '{
    "currency": "EUR",
    "startDate": "2023-01-01T00:00:00.000Z",
    "endDate": "2023-01-31T23:59:59.999Z"
}'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.appManagement.billing.getMeteredBillingCharges(options)
 Description: Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model.md#set-up-a-usage-based-business-model).  When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges.md) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.  > **Important:** > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.  > **Note:** > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).
 Method parameters:
   param name: options | type: GetMeteredBillingChargesOptions  none  
        - name: currency | type: string | description: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.  | validation: format CURRENCY
        - name: startDate | type: Date | description: Start of the period you want to retrieve the custom charges for in `YYYY-MM-DDThh:mm:ss.sssZ` format.  
        - name: endDate | type: Date | description: End of the period you want to retrieve the custom charges for in `YYYY-MM-DDThh:mm:ss.sssZ` format.  
 Return type: PROMISE<GetMeteredBillingChargesResponse>
  - name: charges | type: array<Charge> | description: List of retrieved custom charges.  
     - name: _id | type: string | description: GUID of the custom charge. The GUID consists of 64 characters.  
     - name: description | type: string | description: Description of the custom charge.  
     - name: amount | type: string | description: Charge amount.  Min: `0.50`  | validation: format DECIMAL_VALUE, decimalValue {"gt":"0.00"}


```

### Examples

### getMeteredBillingCharges
```javascript
import { billing } from '@wix/app-management';

async function getMeteredBillingCharges(options) {
  const response = await billing.getMeteredBillingCharges(options);
};
```

### getMeteredBillingCharges (with elevated permissions)
```javascript
import { billing } from '@wix/app-management';
import { auth } from '@wix/essentials';

async function myGetMeteredBillingChargesMethod(options) {
  const elevatedGetMeteredBillingCharges = auth.elevate(billing.getMeteredBillingCharges);
  const response = await elevatedGetMeteredBillingCharges(options);
}
```

### getMeteredBillingCharges (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { billing } from '@wix/app-management';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { billing },
  // Include the auth strategy and host as relevant
});


async function getMeteredBillingCharges(options) {
  const response = await myWixClient.billing.getMeteredBillingCharges(options);
};
```

---