Skip to content
Coritan Docs

Move an organization's deployment to usage billing

Move one of your organization's deployments from pay as you go or monthly per location to usage billing, after a preview built from its last 30 days.

View as Markdown

A deployment you order for your organization keeps the plan price it was ordered at, on pay as you go or monthly per location. Its owner's account pays for it. You can move it to usage billing, where it has no price of its own and is billed by the second for what it uses, after the month's included amounts (Usage rates). The move is one way.

You switch with the API. The dashboard has no button for it yet. Once the deployment is moved, its Billing tab shows how it is billed (How App Deployment is billed).

  • You need the Billing role or above in the organization. A member with a lower role is refused with 403.
  • The deployment must be the organization's own. A deployment your storefront sold to a customer keeps the price you set, and so does one of Coritan's own brands.
  • The owner's account pays, so what the move needs comes from the owner. A prepaid owner needs the first deposit for anything that runs an instance. A game server or a database needs the owner to have the Paid plan. Credit for unused days goes to the owner's credit balance.
  • The deployment's service must be active and not set to end.
  • Get an access token for the Organization API. How organizations work says which credential each API takes.

Send POST /orgs/{org_slug}/billing/deployments/{app_uuid}/switch with ?preview=1. It writes nothing. It answers what the last 30 days would have cost on usage billing, what the deployment paid, and when and how the move would happen.

Shell
curl -s -X POST "https://api.coritan.com/api/v1/orgs/acme/billing/deployments/$DEPLOYMENT_UUID/switch?preview=1" \
  -H "Authorization: Bearer $CORITAN_TOKEN"

Preview the move explains each field of the answer.

Send the same request without ?preview=1. The body takes when, for a deployment billed by the month or longer: renewal (the default) moves it when its paid period ends, and now moves it at once and credits its unused days, less the days Coritan keeps back, to the owner's credit balance. A deployment on pay as you go moves at once.

Shell
curl -s -X POST https://api.coritan.com/api/v1/orgs/acme/billing/deployments/$DEPLOYMENT_UUID/switch \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"when": "now"}'

The answer is the deployment's billing with a switch object, as Move the service describes. When the move happens says what each choice does to the renewal.

The deployment's billing_mode is usage. The move is in the organization's audit log with your name on it, and in the platform's too.

403
You have a role below Billing in the organization, or the owner's account has not made the first deposit (deposit_required).
402 with the code paid_plan_required
The deployment is a game server or a database, and the owner's account has no Paid plan.
404
The deployment is not the organization's own: it belongs to another organization, it is deleted, or your storefront sold it to a customer.
409
The deployment is already billed by use, runs at no charge, belongs to one of Coritan's own brands, is not billed yet, is not active, or already moves at its renewal. Troubleshooting lists each code.

API operations on this page

MethodPathWhat it does
POST/api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}/switchSwitch org deployment to usage