Orders V2

Create a new order with variant-specific items

Creates an order by:

  1. Validating variant availability for each item
  2. Creating order record in V1 orders table
  3. Creating market_orders entries (V1 compatibility)
  4. Creating order_market_items_v2 entries with variant tracking
  5. Snapshotting variant prices at purchase time
  6. Allocating stock from variant-specific lots
  7. Notifying seller of new order

Uses database transaction for atomicity to ensure all-or-nothing behavior. Stock allocation uses listing_item_lots directly (V2).

Requirements:

  • 25.1: POST /api/v2/orders endpoint
  • 25.2: Accept array of items with listing_id, variant_id, quantity
  • 25.3: Validate variant availability before order creation
  • 25.4: Use variant-specific pricing in order calculations
  • 25.5: Allocate stock from correct variant's stock lots
  • 25.6: Use database transaction for atomicity
  • 25.7: Snapshot variant prices at time of order creation
  • 25.8: Prevent ordering unavailable variants with descriptive error
  • 25.9: Create order_market_items_v2 entries for each item
  • 25.10: Return order_id and order details on success
  • 25.11: Notify seller of new order
  • 25.12: Log order creation to Audit_Trail
post/orders

Request

  • Base URL: /api/v2 (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/v2/orders
  • Auth: loggedin (a scheme the document does not define)

Request body

Response

Created order with order_id and item details

order_idstring required

UUID of the created order

buyer_idstring required

UUID of the buyer

shop_idstring required

Shop ID of the seller

total_pricenumber double required

Total price in aUEC (atomic units)

statusstring required

Order status

created_atstring required

ISO 8601 timestamp of order creation

Changes

    • ▲

      removed the required property from the response with the status

    • ○

      added the required property to the response with the status