Activate Event-Based Component
Activates an event-based component for a single subscription.
To bill your subscribers on your Events data under the Events-Based Billing feature, the components must be activated for the subscriber.
For more information, see Design Your Catalog.
Use this endpoint to activate an event-based component for a single subscription. Activating an event-based component causes billing for events when the subscription is renewed.
Note: it is possible to stream events for a subscription at any time, regardless of component activation status. The activation status only determines if the subscription should be billed for event-based component usage at renewal.
Authorization
BasicAuth The username is a Maxio Chargify API key. The password is x.
In: header
Path Parameters
The Advanced Billing id of the subscription
The Advanced Billing id of the component
Request Body
application/json
The Chargify id of the price point
Billing schedule settings for component allocations or usages on multi-frequency subscriptions. Use this to start a component's billing period on a custom date instead of aligning with the product charge schedule.
Create or update custom pricing unique to the subscription. Used in place of price_point_id.
Response Body
curl -X POST "https://example.com/event_based_billing/subscriptions/0/components/0/activate.json" \ -H "Content-Type: application/json" \ -d '{ "price_point_id": 1, "billing_schedule": { "initial_billing_at": "2022-01-01" }, "custom_price": { "tax_included": false, "pricing_scheme": "per_unit", "interval": 30, "interval_unit": "day", "prices": [ { "starting_quantity": 1, "ending_quantity": null, "unit_price": "5.0" } ] } }'Create Usage POST
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](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). 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: - [Create and Manage Components](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components) - [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage) - [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status) The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](https://maxio-test-wp.pages.dev/api/openapi/subscription-components/readSubscriptionComponent) for the subscription. ## Price Point ID usage 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. ## Deducting Usage 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: ```json { "usage": { "quantity": 5000, "memo": "Recording 5000 units" } } ``` To reduce the quantity to `0`, POST the following payload: ```json { "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`.
Deactivate Event-Based Component POST
Deactivates an event-based component for a single subscription. Deactivating the event-based component causes Advanced Billing to ignore related events at subscription renewal.