Documentation Index
Fetch the complete documentation index at: https://mintlify.com/peLuis123/crypto-shop-backend/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/orders
Creates a new order for the authenticated user. Only one pending order is allowed per user at a time.Authentication
Requires JWT authentication token in the Authorization header.Request Body
Response
Indicates if the order was created successfully
Success message
The created order object
Order MongoDB ObjectId
Human-readable order ID (format: #TRX-)
Array of ordered products with details
Sum of all product prices
TRC-20 network fee (-0.01 TRX)
Total amount to pay (subtotal + networkFee)
Order status (always ‘pending’ for new orders)
TRC-20 wallet address where payment should be sent
ISO 8601 timestamp of order creation
Order Status Flow
When created, orders start in thepending state. The possible states are:
- pending - Order created, awaiting payment
- completed - Payment confirmed and order fulfilled
- failed - Payment transaction failed
- cancelled - Order cancelled by user or system
- refunded - Payment refunded to user
Error Responses
400 Bad RequestExample Request
Example Response
Important Notes
- Users can only have one pending order at a time
- Product stock is validated before order creation
- The network fee is fixed at -0.01 TRX
- The merchant address is determined from the admin user’s wallet or environment variable
- User must have a configured wallet to create orders