Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aluxey/E-Commerce/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
Authentication
Request Body
Array of cart items to purchase. Each item must include a variant ID.
Payment currency. Defaults to
eur (Euro).Response
Stripe payment intent client secret. Use this with Stripe.js to complete the payment on the frontend.
The created order ID. Use this to track the order status.
Error Codes
| Status Code | Error Message | Description |
|---|---|---|
401 | Unauthorized | Missing or invalid authentication token |
400 | Cart is empty | The cartItems array is empty or invalid |
400 | Chaque article doit inclure un variant_id. | One or more items missing variant_id |
400 | Variant {id} introuvable | Specified variant not found in database |
400 | Variant et produit incompatibles | Variant doesn’t belong to the specified item |
400 | Stock insuffisant pour un des variants | Insufficient stock for requested quantity |
400 | Invalid amount | Calculated total is zero or negative |
500 | Checkout failed | Internal server error during checkout |
Workflow
- Authentication: Validates user token
- Normalization: Normalizes cart item format
- Validation: Ensures all items have variants and cart is not empty
- Pricing: Fetches current prices from database
- Stock Check: Verifies sufficient stock for each variant
- Order Creation: Creates order record with
pendingstatus - Order Items: Inserts individual order items
- Payment Intent: Creates Stripe payment intent
- Update Order: Stores payment intent ID on order
- Response: Returns client secret for frontend payment completion
Example Request
Example Response
Using the Client Secret
After receiving theclientSecret, use it with Stripe.js to complete the payment:
Order Status Updates
Once the payment is processed, Stripe will send webhook events to update the order status:payment_intent.succeeded→ Order status updated topaidpayment_intent.payment_failed→ Order status updated tofailedpayment_intent.canceled→ Order status updated tocanceled
Notes
- All prices are calculated server-side from the database to prevent tampering
- Stock levels are validated before order creation
- Orders are created with
pendingstatus and updated via webhooks - The payment intent ID is stored on the order for tracking
- Failed order creation will not create a Stripe payment intent