Generate invoice from cart items
POST /cart/checkout/invoice
Parameters
Header Parameters
Authentication token for the user session
Request Body required
object
object
Product ID from the database
123
Domain name when ordering a Domain product type
example.com
Billing cycle for the product
monthly
Configuration options for the product. Required for VPS/Dedicated servers (moduleId 2 or 5). All options must be provided for VPS services.
object
Domain name for the service. Must contain only alphanumeric characters, dots, and hyphens. Cannot start or end with a dot.
myserver.example.com
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
SecurePass123!
Type of product being ordered
Hosting
Optional coupon code to apply to the order
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
true
object
The ID of the generated invoice
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
Examples
Missing required fields
{ "success": false, "message": "missing fields"}
Product not found
{ "success": false, "message": "product not found"}
Weak password
{ "success": false, "message": "VPS Server is configured with a weak password, please check your cart"}
Invalid coupon code
{ "success": false, "message": "invalid coupon code"}
Insufficient stock
{ "success": false, "message": "Not enough stock available"}
401
User is not authenticated or invalid token
object
Example
{ "success": false, "message": "unauthenticated"}
404
Product not found in database
object
Example
{ "success": false, "message": "product not found"}