API Reference
Orders API
Complete API reference for tracking purchases, sales history, and transaction details.
Base URL
http://localhost:5000/api/ordersAuthentication
All order endpoints require authentication:
Authorization: Bearer YOUR_JWT_TOKENGET /my-orders
Get all orders (purchases) for authenticated user.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | number | 1 | Page number |
limit | number | 20 | Items per page (max: 100) |
status | string | all | completed, pending, failed |
Example Request
curl -X GET "http://localhost:5000/api/orders/my-orders?page=1&limit=10" \\
-H "Authorization: Bearer YOUR_JWT_TOKEN"Success Response (200 OK)
{
"success": true,
"data": {
"orders": [
{
"id": "ord_H8dN3K2mL9jP",
"product": {
"id": "507f1f77bcf86cd799439011",
"title": "React Advanced Course",
"thumbnail": "https://cdn.contentsellify.com/thumbnails/course1.jpg",
"price": 1999
},
"seller": {
"id": "507f1f77bcf86cd799439012",
"name": "Swapnil Shelke"
},
"amount": 1999,
"status": "completed",
"paymentId": "pay_ABC123XYZ789",
"downloadUrl": "https://cdn.contentsellify.com/downloads/secure/abc123",
"purchasedAt": "2026-02-05T10:30:00.000Z"
}
],
"pagination": {
"currentPage": 1,
"totalPages": 3,
"totalItems": 28,
"itemsPerPage": 10
}
}
}GET /my-sales
Get all sales for authenticated seller.
Example Request
curl -X GET "http://localhost:5000/api/orders/my-sales?page=1" \\
-H "Authorization: Bearer YOUR_JWT_TOKEN"Success Response (200 OK)
{
"success": true,
"data": {
"sales": [
{
"id": "ord_H8dN3K2mL9jP",
"product": {
"id": "507f1f77bcf86cd799439011",
"title": "React Advanced Course"
},
"buyer": {
"name": "John Doe",
"email": "john@example.com"
},
"amount": 1999,
"platformFee": 200,
"earnings": 1799,
"status": "completed",
"purchasedAt": "2026-02-05T10:30:00.000Z"
}
],
"summary": {
"totalSales": 150,
"totalRevenue": 299850,
"totalEarnings": 269865
}
}
}GET /:orderId
Get detailed information about a specific order.
Example Request
curl -X GET http://localhost:5000/api/orders/ord_H8dN3K2mL9jP \\
-H "Authorization: Bearer YOUR_JWT_TOKEN"Success Response (200 OK)
{
"success": true,
"data": {
"id": "ord_H8dN3K2mL9jP",
"product": {
"id": "507f1f77bcf86cd799439011",
"title": "React Advanced Course",
"price": 1999
},
"seller": {
"name": "Swapnil Shelke",
"email": "swapnil@example.com"
},
"pricing": {
"amount": 1999,
"platformFee": 200,
"sellerEarnings": 1799
},
"payment": {
"paymentId": "pay_ABC123XYZ789",
"method": "upi",
"status": "captured"
},
"download": {
"url": "https://cdn.contentsellify.com/downloads/secure/abc123",
"expiresAt": "2026-02-12T10:30:00.000Z"
},
"status": "completed",
"purchasedAt": "2026-02-05T10:30:00.000Z"
}
}Order Status Codes
completed
Payment successful, product accessible for download
pending
Payment initiated but not yet confirmed
failed
Payment failed or declined