Skip to navigation

Orders

An order is the deal you’ve agreed with a customer: which prices and rate cards they pay, from when to when, and how they’re invoiced. Each price or rate card on it is an order line. Nothing in your catalog bills anyone until an order puts it on a customer, and a new order bills nothing until you activate it, so you can build and check a deal before it goes live.

Use an order to:

  • Start billing a customer by putting prices, rate cards or a plan on them and activating the order.
  • Record a negotiated deal with its discounts and spend commitments, using negotiated pricing and commits created with the order.
  • Change what a customer pays mid-term with an amendment that previews the exact proration before it’s applied.
  • Sell seats by putting a seat price on the order and assigning seats to people.

Orders are in the orders=v1 private beta: send Paid-Beta: orders=v1 with each request.

Creating an order on rate cards is in the internal rate_cards=v1 preview: send Paid-Beta: rate_cards=v1 and an Idempotency-Key. In the preview, create saves the order and activates it in one call, on a monthly billing cycle. It needs at least one rateCard line, and a price line can only add a recurring price that grants credits. If billing can’t confirm the activation, it returns a retryable 503: send the same request with the same key.

How an order works

  1. You create a draft. It names the customer, the term (startsAt to the exclusive endsAt), the billing cycle and the lines. A draft is inert: it bills nothing and you can change anything on it.
  2. You activate it. Paid checks the customer and every line, then starts billing. From then on, what’s billed changes only through amendments.
  3. It invoices on its billing cycle. Recurring fees are invoiced in advance by default, usage in arrears, and one-time charges straight away.
  4. It ends on its own at endsAt, with a final invoice for the usage in its last cycle. An order without an endsAt runs until you amend it.

Create an order

Clausebase signs Halberd LLP for 2027: contract review priced per page on tiers, a monthly platform fee and 25 reviewer seats, invoiced monthly on Net 45 terms against Halberd’s purchase order.

Create an order with the customer, the term, the billing cycle and the lines. It’s created as a draft.

{
"customer": "cus_2Jm7Hd",
"externalId": "halberd-2027",
"name": "Halberd 2027",
"startsAt": "2027-01-01T00:00:00Z",
"endsAt": "2028-01-01T00:00:00Z",
"billingCycle": { "interval": "month", "intervalCount": 1, "anchorDay": 1 },
"paymentTerms": "net45",
"purchaseOrderNumber": "PO-88213",
"lines": [
{
"type": "price",
"price": { "price": "prc_7Kd2Pw" },
"displayName": "Contract review pages (2027 MSA)"
},
{ "type": "price", "price": { "price": "prc_3Wq9Lb" } },
{ "type": "price", "price": { "price": "prc_5Tn8Rv", "quantity": 25 } }
]
}

Store the ord_ ID. Anywhere the API takes an order in its path, it also accepts your externalId.

When the deal is signed, activate the order:

It returns the order with status: "active", or 202 with status: "activating" if billing takes longer to confirm.

Send lines, a plan, or both. At least one is required.

Order lines

Each line is a price or a rateCard. A line bills from the order’s start to its end unless you give it its own startsAt or endsAt, which must fall inside the order.

FieldWhat it’s for
price.priceThe price to bill, by prc_ ID. It must be active and offered in the order’s currency.
price.quantityHow many units, for a recurring or one-time price with a unit, such as 25 seats. Leave it out for usage prices and flat fees. On a seat price that bills assigned seats, it’s the minimum billed.
price.quantityLimitsminimum and maximum for this line’s quantity, within the price’s own limits, such as a deal capped at 50 seats.
rateCard.rateCardThe rate card to bill, by its key. The line pins the version in effect at its start, and keeps it until a migration moves it to a later one.
invoiceFor a one-time price: now (the default) puts the charge on its own invoice straight away, and nextInvoice adds it to the next scheduled invoice.
nameYour label for the line. Defaults to the price’s or rate card’s name. Your customer never sees it.
displayNameWhat your customer sees for this line on invoices and credit notes, up to 250 characters. When it’s null, they use the price’s or rate card’s own label, then its name.

Responses add each line’s id, the plan it came from, endedByAmendment once an amendment ends it, and, for a one-time line, charged with the invoice it was charged on. Ended lines stay on the order, so it always shows the full history of what was billed. Orders created with the legacy API return their lines as type: "legacy", with the pricing they were created with.

Term and billing cycle

startsAt is when billing starts. It can be in the past: when you activate the order, usage from events already received since startsAt is billed, and the first invoice covers the periods that have passed. endsAt is exclusive, so an order for 2027 ends at 2028-01-01T00:00:00Z. Leave it out for an order with no end.

billingCycle sets how often the order invoices:

FieldValues
intervalmonth.
intervalCountMonths per invoice, 1 to 36. Defaults to 1; 3 is quarterly and 12 annual.
anchorDayThe day of the month each cycle starts, 1 to 31. Defaults to the day of startsAt.

