Skip to content

Generate invoice from cart items

POST
/cart/checkout/invoice

Parameters

Header Parameters

token
required
string

Authentication token for the user session

Request Body required

object
products
required
Array<object>
object
id
required

Product ID from the database

integer
123
domain

Domain name when ordering a Domain product type

string
example.com
cycle
required

Billing cycle for the product

string
Allowed values: monthly quarterly semiannually annually biennially triennially
monthly
options

Configuration options for the product. Required for VPS/Dedicated servers (moduleId 2 or 5). All options must be provided for VPS services.

object
option1
One of:
number
option2
One of:
number
option3
One of:
number
option4
One of:
number
option5
One of:
number
option6
One of:
number
option7
One of:
number
option8
One of:
number
domain

Domain name for the service. Must contain only alphanumeric characters, dots, and hyphens. Cannot start or end with a dot.

string
/^[a-zA-Z0-9.-]+$/
myserver.example.com
password

Service password that must meet security requirements:

  • At least 8 characters long
  • Must contain at least 3 of the following: lowercase letter, uppercase letter, number, special character
string
>= 8 characters /^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*\d)(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]))([A-Za-z\d@#$%^&*\-_+=\[\]{}<>|\\:',.?/`~"();!]){8,}$/
SecurePass123!
type
required

Type of product being ordered

string
Allowed values: Hosting Domain
Hosting
couponcode

Optional coupon code to apply to the order

string
Example
{
"products": [
{
"id": 123,
"cycle": "monthly",
"type": "Hosting",
"options": {
"option1": 4,
"option2": 80,
"option3": 2,
"option4": 1,
"option5": 1,
"option6": "ubuntu",
"option7": "1gbit",
"option8": "AMS",
"domain": "example.com",
"password": "SecurePass123!"
}
}
],
"couponcode": "SAVE20"
}

Responses

200

Invoice successfully generated and order confirmation email sent

object
success
boolean
true
data
object
invoice_id

The ID of the generated invoice

integer
12345

400

Bad request - Various validation errors including:

  • No products in cart
  • Missing required fields for product configuration
  • Invalid product ID
  • Invalid product configuration (memory, storage, CPU, etc.)
  • Invalid domain format
  • Weak password
  • Invalid coupon code
  • Insufficient stock
object
success
boolean
message
string
Examples

Missing required fields

{
"success": false,
"message": "missing fields"
}

401

User is not authenticated or invalid token

object
success
boolean
message
string
Example
{
"success": false,
"message": "unauthenticated"
}

404

Product not found in database

object
success
boolean
message
string
Example
{
"success": false,
"message": "product not found"
}