Skip to content
Coritan Docs

Organization API: Billing & Payouts: Billing

The 13 Organization API operations for billing.

View as Markdown

Part of Billing & Payouts.

Method Path Summary
PUT /api/v1/orgs/{org_slug}/billing/basis Switch what Coritan charges you for compute, from the 1st of next month
GET /api/v1/orgs/{org_slug}/billing/basis/preview What switching the billing basis would have meant over the last three months
GET /api/v1/orgs/{org_slug}/billing/cut Get platform cut
GET /api/v1/orgs/{org_slug}/billing/paynow Get paynow status
PUT /api/v1/orgs/{org_slug}/billing/paynow Save org-owned PayNow store credentials (owngateway / hybrid)
GET /api/v1/orgs/{org_slug}/billing/paynow/affiliates List paynow affiliates
POST /api/v1/orgs/{org_slug}/billing/paynow/affiliates Create paynow affiliate
GET /api/v1/orgs/{org_slug}/billing/paynow/giftcards List paynow giftcards
POST /api/v1/orgs/{org_slug}/billing/paynow/giftcards Create paynow giftcard
GET /api/v1/orgs/{org_slug}/billing/paynow/subscriptions List paynow subscriptions
POST /api/v1/orgs/{org_slug}/billing/paynow/subscriptions/{subscription_id}/cancel Cancel paynow subscription
PUT /api/v1/orgs/{org_slug}/billing/usage-budget Set the most your customers' compute use may cost you in a month, or remove it
GET /api/v1/orgs/{org_slug}/billing/usage-cost What your customers' compute use cost you in a month, by product and by customer

Switch what Coritan charges you for compute, from the 1st of next month

Section titled Switch what Coritan charges you for compute, from the 1st of next month

PUT /api/v1/orgs/{org_slug}/billing/basis

Switch what Coritan charges you for compute, from the 1st of next month.

Send usage to pay wholesale rates on what your customers' servers use, or plans to pay wholesale on each plan they pay for. The change takes effect on the 1st of next month at midnight UTC, so no month mixes the two, and running servers are not touched. The answer is the basis in force now and the switch still to come in pending. Sending the basis you are on cancels a switch that has not happened yet. Look at GET /billing/basis/preview first.

Only the organization's owner can do this, and it is recorded in the audit log. Any other member gets 403, and Coritan's own organizations 409. A basis other than plans or usage answers 422.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
basis string, one of plans, usage yes usage to pay wholesale rates on what your customers' servers use, plans to pay wholesale on each plan they pay for.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
basis string The basis in force now.
pending BasisPending or null The switch that takes effect on the 1st of next month, or null.
pending.basis string The basis the organization moves to: plans or usage.
pending.effective_at string When it takes effect: midnight UTC on the 1st of a month, as an ISO 8601 time.

What switching the billing basis would have meant over the last three months

Section titled What switching the billing basis would have meant over the last three months

GET /api/v1/orgs/{org_slug}/billing/basis/preview

What switching the billing basis would have meant over the last three months.

On the plans basis you pay Coritan wholesale on each compute plan your customers pay for, however much they use. On the usage basis you pay wholesale rates on what their servers use instead, and nothing on the plan lines of compute plans. Each month shows both figures in US dollars: plan_wholesale is what Coritan charged on compute plans and usage_estimate what the same customers' use would have cost.

Until we have three months of readings, a month without any assumes every server runs all month and uses 10% of its CPU. assumed is then true and assumption says so. effective_at is when a switch asked for now would start: the 1st of next month, so no month mixes the two. pending shows a switch you already asked for. Billing, admins and the owner. Coritan's own organizations have no basis to switch and answer 409.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
current string The basis the organization is on now: plans or usage.
months array of BasisMonth The last three complete months, oldest first.
months[].month string The month, as YYYY-MM.
months[].plan_wholesale string What Coritan charged on your compute plans that month, in US dollars.
months[].usage_estimate string What your customers' servers would have cost at wholesale usage rates, in US dollars.
assumed boolean True when a month had no readings of its own and was estimated.
assumption string or null How an estimated month was worked out, or null when every month is measured.
effective_at string When a switch asked for now would take effect.
pending BasisPending or null A switch already asked for, when there is one.
pending.basis string The basis the organization moves to: plans or usage.
pending.effective_at string When it takes effect: midnight UTC on the 1st of a month, as an ISO 8601 time.

