Records an instance of metered or prepaid usage for a subscription.
You can report metered or prepaid usage to Advanced Billing as often as you wish. You can report usage as it happens or periodically, such as each night or once per billing period.
Full documentation on how to create Components in the Advanced Billing UI can be located here. Additionally, for information on how to record component usage against a subscription, see the following resources:
It is not possible to record metered usage for more than one component at a time. Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each.
See the following product documentation articles for more information:
The quantity from usage for each component is accumulated to the unit_balance on the Component Line Item for the subscription.
If you are using price points, for metered and prepaid usage components Advanced Billing gives you the option to specify a price point in your request.
You do not need to specify a price point ID. If a price point is not included, the default price point for the component will be used when the usage is recorded.
If you need to reverse a previous usage report or otherwise deduct from the current usage balance, you can provide a negative quantity.
Example:
Previously recorded quantity was 5000:
{ "usage": { "quantity": 5000, "memo": "Recording 5000 units" }}To reduce the quantity to 0, POST the following payload:
{ "usage": { "quantity": -5000, "memo": "Deducting 5000 units" }}The unit_balance has a floor of 0; negative unit balances are never allowed. For example, if the usage balance is 100 and you deduct 200 units, the unit balance would then be 0, not -100.
The username is a Maxio Chargify API key and the password is x. Basic authentication works only with the US and EU environments, which connect to chargify.com directly. The Maxio API Gateway environment does not accept Basic authentication.
In: header
Either the Advanced Billing subscription ID (integer) or the subscription reference (string). Important: In cases where a numeric string value matches both an existing subscription ID and an existing subscription reference, the system will prioritize the subscription ID lookup. For example, if both subscription ID 123 and subscription reference "123" exist, passing "123" will return the subscription with ID 123.
Either the Advanced Billing id for the component or the component's handle prefixed by handle:
application/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
application/json
curl -X POST \ --url 'https://subdomain.chargify.com/subscriptions/1/components/1/usages.json' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ACCESS_TOKEN' \ --data-raw '{ "usage": { "quantity": 1000, "price_point_id": "149416", "memo": "My memo" }}'