Skip to main content
HydroGo
CommerceCart & Checkout API

Cart & Checkout API

REST endpoints for customer carts, server-side pricing verification, and atomic checkout submission.

Public Cart & Checkout Endpoints

MethodEndpointDescription
GET/api/v1/commerce/cartRetrieve the active shopper's cart (via member auth or cart session cookie).
POST/api/v1/commerce/cart/itemsAdd 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/currenciesList supported display currencies and configured exchange rates.
GET/api/v1/commerce/checkout-configRetrieve active payment providers, shipping rules, and tax settings.
POST/api/v1/commerce/checkoutPlace 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}/paymentInitiate 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:

MethodEndpointPurpose
GET/api/v1/admin/commerce/ordersSearch, 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/stockOverview of inventory levels across all catalog variants.
POST/api/v1/admin/commerce/stockAdjust physical stock count or trigger inventory replenishment.
POST/api/v1/admin/commerce/discount-codesCreate percentage or fixed-amount promotional voucher codes.
POST/api/v1/admin/commerce/orders/{id}/shipmentMark an order as dispatched and attach tracking details.