Skip to content

Bill an org by invoice

POST
/billing/admin/orgs/{orgId}/invoice-billing
curl --request POST \
--url https://api.sloose.com/billing/admin/orgs/org_9f3c/invoice-billing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "planKey": "team", "interval": "month", "daysUntilDue": 1, "tax": "au_gst", "poNumber": "example", "reason": "example" }'

Backoffice route: a staff session, or ADMIN_TOKEN; never a customer’s session. Makes the org’s subscription billed by invoice (collection_method: send_invoice) on the plan and interval given, due daysUntilDue days after each invoice, with Australian GST at 10% on top (tax: au_gst) or no tax (none, a customer overseas). Dinode is the seller on these invoices: Stripe collects no tax, so the invoice charges only the tax chosen here. Every invoice names the seller (Dinode Pty Ltd, a custom field) and prints the account’s ABN, the bank details this deployment carries (INVOICE_PAYMENT_INSTRUCTIONS) and the PO number, if one is given; the first is issued, and so sent, at once. Its credits are granted as each invoice is issued, not when it is paid. Refused, as a Checkout is, while the org has a subscription — in its row or live at Stripe — and the org’s open plan Checkouts are closed first. Written down as org.invoice_billing with the reason.

orgId
required

The org id.

string
Example
org_9f3c

The org id.

Media typeapplication/json
object
planKey
string
Allowed values: team business enterprise
interval
string
Allowed values: month year
daysUntilDue

From 1 to 90; 30 when not given.

number
tax
string
Allowed values: au_gst none
poNumber
string | null
reason
string
key
additional properties

The subscription made, and its first invoice.

Media typeapplication/json
object
subscriptionId
required
string
invoice
required

The first invoice: open once issued and sent; a draft here could not be issued, and Stripe issues it once invoice.created has given it the bank details — held back while that fails, for up to three days. Check its status at Stripe.

object
id
required
string
number
required
string | null
status
required
string | null
total
required
number
currency
required
string
hostedInvoiceUrl
required
string | null
seller
required

Who sells on these invoices.

string
Examplegenerated
{
"subscriptionId": "example",
"invoice": {
"id": "example",
"number": "example",
"status": "example",
"total": 1,
"currency": "example",
"hostedInvoiceUrl": "example"
},
"seller": "example"
}

The request is not one this can make.

Media typeapplication/json
object
error
required
string
key
additional properties
Examplegenerated
{
"error": "example"
}

A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

A customer’s session, an API token, or no bearer at all — not staff, and not the ADMIN_TOKEN (code: ADMIN_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

No such org (ORG_NOT_FOUND).

Media typeapplication/json
object
error
required
string
code
required
string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

The org has a subscription already (ALREADY_SUBSCRIBED), it is closed (ORG_CLOSED: one closed while this was made has the subscription cancelled), or Stripe has no address to send invoices to (NO_BILLING_EMAIL).

Media typeapplication/json
object
error
required
string
code
required
string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

Stripe refused the request (PAYMENT_PROVIDER_REFUSED) — nothing was charged, though a step taken before the refusal stands: the org’s first Stripe customer, or an existing customer’s billing email brought up to date — or was unavailable (PAYMENT_PROVIDER_UNAVAILABLE: unreachable, failing or rate-limiting), which may or may not have gone through — check before retrying. Stripe’s own words are logged, not returned.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed values: PAYMENT_PROVIDER_REFUSED PAYMENT_PROVIDER_UNAVAILABLE
key
additional properties
Example
{
"code": "PAYMENT_PROVIDER_REFUSED"
}

This deployment cannot issue it: no bank details (INVOICE_NOT_CONFIGURED), no price for the plan and interval (PRICE_NOT_CONFIGURED), no GST rate (TAX_RATE_NOT_CONFIGURED), no ABN (ABN_NOT_CONFIGURED), or no Stripe (STRIPE_NOT_CONFIGURED).

Media typeapplication/json
object
error
required
string
code
required
string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

Report a problem with this page