POST
/cart/checkout/invoice Generate invoice from cart items
Parameters
| Name | Type | In | Description |
|---|---|---|---|
token* | string | header | Authentication token for the user session |
Request Body
productsarrayRequiredcouponcodestringOptional coupon code to apply to the order
Response
200
400
401
404
successbooleandataobjectinvoice_idintegerThe ID of the generated invoice
Request
curl -X POST "https://api.royalehosting.net/cart/checkout/invoice" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-organization-id: YOUR_ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'Request
const response = await fetch("https://api.royalehosting.net/cart/checkout/invoice", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"x-organization-id": "YOUR_ORG_ID",
"Content-Type": "application/json",
},
body: JSON.stringify({
"products": [
{
"id": 123,
"domain": "example.com",
"cycle": "monthly",
"options": {
"option1": 4,
"option2": 80,
"option3": 2,
"option4": 1,
"option5": 1,
"option6": "ubuntu",
"option7": "1gbit",
"option8": "AMS",
"domain": "myserver.example.com",
"password": "SecurePass123!"
},
"type": "Hosting"
}
],
"couponcode": "string"
}),
});
const data = await response.json();Request
import requests
response = requests.post(
"https://api.royalehosting.net/cart/checkout/invoice",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"x-organization-id": "YOUR_ORG_ID",
}
)
print(response.json())Response
{
"success": true,
"data": {
"invoice_id": 12345
}
}