Ask to pay by invoice
const url = 'https://api.sloose.com/orgs/org_9f3c/billing/invoice-request';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"billingEntity":"example","country":"example","taxId":"example","poNumber":"example","currency":"USD"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/orgs/org_9f3c/billing/invoice-request \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "billingEntity": "example", "country": "example", "taxId": "example", "poNumber": "example", "currency": "USD" }'Every plan is sold by card. An organisation that has to pay by invoice asks here, with the details an invoice needs: the entity the invoices are made out to, its country (which decides the tax: GST on top in Australia, none elsewhere), its tax ID and purchase order if it has them, and the currency it would rather pay in (plans are priced in USD). Sloose’s billing team is mailed and sets it up with the organisation; until then the request is invoiceRequest on the billing summary. One open request at a time: asked again while one is open, the answer is 409 INVOICE_REQUEST_OPEN with that request, and from an organisation billed by invoice already, 409 ALREADY_INVOICED. Written down on Plan’s history as plan.invoiceRequested.
Session only: billing is a person’s to manage, never an organisation’s API token’s (D5).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation id the session was issued for. A token for one organisation can never read another.
Example
org_9f3cThe organisation id the session was issued for. A token for one organisation can never read another.
Request Bodyrequired
Section titled “Request Bodyrequired”object
USD when not given.
Responses
Section titled “Responses”Asked: the billing team is told. The request as it stands once made — billed, mailing nobody, when the organisation was billed by invoice in that moment.
object
object
This request’s own place among the organisation’s requests (#1478, #1532): how many the organisation had made up to and including it, in the order they were made. It never moves, whatever is declined or made after it. A page compares it with the billing summary’s invoiceRequestsMade, the organisation’s total: fewer there, and the summary was read before this request was made; as many, after it; more, after another was made since.
Example
{ "request": { "status": "open" }}A request this cannot take.
object
Examplegenerated
{ "error": "example"}No bearer, or one that no longer resolves: a session that is unknown or expired (code: AUTH_REQUIRED), or an API token that was revoked or expired (TOKEN_REVOKED, TOKEN_EXPIRED), whose organisation is gone (ORG_NOT_FOUND) or whose member or user row is (MEMBERSHIP_GONE).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The bearer’s role is too low, it was issued for a different organisation, it is an API token (SESSION_REQUIRED), or it is a staff member’s view of the organisation (IMPERSONATION_REFUSED). Like every route behind a session: a session signed in but in no organisation is refused code: NO_ORG, a banned person code: BANNED, and a closed organisation code: ORG_CLOSED.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}A request is open already (INVOICE_REQUEST_OPEN, that request), or the organisation is billed by invoice already (ALREADY_INVOICED). Nothing new was made.
object
Example
{ "code": "INVOICE_REQUEST_OPEN", "request": { "status": "open" }}The restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.
object
Example
{ "code": "MAINTENANCE"}Headers
Section titled “Headers”Seconds until asking again is worth it (300 while the switch is on).