GET /api/v1/orgs/{org_slug}/billing/cut

What the organization pays the platform: the tiers, this month so far, the closed months and what the next hosting payout would settle.

this_month is the dict the admin console shows for the organization (volume in USD so far, the rate it pays now). months are the last twelve closed months, newest first. settlement is the preview of the next payout's window up to the start of this month, as the admin console's settlement preview answers it (it carries usage_total, the compute use charged, and earlier_shortfall, what it pays toward an earlier unpaid settlement invoice), or null when it cannot be worked out. payout is where that payout goes (_payout_destination). Coritan's own organizations are exempt: rate 0 and no wholesale. Billing, admins and the owner.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/billing/paynow

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Save org-owned PayNow store credentials (owngateway / hybrid)

Section titled Save org-owned PayNow store credentials (owngateway / hybrid)

PUT /api/v1/orgs/{org_slug}/billing/paynow

Save org-owned PayNow store credentials (own_gateway / hybrid).

platform_fee_bps is refused with 422: the store sets no platform fee, since the platform cut on its money is settled monthly with the hosting settlement.

Name In Type Required
org_slug path string yes

application/json (required)

Type: Body.

Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/billing/paynow/affiliates

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/billing/paynow/affiliates

Name In Type Required
org_slug path string yes

application/json (required)

Type: Body.

Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/billing/paynow/giftcards

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/billing/paynow/giftcards

Name In Type Required
org_slug path string yes

application/json (required)

Type: Body.

Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/billing/paynow/subscriptions

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/billing/paynow/subscriptions/{subscription_id}/cancel

Name In Type Required
subscription_id path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Set the most your customers' compute use may cost you in a month, or remove it

Section titled Set the most your customers' compute use may cost you in a month, or remove it

PUT /api/v1/orgs/{org_slug}/billing/usage-budget

Set the most your customers' compute use may cost you in a month, or remove it.

Send amount in US dollars as text ("100.00"), or null to remove the budget. The budget does not limit what customers run. We tell you at 80% and at 100% of it with a billing.usage_budget webhook (threshold, spent, amount, month), once a month each, and at 100% we pause new orders until you raise the budget or the month turns. Servers that already run keep running. The answer shows the budget and this month's spend so far.

Billing, admins and the owner. An amount that is not more than zero answers 422.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
amount string or integer or number or null no The most you want your customers' use to cost in a month, in US dollars ("100.00"), or null to remove the budget.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
amount string or null The monthly budget in US dollars, or null when there is none.
spent string What your customers' use has cost this month so far, in US dollars.
percent number or null spent as a percentage of amount, or null with no budget.

What your customers' compute use cost you in a month, by product and by customer

Section titled What your customers' compute use cost you in a month, by product and by customer

GET /api/v1/orgs/{org_slug}/billing/usage-cost

What your customers' compute use cost you in a month, by product and by customer.

On the usage basis Coritan charges wholesale rates on what your customers' servers use. This report adds that up in US dollars: totals.usage_wholesale is what you pay, totals.list what the same use costs at Coritan's list rates, totals.retail_revenue what the customers' plans bring in for the days their servers ran, and totals.margin the revenue less the usage, before the platform cut. by_product and by_customer split them. by_customer lists the limit customers with the worst margin first, and loses_money marks one whose use costs more than it pays. customers counts them all. budget is your monthly budget with the spend for the month asked, or null, and hold says whether new orders are paused.

A customer on a flat plan sees none of this, because it is your cost, so there is no portal route for it. Billing, admins and the owner. An organization on the plans basis has no usage rows and answers zeros.

Name In Type Required Description
org_slug path string yes
month query string or null no The month as YYYY-MM, in UTC. This month so far when left out.
limit query integer no How many customers by_customer lists, worst margin first. Default: 100.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.