Components

Create Event Based Component

POST
/product_families/{product_family_id}/event_based_components.json

Creates an event-based component definition under the specified product family. An event-based component can then be added and “allocated” for a subscription.

Event-based components are similar to other component types, in that you define the component parameters (such as name and taxability) and the pricing. A key difference for the event-based component is that it must be attached to a metric. This is because the metric provides the component with the actual quantity used in computing what and how much will be billed each period for each subscription.

So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events.

For more information, see Components Overview.

If you have the new Catalog experience enabled, taxable components must include a non-blank tax_code; sending a blank value results in a validation error.

Authorization

BasicAuth
AuthorizationBasic <token>

The username is a Maxio Chargify API key. The password is x.

In: header

Path Parameters

product_family_id*string

Either the product family's id or its handle prefixed with handle:

Request Body

application/json

event_based_component*

Response Body

application/json

application/json

curl -X POST "https://example.com/product_families/string/event_based_components.json" \  -H "Content-Type: application/json" \  -d '{    "event_based_component": {      "name": "Component Name",      "unit_name": "string",      "description": "string",      "handle": "some_handle",      "taxable": true,      "pricing_scheme": "per_unit",      "prices": [        {          "starting_quantity": 1,          "unit_price": "0.49"        }      ],      "event_based_billing_metric_id": 123    }  }'
{  "component": {    "id": 1489581,    "name": "stripeCharges",    "handle": null,    "pricing_scheme": null,    "unit_name": "charge",    "unit_price": null,    "product_family_id": 1517093,    "product_family_name": "Billing Plans",    "price_per_unit_in_cents": null,    "kind": "event_based_component",    "archived": false,    "taxable": false,    "description": null,    "default_price_point_id": null,    "price_point_count": 0,    "price_points_url": "https://staging.chargify.com/components/1489581/price_points",    "default_price_point_name": "Original",    "tax_code": null,    "recurring": false,    "upgrade_charge": null,    "downgrade_credit": null,    "created_at": "2021-10-12T07:33:24-05:00",    "updated_at": "2021-10-12T07:33:24-05:00",    "archived_at": null,    "hide_date_range_on_invoice": false,    "allow_fractional_quantities": false,    "use_site_exchange_rate": null,    "item_category": null,    "accounting_code": null,    "event_based_billing_metric_id": 1163  }}