v1

latestOpenAPI 3.1.02026-07-261444991.2 MB
Price interval

Add or edit price intervals

This endpoint is used to add and edit subscription price intervals. By making modifications to a subscription’s price intervals, you can flexibly and atomically control the billing behavior of a subscription.

Adding price intervals

Prices can be added as price intervals to a subscription by specifying them in the add array. A price_id or external_price_id from an add-on price or previously removed plan price can be specified to reuse an existing price definition (however, please note that prices from other plans cannot be added to the subscription). Additionally, a new price can be specified using the price field — this price will be created automatically.

A start_date must be specified for the price interval. This is the date when the price will start billing on the subscription, so this will notably result in an immediate charge at this time for any billed in advance fixed fees. The end_date will default to null, resulting in a price interval that will bill on a continually recurring basis. Both of these dates can be set in the past or the future and Orb will generate or modify invoices to ensure the subscription’s invoicing behavior is correct.

Additionally, a discount, minimum, or maximum can be specified on the price interval. This will only apply to this price interval, not any other price intervals on the subscription.

Adjustment intervals

An adjustment interval represents the time period that a particular adjustment (a discount, minimum, or maximum) applies to the prices on a subscription. Adjustment intervals can be added to a subscription by specifying them in the add_adjustments array, or modified via the edit_adjustments array. When creating an adjustment interval, you'll need to provide the definition of the new adjustment (the type of adjustment, and which prices it applies to), as well as the start and end dates for the adjustment interval. The start and end dates of an existing adjustment interval can be edited via the edit_adjustments field (just like price intervals). (To "change" the amount of a discount, minimum, or maximum, then, you'll need to end the existing interval, and create a new adjustment interval with the new amount and a start date that matches the end date of the previous interval.)

Editing price intervals

Price intervals can be adjusted by specifying edits to make in the edit array. A price_interval_id to edit must be specified — this can be retrieved from the price_intervals field on the subscription.

A new start_date or end_date can be specified to change the range of the price interval, which will modify past or future invoices to ensure correctness. If either of these dates are unspecified, they will default to the existing date on the price interval. To remove a price interval entirely from a subscription, set the end_date to be equivalent to the start_date.

Fixed fee quantity transitions

The fixed fee quantity transitions for a fixed fee price interval can also be specified when adding or editing by passing an array for fixed_fee_quantity_transitions. A fixed fee quantity transition must have a quantity and an effective_date, which is the date after which the new quantity will be used for billing. If a fixed fee quantity transition is scheduled at a billing period boundary, the full quantity will be billed on an invoice with the other prices on the subscription. If the fixed fee quantity transition is scheduled mid-billing period, the difference between the existing quantity and quantity specified in the transition will be prorated for the rest of the billing period and billed immediately, which will generate a new invoice.

Notably, the list of fixed fee quantity transitions passed will overwrite the existing fixed fee quantity transitions on the price interval, so the entire list of transitions must be specified to add additional transitions. The existing list of transitions can be retrieved using the fixed_fee_quantity_transitions property on a subscription’s serialized price intervals.

post/subscriptions/{subscription_id}/price_intervals

Path parameters

subscription_idstring required

Request body

can_defer_billingboolean nullable

If set, the default value to use for added/edited price intervals with an end_date set.

allow_invoice_credit_or_voidboolean nullable

If false, this request will fail if it would void an issued invoice or create a credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed.

Response

OK

metadataobject required

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.

idstring required
namestring required

The name of the subscription.

start_datestring date-time required

The date Orb starts billing for this subscription.

end_datestring date-time nullable required

The date Orb stops billing for this subscription.

created_atstring date-time required
current_billing_period_start_datestring date-time nullable required

The start date of the current billing period. This is an inclusive timestamp; the instant returned is exactly the beginning of the billing period. Set to null if the subscription is not currently active.

current_billing_period_end_datestring date-time nullable required

The end of the current billing period. This is an exclusive timestamp, such that the instant returned is not part of the billing period. Set to null for subscriptions that are not currently active.

status'active' | 'ended' | 'upcoming' required
active_plan_phase_orderinteger nullable required

The current plan phase that is active, only if the subscription's plan has phases.

default_invoice_memostring nullable required

Determines the default memo on this subscriptions' invoices. Note that if this is not provided, it is determined by the plan configuration.

auto_collectionboolean nullable required

Determines whether issued invoices for this subscription will automatically be charged with the saved payment method on the due date. This property defaults to the plan's behavior. If null, defaults to the customer's setting.

auto_issuanceboolean nullable required

Determines whether invoices for this subscription will be automatically issued. This resolves the effective setting for the subscription: a subscription-level override if set, otherwise the customer-level setting, otherwise the account-level default.

net_termsinteger required

Determines the difference between the invoice issue date for subscription invoices as the date that they are due. A value of 0 here represents that the invoice is due on issue, whereas a value of 30 represents that the customer has a month to pay the invoice.

billing_cycle_dayinteger required

The day of the month on which the billing cycle is anchored. If the maximum number of days in a month is greater than this value, the last day of the month is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the 30th.

invoicing_thresholdstring nullable required