> 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 # 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/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. 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. 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. Return type: GetMeteredBillingChargesResponse - name: charges | type: array | 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` ``` ### Examples ### GetMeteredBillingCharges ```curl ~~~cURL curl -X GET \ https://www.wixapis.com/apps/v1/metered-billing-charges \ -H 'Authorization: ' \ -d '{ "currency": "EUR", "startDate": "2023-01-01T00:00:00.000Z", "endDate": "2023-01-31T23:59:59.999Z" }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.appBilling.Checkout.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. - 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 - name: charges | type: array | 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` ``` ### 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-hosted) Self-hosted 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); }; ``` ---