POST /v1/invoices bills a customer once for one or more charges. There is no subscription and nothing recurs. It needs the invoices:write scope and an Idempotency-Key. It returns the invoice with status 201.
Saasybill applies the same rules as the New Invoice form and sends the invoice to Xero before it answers.
This is never a subscription invoice and it is not recurring revenue. Each line has the revenue type
one_time. Saasybill records it in the one-time charge account chosen for the organisation in Xero.Request fields
A charge allows an override when
allows_price_override is true on the charge. Sending price for any other charge is refused with 422, so you never bill something other than what you asked for.
What happens
Saasybill creates the invoice, then sends it to Xero. Whether Xero emails it follows the organisation’s default invoice status and minimum invoice amount.
The invoice has no
subscription. Webhook events follow as for any invoice. See Webhook events.
Retries
Idempotency-Key is required, because a repeated request would otherwise be a second invoice and a second bill. A retry with the same key and body returns the first response. The invoice id is derived from the key, so a crash partway through can’t produce a second invoice.
When a request is refused
The organisation’s state decides some refusals. They answer409, and nothing in the request can fix them.
A problem with a field answers
422, and param names it.
An unknown customer answers
404 customer_not_found, and an unknown charge answers 404 charge_not_found. See Errors.
A key made before
invoices:write existed doesn’t have it. An owner or admin adds the scope to the key, or creates a new one. See Authentication.