CommerceCart & Checkout API
Cart & Checkout API
REST endpoints for customer carts, server-side pricing verification, and atomic checkout submission.
Public Cart & Checkout Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/commerce/cart | Retrieve the active shopper's cart (via member auth or cart session cookie). |
POST | /api/v1/commerce/cart/items | Add a SKU/variant to cart. Prices are always calculated server-side. |
DELETE | /api/v1/commerce/cart/items/{id} | Remove a line item from the cart. |
GET | /api/v1/commerce/stock/{variantID} | Check real-time available and reserved inventory for a variant. |
GET | /api/v1/commerce/currencies | List supported display currencies and configured exchange rates. |
GET | /api/v1/commerce/checkout-config | Retrieve active payment providers, shipping rules, and tax settings. |
POST | /api/v1/commerce/checkout | Place order from current cart. Supports idempotency_key in the JSON body (returns 409 Conflict if reused with a different cart). |
GET | /api/v1/commerce/orders/{id} | Inspect placed order status, items, and tracking info (owner only). |
POST | /api/v1/commerce/orders/{id}/payment | Initiate payment session or retry payment for an existing unpaid order. |
Server-Side Price Integrity
The client never specifies prices. When calling
POST /api/v1/commerce/cart/items, the frontend sends only {variant_id, quantity}. HydroGo inspects the database catalog, verifies active promotional rules, and calculates line totals server-side.Idempotent Checkout Example
BASH
curl -X POST https://cms.example.com/api/v1/commerce/checkout \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 8a7f92b4-5c1e-43a9-b36d-1092837465ab" \
-d '{
"customer": {
"name": "Ahmet Yılmaz",
"email": "[email protected]",
"phone": "+905551234567"
},
"shipping_address": {
"address_line1": "Büyükdere Cad. No: 122",
"city": "İstanbul",
"district": "Şişli",
"postal_code": "34394",
"country": "TR"
},
"payment_method": "card"
}'Catalog reads & Admin screens
Public product catalog reads use the collection endpoint GET /api/v1/content/products (the products collection must have public: true in its YAML schema). In the admin panel, commerce views live under /admin/commerce (orders, products, inventory reservations, discounts, and reconciliation).
Admin Commerce API
Requires admin.commerce.read or admin.commerce.write permissions:
| Method | Endpoint | Purpose |
|---|---|---|
GET | /api/v1/admin/commerce/orders | Search, filter, and paginate through customer orders. |
GET | /api/v1/admin/commerce/orders/{id} | Detailed order breakdown with line items and audit log. |
GET | /api/v1/admin/commerce/stock | Overview of inventory levels across all catalog variants. |
POST | /api/v1/admin/commerce/stock | Adjust physical stock count or trigger inventory replenishment. |
POST | /api/v1/admin/commerce/discount-codes | Create percentage or fixed-amount promotional voucher codes. |
POST | /api/v1/admin/commerce/orders/{id}/shipment | Mark an order as dispatched and attach tracking details. |