This request will create a component definition of kind event_based_component under the specified product family. 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 on components, please see our documentation here.
POST /product_families/{product_family_id}/event_based_components.json
This endpoint requires BasicAuth
Created
application/json
{
"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
}
}
curl -X POST \
--url 'https://subdomain.chargify.com/product_families/product_family_id4/event_based_components.json' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"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
}
}'