Market --- email checkout (integrators)

Last updated: Nov 27, 2026Section: Integrations

Mailoo does not host your storefront. The Market integration gives you a catalog API, optional order APIs for a simple "cart snapshot → order by email" flow, and dashboard APIs for the project owner to list orders and change status.

Related: catalog read and attributes --- market-catalog-csv{.interpreted-text role="doc"} / market-catalog-external-api{.interpreted-text role="doc"}. OpenAPI --- https://api.mailoo.app/docs/v1.

Architecture

  • Cart / catalog cache: Keep cart state in the integrator site (e.g. localStorage or a client store). Refresh prices using ``GET /api/v1/market/.../effective-price?kind=...`` with the price kind key (or the same resolution rules) before submit so totals match the server. See market-catalog-external-api{.interpreted-text role="doc"} (Price kinds and effective price).
  • Secrets: All ``X-API-Key`` calls run from your server or BFF, never from public browser bundles.
  • Submit order: Your BFF **``POST``**s to Mailoo with ``market.order.submit``; Mailoo stores a line snapshot and resolved prices, sends a confirmation email to the buyer when that Market integration has outbound SMTP configured (dashboard Connection & settings → Outbound email (SMTP) --- same outboundMail as FORM/CONTACT integrations), and returns a one-time ``accessToken`` for read-only polling. Global platform SMTP (GLOBAL_SMTP_*) is not used for this email.
  • After submit: The buyer (or your SPA) can call ``GET /api/v1/market/public/orders/{orderId}?token=`` without an API key until the token expires. If the token is lost, the buyer only has the email and order id you surface in the UI.
  • Back office: The project owner uses Bearer routes under ``/api/v1/projects/{uid}/integrations/{id}/market/orders/...`` to list orders, read detail, and update status.

Create order (BFF)

  • ``POST {baseUrl}/api/v1/market/{projectUid}/integrations/{integrationId}/orders``
  • Headers: ``X-API-Key`` with ``market.order.submit`` (or FULL)
  • Body (JSON):
  • ``customerEmail`` (required) --- buyer address (normalized to lowercase)
  • ``items`` (required, non-empty) --- each item:
  • ``productId`` --- must be ``PUBLISHED`` in this integration
  • ``priceKindId`` or ``priceKindKey`` (exactly one) --- the price kind. Prefer ``priceKindKey`` (e.g. base) for integrator config; ``priceKindId`` is the internal CUID if you already have it (e.g. from ``GET .../price-lists/...`` lines).
  • ``quantity`` --- positive decimal string (e.g. "2", "1.5")
  • ``variantId`` --- required if the product has variants, omitted (or null) if it has none
  • ``measurementUnitId`` --- optional; defaults to the product's default + effective-price resolution rules
  • ``note``, ``metadata`` --- optional (integrator-defined)
  • ``shippingMethodId``, ``address`` --- optional until a shipping profile exists on the Market integration. When the profile is configured: required together unless optional place is enabled and both are omitted. ``address``: ``country`` (ISO alpha-2), ``location`` (yerevan / other for AM, otherwise null), ``street``, ``name``, ``phone``. ClientshippingAmount** is rejected.

Response (201): ``data.id``, ``data.status`` (starts as NEW), ``data.accessToken`` (store only in the buyer session / return to the client for UX), ``data.accessExpiresAt``, ``data.totalAmount``, ``data.currency``, ``data.shippingAmount``, ``data.shipping`` (immutable snapshot: quoted with amount, or excluded with notice CALCULATED_WITHOUT_DELIVERY when place was omitted or the method could not be priced), and ``data.emailToCustomer`` (whether integration outboundMail could send: SENT / FAILED / NOT_CONFIGURED).

Shipping quote (BFF)

  • ``POST {baseUrl}/api/v1/market/{projectUid}/integrations/{integrationId}/shipping-quotes``
  • Headers: ``X-API-Key`` with ``market.shipping.quote`` (or FULL) --- do not reuse ``market.order.submit`` alone
  • Body: cart ``items`` (same shape as order create, no prices) plus optional ``country`` / ``location``
  • Response: ``configured`` (true when a MarketShippingSettings row exists; otherwise ``false`` --- still 200, not 404), ``optional``, ``zone``, ``offers`` (ready methods with amounts only), ``unavailable`` (named reasons such as PROVIDER_NOT_READY, QUOTE_ON_REQUEST, CURRENCY_MISMATCH), and ``notice`` CALCULATED_WITHOUT_DELIVERY when place is omitted or no offer has an amount. When ``configured`` is ``false``: ``optional`` is ``false``, ``zone`` / ``notice`` / ``noticeMessage`` are ``null``, ``offers`` and ``unavailable`` are empty.

Zones: AM + yerevan → yerevan; AM + other → armenia; any other country → world. Provider port currently registers only ``manual``. Snapshot on the order does not change if a method's tariff is edited later.

Public read (buyer)

  • ``GET {baseUrl}/api/v1/market/public/orders/{orderId}?token={accessToken}``
  • Or ``X-Market-Order-Token: {accessToken}``
  • No ``X-API-Key``. Invalid/missing token returns 404 (same as unknown order) to avoid leaking existence.

Token TTL defaults to 72 hours; the API may set ``MARKET_ORDER_ACCESS_TOKEN_TTL_HOURS`` (1--720) on the Mailoo host.

Signed-in shopper order list

When Market customer auth is enabled, a verified shopper can list their orders for this integration (including guest checkouts placed with the same email before sign-in):

  • ``GET {baseUrl}/api/v1/market/{projectUid}/integrations/{integrationId}/me/orders``
  • Headers: ``X-API-Key`` with ``market.customer-auth`` (or FULL) and ``Authorization: Bearer`` (shopper access JWT from ``auth/verify`` / ``auth/refresh``)
  • Behaviour: On each call Mailoo links unmatched rows where ``customerEmail`` equals the signed-in customer email (both stored trimmed lowercase) by setting ``customerId``, then returns those orders newest first. Order id is the public number; response includes status, amounts, line snapshots --- no access token or SMTP fields.
  • Guest ``POST .../orders`` is unchanged (``market.order.submit`` only); linking happens on this list endpoint.

Owner dashboard (JWT)

Authenticated routes (summary):

  • ``GET .../market/orders`` --- list (optional ``limit`` query, max 100)
  • ``GET .../market/orders/{orderId}`` --- full snapshot + line ``attributesSnapshot``
  • ``PATCH .../market/orders/{orderId}`` --- ``{ "status": "...", "note"?: "..." }`` (status transitions: terminal states ``REJECTED``, ``FULFILLED``, ``CANCELLED`` cannot move to a different status)
  • ``GET .../market/orders/{orderId}/status-events`` --- audit trail

Statuses: ``NEW``, ``PROCESSING``, ``CONFIRMED``, ``REJECTED``, ``FULFILLED``, ``CANCELLED``.

Scoping API keys

  • ``market.external-read`` --- only catalog **``GET``**s; use on a BFF that fetches product pages.
  • ``market.order.submit`` --- only ``POST .../orders``; can be a different restricted key on the checkout BFF.
  • ``market.shipping.quote`` --- only ``POST .../shipping-quotes``.
  • You may use one FULL key only in trusted backends; for least privilege, split read vs submit as above.

:::: note ::: title Note :::

The Mailoo dashboard is the admin console; customer-facing checkout runs on your site and calls Mailoo's public API the same way any third-party would. ::::