curl --request POST \
--url https://api.withorb.com/v1/plans/{plan_id}/versions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 123,
"add_prices": [
{
"price": {
"model_type": "unit",
"unit_config": {
"unit_amount": "<string>",
"prorated": false
},
"name": "<string>",
"item_id": "<string>",
"cadence": "annual",
"metadata": {},
"external_price_id": "<string>",
"dimensional_price_configuration": {
"dimension_values": [
"<string>"
],
"dimensional_price_group_id": "<string>",
"external_dimensional_price_group_id": "<string>"
},
"billable_metric_id": "<string>",
"billed_in_advance": true,
"fixed_price_quantity": 123,
"invoice_grouping_key": "<string>",
"billing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"invoicing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"conversion_rate": 123,
"conversion_rate_config": {
"conversion_rate_type": "unit",
"unit_config": {
"unit_amount": "<string>"
}
},
"currency": "<string>",
"reference_id": "<string>"
},
"allocation_price": {
"currency": "<string>",
"amount": "<string>",
"cadence": "one_time",
"expires_at_end_of_cadence": true,
"custom_expiration": {
"duration": 123,
"duration_unit": "day"
},
"filters": [
{
"field": "item_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"per_unit_cost_basis": "0.00",
"item_id": "<string>"
},
"plan_phase_order": 123
}
],
"remove_prices": [
{
"price_id": "<string>",
"plan_phase_order": 123
}
],
"replace_prices": [
{
"replaces_price_id": "<string>",
"price": {
"model_type": "unit",
"unit_config": {
"unit_amount": "<string>",
"prorated": false
},
"name": "<string>",
"item_id": "<string>",
"cadence": "annual",
"metadata": {},
"external_price_id": "<string>",
"dimensional_price_configuration": {
"dimension_values": [
"<string>"
],
"dimensional_price_group_id": "<string>",
"external_dimensional_price_group_id": "<string>"
},
"billable_metric_id": "<string>",
"billed_in_advance": true,
"fixed_price_quantity": 123,
"invoice_grouping_key": "<string>",
"billing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"invoicing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"conversion_rate": 123,
"conversion_rate_config": {
"conversion_rate_type": "unit",
"unit_config": {
"unit_amount": "<string>"
}
},
"currency": "<string>",
"reference_id": "<string>"
},
"allocation_price": {
"currency": "<string>",
"amount": "<string>",
"cadence": "one_time",
"expires_at_end_of_cadence": true,
"custom_expiration": {
"duration": 123,
"duration_unit": "day"
},
"filters": [
{
"field": "item_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"per_unit_cost_basis": "0.00",
"item_id": "<string>"
},
"plan_phase_order": 123
}
],
"add_adjustments": [
{
"adjustment": {
"adjustment_type": "percentage_discount",
"percentage_discount": 123,
"applies_to_price_ids": [
"price_1",
"price_2"
],
"applies_to_item_ids": [
"item_1",
"item_2"
],
"applies_to_all": true,
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"currency": [
"USD",
"JPY",
"credits"
],
"price_type": "usage",
"is_invoice_level": true
},
"plan_phase_order": 123
}
],
"remove_adjustments": [
{
"adjustment_id": "<string>",
"plan_phase_order": 123
}
],
"replace_adjustments": [
{
"adjustment": {
"adjustment_type": "percentage_discount",
"percentage_discount": 123,
"applies_to_price_ids": [
"price_1",
"price_2"
],
"applies_to_item_ids": [
"item_1",
"item_2"
],
"applies_to_all": true,
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"currency": [
"USD",
"JPY",
"credits"
],
"price_type": "usage",
"is_invoice_level": true
},
"replaces_adjustment_id": "<string>",
"plan_phase_order": 123
}
],
"set_as_default": true
}
'{
"created_at": "2023-11-07T05:31:56Z",
"version": 123,
"plan_phases": [
{
"id": "<string>",
"description": "<string>",
"duration": 123,
"duration_unit": "daily",
"name": "<string>",
"order": 123
}
],
"prices": [
{
"model_type": "unit",
"unit_config": {
"unit_amount": "<string>",
"prorated": false
},
"metadata": {},
"id": "<string>",
"name": "<string>",
"external_price_id": "<string>",
"replaces_price_id": "<string>",
"price_type": "usage_price",
"created_at": "2023-11-07T05:31:56Z",
"cadence": "one_time",
"billing_mode": "in_advance",
"billing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"invoicing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"billable_metric": {
"id": "<string>"
},
"fixed_price_quantity": 123,
"plan_phase_order": 123,
"currency": "<string>",
"conversion_rate": 123,
"conversion_rate_config": {
"conversion_rate_type": "unit",
"unit_config": {
"unit_amount": "<string>"
}
},
"item": {
"id": "<string>",
"name": "<string>"
},
"credit_allocation": {
"currency": "<string>",
"allows_rollover": true,
"custom_expiration": {
"duration": 123,
"duration_unit": "day"
},
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
]
},
"composite_price_filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"discount": {
"discount_type": "percentage",
"percentage_discount": 0.5,
"applies_to_price_ids": [
"h74gfhdjvn7ujokd",
"7hfgtgjnbvc3ujkl"
],
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"reason": "<string>"
},
"minimum": {
"minimum_amount": "<string>",
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"applies_to_price_ids": [
"<string>"
]
},
"minimum_amount": "<string>",
"maximum": {
"maximum_amount": "<string>",
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"applies_to_price_ids": [
"<string>"
]
},
"maximum_amount": "<string>",
"dimensional_price_configuration": {
"dimensional_price_group_id": "<string>",
"dimension_values": [
"<string>"
]
}
}
],
"adjustments": [
{
"id": "<string>",
"is_invoice_level": true,
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"applies_to_price_ids": [
"<string>"
],
"reason": "<string>",
"replaces_adjustment_id": "<string>",
"adjustment_type": "usage_discount",
"usage_discount": 123,
"plan_phase_order": 123
}
]
}This endpoint allows the creation of a new plan version for an existing plan.
curl --request POST \
--url https://api.withorb.com/v1/plans/{plan_id}/versions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 123,
"add_prices": [
{
"price": {
"model_type": "unit",
"unit_config": {
"unit_amount": "<string>",
"prorated": false
},
"name": "<string>",
"item_id": "<string>",
"cadence": "annual",
"metadata": {},
"external_price_id": "<string>",
"dimensional_price_configuration": {
"dimension_values": [
"<string>"
],
"dimensional_price_group_id": "<string>",
"external_dimensional_price_group_id": "<string>"
},
"billable_metric_id": "<string>",
"billed_in_advance": true,
"fixed_price_quantity": 123,
"invoice_grouping_key": "<string>",
"billing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"invoicing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"conversion_rate": 123,
"conversion_rate_config": {
"conversion_rate_type": "unit",
"unit_config": {
"unit_amount": "<string>"
}
},
"currency": "<string>",
"reference_id": "<string>"
},
"allocation_price": {
"currency": "<string>",
"amount": "<string>",
"cadence": "one_time",
"expires_at_end_of_cadence": true,
"custom_expiration": {
"duration": 123,
"duration_unit": "day"
},
"filters": [
{
"field": "item_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"per_unit_cost_basis": "0.00",
"item_id": "<string>"
},
"plan_phase_order": 123
}
],
"remove_prices": [
{
"price_id": "<string>",
"plan_phase_order": 123
}
],
"replace_prices": [
{
"replaces_price_id": "<string>",
"price": {
"model_type": "unit",
"unit_config": {
"unit_amount": "<string>",
"prorated": false
},
"name": "<string>",
"item_id": "<string>",
"cadence": "annual",
"metadata": {},
"external_price_id": "<string>",
"dimensional_price_configuration": {
"dimension_values": [
"<string>"
],
"dimensional_price_group_id": "<string>",
"external_dimensional_price_group_id": "<string>"
},
"billable_metric_id": "<string>",
"billed_in_advance": true,
"fixed_price_quantity": 123,
"invoice_grouping_key": "<string>",
"billing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"invoicing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"conversion_rate": 123,
"conversion_rate_config": {
"conversion_rate_type": "unit",
"unit_config": {
"unit_amount": "<string>"
}
},
"currency": "<string>",
"reference_id": "<string>"
},
"allocation_price": {
"currency": "<string>",
"amount": "<string>",
"cadence": "one_time",
"expires_at_end_of_cadence": true,
"custom_expiration": {
"duration": 123,
"duration_unit": "day"
},
"filters": [
{
"field": "item_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"per_unit_cost_basis": "0.00",
"item_id": "<string>"
},
"plan_phase_order": 123
}
],
"add_adjustments": [
{
"adjustment": {
"adjustment_type": "percentage_discount",
"percentage_discount": 123,
"applies_to_price_ids": [
"price_1",
"price_2"
],
"applies_to_item_ids": [
"item_1",
"item_2"
],
"applies_to_all": true,
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"currency": [
"USD",
"JPY",
"credits"
],
"price_type": "usage",
"is_invoice_level": true
},
"plan_phase_order": 123
}
],
"remove_adjustments": [
{
"adjustment_id": "<string>",
"plan_phase_order": 123
}
],
"replace_adjustments": [
{
"adjustment": {
"adjustment_type": "percentage_discount",
"percentage_discount": 123,
"applies_to_price_ids": [
"price_1",
"price_2"
],
"applies_to_item_ids": [
"item_1",
"item_2"
],
"applies_to_all": true,
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"currency": [
"USD",
"JPY",
"credits"
],
"price_type": "usage",
"is_invoice_level": true
},
"replaces_adjustment_id": "<string>",
"plan_phase_order": 123
}
],
"set_as_default": true
}
'{
"created_at": "2023-11-07T05:31:56Z",
"version": 123,
"plan_phases": [
{
"id": "<string>",
"description": "<string>",
"duration": 123,
"duration_unit": "daily",
"name": "<string>",
"order": 123
}
],
"prices": [
{
"model_type": "unit",
"unit_config": {
"unit_amount": "<string>",
"prorated": false
},
"metadata": {},
"id": "<string>",
"name": "<string>",
"external_price_id": "<string>",
"replaces_price_id": "<string>",
"price_type": "usage_price",
"created_at": "2023-11-07T05:31:56Z",
"cadence": "one_time",
"billing_mode": "in_advance",
"billing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"invoicing_cycle_configuration": {
"duration": 123,
"duration_unit": "day"
},
"billable_metric": {
"id": "<string>"
},
"fixed_price_quantity": 123,
"plan_phase_order": 123,
"currency": "<string>",
"conversion_rate": 123,
"conversion_rate_config": {
"conversion_rate_type": "unit",
"unit_config": {
"unit_amount": "<string>"
}
},
"item": {
"id": "<string>",
"name": "<string>"
},
"credit_allocation": {
"currency": "<string>",
"allows_rollover": true,
"custom_expiration": {
"duration": 123,
"duration_unit": "day"
},
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
]
},
"composite_price_filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"discount": {
"discount_type": "percentage",
"percentage_discount": 0.5,
"applies_to_price_ids": [
"h74gfhdjvn7ujokd",
"7hfgtgjnbvc3ujkl"
],
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"reason": "<string>"
},
"minimum": {
"minimum_amount": "<string>",
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"applies_to_price_ids": [
"<string>"
]
},
"minimum_amount": "<string>",
"maximum": {
"maximum_amount": "<string>",
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"applies_to_price_ids": [
"<string>"
]
},
"maximum_amount": "<string>",
"dimensional_price_configuration": {
"dimensional_price_group_id": "<string>",
"dimension_values": [
"<string>"
]
}
}
],
"adjustments": [
{
"id": "<string>",
"is_invoice_level": true,
"filters": [
{
"field": "price_id",
"operator": "includes",
"values": [
"<string>"
]
}
],
"applies_to_price_ids": [
"<string>"
],
"reason": "<string>",
"replaces_adjustment_id": "<string>",
"adjustment_type": "usage_discount",
"usage_discount": 123,
"plan_phase_order": 123
}
]
}API Keys can be issued in the Orb's web application.
New version number.
Additional prices to be added to the plan.
Show child attributes
The price to add to the plan
Show child attributes
The pricing model type
unit The name of the price.
The id of the item the price will be associated with.
The cadence to bill for this price on.
annual, semi_annual, monthly, quarterly, one_time, custom An alias for the price.
For dimensional price: specifies a price group and dimension values
Show child attributes
The list of dimension values matching (in order) the dimensions of the price group
The id of the dimensional price group to include this price in
The external id of the dimensional price group to include this price in
The id of the billable metric for the price. Only needed if the price is usage-based.
If the Price represents a fixed cost, the price will be billed in-advance if this is true, and in-arrears if this is false.
If the Price represents a fixed cost, this represents the quantity of units applied.
The property used to group this price on an invoice
1For custom cadence: specifies the duration of the billing period in days or months.
Within each billing cycle, specifies the cadence at which invoices are produced. If unspecified, a single invoice is produced per billing cycle.
The per unit conversion rate of the price currency to the invoicing currency.
The configuration for the rate of the price currency to the invoicing currency.
Show child attributes
unit An ISO 4217 currency string, or custom pricing unit identifier, in which this price is billed.
A transient ID that can be used to reference this price when adding adjustments in the same API call.
The allocation price to add to the plan.
Show child attributes
An ISO 4217 currency string or a custom pricing unit identifier in which to bill this price.
An amount of the currency to allocate to the customer at the specified cadence.
The cadence at which to allocate the amount to the customer.
one_time, monthly, quarterly, semi_annual, annual Whether the allocated amount should expire at the end of the cadence or roll over to the next period. Set to null if using custom_expiration.
The filters that determine which items the allocation applies to.
Show child attributes
The property of the price the block applies to. Only item_id is supported.
item_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
The (per-unit) cost basis of each created block. If non-zero, a customer will be invoiced according to the quantity and per unit cost basis specified for the allocation each cadence.
The item ID that line items representing charges for this allocation will be associated with. If not provided, the default allocation item for the currency will be used (e.g. 'Included Allocation (USD)').
The phase to add this price to.
Prices to be replaced with additional prices on the plan.
Show child attributes
The id of the price on the plan to replace in the plan.
The price to add to the plan
Show child attributes
The pricing model type
unit The name of the price.
The id of the item the price will be associated with.
The cadence to bill for this price on.
annual, semi_annual, monthly, quarterly, one_time, custom User-specified key/value pairs for the resource. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.
Show child attributes
An alias for the price.
For dimensional price: specifies a price group and dimension values
Show child attributes
The list of dimension values matching (in order) the dimensions of the price group
The id of the dimensional price group to include this price in
The external id of the dimensional price group to include this price in
The id of the billable metric for the price. Only needed if the price is usage-based.
If the Price represents a fixed cost, the price will be billed in-advance if this is true, and in-arrears if this is false.
If the Price represents a fixed cost, this represents the quantity of units applied.
The property used to group this price on an invoice
1For custom cadence: specifies the duration of the billing period in days or months.
Within each billing cycle, specifies the cadence at which invoices are produced. If unspecified, a single invoice is produced per billing cycle.
The per unit conversion rate of the price currency to the invoicing currency.
The configuration for the rate of the price currency to the invoicing currency.
Show child attributes
unit An ISO 4217 currency string, or custom pricing unit identifier, in which this price is billed.
A transient ID that can be used to reference this price when adding adjustments in the same API call.
The allocation price to add to the plan.
Show child attributes
An ISO 4217 currency string or a custom pricing unit identifier in which to bill this price.
An amount of the currency to allocate to the customer at the specified cadence.
The cadence at which to allocate the amount to the customer.
one_time, monthly, quarterly, semi_annual, annual Whether the allocated amount should expire at the end of the cadence or roll over to the next period. Set to null if using custom_expiration.
The filters that determine which items the allocation applies to.
Show child attributes
The property of the price the block applies to. Only item_id is supported.
item_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
The (per-unit) cost basis of each created block. If non-zero, a customer will be invoiced according to the quantity and per unit cost basis specified for the allocation each cadence.
The item ID that line items representing charges for this allocation will be associated with. If not provided, the default allocation item for the currency will be used (e.g. 'Included Allocation (USD)').
The phase to replace this price from.
Additional adjustments to be added to the plan.
Show child attributes
The definition of a new adjustment to create and add to the plan.
Show child attributes
percentage_discount The set of price IDs to which this adjustment applies.
["price_1", "price_2"]The set of item IDs to which this adjustment applies.
["item_1", "item_2"]If set, the adjustment will apply to every price on the subscription.
true, false A list of filters that determine which prices this adjustment will apply to.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
If set, only prices in the specified currency will have the adjustment applied.
["USD", "JPY", "credits"]If set, only prices of the specified type will have the adjustment applied.
usage, fixed_in_advance, fixed_in_arrears, fixed, in_arrears When false, this adjustment will be applied to a single price. Otherwise, it will be applied at the invoice level, possibly to multiple prices.
The phase to add this adjustment to.
Adjustments to be replaced with additional adjustments on the plan.
Show child attributes
The definition of a new adjustment to create and add to the plan.
Show child attributes
percentage_discount The set of price IDs to which this adjustment applies.
["price_1", "price_2"]The set of item IDs to which this adjustment applies.
["item_1", "item_2"]If set, the adjustment will apply to every price on the subscription.
true, false A list of filters that determine which prices this adjustment will apply to.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
If set, only prices in the specified currency will have the adjustment applied.
["USD", "JPY", "credits"]If set, only prices of the specified type will have the adjustment applied.
usage, fixed_in_advance, fixed_in_arrears, fixed, in_arrears When false, this adjustment will be applied to a single price. Otherwise, it will be applied at the invoice level, possibly to multiple prices.
The id of the adjustment on the plan to replace in the plan.
The phase to replace this adjustment from.
Set this new plan version as the default
Created
The PlanVersion resource represents the prices and adjustments present on a specific version of a plan.
Show child attributes
How many terms of length duration_unit this phase is active for. If null, this phase is evergreen and active indefinitely
daily, monthly, quarterly, semi_annual, annual Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
Prices for this plan. If the plan has phases, this includes prices across all phases of the plan.
The Price resource represents a price that can be billed on a subscription, resulting in a charge on an invoice in the form of an invoice line item. Prices take a quantity and determine an amount to bill.
Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price object. The model_type field determines the key for the configuration object that is present.
For more on the types of prices, see the core concepts documentation
Show child attributes
The pricing model type
unit User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.
Show child attributes
The price id this price replaces. This price will take the place of the replaced price in plan version migrations.
usage_price, fixed_price, composite_price one_time, monthly, quarterly, semi_annual, annual, custom in_advance, in_arrear Show child attributes
Show child attributes
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
Show child attributes
percentage Only available if discount_type is percentage. This is a number between 0 and 1.
0 <= x <= 1List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a subset of prices.
["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"]The filters that determine which prices to apply this discount to.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
Show child attributes
Minimum amount applied
The filters that determine which prices to apply this minimum to.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this can be a subset of prices.
Show child attributes
Maximum amount applied
The filters that determine which prices to apply this maximum to.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this can be a subset of prices.
Adjustments for this plan. If the plan has phases, this includes adjustments across all phases of the plan.
Show child attributes
True for adjustments that apply to an entire invoice, false for adjustments that apply to only one price.
The filters that determine which prices to apply this adjustment to.
Show child attributes
The property of the price to filter on.
price_id, item_id, price_type, currency, pricing_unit_id Should prices that match the filter be included or excluded.
includes, excludes The IDs or values that match this filter.
The price IDs that this adjustment applies to.
The reason for the adjustment.
The adjustment id this adjustment replaces. This adjustment will take the place of the replaced adjustment in plan version migrations.
usage_discount The number of usage units by which to discount the price this adjustment applies to in a given billing period.
The plan phase in which this adjustment is active.
Was this page helpful?