Skip to main content
POST
Create Order
string
default:"purchase"
What the order is for. Possible values: purchase, renew, upgrade.
string
required
The plan slug being purchased, renewed or upgraded to.
integer
required
How many months to purchase.
string
An optional discount coupon code.
A renew order requires the target plan to match the account’s current plan; an upgrade order requires it to be strictly larger. Use type: "purchase" when there’s no active plan of that kind yet.

Response

object

Error Responses

string
The error code indicating the reason for failure. Possible values:
  • UNAUTHORIZED: The user is not authenticated.
  • USER_NOT_FOUND: The authenticated user was not found.
  • INVALID_PAYLOAD: The request body failed validation.
  • MISSING_PLAN_OR_MONTHS: plan or months is missing.
  • INVALID_MONTHS: The requested duration is not an accepted number of months.
  • INVALID_PLAN: The plan slug does not exist.
  • NOT_AN_UPGRADE: For type: "upgrade", the target plan is not larger than the current one.
  • PLAN_MISMATCH_FOR_RENEWAL: For type: "renew", the target plan does not match the current one.
  • PENDING_ORDER_LIMIT_REACHED: Too many unpaid orders already open.
  • INTERNAL_SERVER_ERROR: An unexpected server error occurred.