[POST] /order/create-customer-order
This API allows you to create a new customer order.Authentication
All endpoints require an API key to be sent in the request headers:
x-api-key: your-api-key
Base URLs
Staging
https://staging-totalcare.c2certification.com/api/partner/order/create-customer-order
Live
https://totalcare.c2certification.com/api/partner/order/create-customer-order
Endpoints
Create Customer Order
POST
Creates a new customer order with basic customer information.
Request Body:
{
"referrer_id": "string", // Partner's unique referrer ID
"selectedProductId": "string", // Product ID being purchased
"c_email": "string", // Customer email
"c_name": "string", // Customer name
"c_phone": "string" // Customer phone
}
Required Fields:
referrer_idselectedProductIdc_emailc_namec_phone
Example Request:
curl -X POST 'https://staging-totalcare.c2certification.com/api/partner/order/create-customer-order' \
-H 'x-api-key: your-api-key' \
-H 'Content-Type: application/json' \
-d '{
"referrer_id": "partner123",
"selectedProductId": "product456",
"c_email": "customer@example.com",
"c_name": "John Doe",
"c_phone": "+1234567890"
}'
Success Response:
{
"success": true,
"orderId": "string", // Firestore document ID
"uuid": "string" // Unique identifier for the order
}
Status Code: 200
Error Responses:
401 Unauthorized
- Missing API key:
{
"success": false,
"error": "Missing API key"
}
- Invalid API key:
{
"success": false,
"error": "Invalid API key"
}
- Inactive API key:
{
"success": false,
"error": "API key is inactive"
}
- Wrong environment:
{
"success": false,
"error": "Invalid API key for [environment] environment"
}
400 Bad Request
- Missing required fields:
{
"success": false,
"error": "Missing required field: [field_name]"
}
- Invalid referrer ID:
{
"success": false,
"error": "Invalid referrer_id for this API key"
}
- Unauthorized product:
{
"success": false,
"error": "Product [product_id] is not allowed for this partner"
}
General Error Handling
All endpoints may return a 500 Internal Server Error if something goes wrong:
{
"success": false,
"error": "Internal server error"
}
Validation Rules
- API key must be valid and active
- API key must match the environment (development/production)
- The
referrer_idin the payload must match the one associated with the API key - The
selectedProductIdmust be in the partner's allowed products list