Usage prices and rate cards have no interval of their own, so they’re invoiced once per cycle. A recurring price’s interval must divide the cycle evenly or be a whole multiple of it: a monthly fee on an annual cycle is charged 12 times on each invoice, and an annual fee on a monthly cycle is charged on the invoice where each year starts. An interval that’s neither, such as every 2 months on a quarterly cycle, can’t go on the order.

currency defaults to the customer’s currency, and every line’s price or rate card must be offered in it.

Invoice settings

FieldWhat it’s for
paymentTermsWhen invoices are due: dueOnReceipt, net15, net30 (the default), net45, net60 or net90.
invoiceSettingsautoFinalize to finalize invoices without review, autoSend to email them, and sendPaymentReminders. Each defaults to your account’s setting.
purchaseOrderNumberPrinted on every invoice.
billingContactsThe contacts who receive the invoices.
billToThe customer that receives and pays this order’s invoices. Defaults, when the order is created, to the customer’s parent, then to the customer itself.

Start from a plan

Send a plan instead of, or as well as, lines to copy a plan’s lines onto the order. quantities, keyed by price, replaces the plan’s default quantities:

"plan": { "plan": "team_annual", "quantities": { "prc_5Tn8Rv": 25 } }

The response returns plan as the plan and the version the order was built from. To move a running order to another plan, use a changePlan amendment.

Negotiated terms

Terms you negotiate are sent with the order, so they exist before the first invoice. They’re created with the draft and take effect when it’s activated:

  • negotiatedPricing: up to 50 contracted prices, discounts and surcharges that apply to this order only. Each targets something the order bills. See Introduction to pricing.
  • commits: up to 10 spend commitments, either an invoiced minimum or a prepaid amount. See Commits.

Halberd’s 15% discount on the platform fee for the whole term:

"negotiatedPricing": [
{
"key": "platform_discount",
"type": "discount",
"discount": { "type": "percentage", "percentage": { "percentOff": "15" } },
"target": { "type": "price", "price": { "price": "prc_3Wq9Lb" } },
"displayName": "Negotiated discount"
}
]

An entry with no dates starts with the order and ends with it. Sending commits needs the commits=v1 beta. To add terms to an order that’s already active, send them with an amendment.

The order lifecycle

statusMeans
draftCreated and editable. Bills nothing.
activatingActivation is waiting for billing to confirm.
activeBilling. It changes only through amendments.
pausedInvoicing is stopped. Usage is still recorded.
endedPast its endsAt.
  • Activate. Activation fails unless the customer is active and every line’s price or rate card is active and offered in the order’s currency. An order that returns activating moves to active when billing confirms, or back to draft if activation fails.
  • Deactivate. Deactivate returns an active order to draft, to undo a mistaken activation. It’s allowed only while startsAt is still in the future and no invoice has been issued.
  • Pause and resume. Pause stops invoicing without ending the order. Usage is still recorded, and is invoiced when you resume.
  • End. An order ends at endsAt with no action from you. To end it early or extend it, amend its term.

A customer can have several active orders, as long as they don’t price the same usage over the same dates. Activating or amending an order whose lines would bill the same product, meter and workflow outcome as another of the customer’s orders, over overlapping dates, fails with meter_already_priced_for_customer, so no usage is billed twice.

How it bills

Halberd’s order is on a monthly cycle from 1 January. Pages are priced on graduated tiers: $0.40 a page for the first 10,000 pages a month, and $0.25 a page after that. The platform fee is $2,000.00 a month and each reviewer seat $40.00 a month, both in advance. Halberd’s lawyers review 14,200 pages in January. The invoice issued on 1 February carries January’s pages in arrears and February’s fees in advance:

StepValue
Pages, first tier10,000 × $0.40 = $4,000.00
Pages, second tier(14,200 − 10,000) × $0.25 = 4,200 × $0.25 = $1,050.00
Contract review pages (2027 MSA), January$4,000.00 + $1,050.00 = $5,050.00
Platform fee, February$2,000.00
Reviewer seat, February25 × $40.00 = $1,000.00
Invoice total$5,050.00 + $2,000.00 + $1,000.00 = $8,050.00, before tax
DueNet 45: 45 days after 1 February, on 18 March 2027

The first line shows the order line’s displayName. The other two have none, so they show their prices’ labels. The PO number PO-88213 is printed on the invoice. See Invoices for everything else that can appear on one.

Change or delete an order

On a draft, update any field. lines replaces the whole list.

Once the order is active, you can update its name, externalId, billTo, paymentTerms, invoiceSettings, purchaseOrderNumber, billingContacts, metadata and each line’s displayName. A new label applies to invoices issued afterwards. Everything that changes what’s billed, such as lines, quantities, prices, dates, the billing cycle or the currency, changes through an amendment.

Delete a draft you no longer need. It’s removed for good, and the commits created with it are archived. Only drafts can be deleted: an order that has billed stays on record.