{"openapi":"3.1.0","info":{"title":"mflow commerce API","version":"1.0.0","description":"Self-serve commerce platform API. An operator (L2) manages its OWN store; a shopper buys through it. The API is the sole authority — every invariant (own-tenant isolation, the money/irreversibility firewall, the funding-before-fulfillment and compliance gates) is enforced server-side regardless of the client. AUTH: operators present an own-tenant, scoped M2M key `x-mflow-api-key: mfok_<ref>.<secret>` OR the human operator session cookie; shoppers present `x-mflow-guest-token` (minted at POST /auth/browse-token). FIREWALL: a `manage`-scoped key (what an AI agent holds) may freely do setup + non-money management (store, branding, catalog, pricing≥cost, drops, onboarding self-attest, CORS origins) but may NOT take-store-live-in-production — that scope-gated action needs the operator session or a `full`-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE). Minting/rotating/deleting/listing operator keys (and /operator/me) is SESSION-ONLY — NO key passes, manage or full (⇒ 401 OPERATOR_UNAUTHENTICATED); a key-holder self-checks via /operator/whoami. Refunds require the admin session plus a money-signing artifact and are not operator-key-facing; there is no store-deletion route. HEADLESS: a self-hosted storefront needs only the guest-token handshake + a registered CORS origin (no per-tenant base host, no custom domain). See docs/API.md + docs/HEADLESS.md."},"servers":[{"url":"https://api.fuxitrading.com","description":"production"},{"url":"http://127.0.0.1:8080","description":"local"}],"tags":[{"name":"operator","description":"Operator (L2) management surface — own-tenant, key- or session-authenticated."},{"name":"storefront","description":"Public commerce surface — shoppers use a guest token; reads are open per tenant."},{"name":"webhooks","description":"Provider → API deliveries (signature-authenticated). Documented for integrators and ops; never called by a client."}],"x-mflow-auth":{"operatorKey":{"header":"x-mflow-api-key","format":"mfok_<24hex>.<secret>","ownTenant":true,"scopes":["manage","full"]},"operatorSession":{"cookie":"mflow_operator_session","note":"human operator; full authority"},"guestToken":{"header":"x-mflow-guest-token","mint":"POST /auth/browse-token","ttlHours":24}},"x-mflow-firewall":{"summary":"What an operator M2M key may NOT do — enforced server-side regardless of client. TWO distinct refusal modes an AI must not conflate.","scopeGated":{"note":"Money/irreversible: a `full`-scoped key OR the human session passes; a `manage` key is refused.","status":403,"refusalCode":"OPERATOR_KEY_INSUFFICIENT_SCOPE","actions":["take-store-live-in-production (POST /operator/self-serve/go-live)"]},"sessionOnly":{"note":"NO M2M key passes (manage OR full) — only the human operator session cookie. A full key does NOT help.","status":401,"refusalCode":"OPERATOR_UNAUTHENTICATED","actions":["minting/rotating/deleting/listing operator keys (/operator/keys*)","GET /operator/me"]},"moneySigned":{"note":"Refunds require the admin session AND the money-signing artifact (refund HMAC); payouts/settlement are not operator-key-facing at all.","actions":["refunds","payouts/settlement"]},"note":"There is no store-deletion route. Non-money management (store/branding/catalog/pricing≥cost/drops/onboarding self-attest/CORS origins) is manage-key OK; a key-holder self-checks its posture via GET /operator/whoami."},"x-mflow-error-codes":["OPERATOR_UNAUTHENTICATED","OPERATOR_NOT_ACTIVE","OPERATOR_KEY_INSUFFICIENT_SCOPE","OPERATOR_INVALID_SCOPE","OPERATOR_NO_TENANT","OPERATOR_KEY_NOT_FOUND","OPERATOR_UNCONFIGURED","SELF_SERVE_DISABLED","SELF_SERVE_GO_LIVE_REFUSED","SELF_SERVE_PROCESSOR_NOT_VERIFIED","SELF_SERVE_NO_PAYMENT_ACCOUNT","TENANT_REQUIRED","ORDER_NOT_FOUND","PRICE_BELOW_COST","PRICING_INVALID_INPUT","ALLOCATION_NOT_FOUND","ALLOCATION_INSUFFICIENT_AVAILABLE","ALLOCATION_WINDOW_CLOSED","SKU_ALLOCATION_MISMATCH","SOLD_UNITS_SACROSANCT","TENANT_SCOPE_VIOLATION","SHOPPER_SCOPE_REQUIRED","RESERVATION_NOT_OWNED","TERMS_NOT_ACCEPTED","DELIVERY_ADDRESS_REQUIRED","CART_INVALID","DESTINATION_NOT_SUPPORTED","SHIPPING_UNAVAILABLE","SHIPPING_METHOD_INVALID","CURRENCY_NOT_SUPPORTED","SKU_NOT_SHIPPABLE_TO_DESTINATION","CHECKOUT_BLOCKED","PAYMENT_CONFIG_MISSING","PAYMENT_NOT_FOUND","PAYMENT_PROVIDER_MISMATCH","PAYMENT_STATUS_UNAVAILABLE","INVALID_PAYMENT_METHOD","WALLET_RETURN_URL_INVALID","PAYMENT_METHOD_UNAVAILABLE","TAX_POSTURE_REQUIRED","WALLET_HOLD_UNAVAILABLE","WALLET_PROVIDER_REFUSED","WALLET_PROVIDER_UNAVAILABLE","OPERATOR_INVALID_INPUT","PH_WALLET_RAIL_UNCONFIGURED","PH_WALLET_RAIL_DISABLED","PAYMENT_ACCOUNT_NOT_FOUND","PAYMENT_ACCOUNT_NOT_ELIGIBLE","PAYMENT_ACCOUNT_CONTACT_REQUIRED","PAYMENT_ACCOUNT_ALREADY_SUBMITTED","PAYMENT_ACCOUNT_READ_ONLY","PAYMENT_ACCOUNT_BUSINESS_TYPE_NOT_ELIGIBLE","PAYMENT_ACCOUNT_DETAILS_REQUIRED","PAYMENT_ACCOUNT_DOCUMENT_INVALID","PAYMENT_ACCOUNT_TAX_POSTURE_INVALID","PAYMENT_ACCOUNT_PROVIDER_REJECTED","PAYMENT_ACCOUNT_PROVIDER_BUSY","PAYMENT_ACCOUNT_PROVIDER_UNCONFIGURED","PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE","PAYMENT_ACCOUNT_NOT_REPLACEABLE","PAYMENT_ACCOUNT_WEBHOOK_NOT_REGISTERED","PAYMENT_ACCOUNT_WEBHOOK_OVERLAP_INVALID","PAYMENT_ACCOUNT_WEBHOOK_ROTATION_CONFLICT","PAYMENT_ACCOUNT_SANDBOX_STATIC_CHILD","PAYMENT_ACCOUNT_PROVIDER_CONFLICT","PAYMENT_ACCOUNT_CREATE_IN_PROGRESS","PAYMENT_ACCOUNT_DOCUMENT_REF_INVALID","PAYMENT_ACCOUNT_DOCUMENTS_REQUIRED","PAYMENT_DOCUMENTS_UNCONFIGURED","PAYMENT_DOCUMENT_INVALID","PAYMENT_DOCUMENT_EMPTY","PAYMENT_DOCUMENT_TOO_LARGE","PAYMENT_DOCUMENT_UNSUPPORTED_TYPE","PAYMENT_DOCUMENT_TYPE_MISMATCH","PAYMENT_DOCUMENT_VERSION_LIMIT","STORE_PAUSED_VOLUME_CAP","CATALOG_CURSOR_INVALID","PRODUCT_NOT_FOUND","TENANT_PARAM_REFUSED","MEDIA_STORE_UNCONFIGURED","BULK_CONFIG_MISSING","LOT_NOT_LISTED","LOT_PAUSED","LOT_CURRENCY_MISMATCH","BULK_BELOW_MIN","BULK_PRICE_MOVED","BULK_BUYER_IDENTITY_REQUIRED","BULK_SKU_NOT_ADMITTED","VENDOR_ACCOUNT_NOT_READY","BULK_INVALID_INPUT","BULK_UNCONFIGURED","BULK_LOT_NOT_FOUND","ALLOCATION_REMAINDER_BELOW_FLOOR","VELOCITY_LIMITED","BULK_NOT_AVAILABLE","BULK_LISTING_NOT_AVAILABLE","BULK_REF_INVALID","BULK_CURRENCY_MISMATCH","BULK_ANCHOR_QTY_MISMATCH","BULK_ALLOCATION_NOT_ACTIVE","BULK_RESTOCK_DRIFT","BULK_SCHEDULE_INVALID","BULK_SCHEDULE_ANCHOR_MISSING","BULK_SCHEDULE_TIERS_NOT_DECREASING","BULK_SCHEDULE_RATE_NOT_MONOTONE","BULK_SCHEDULE_MIN_BULK_INVALID","BULK_TIER_INVALID","BULK_QTY_INVALID","BULK_PRICE_OVERFLOW","POOL_BROWSE_INVALID_INPUT","POOL_BROWSE_CURSOR_INVALID","POOL_BROWSE_BATCH_TOO_LARGE","POOL_BROWSE_STORE_UNAVAILABLE","POOL_BROWSE_UNCONFIGURED","STORE_LISTING_INVALID_INPUT","STORE_LISTING_NOT_A_MEMBER","STORE_LISTING_NOT_ELIGIBLE","STORE_LISTING_STORE_UNAVAILABLE","STORE_PRICING_INVALID_INPUT","STORE_PRICING_BELOW_BASIS","STORE_PRICING_NOT_A_MEMBER","STORE_PRICING_CROSS_STORE_READ","STORE_PRICING_STORE_UNAVAILABLE"],"paths":{"/auth/browse-token":{"post":{"tags":["storefront"],"summary":"Mint an ANONYMOUS guest browse token (zero PII, tenant+cart scope). No auth — the FIRST call a headless storefront makes; thereafter send the token as the x-mflow-guest-token header. Renew by re-minting. Send `cart:true` to get a CART-SCOPED token — the server MINTS an unforgeable cartRef and RETURNS it (use it as your hold contextRef); a client-supplied cartRef value is ignored. A hold requires a cart-scoped token.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrowseTokenRequest"}}}},"responses":{"201":{"description":"a fresh 24h tenant-bound guest token; cartRef is server-minted (or null for pure-browse)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrowseTokenResponse"}}}},"400":{"description":"invalid input (blank tenantId)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate limited (auth tier, 10/min) — back off and retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"browse tokens are not configured (MAGIC_LINK_SECRET unset)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/magic-link":{"post":{"tags":["storefront"],"summary":"Email a shopper a magic sign-in link (order lookup). The token travels via email — never in the response.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MagicLinkRequest"}}}},"responses":{"202":{"description":"accepted — the link was dispatched","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MagicLinkAck"}}}},"400":{"description":"email and tenantId are required / invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"could not deliver the sign-in link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"magic-link is not configured (MAGIC_LINK_SECRET unset)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/magic-link/verify":{"get":{"tags":["storefront"],"summary":"Verify a magic-link token (query ?token=…) → the guest principal for order lookup.","responses":{"200":{"description":"the verified guest principal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MagicLinkVerifyResponse"}}}},"401":{"description":"invalid or expired link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/signup":{"post":{"tags":["operator"],"summary":"Create a PENDING operator account (email+password).","responses":{"201":{"description":"success"},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"email taken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/verify":{"post":{"tags":["operator"],"summary":"Verify an email token → ACTIVE + operator session cookie.","responses":{"200":{"description":"success"},"401":{"description":"invalid/expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/login":{"post":{"tags":["operator"],"summary":"Password login → operator session cookie.","responses":{"200":{"description":"success"},"401":{"description":"invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/logout":{"post":{"tags":["operator"],"summary":"Clear the operator session cookie.","responses":{"204":{"description":"logged out"}}}},"/operator/me":{"get":{"tags":["operator"],"summary":"The authenticated operator + its bound tenant. SESSION-only — an M2M key ⇒ 401; a key-holder (AI) self-checks via GET /operator/whoami instead.","security":[{"OperatorSession":[]}],"x-mflow-auth-mode":"session-only","x-mflow-firewall":"session-only: NOT scope-gated — ANY operator key (manage or full) ⇒ 401 OPERATOR_UNAUTHENTICATED; requires the human operator session cookie","responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/keys":{"post":{"tags":["operator"],"summary":"Mint an own-tenant M2M key. Optional body.scope (manage|full). SESSION-only — a key (manage OR full) cannot mint a key ⇒ 401; only the human operator session can. Issue/rotate keys from the dashboard.","security":[{"OperatorSession":[]}],"x-mflow-auth-mode":"session-only","x-mflow-firewall":"session-only: NOT scope-gated — ANY operator key (manage or full) ⇒ 401 OPERATOR_UNAUTHENTICATED; requires the human operator session cookie","responses":{"201":{"description":"success"},"400":{"description":"invalid scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"no store linked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["operator"],"summary":"List own-tenant key prefixes + their scope (never a secret). SESSION-only — an M2M key ⇒ 401.","security":[{"OperatorSession":[]}],"x-mflow-auth-mode":"session-only","x-mflow-firewall":"session-only: NOT scope-gated — ANY operator key (manage or full) ⇒ 401 OPERATOR_UNAUTHENTICATED; requires the human operator session cookie","responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/keys/{credentialRef}/rotate":{"post":{"tags":["operator"],"summary":"Rotate an own-tenant key (successor inherits scope). SESSION-only — an M2M key ⇒ 401.","security":[{"OperatorSession":[]}],"x-mflow-auth-mode":"session-only","x-mflow-firewall":"session-only: NOT scope-gated — ANY operator key (manage or full) ⇒ 401 OPERATOR_UNAUTHENTICATED; requires the human operator session cookie","responses":{"201":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"no such key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/keys/{credentialRef}":{"delete":{"tags":["operator"],"summary":"Revoke an own-tenant key. SESSION-only — an M2M key ⇒ 401.","security":[{"OperatorSession":[]}],"x-mflow-auth-mode":"session-only","x-mflow-firewall":"session-only: NOT scope-gated — ANY operator key (manage or full) ⇒ 401 OPERATOR_UNAUTHENTICATED; requires the human operator session cookie","responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"no such key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/stores":{"post":{"tags":["operator"],"summary":"Create the operator’s OWN store (setup). SESSION-only — an M2M key ⇒ 401; a store is created in the browser (dashboard or the connector consent screen).","security":[{"OperatorSession":[]}],"x-mflow-auth-mode":"session-only","x-mflow-firewall":"session-only: NOT scope-gated — ANY operator key (manage or full) ⇒ 401 OPERATOR_UNAUTHENTICATED; requires the human operator session cookie","responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/store":{"get":{"tags":["operator"],"summary":"Read the own-tenant store config. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}},"patch":{"tags":["operator"],"summary":"Update own-tenant store branding/config. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/store/logo":{"post":{"tags":["operator"],"summary":"Upload the store logo. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/whoami":{"get":{"tags":["operator"],"summary":"Capability self-check for a key-holding AI — call this FIRST. Returns own tenant, auth method (key|session), and the money/irreversibility firewall posture (manageStore/configureCors yes; moveMoney/takeStoreLiveInProduction/issueOrRotateKeys only for a human session). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the caller’s own tenant + firewall posture","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorWhoami"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/store/origins":{"patch":{"tags":["operator"],"summary":"Replace the store’s browser CORS origin allowlist (own-tenant, ≤20 canonical https origins, no wildcard). A headless storefront registers its front-end origin here. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreOriginsBody"}}}},"responses":{"200":{"description":"the persisted allowlist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreOriginsResponse"}}}},"400":{"description":"origins must be canonical https origins (≤20, no wildcard/path/credentials)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"no store is linked to this operator yet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/store/domain":{"post":{"tags":["operator"],"summary":"Attach the operator’s OWN custom domain (Cloudflare-for-SaaS). Non-money management — manage key OK; GATED on the store already being LIVE. Headless self-hosted stores do NOT need a custom domain.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachCustomDomainBody"}}}},"responses":{"200":{"description":"idempotent re-attach of the same host","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainResponse"}}}},"201":{"description":"claimed (PENDING) — set the returned DNS records","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainResponse"}}}},"400":{"description":"host must be a well-formed FQDN, not a platform host","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"this store must be LIVE before it can attach a custom domain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"a different domain is already attached, or the host is already claimed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"the domain provider is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"custom domains are not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["operator"],"summary":"Read the current custom domain + verification status + the DNS records to display. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the current domain state (attached:false when none)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"no store is linked to this operator yet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"custom domains are not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["operator"],"summary":"Detach (release) the operator’s OWN custom domain. Own-tenant; idempotent. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"detached (or nothing was attached)"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"no store is linked to this operator yet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"custom domains are not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/store/domain/verify":{"post":{"tags":["operator"],"summary":"Re-read Cloudflare and, when the hostname is ACTIVE (DNS + TLS verified), flip it to served. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the verification result (served only when CF reports active)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"this store must be LIVE before it can verify a custom domain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no custom domain is attached to this store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"the domain provider is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"custom domains are not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/store/shipping":{"patch":{"tags":["operator"],"summary":"Author the store’s OWN per-destination flat shipping rates (full replacement; only configured destination countries; integer minor units, bounded). A fresh store has NONE and cannot quote checkout until this is set — see GET /operator/store setup.shippingConfigured. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/store/destinations":{"patch":{"tags":["operator"],"summary":"Set the ISO countries the store SELLS/ships to (tenant_payment_config.destination_countries; full replacement, non-empty, bounded 2-letter codes). A removed country’s stale shipping rate is pruned. Gates what a store can order and, in the pool, what it can list. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/store/storefront-mode":{"patch":{"tags":["operator"],"summary":"Set the store’s STOREFRONT MODE (tenant_branding.storefront_mode, migration 0080): hosted (indexable .mflow template, default) | headless (self-hosted SPA canonical; the hosted template noindexes + canonicals to canonicalUrl) | disabled (hosted retired; noindex + a \"moved\" notice — no hard redirect). Body {mode, canonicalUrl?}; canonicalUrl REQUIRED as a valid https URL when headless/disabled, cleared when hosted. PRESENTATION ONLY — one tenant = one catalog/pricing/orders/MoR, never a second data path; fully reversible. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/catalog":{"get":{"tags":["operator"],"summary":"List the operator’s ingested products + visibility. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/catalog/{productId}":{"patch":{"tags":["operator"],"summary":"Toggle a product’s store visibility (hide-only). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/catalog/media/health":{"get":{"tags":["operator"],"summary":"READ-ONLY media integrity report for the operator’s OWN catalogue: which product media KEYS do not resolve to an object. Ingest writes derived keys on faith and listability counts KEYS, NOT OBJECTS, so a product with dangling keys is fully listable and every presence check (imageUrl != null, jsonb_array_length(media) > 0) stays true while the storefront serves 404s. Each key is probed with a HEAD (no bytes). Reports counts plus a BOUNDED sample of {productId, key, reason MISSING|INVALID_KEY}; a probe that could not be completed is reported separately as indeterminate and is NEVER an offender (the repair for a dangling key deletes it). Covers BOTH halves of what this store lists: its own-tenant products AND (when the pool canary is on) the POOL products the storefront serves alongside them — those live in the vendor’s source-tenant book, are probed in that namespace, and are reported in a SEPARATE `pool` block because their repair belongs to the vendor. `scope` names each lane as examined / off / unavailable / deferred, so a lane nobody looked at never reads as a clean one. Own-tenant ONLY — a tenantId parameter is refused 400, not honoured. Bounded per request (products ≤ 250, 500 keys per lane) with the bound and a resume cursor in the body; no product is exempt from the key ceiling, and an oversized gallery is examined in part and named in `bounds.truncatedProductId` with its unexamined key count. Repair is a direct UPDATE of product.media — NEVER a re-ingest, which would double qty_allocated. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"parameters":[{"name":"products","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":250,"default":100},"description":"products walked this request (clamped)"},{"name":"sample","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":50,"default":20},"description":"offending {productId,key} pairs returned (clamped)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"keyset cursor = nextCursor from the prior page (omit for the first page)"}],"responses":{"200":{"description":"success"},"400":{"description":"TENANT_PARAM_REFUSED — this surface reports on the authenticated operator’s own catalogue; drop the tenantId parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"CATALOG_UNCONFIGURED (no catalog database) or MEDIA_STORE_UNCONFIGURED (the object store is unbound — an unprobeable catalogue is never reported as a healthy one)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/pool/browse":{"get":{"tags":["operator"],"summary":"BROWSE what is ON OFFER to this store from the shared vendor pools — the read that answers what the store does NOT yet sell (every other pool read starts from its own listings, so it can only answer \"what do I already sell\"). Returns HYDRATED offers: skuId, title, brand, category, condition grade, imageUrl (a SIGNED, time-bounded serving path for ONE hero image — NEVER a raw storage key; null when there is no served image, when the media lane is unbound, or when either the vendor’s or this store’s media kill-switch has tripped. A pooled product’s objects live in the VENDOR book, so the key is signed under sourceTenantId, not the browsing store), mediaCount, the SHARED frozen vendor basis + currency, vendorId/vendorName, poolId, sourceTenantId (the vendor book the media lives in), and whether THIS store already lists it (alreadyListed / listingIncluded: true=listed, false=hidden, null=never listed). Eligibility is EXACTLY the ceiling the listing opt-in enforces (ACTIVE membership x ACTIVE pool x authenticity OK x a non-empty geo intersection of the store destinations and the vendor ship-to set, all fail-closed) so nothing shown here can be refused when you list it. AVAILABILITY IS NOT A FILTER: an item with no stock lifted yet is RETURNED with available=null and stockState=NOT_YET_STOCKED — that is \"not yet stocked\", NOT \"sold out\"; the response carries an availabilityLegend naming all three states so a UI never renders an empty catalogue by reading a bare 0 as sold out. Filters: category (PREFIX over the dotted taxonomy — \"beauty.\" returns the whole family), vendorId, poolId, q (substring over title/brand). Keyset-paged (default 50, clamp 1..200); pass back page.nextCursor. Own-tenant ONLY: a tenantId parameter is REFUSED 400, never honoured. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"dotted-taxonomy category PREFIX; \"beauty\" and \"beauty.\" both return the whole beauty family (alias: categoryPrefix)"},{"name":"vendorId","in":"query","required":false,"schema":{"type":"string"},"description":"only offers from this vendor"},{"name":"poolId","in":"query","required":false,"schema":{"type":"string"},"description":"only offers from this pool (discover ids via GET /operator/pool/directory)"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"case-insensitive substring over product title and brand; wildcards are literal characters"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"page size (clamped)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"opaque keyset token = page.nextCursor from the prior page; omit for the first page"}],"responses":{"200":{"description":"a bounded page of hydrated pool offers","content":{"application/json":{"schema":{"type":"object","required":["tenantId","items","page","availabilityLegend"],"properties":{"tenantId":{"type":"string"},"items":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"poolId, poolName, vendorId, vendorName, sourceTenantId, productId, skuId, title, brand, category, vendorSku, variant, conditionGrade, imageUrl (a SIGNED hero serving path or null — never a raw storage key), mediaCount, sharedBasisMinor, basisCurrency, priceMinor (THIS store’s own price or null), available (null when nothing is stocked yet), activeAllocations, stockState, listingIncluded, alreadyListed"}},"page":{"type":"object","required":["limit","hasMore","nextCursor"],"properties":{"limit":{"type":"integer"},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"]}}},"availabilityLegend":{"type":"object","additionalProperties":true,"description":"what NOT_YET_STOCKED / IN_STOCK / OUT_OF_STOCK mean, shipped inline so a client cannot mistake an unstocked item for a sold-out one"}}}}}},"400":{"description":"TENANT_PARAM_REFUSED (this surface always acts on the caller’s own store — drop tenantId), POOL_BROWSE_CURSOR_INVALID (a present-but-undecodable cursor; omit it to restart) or POOL_BROWSE_INVALID_INPUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"POOL_BROWSE_UNCONFIGURED / POOL_BROWSE_STORE_UNAVAILABLE — the pool could not be read; an unreadable pool is never reported as an empty one","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/pool/directory":{"get":{"tags":["operator"],"summary":"The pools this store MAY BUY FROM — the only pool enumeration in the API. Every other pool read addresses a pool by id, so without this a poolId is undiscoverable and the browse/bulk surfaces are unreachable. Each entry carries poolId, poolName, vendorId, vendorName, skuCount (eligible offers for THIS store), listedCount (how many it already lists) and per-category counts for the dotted taxonomy, so a client can build a category tree and then narrow GET /operator/pool/browse. A pool appears only if at least one of its SKUs is actually offerable to this store (same fail-closed ceiling as browse), so a suspended pool or a vendor that cannot ship to this store’s destinations never shows. Own-tenant ONLY: a tenantId parameter is REFUSED 400. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"description":"pools returned (clamped)"}],"responses":{"200":{"description":"the pools this store may buy from","content":{"application/json":{"schema":{"type":"object","required":["tenantId","pools"],"properties":{"tenantId":{"type":"string"},"pools":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"poolId, poolName, vendorId, vendorName, skuCount, listedCount, categories[] of {category, count}"}}}}}}},"400":{"description":"TENANT_PARAM_REFUSED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"POOL_BROWSE_UNCONFIGURED / POOL_BROWSE_STORE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/pool/listings/bulk":{"post":{"tags":["operator"],"summary":"List (or hide) MANY pool SKUs in ONE call. Send EITHER items[] of {poolId, skuId} OR a selector {vendorId?, poolId?, categoryPrefix?, cursor?} (exactly one; a selector must narrow by at least one field), plus included (default true) and an optional price policy {markupBps} | {priceMinor} applied to each item that lists. Runs the SAME per-item write path as PUT /operator/pool/listings/{poolId}/{skuId} and POST /operator/pool/pricing/{poolId}/{skuId} — the same membership check, the same trust-admit + geo eligibility probe, the same HIDE-only upsert, the same shared-frozen-basis resolution and below-basis refusal — so a bulk call can never list something the single call would refuse. PARTIAL-FAILURE TOLERANT: one ineligible item never fails the batch; the response is 200 with a per-item outcome carrying the SAME error code the single-item route would have returned (e.g. STORE_LISTING_NOT_ELIGIBLE, STORE_PRICING_BELOW_BASIS), plus a summary. A price failure leaves the LISTING in place and is reported as outcomes[].priceError. IDEMPOTENT — both writes are upserts on (tenant, pool, sku), so replaying a batch converges. BOUND: at most 200 (pool, sku) pairs per call; an items[] longer than that is refused 400 POOL_BROWSE_BATCH_TOO_LARGE, while a selector matching more is applied to the first 200 and returns truncated=true + nextCursor to continue. Own-tenant ONLY: a tenantId in the body is REFUSED 400. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","maxItems":200,"items":{"type":"object","required":["poolId","skuId"],"properties":{"poolId":{"type":"string"},"skuId":{"type":"string"}}}},"selector":{"type":"object","properties":{"vendorId":{"type":"string"},"poolId":{"type":"string"},"categoryPrefix":{"type":"string"},"cursor":{"type":"string"}},"description":"at least one of vendorId / poolId / categoryPrefix; cursor continues a selector larger than the bound"},"included":{"type":"boolean","default":true,"description":"true = list (eligibility-gated); false = hide (always safe, and never carries a price)"},"price":{"type":"object","description":"exactly one of markupBps or priceMinor; refused alongside included=false","properties":{"markupBps":{"type":"integer","minimum":0,"maximum":100000},"priceMinor":{"type":"integer","minimum":0}}}}}}}},"responses":{"200":{"description":"the batch ran; every item is accounted for in outcomes[]","content":{"application/json":{"schema":{"type":"object","required":["tenantId","maxItems","summary","outcomes","truncated","nextCursor"],"properties":{"tenantId":{"type":"string"},"maxItems":{"type":"integer","description":"the per-call bound in force, echoed so a client never guesses it"},"summary":{"type":"object","additionalProperties":true,"description":"requested (distinct targets), listed, hidden, failed, priced, priceFailed"},"outcomes":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"poolId, skuId, ok, included, error{code,message}?, price{priceMinor,basisMinor,currency,markupBps}?, priceError{code,message}?"}},"truncated":{"type":"boolean"},"nextCursor":{"type":["string","null"]}}}}}},"400":{"description":"TENANT_PARAM_REFUSED, POOL_BROWSE_INVALID_INPUT (neither/both of items and selector, an unnarrowed selector, a price alongside included=false, or a bad item shape), POOL_BROWSE_CURSOR_INVALID, or POOL_BROWSE_BATCH_TOO_LARGE (items[] over the bound — the message names it)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"POOL_BROWSE_UNCONFIGURED, or POOL_BROWSE_STORE_UNAVAILABLE — the listing/pricing store went away mid-batch, which aborts rather than collecting N identical failures","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/pricing":{"get":{"tags":["operator"],"summary":"Read own-tenant pricing (markup + per-sku). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/pricing/markup":{"post":{"tags":["operator"],"summary":"Set the store-wide markup (price ≥ cost enforced server-side; below cost ⇒ 400 PRICE_BELOW_COST). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/pricing/skus/{skuId}":{"post":{"tags":["operator"],"summary":"Set a per-sku price (≥ cost; below cost ⇒ 400 PRICE_BELOW_COST). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/connect-account":{"post":{"tags":["operator"],"summary":"Create the Stripe connected account (a FULL/Standard-style, loss-bearing account — controller.losses.payments='stripe', NOT an Express dashboard) + hosted onboarding link. The L2 is the loss-bearer + merchant of record; L1 is not. Onboarding self-attest — manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}},"get":{"tags":["operator"],"summary":"Read the connected-account onboarding status. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/connect-account/refresh":{"post":{"tags":["operator"],"summary":"Refresh the hosted onboarding link. Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"success"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/self-serve/complete-kyb":{"post":{"tags":["operator"],"summary":"Record KYB/sanctions/BO from the store’s payment rail’s OWN verified merchant account — Stripe Connect, or the store’s PayMongo linked account (PH wallet rail) — env-gated (SELF_SERVE_SANDBOX_DETERMINATION + SELF_SERVE_ALLOW_IN_PRODUCTION). Records carry the rail’s provenance (e.g. provider paymongo-linked-account, refs paymongo-account:<org_…>). Onboarding self-attest — manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelfServeProviderRequest"}}}},"responses":{"200":{"description":"success"},"400":{"description":"SELF_SERVE_PROVIDER_INVALID, or SELF_SERVE_PROVIDER_REQUIRED (the store has both rails — name one)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"not found (flag off)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"SELF_SERVE_NO_PAYMENT_ACCOUNT, or SELF_SERVE_PROCESSOR_NOT_VERIFIED (PayMongo: reasons[] of ACCOUNT_NOT_ACTIVE, IDENTITY_NOT_VERIFIED, IDENTITY_ATTESTATION_FORM_ONLY, BUSINESS_TYPE_NOT_REGISTERED, WEBHOOK_NOT_REGISTERED, PROCESSOR_NOT_VERIFIED) — nothing is recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"SELF_SERVE_PROCESSOR_UNAVAILABLE — the rail could not be read","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/self-serve/go-live":{"post":{"tags":["operator"],"summary":"Take the store LIVE (irreversible). PRIVILEGED — a manage key ⇒ 403; needs the operator session or a full key. Determination prerequisites also enforced. The optional provider only labels the decision’s provenance (default: PayMongo for a store with a PayMongo account and no Stripe account, else Stripe).","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelfServeProviderRequest"}}}},"responses":{"200":{"description":"success"},"400":{"description":"SELF_SERVE_PROVIDER_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"not found (flag off)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"prerequisites incomplete","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"$ref":"#/components/responses/Unconfigured"}}}},"/operator/platform-fees/statements":{"get":{"tags":["operator"],"summary":"The operator’s own finalized monthly platform-fee statements (read-only): the fee charged at payment time, the fee mflow is entitled to after refunds/shipping, the fee the payment provider’s records show was collected, and the resulting refund, charge or carry-forward with its settlement state.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"finalized statements, newest first","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformFeeStatementsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/operator/platform-fees/statements/{statementId}":{"get":{"tags":["operator"],"summary":"One of the operator’s own statements with its per-payment lines (read-only).","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"parameters":[{"name":"statementId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the statement and its lines","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformFeeStatementDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"STATEMENT_NOT_FOUND (also for another store’s statement)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-rails":{"get":{"tags":["operator"],"summary":"Server-side payment-rail eligibility for the operator’s own store: Stripe (card) vs the PH wallet rail (PayMongo: GCash + QR Ph — a business registered in PH, presenting PHP, with the rail enabled). A PH store is never offered Stripe. Read-only.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the rails and why each is (not) eligible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRailsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/operator/payment-accounts":{"get":{"tags":["operator"],"summary":"The store’s payment accounts: the synthesized Stripe binding (status read at GET /operator/connect-account) plus its own PayMongo account view — status, identity/activation, capabilities, webhook, verification, the single next action and who owns it, missing field names, VAT posture. No personal data; the hosted identity-check link (verificationSession.url) is included for the owner (session or full-scoped key) only — a manage-scoped key sees just when it expires. Read-only; works with the rail switched off.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the store’s payment accounts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["operator"],"summary":"Open the store’s OWN PayMongo linked account (type merchant; the store’s contact e-mail + E.164 mobile are passed to PayMongo). Idempotent: 201 on create, 200 when it already exists for (store, environment). Admission route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentAccountRequest"}}}},"responses":{"200":{"description":"the existing account (created:false)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentAccountResponse"}}}},"201":{"description":"the new account (created:true)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentAccountResponse"}}}},"400":{"description":"OPERATOR_INVALID_INPUT — provider must be \"paymongo\"; PAYMENT_ACCOUNT_PROVIDER_REJECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"PH_WALLET_RAIL_DISABLED, PAYMENT_ACCOUNT_CONTACT_REQUIRED (record a contact e-mail + E.164 mobile first), PAYMENT_ACCOUNT_CREATE_IN_PROGRESS, PAYMENT_ACCOUNT_SANDBOX_STATIC_CHILD (PayMongo test mode returns one static child id) or PAYMENT_ACCOUNT_PROVIDER_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PAYMENT_ACCOUNT_NOT_ELIGIBLE — not a PH/PHP store (the message lists the reasons)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"PAYMENT_ACCOUNT_PROVIDER_BUSY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE — outcome unknown, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED or PAYMENT_ACCOUNT_PROVIDER_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/replace":{"post":{"tags":["operator"],"summary":"Open a NEW PayMongo account for the store after PayMongo declined or closed the current one (a declined activation is final). The old account is kept with its history and keeps servicing its own orders, webhooks and refunds; the new account starts at CREATED with the store’s contact e-mail + mobile. Idempotent per replacement. Owner act (session or full-scoped key); admission route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","responses":{"200":{"description":"the replacement already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountReplaceResponse"}}}},"201":{"description":"the new current account and the superseded one","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountReplaceResponse"}}}},"400":{"description":"PAYMENT_ACCOUNT_PROVIDER_REJECTED with fieldErrors (e.g. PayMongo refused a contact e-mail already in use)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"PH_WALLET_RAIL_DISABLED, PAYMENT_ACCOUNT_CONTACT_REQUIRED or PAYMENT_ACCOUNT_NOT_REPLACEABLE (the current account is not declined / closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PAYMENT_ACCOUNT_NOT_ELIGIBLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/webhook/rotate":{"post":{"tags":["operator"],"summary":"Rotate the store’s PayMongo webhook signing secret: a new webhook is registered at PayMongo on the next generation path (/webhooks/paymongo/account/{tpaId}/r<n> — no roll endpoint, a URL backs one hook) and its secret stored encrypted; the previous secret keeps verifying deliveries for the overlap window (default 24 h, max 72 h; 0 ⇒ none), then the old webhook is disabled at PayMongo. Owner act (session or full-scoped key); servicing route (works with the rail switched off). No secret is ever returned.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountWebhookRotateRequest"}}}},"responses":{"200":{"description":"the account with its new webhook registration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountWebhookRotateResponse"}}}},"400":{"description":"PAYMENT_ACCOUNT_WEBHOOK_OVERLAP_INVALID or PAYMENT_ACCOUNT_PROVIDER_REJECTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"PAYMENT_ACCOUNT_WEBHOOK_NOT_REGISTERED (refresh the account first) or PAYMENT_ACCOUNT_WEBHOOK_ROTATION_CONFLICT (retry)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE — outcome unknown, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/verification-session":{"post":{"tags":["operator"],"summary":"Create a hosted PayMongo identity-verification session for the business’s authorized representative (72 h). It has NO return URL — the dashboard polls GET /operator/payment-accounts. IDENTITY_FAILED ⇒ create a new session. Admission route. Hand the URL only to the owner.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","responses":{"200":{"description":"the account with verificationSession {url, expiresAt}","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"PH_WALLET_RAIL_DISABLED or PAYMENT_ACCOUNT_ALREADY_SUBMITTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/details":{"patch":{"tags":["operator"],"summary":"Save one section (representative | business) of the PayMongo account details. PASS-THROUGH: sent to PayMongo and never stored or logged; the response carries Cache-Control: no-store. PERSONAL DATA — collect it only in the store owner’s own authenticated form. Registered businesses only. Admission route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDetailsRequest"}}}},"responses":{"200":{"description":"the account after PayMongo accepted the section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountEnvelope"}}}},"400":{"description":"OPERATOR_INVALID_INPUT, or PAYMENT_ACCOUNT_PROVIDER_REJECTED with fieldErrors[{pointer,message}]","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"PH_WALLET_RAIL_DISABLED or PAYMENT_ACCOUNT_READ_ONLY (active / under review / declined)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PAYMENT_ACCOUNT_BUSINESS_TYPE_NOT_ELIGIBLE (individual) with fieldErrors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountError"}}}},"502":{"description":"PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/activate":{"post":{"tags":["operator"],"summary":"Submit the PayMongo account for activation. The result arrives by the parent webhook (ACTIVATION_REVIEW → ACTIVE / DECLINED); on ACTIVE the API registers the store’s own webhook and records processor evidence. Admission route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","responses":{"200":{"description":"the account (ACTIVATION_REVIEW or ACTIVE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"PH_WALLET_RAIL_DISABLED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PAYMENT_ACCOUNT_DETAILS_REQUIRED (with fieldErrors naming what PayMongo still needs) or PAYMENT_ACCOUNT_BUSINESS_TYPE_NOT_ELIGIBLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountError"}}}},"502":{"description":"PAYMENT_ACCOUNT_PROVIDER_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/refresh":{"post":{"tags":["operator"],"summary":"Re-read the account from PayMongo (at most once per 30 s unless force): status, capabilities, child webhook registration retry and evidence recording. When PayMongo is unreachable the last known facts return with statusAvailable:false (never a fabricated state). Servicing route (works with the rail switched off).","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountRefreshRequest"}}}},"responses":{"200":{"description":"the refreshed account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/documents":{"get":{"tags":["operator"],"summary":"The store’s uploaded registration documents — the current version of each type (metadata only; no filename, no download link) — and its review status (last submission, latest business-verification status). Owner only. Servicing route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","responses":{"200":{"description":"current documents + review status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDocumentList"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED or PAYMENT_DOCUMENTS_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["operator"],"summary":"Record the BIR Form 2303 TIN + DTI/SEC registration with the UPLOADED certificates (documentRefs from POST …/documents/uploads) as a PENDING KYB case in the restricted compliance vault for mflow’s review — required for PH live admission unless PayMongo’s GCash review already verified the business. Only this store’s own document refs are accepted. Owner form only. Servicing route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDocumentsRequest"}}}},"responses":{"201":{"description":"the PENDING KYB case","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDocumentsResponse"}}}},"400":{"description":"PAYMENT_ACCOUNT_DOCUMENT_INVALID (numbers), or PAYMENT_ACCOUNT_DOCUMENT_REF_INVALID (a reference that is not this store’s uploaded document, or a DTI/SEC certificate that does not match registrationType)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PAYMENT_ACCOUNT_DOCUMENTS_REQUIRED — fieldErrors name the missing document types (documents.BIR_2303 / documents.DTI_REGISTRATION / documents.SEC_REGISTRATION)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountError"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED or PAYMENT_DOCUMENTS_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/paymongo/documents/uploads":{"post":{"tags":["operator"],"summary":"Upload ONE registration document (BIR_2303, DTI_REGISTRATION or SEC_REGISTRATION) for mflow’s business review. PDF, JPEG or PNG decided from the file’s magic bytes; at most 10 MiB. Stored privately (never a public URL); the response is an opaque documentRef + metadata. A new upload of the same type appends the next version; the same bytes again are idempotent (200 created:false). COMPLIANCE EVIDENCE — owner session or full-scoped key only, never an AI assistant; the response carries Cache-Control: no-store. Requires the store’s PayMongo account. Servicing route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDocumentUploadRequest"}}}},"responses":{"200":{"description":"the same bytes are already the current version (created:false)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDocumentUploadResponse"}}}},"201":{"description":"a new version was stored (created:true)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountDocumentUploadResponse"}}}},"400":{"description":"PAYMENT_DOCUMENT_INVALID (unknown documentType / not canonical base64) or PAYMENT_DOCUMENT_EMPTY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"PAYMENT_DOCUMENT_VERSION_LIMIT — too many uploads of this type; contact support","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"PAYMENT_DOCUMENT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"PAYMENT_DOCUMENT_UNSUPPORTED_TYPE (not a PDF/JPEG/PNG by its bytes) or PAYMENT_DOCUMENT_TYPE_MISMATCH (declared contentType disagrees with the bytes)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED or PAYMENT_DOCUMENTS_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operator/payment-accounts/tax-posture":{"get":{"tags":["operator"],"summary":"The store’s declared PH VAT posture (VAT_REGISTERED | NON_VAT | null). Wallet checkout is closed while it is null.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the declared posture","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountTaxPosture"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["operator"],"summary":"Declare the store’s OWN PH VAT posture from its BIR Form 2303 (the L2’s tax duty, not L1’s). VAT_REGISTERED ⇒ quotes extract the 12 % VAT embedded in PH prices and the platform fee is taken on the pre-tax base; NON_VAT ⇒ no VAT line. Affects quotes from now on, never a booked order. Servicing route.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"x-mflow-operator-key-scope":"full","x-mflow-firewall":"money-or-irreversible: requires the operator SESSION or a full-scoped key (a manage key ⇒ 403 OPERATOR_KEY_INSUFFICIENT_SCOPE)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountTaxPostureRequest"}}}},"responses":{"200":{"description":"the recorded posture","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAccountTaxPosture"}}}},"400":{"description":"PAYMENT_ACCOUNT_TAX_POSTURE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"OPERATOR_KEY_INSUFFICIENT_SCOPE — the owner session or a full-scoped key is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PAYMENT_ACCOUNT_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PH_WALLET_RAIL_UNCONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tenants/resolve":{"get":{"tags":["storefront"],"summary":"Resolve a store → its PUBLIC config (identity, market presentation, branding, affiliation disclosure, publishable key), wrapped as `{ tenant }`. Provide EITHER `?host=<store-host>` OR `?tenantId=<tnt_…>` (the headless-bootstrap input for an operator that has no host bound yet); `host` wins when both are given. Public — no token required.","parameters":[{"name":"host","in":"query","required":false,"schema":{"type":"string"},"description":"The store host to resolve (e.g. shop.example.com or <tenantId>.mflow.fuxitrading.com)."},{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"Alternative to `host`: resolve by the tenant’s own id (tnt_…). Same public config; unknown id ⇒ 404."}],"responses":{"200":{"description":"the store’s public config, under `tenant`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResolveResponse"}}}},"400":{"description":"neither host nor tenantId supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"no such store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"TENANTS_UNCONFIGURED — tenant resolution is unbound (DATABASE_URL unset). A RETRYABLE service-unconfigured state on a degraded deploy, NOT a client error — a storefront bootstrap should retry, not treat it as fatal.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/catalog/products":{"get":{"tags":["storefront"],"summary":"List a store’s listable products (derived scarcity; per-tenant), keyset-paginated. Requires a guest token. ?view=card returns the list-lite CatalogProductCard projection (a field-trim of the SAME page — no behaviour change).","security":[{"GuestToken":[]}],"parameters":[{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own (a mismatch ⇒ 403)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":250,"default":100},"description":"keyset page size (clamped 1..250; default 100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"opaque keyset token from a prior page’s page.nextCursor; ABSENT ⇒ first page; an unparseable/invalid token ⇒ 400 CATALOG_CURSOR_INVALID (never a silent restart). Pass it back verbatim — do not parse/synthesize it."},{"name":"view","in":"query","required":false,"schema":{"type":"string","enum":["full","card"],"default":"full"},"description":"full (default; absent/unknown ⇒ full — NO behaviour change) returns CatalogProduct items; card returns the list-lite CatalogProductCard projection (signed hero + priceFrom + inStock, NO skus[]/allocations[]) — a pure field-trim of the SAME hydrated, curation-filtered page (listability/pricing/availability stay byte-identical)."}],"responses":{"200":{"description":"the store-visible product list (full or card items per ?view); each page carries up to `limit` VISIBLE products (no empty leading page) with hasMore/nextCursor over the filtered stream","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogProductsResponse"}}}},"400":{"description":"CATALOG_CURSOR_INVALID — the cursor could not be decoded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/catalog/search":{"get":{"tags":["storefront"],"summary":"Free-text search + facet filter/sort/pagination over the SAME store-visible set (a facet can only ever NARROW it, never surface a hidden product). ?view=card returns the list-lite CatalogProductCard projection. Requires a guest token.","security":[{"GuestToken":[]}],"parameters":[{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own (a mismatch ⇒ 403)."},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"free-text query (safe prefix match; empty ⇒ browse the store-visible book)"},{"name":"condition","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"condition-grade facet (repeatable) — NARROWS only"},{"name":"inStock","in":"query","required":false,"schema":{"type":"boolean"},"description":"restrict to products with reservable stock"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["relevance","newest","oldest","title","available"]},"description":"result ordering"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"page size"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"},"description":"page offset"},{"name":"view","in":"query","required":false,"schema":{"type":"string","enum":["full","card"],"default":"full"},"description":"full (default; absent/unknown ⇒ full — NO behaviour change) returns CatalogProduct items; card returns the list-lite CatalogProductCard projection (signed hero + priceFrom + inStock, NO skus[]/allocations[]) — a pure field-trim of the SAME hydrated, curation-filtered page (listability/pricing/availability stay byte-identical)."}],"responses":{"200":{"description":"the paginated, faceted result (full or card items per ?view)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogSearchResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/catalog/products/{productId}":{"get":{"tags":["storefront"],"summary":"A single listable product. Requires a guest token.","security":[{"GuestToken":[]}],"responses":{"200":{"description":"the product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogProductResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"PRODUCT_NOT_FOUND — no such product in this tenant book, or it is not store-visible/listable (a hidden or unbacked product 404s to a guest via its direct URL too)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/skus/{skuId}/effective-price":{"get":{"tags":["storefront"],"summary":"The effective (marked-up, markdown-resolved) price for a sku, with the GST-inclusive display convention. Requires a guest token.","security":[{"GuestToken":[]}],"responses":{"200":{"description":"the effective price at `at`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectivePrice"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"no price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/skus/effective-prices":{"post":{"tags":["storefront"],"summary":"BULK effective prices — batch the SAME per-sku computation as GET /pricing/skus/{skuId}/effective-price for up to 250 skus in one READ (price a whole ?view=card page with ZERO per-card calls). L1 computes nothing new; it returns the L2's OWN effective price per sku. One entry per requested skuId, in request order; an unknown/unpriced sku yields an error entry, never a batch failure. Requires a guest token.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectivePricesRequest"}}}},"responses":{"200":{"description":"one price-or-error entry per requested skuId, in request order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectivePricesResponse"}}}},"400":{"description":"skuIds must be a non-empty array of at most 250 ids (PRICING_INVALID_INPUT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"pricing is not bound to a database (DATABASE_URL unset) — the lane is unconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/skus/{skuId}/markdown":{"get":{"tags":["storefront"],"summary":"The FULL falling-price step schedule + next-markdown countdown for a sku (the storefront drops/timer surface). Requires a guest token.","security":[{"GuestToken":[]}],"responses":{"200":{"description":"the markdown state + step schedule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkdownState"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"no price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"markdown schedule malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/holds":{"post":{"tags":["storefront"],"summary":"Place a short-lived checkout hold (engine reserve + price-at-reservation capture in one round-trip). Keyed on skuId + contextRef; allocationId is OPTIONAL — omit it and the allocation engine (the single oversell firewall) resolves the current available allocation server-side, so a persisted cart never 400/409s against itself. Re-holding the same reservationId replays the STALE hold; at checkout, release then re-hold with a FRESH reservationId. OWNERSHIP: a hold REQUIRES a cart-scoped browse token; the hold’s contextRef is BOUND to that token’s server-minted cartRef (the body contextRef is ignored for ownership) so only that cart can later release it. Replaying another cart’s reservationId is refused (403 RESERVATION_NOT_OWNED) — no foreign reservation is echoed.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HoldRequest"}}}},"responses":{"200":{"description":"idempotent replay of an existing hold","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HoldResponse"}}}},"201":{"description":"a fresh hold + captured price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HoldResponse"}}}},"400":{"description":"skuId and contextRef are required (allocationId is OPTIONAL — the engine resolves it when omitted); malformed input ⇒ PRICING_INVALID_INPUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SHOPPER_SCOPE_REQUIRED — the token is not cart-scoped (mint one with cart:true); or RESERVATION_NOT_OWNED — the reservationId belongs to another cart","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ALLOCATION_NOT_FOUND — a pinned allocationId does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"unavailable: ALLOCATION_INSUFFICIENT_AVAILABLE (oversold / no reservable units), ALLOCATION_WINDOW_CLOSED, or SKU_ALLOCATION_MISMATCH (a pinned allocation is not this sku’s); or STORE_PAUSED_VOLUME_CAP (the store is not accepting new orders right now — act on the CODE; the message is deliberately generic and never discloses the store’s sales, limits or verification standing. Funded orders, fulfillment and refunds are never blocked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/holds/release":{"post":{"tags":["storefront"],"summary":"Release a price hold (HELD → RELEASED — frees the unit). Use the allocationId returned on the hold’s `allocation`. OWNERSHIP: a hold may be released ONLY by the cart that created it — the reservation’s contextRef (bound to your cart token’s cartRef at create) must match the caller’s cart, else 403 RESERVATION_NOT_OWNED and the hold is left untouched. Correct checkout pattern: release the prior hold, then re-hold fresh with a NEW reservationId.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseHoldRequest"}}}},"responses":{"200":{"description":"released","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseHoldResponse"}}}},"400":{"description":"allocationId and reservationId are required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"RESERVATION_NOT_OWNED — the hold belongs to another cart (or the caller is not cart-scoped / the reservation is not found in scope); only the owning cart may release it. The hold is NOT released.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"SOLD_UNITS_SACROSANCT — the reservation already CONVERTED (sold); a sold unit can never be released","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/reservations/{reservationId}/checkout-price":{"get":{"tags":["storefront"],"summary":"The price-at-reservation CHECKOUT price for a reservation (the policy result): a LIVE captured hold is honored at its captured price; an expired/released/missing hold re-quotes at the current effective price. Read-only. Requires a guest token (an operator caller names the tenant).","security":[{"GuestToken":[]}],"parameters":[{"name":"reservationId","in":"path","required":true,"schema":{"type":"string"},"description":"the reservation to price"},{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own (a mismatch ⇒ 403)."},{"name":"at","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"OPTIONAL instant to resolve the markdown at (defaults to now)"}],"responses":{"200":{"description":"the price-at-reservation policy result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReservationCheckoutPrice"}}}},"400":{"description":"TENANT_REQUIRED — an operator caller did not name the tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION — a scoped caller addressed another tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"RESERVATION_NOT_FOUND / RESERVATION_PRICE_NOT_FOUND / PRICE_BOOK_NOT_FOUND — no such reservation, no captured price, or no governing price_book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"MARKDOWN_SCHEDULE_MALFORMED — the sku’s markdown schedule is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PRICING_UNCONFIGURED — the pricing lane is not bound to a database (DATABASE_URL unset)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/reservations/{reservationId}/capture":{"post":{"tags":["storefront"],"summary":"Record the price-at-reservation for a reservation (idempotent — the FIRST capture wins; 200 on replay, 201 on a fresh capture). Body: {skuId (required), tenantId?, allocationId?}. Requires a guest token (an operator caller names the tenant).","security":[{"GuestToken":[]}],"parameters":[{"name":"reservationId","in":"path","required":true,"schema":{"type":"string"},"description":"the reservation to capture a price for"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReservationCaptureRequest"}}}},"responses":{"200":{"description":"idempotent replay of an existing capture","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReservationPriceCapture"}}}},"201":{"description":"a fresh price capture","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReservationPriceCapture"}}}},"400":{"description":"PRICING_INVALID_INPUT (skuId is required) or TENANT_REQUIRED (an operator caller did not name the tenant)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION — a scoped caller addressed another tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"RESERVATION_NOT_FOUND / PRICE_BOOK_NOT_FOUND — no such reservation, or no governing price_book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PRICING_UNCONFIGURED — the pricing lane is not bound to a database (DATABASE_URL unset)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/allocation/reserve":{"post":{"tags":["storefront"],"summary":"Reserve inventory against an allocation (oversell-safe; the engine is the single write-time arbiter).","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReserveRequest"}}}},"responses":{"200":{"description":"the arbitrated reservation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReserveResponse"}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"oversold / unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkout/quote":{"post":{"tags":["storefront"],"summary":"Quote a cart (tax + landed cost) — never charges, never reserves. Send `lines` (each may carry a reservationId to quote at the captured price) NOT `items`; a guest body OMITS `tenant` (it is derived from the token). The response carries snake_case fields WITH camelCase aliases (camelCase canonical; see QuoteResult). PH wallet rail (additive): on a deployment with PayMongo configured the quote also carries `offered_methods` / `offeredMethods` — the payment methods (card | gcash | qrph) this store can take for this total; absent ⇒ card-only. NOTE: the handler returns NO 400 — a business refusal is 422 (or 404/409 for the CART_INVALID variants), never 400.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutQuoteRequest"}}}},"responses":{"200":{"description":"the priced quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION — a guest body named a tenant (omit it; the token scopes the tenant)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"unknown tenant; or CART_INVALID — a cartId whose stored cart is missing/empty, or a sku/pool line with no price_book / store_price_book row (not quotable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"CART_INVALID — a line’s reservationId captured a price for a DIFFERENT sku than the line","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"a deferred / unservable market or bad input: DESTINATION_NOT_SUPPORTED (country not sold-to / missing), SHIPPING_UNAVAILABLE (no flat rate for the destination), SHIPPING_METHOD_INVALID (a shippingMethod id the destination does not offer), CURRENCY_NOT_SUPPORTED (presentment ≠ price-book currency — the price path does no FX), SKU_NOT_SHIPPABLE_TO_DESTINATION (a pooled line whose vendor cannot ship its origin there), or CART_INVALID (neither cartId nor lines, or a non-positive qty)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"payments lane is not configured (no DATABASE_URL / tax / duties) — fail closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkout/intent":{"post":{"tags":["storefront"],"summary":"Create the DIRECT-charge payment intent on the L2-owned connected account (funding-before-fulfillment; the L2 is the MoR, never L1). Guest/cart-scoped: send `lines` NOT `items`, `email` TOP-LEVEL, the address field `postcode` NOT `postal`, and OMIT `cartId`. PH WALLET RAIL (additive): with `paymentMethod: \"gcash\" | \"qrph\"` (+ `returnUrl` for GCash) the charge is created on the store’s OWN PayMongo account instead and the 201 is a WalletCheckoutIntentResponse (`status: requires_action` + `payment_action` redirect | qr; no client secret, never /checkout/confirm — poll /checkout/status). Holds are extended to the ~30 min payment window first and the order + payment row are persisted before any provider call.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutIntentRequest"}}}},"responses":{"201":{"description":"the Payment Element config + intent (card), or the wallet customer action (gcash | qrph)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutIntentResult"}}}},"400":{"description":"DELIVERY_ADDRESS_REQUIRED (missing/incomplete shipping_address) or CART_INVALID (a non-empty cartId with an expired/missing/uncaptured hold — OMIT cartId for the reservation-backed flow); wallet: INVALID_PAYMENT_METHOD (not card | gcash | qrph — a client bug) or WALLET_RETURN_URL_INVALID (a GCash returnUrl that is not https /checkout/complete on one of the store’s own hosts)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"SHOPPER_SCOPE_REQUIRED — the guest token was minted WITHOUT a cartRef (re-mint with cartRef), or a cross-tenant scope; or CHECKOUT_BLOCKED — the store is not accepting orders yet (the onboarding gate refused; the message is deliberately generic and never discloses the store’s verification standing — act on the CODE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ORDER_NOT_FOUND — email/cartRef mismatch or a foreign reservation (a hold’s contextRef must equal the token’s cartRef); or PAYMENT_CONFIG_MISSING — unknown tenant / no payment config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"stock/reservation conflict — a held unit is unavailable or a pool line cannot be reserved (NOT a funding failure; the FundingCheck / inv. 6 gate runs POST-capture); CART_INVALID can also be 409 when a line’s reservation captured a price for a DIFFERENT sku. Wallet: PAYMENT_METHOD_UNAVAILABLE with `reason` ACCOUNT_NOT_READY | METHOD_WITHDRAWN (the method is not available for this store now — re-quote and offer the others) or WALLET_HOLD_UNAVAILABLE (a hold could not be extended for the payment window — renew the cart)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"TERMS_NOT_ACCEPTED (terms_version != tenant.termsVersion) or a deferred / unservable market — intent reuses buildQuote, so the same codes as /checkout/quote reach here: DESTINATION_NOT_SUPPORTED, SHIPPING_UNAVAILABLE, SHIPPING_METHOD_INVALID, CURRENCY_NOT_SUPPORTED, SKU_NOT_SHIPPABLE_TO_DESTINATION. Wallet: PAYMENT_METHOD_UNAVAILABLE with `reason` AMOUNT_OUT_OF_RANGE (outside the method limits) | MARGIN_TOO_THIN (the fee headroom), TAX_POSTURE_REQUIRED / CURRENCY_NOT_SUPPORTED (the store cannot take wallet payments yet — PH VAT posture undeclared or presentment not PHP), WALLET_PROVIDER_REFUSED (PayMongo refused; the order was canceled and any credit restored — retry or use another method)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"the payments lane is not configured (fail closed); wallet: WALLET_PROVIDER_UNAVAILABLE or PAYMENT_METHOD_UNAVAILABLE (`reason` RAIL_UNCONFIGURED) — temporary, nothing was charged, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkout/confirm":{"post":{"tags":["storefront"],"summary":"SERVER-SIDE confirmation only — the server confirms the PaymentIntent from the posted paymentRef. SKIP this when confirming client-side via the Stripe Payment Element (stripe.confirmPayment): the PI is already confirmed, so this returns 400 with nothing left to confirm — go straight to /checkout/status. State stays webhook-driven — fulfillment subscribes to funding.cleared, never payment.captured. Card (Stripe) only: a PH wallet payment is NEVER confirmed here (its paymentRef 404s) — the shopper pays in GCash / their bank app and /checkout/status is the readback.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutConfirmRequest"}}}},"responses":{"200":{"description":"the provider status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutConfirmResponse"}}}},"400":{"description":"paymentRef missing, or the PI is already confirmed (Payment Element flow — skip this call)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"no such payment for this shopper (including any wallet paymentRef)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkout/status":{"post":{"tags":["storefront"],"summary":"Authoritative readback: bind tenant+shopper+order+payment, then validate every money field against the provider. No mutation. PH WALLET RAIL: when the order’s payment is a PayMongo payment with this paymentRef, the answer is the WalletCheckoutStatusResponse projection (`rail: \"PAYMONGO\"`, `customerState`, deadlines, `clearCart`, `refund` incl. a QR Ph claim link) instead of the card `outcome` shape — distinguish by `rail`; a shopper principal also gets `checkoutRef` and the `receipt` snapshot (order lines, subtotal, shipping, tax with taxEmbedded, total — frozen at intent). Poll it while a QR is on screen or after the GCash return; a 502/503 is \"still checking\", never a failure. GCASH RETURN IN ANOTHER BROWSER: send the `returnToken` from the return URL (+ `tenant` when there is no guest token) — it proves ownership of exactly that order and answers the minimal WalletCheckoutStatusReturnTokenResponse (no claim link, no payment action, no receipt, no PII).","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutStatusRequest"}}}},"responses":{"200":{"description":"the verified card order/payment status, the wallet customer-state projection, or the return-token projection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutStatusResult"}}}},"400":{"description":"orderId and paymentRef are required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"PAYMENT_NOT_FOUND — the order/payment pair does not resolve to this shopper’s order, or a returnToken that is expired, tampered, or minted for another order/tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PAYMENT_PROVIDER_MISMATCH — a money field disagreed with the provider; the status could not be verified (do NOT treat as failed — keep polling)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PAYMENT_STATUS_UNAVAILABLE — the provider is temporarily unreachable (keep polling; not a terminal failure)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkout/bulk/quote":{"post":{"tags":["storefront"],"summary":"INDICATIVE wholesale/pallet quote (vendor-MoR, LEGAL.md §14) — never charges, never reserves. Guest-scoped: OMIT `tenant` (derived from the token). The price MOVES with DTC sales on the shared counters (`indicative:true`): carry `qty` + `basisMinor` into POST /checkout/bulk/intent as `expectedQty` + `expectedPriceMinor`. §14: the SELLER OF RECORD is the vendor (`sellerOfRecord`), never L1/L2.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkQuoteRequest"}}}},"responses":{"200":{"description":"the indicative priced quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkQuoteResponse"}}}},"400":{"description":"BULK_INVALID_INPUT — a bad shape / non-positive tierQty","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION — a guest body named a tenant (omit it; the token scopes the tenant); or VENDOR_ACCOUNT_NOT_READY — the vendor’s connected account cannot yet charge (threat #24)","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/BulkError"}]}}}},"404":{"description":"BULK_CONFIG_MISSING — the store’s bulk_mode is off, or no such lot for this store’s surface (missing and foreign are the same 404, B-12)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"409":{"description":"a business/stock refusal: LOT_NOT_LISTED (store opt-in absent), LOT_PAUSED (paused / FD-6 restock-drift / backing allocation not ACTIVE), BULK_SKU_NOT_ADMITTED (FLAGGED/QUARANTINED SKU, detect-and-remove), BULK_BELOW_MIN (remainder below min_bulk_qty), or the engine’s ALLOCATION_WINDOW_CLOSED (rotation window closed) — engine codes surface verbatim","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"422":{"description":"LOT_CURRENCY_MISMATCH (FD-2 lot currency ≠ store presentment, fail-closed) or DESTINATION_NOT_SUPPORTED (geo/OFAC floor + §14 domestic-only: buyer country must equal the vendor warehouse country)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"503":{"description":"BULK_UNCONFIGURED — the bulk money lane is not bound (database/provider unavailable) — fail closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/checkout/bulk/intent":{"post":{"tags":["storefront"],"summary":"Reserve → optimistic confirm → the DIRECT charge on the APPROVED VENDOR’s OWN connected account (never L1’s, never the L2’s — vendor-MoR, §14). Send the quote’s `qty`/`basisMinor` as `expectedQty`/`expectedPriceMinor`, the FD-4 `buyer` identity, and an `idempotencyKey` (a replay ⇒ 200 with the ORIGINAL order/intent; a first intent ⇒ 201). Re-runs EVERY quote gate before touching stock (§3.1). Returns the payment-element config on the vendor account; fulfillment still waits for `funding.cleared`, never `payment.captured`.","security":[{"GuestToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIntentRequest"}}}},"responses":{"200":{"description":"idempotent replay of the original intent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIntentResponse"}}}},"201":{"description":"the Payment Element config + the vendor direct-charge intent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIntentResponse"}}}},"400":{"description":"BULK_INVALID_INPUT (bad shape/qty) or BULK_BUYER_IDENTITY_REQUIRED (FD-4 businessName/businessTaxId missing/blank)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION; VENDOR_ACCOUNT_NOT_READY (vendor account cannot charge); or CHECKOUT_BLOCKED (the onboarding/vendor gate refused; the message is deliberately generic and never discloses the hosting store’s or the vendor’s verification standing)","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/BulkError"}]}}}},"404":{"description":"BULK_CONFIG_MISSING — bulk_mode off / unknown lot for this store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"409":{"description":"BULK_PRICE_MOVED — availability moved between quote and intent (the hold was released); re-quote against `detail{qtyNow,priceMinorNow,band}` and re-confirm. ALSO 409: LOT_NOT_LISTED, LOT_PAUSED, BULK_SKU_NOT_ADMITTED, and the engine’s ALLOCATION_WINDOW_CLOSED / ALLOCATION_REMAINDER_BELOW_FLOOR / ALLOCATION_INSUFFICIENT_AVAILABLE (surfaced verbatim).","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BulkPriceMovedError"},{"$ref":"#/components/schemas/BulkError"}]}}}},"422":{"description":"LOT_CURRENCY_MISMATCH or DESTINATION_NOT_SUPPORTED (§14 domestic-only)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"429":{"description":"VELOCITY_LIMITED — the SAME per-email/per-IP guest velocity counters the DTC intent uses (B-5)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"BULK_UNCONFIGURED — the bulk money lane is not bound (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/catalog/lots":{"get":{"tags":["storefront"],"summary":"One bounded page of LISTED wholesale/pallet lot cards (vendor-MoR, LEGAL.md §14) for the addressed store, BOTH keyspaces. Guest-scoped: the tenant is derived from the browse token (an operator/admin instead names ?tenantId). Every 200 is Cache-Control: no-store — the remainder offer reprices on every DTC sale over the shared counters (`pricesIndicative:true`; the binding figure is the checkout quote). §14: each card carries `sellerOfRecord` (the vendor), never L1/L2; NO commission/referral data reaches the shopper.","security":[{"GuestToken":[]}],"parameters":[{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own (a mismatch ⇒ 403)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"page size (clamped 1..100)"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"keyset cursor = the last lotConfigId of the prior page (omit for the first page)"}],"responses":{"200":{"description":"a page of LISTED lot cards","content":{"application/json":{"schema":{"type":"object","required":["tenantId","bulkMode","lots","page"],"properties":{"tenantId":{"type":"string"},"bulkMode":{"type":"string","enum":["mixed","bulk_only"]},"lots":{"type":"array","items":{"type":"object","description":"a bulk lot card: lotConfigId, keyspace, sku{...}, remaining, completenessBand, derivedStatus, offers[], freightMinor, currency, sellerOfRecord{vendorId,vendorName}, pricesIndicative:true","additionalProperties":true}},"page":{"type":"object","required":["limit","hasMore","nextCursor"],"properties":{"limit":{"type":"integer"},"hasMore":{"type":"boolean"},"nextCursor":{"type":"string","nullable":true}}}}}}}},"400":{"description":"TENANT_REQUIRED — an operator/admin caller must name ?tenantId explicitly","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION (a scoped shopper addressed another tenant) or FORBIDDEN (a vendor credential has no tenant-book read scope here)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"BULK_NOT_AVAILABLE — the store’s bulk_mode is off (indistinguishable from the lane being dark — nothing to enumerate)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"503":{"description":"BULK_UNCONFIGURED — the bulk lane is not bound to a database (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/catalog/lots/{lotConfigId}":{"get":{"tags":["storefront"],"summary":"One LISTED wholesale/pallet lot card by id (vendor-MoR, §14). Missing, UNLISTED, paused, rotation-window-closed, suspended-vendor and foreign-book all collapse to the SAME 404 (fail closed, B-12 posture). Cache-Control: no-store.","security":[{"GuestToken":[]}],"parameters":[{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own (a mismatch ⇒ 403)."}],"responses":{"200":{"description":"the lot card","content":{"application/json":{"schema":{"type":"object","required":["tenantId","bulkMode","lot"],"properties":{"tenantId":{"type":"string"},"bulkMode":{"type":"string","enum":["mixed","bulk_only"]},"lot":{"type":"object","description":"the bulk lot card (see GET /catalog/lots)","additionalProperties":true}}}}}},"400":{"description":"TENANT_REQUIRED — an operator/admin caller must name ?tenantId","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"TENANT_SCOPE_VIOLATION or FORBIDDEN (vendor credential)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"BULK_NOT_AVAILABLE (bulk_mode off) or BULK_LOT_NOT_FOUND (missing / unlisted / paused / rotation-closed / suspended-vendor / foreign — one indistinguishable 404)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"503":{"description":"BULK_UNCONFIGURED — fail closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/bulk/lots/available":{"get":{"tags":["operator"],"summary":"ACTIVE lots joinable to the operator’s OWN store (legacy = own book; pool = the pool-listing visibility rules), each with the storefront’s ESTIMATED commission under the mflow Storefront Referral Program (L1’s OWN affiliate program at the uniform published rate per fee tier — a presentation figure, never a vendor amount; §14). The consuming store is ALWAYS the principal’s own tenant (a tenant in the request is inert). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"responses":{"200":{"description":"the joinable lots + the store’s bulk_mode","content":{"application/json":{"schema":{"type":"object","required":["tenantId","bulkMode","lots"],"properties":{"tenantId":{"type":"string"},"bulkMode":{"type":"string","enum":["off","mixed","bulk_only"]},"lots":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"an available lot view: lotConfigId, keyspace, skuId, vendorId, feeTier, currency, freightMinor, fullLotQty, minBulkQty, remainingQty, offers[] (each with the estimated referralCommission {program,bps,amountMinor}), listing (LISTED|UNLISTED|null)"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"BULK_UNCONFIGURED — the bulk lane is not bound (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/bulk/lots/{lotConfigId}/listing":{"put":{"tags":["operator"],"summary":"Upsert the store’s BINARY store_lot_listing opt-in for a lot (LISTED | UNLISTED). LISTED is refused unless the lot is joinable RIGHT NOW — the eligibility ceiling can never be forced open; UNLISTED is always safe. The row carries NO pricing (0084). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["LISTED","UNLISTED"]}}}}}},"responses":{"200":{"description":"the upserted opt-in","content":{"application/json":{"schema":{"type":"object","required":["listing"],"properties":{"listing":{"type":"object","required":["tenantId","lotConfigId","status"],"properties":{"tenantId":{"type":"string"},"lotConfigId":{"type":"string"},"status":{"type":"string","enum":["LISTED","UNLISTED"]}}}}}}}},"400":{"description":"BULK_INVALID_INPUT — status must be LISTED or UNLISTED (or a missing lotConfigId path segment)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"BULK_LOT_NOT_FOUND — no such lot for this store (missing and foreign-book are the same 404)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"409":{"description":"BULK_LISTING_NOT_AVAILABLE — the lot is not currently joinable to the store (inactive, drifted, not admitted, suspended vendor, rotation window closed, or outside the pool visibility rules); UNLISTED is always safe","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"503":{"description":"BULK_UNCONFIGURED — fail closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/bulk/mode":{"put":{"tags":["operator"],"summary":"Set the store’s OWN bulk_mode commerce axis (off | mixed | bulk_only). Audited (append-only audit_event; a refused audit write refuses the mode change). Manage key OK.","security":[{"OperatorApiKey":[]},{"OperatorSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["mode"],"properties":{"mode":{"type":"string","enum":["off","mixed","bulk_only"]}}}}}},"responses":{"200":{"description":"the new commerce axis","content":{"application/json":{"schema":{"type":"object","required":["tenantId","bulkMode"],"properties":{"tenantId":{"type":"string"},"bulkMode":{"type":"string","enum":["off","mixed","bulk_only"]}}}}}},"400":{"description":"BULK_INVALID_INPUT — mode must be off, mixed or bulk_only (or an unknown tenant)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"BULK_UNCONFIGURED — fail closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkError"}}}}}}},"/orders/{orderId}/timeline":{"get":{"tags":["storefront"],"summary":"The magic-link-token-scoped order timeline (events + tracking). Order existence never leaks across shoppers (a mismatch ⇒ 404).","security":[{"GuestToken":[]}],"responses":{"200":{"description":"the order timeline","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderTimeline"}}}},"400":{"description":"tenant is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"a valid order link is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/drops":{"get":{"tags":["storefront"],"summary":"List a store’s live drops.","responses":{"200":{"description":"the live drops","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDropsResponse"}}}},"400":{"description":"tenant is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/drops/{slug}":{"get":{"tags":["storefront"],"summary":"A single drop landing view (live scarcity + next-markdown countdown + early-access windows).","responses":{"200":{"description":"the drop landing view","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropView"}}}},"404":{"description":"no such drop","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/group-buys/{id}":{"get":{"tags":["storefront"],"summary":"The deterministic current standing of a group buy (verified-buyer count → the ladder-resolved price, clamped to the MAP floor). Public browse read: pass the store via ?tenant / ?tenantId (or a guest token supplies it).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"the group-buy id"},{"name":"tenant","in":"query","required":false,"schema":{"type":"string"},"description":"the store this group buy belongs to (or ?tenantId; a guest token supplies it when omitted)"}],"responses":{"200":{"description":"the deterministic current standing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupBuyStanding"}}}},"400":{"description":"DROP_INVALID_INPUT — tenant is required (pass ?tenant / ?tenantId or a guest token)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"GROUP_BUY_NOT_FOUND — no such group buy in this store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"DROPS_UNCONFIGURED — the drops lane is not bound to a database (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/drops/{dropId}/reserve":{"post":{"tags":["storefront"],"summary":"EARLY-ACCESS-GATED reserve for a drop item. Requires an EMAIL-scoped magic-link guest token (a plain browse token does NOT identify a shopper). The gate is TIMING ONLY — the allocation engine still arbitrates oversell (never a bypass). Returns a NARROW reservation projection (no contextRef is ever echoed).","security":[{"GuestToken":[]}],"parameters":[{"name":"dropId","in":"path","required":true,"schema":{"type":"string"},"description":"the drop to reserve an item from"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropReserveRequest"}}}},"responses":{"201":{"description":"the early-access-gated reservation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropReserveResult"}}}},"400":{"description":"DROP_INVALID_INPUT — allocationId, reservationId, contextRef and qty are all required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"SUBJECT_REQUIRED — a valid magic-link (email-scoped) token is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"EARLY_ACCESS_NOT_OPEN — this tier’s reservation window is not open yet (a TIMING refusal, never a stock decision)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"DROP_NOT_FOUND — no such drop in this store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"DROPS_UNCONFIGURED — the drops lane / allocation engine is unbound (reserve fails closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/paymongo/account/{tpaId}":{"post":{"tags":["webhooks"],"summary":"PayMongo → API only: TRANSACTION events for ONE store’s PayMongo account (payment.paid, payment.failed, payment.refunded, payment.refund.updated, qrph.expired; payout.* / dispute.* are stored and flagged). Registered automatically when the account activates. Authenticated by the Paymongo-Signature HMAC over the RAW body with that account’s own webhook secret (stored encrypted) — after a rotation or re-registration the previous secret is also accepted until its overlap window ends; the event environment must match the account. A replaced (superseded) account keeps receiving its own payments’ events here. The body is only a locator — money truth comes from a provider readback. Receipts are stored redacted with a raw-body digest and processed under a lease.","parameters":[{"name":"tpaId","in":"path","required":true,"schema":{"type":"string"},"description":"the opaque payment-account id the webhook was registered with (tpa_…)"}],"responses":{"200":{"description":"applied, ignored, or a duplicate of a settled receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"400":{"description":"bad signature, stale timestamp, or environment mismatch — not retried usefully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"404":{"description":"unknown account, other environment, or no webhook secret provisioned (indistinguishable; nothing stored)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"409":{"description":"receipt busy / lease lost (retry-after: 1) or an event-identity collision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"500":{"description":"handler failure — the receipt is marked FAILED and PayMongo retries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"503":{"description":"wallet webhook intake not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}}}}},"/webhooks/paymongo/account/{tpaId}/{generation}":{"post":{"tags":["webhooks"],"summary":"PayMongo → API only: the same child-account handler as /webhooks/paymongo/account/{tpaId}, on a rotated webhook’s generation path (PayMongo has no roll endpoint and a URL backs one hook, so rotation n registers `/r<n>`). Authenticated exactly as the base path (current secret, then the previous one inside its overlap).","parameters":[{"name":"tpaId","in":"path","required":true,"schema":{"type":"string"}},{"name":"generation","in":"path","required":true,"schema":{"type":"string","pattern":"^r[0-9]{1,6}$"},"description":"r2, r3, …"}],"responses":{"200":{"description":"applied, ignored, or a duplicate of a settled receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"400":{"description":"bad signature, stale timestamp, or environment mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"404":{"description":"unknown account / generation segment, other environment, or no webhook secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"409":{"description":"receipt busy / lease lost or an event-identity collision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"500":{"description":"handler failure — PayMongo retries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"503":{"description":"wallet webhook intake not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}}}}},"/webhooks/paymongo/parent":{"post":{"tags":["webhooks"],"summary":"PayMongo → API only: ONBOARDING events for linked accounts (merchant.activated / merchant.declined / account.identity_verification.passed|failed), registered once with scripts/paymongo/register-parent-webhook.mjs. Authenticated by the Paymongo-Signature HMAC with PAYMONGO_PARENT_WEBHOOK_SECRET; the environment must match the deployment (identity-verification events are the one documented exception). Events for an unknown account are acknowledged and not stored.","responses":{"200":{"description":"applied, ignored (incl. unknown account), or duplicate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"400":{"description":"bad signature or environment mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"409":{"description":"receipt busy / lease lost — retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"500":{"description":"handler failure — retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}},"503":{"description":"onboarding webhook intake not configured (fail closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayMongoWebhookAck"}}}}}}}},"components":{"securitySchemes":{"OperatorApiKey":{"type":"apiKey","in":"header","name":"x-mflow-api-key","description":"Own-tenant, scoped operator M2M key `mfok_<ref>.<secret>`. Scope manage|full; a manage key is refused on privileged (money/irreversible) routes."},"OperatorSession":{"type":"apiKey","in":"cookie","name":"mflow_operator_session","description":"The human operator session cookie — full authority. Required to mint/rotate/delete keys and for privileged routes."},"GuestToken":{"type":"apiKey","in":"header","name":"x-mflow-guest-token","description":"A shopper’s tenant-bound guest token. OBTAIN one anonymously at POST /auth/browse-token (body {tenantId, cartRef?}); an identified shopper instead verifies a magic link. TENANT + PURPOSE bound (a browse token authorizes only catalog/pricing/hold reads for its own tenant — never money, orders, or admin; it can never verify as a magic-link or admin token). Carries ZERO PII. 24h TTL (BROWSE_TOKEN_TTL_SECONDS) — RENEW by re-minting (there is no refresh). Minting is rate-limited (auth tier, 10/min ⇒ 429)."}},"schemas":{"Error":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"human-readable message"},"code":{"type":"string","description":"stable machine-readable code (see x-mflow-error-codes)"},"message":{"type":"string","description":"checkout payment refusals: the same human-readable text as `error` (the field name other routes use)"},"reason":{"type":"string","enum":["ACCOUNT_NOT_READY","METHOD_WITHDRAWN","AMOUNT_OUT_OF_RANGE","MARGIN_TOO_THIN","RAIL_UNCONFIGURED"],"description":"PH wallet checkout refusals only (PAYMENT_METHOD_UNAVAILABLE): a STABLE sub-code so a client never parses the message or guesses from the HTTP status. ACCOUNT_NOT_READY (409, the store’s PayMongo account cannot take the method yet) · METHOD_WITHDRAWN (409, the method is not open for new charges now — re-quote) · AMOUNT_OUT_OF_RANGE (422, outside the method’s provider limits) · MARGIN_TOO_THIN (422, the order cannot carry the wallet fees) · RAIL_UNCONFIGURED (503, temporary; nothing charged). Offer the other methods for the first four."}}},"BrowseTokenRequest":{"type":"object","required":["tenantId"],"properties":{"tenantId":{"type":"string","description":"the tenant (store) the anonymous browse token is bound to"},"cart":{"type":"boolean","description":"Set true to request a CART-SCOPED token: the server MINTS an unforgeable cartRef and returns it in the response. Omit (or false) for a pure-browse token (catalog/pricing reads only, no cart)."},"cartRef":{"deprecated":true,"type":"string","description":"DEPRECATED and IGNORED as a value. Its presence is accepted (legacy) as the same signal as `cart:true`, but clients can no longer choose their cartRef — it is the ownership credential and is always server-minted. Read the assigned cartRef from the response."}},"additionalProperties":false},"BrowseTokenResponse":{"type":"object","required":["token","expiresAt","cartRef"],"properties":{"token":{"type":"string","description":"the HMAC guest token; thereafter sent as the x-mflow-guest-token header"},"expiresAt":{"type":"string","format":"date-time","description":"ISO 8601 expiry (24h default; renew by re-minting)"},"cartRef":{"type":["string","null"],"description":"the SERVER-MINTED, unforgeable cart handle when a cart-scoped token was requested (else null). Use it as the `contextRef` on POST /pricing/holds; a hold can only be released by the token bearing this cartRef."}}},"MagicLinkRequest":{"type":"object","required":["email","tenantId"],"properties":{"email":{"type":"string","format":"email","description":"shopper email the sign-in link is delivered to"},"tenantId":{"type":"string"},"storefrontBaseUrl":{"type":"string","description":"OPTIONAL tenant storefront origin for the emailed landing link (must be bound to the tenant)."}},"additionalProperties":false},"MagicLinkAck":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","description":"always true — the token travels via email, never in this response"}}},"GuestPrincipal":{"type":"object","required":["kind","tenantId","email"],"properties":{"kind":{"type":"string","enum":["guest"]},"tenantId":{"type":"string"},"email":{"type":"string","description":"the identified shopper email (empty for an anonymous browse principal)"}}},"MagicLinkVerifyResponse":{"type":"object","required":["ok","principal"],"properties":{"ok":{"type":"boolean"},"principal":{"$ref":"#/components/schemas/GuestPrincipal"}}},"TenantTheme":{"type":"object","required":["brand","accent","bg","fg","muted","radius","logoText"],"properties":{"brand":{"type":"string"},"accent":{"type":"string"},"bg":{"type":"string"},"fg":{"type":"string"},"muted":{"type":"string"},"radius":{"type":"string"},"logoText":{"type":"string"}}},"TenantPixels":{"type":"object","properties":{"tiktok":{"type":["string","null"]},"meta":{"type":["string","null"]},"linkedin":{"type":["string","null"]}}},"TenantBranding":{"type":"object","required":["storeName","slug","tagline","theme","logoUrl","customHost"],"properties":{"storeName":{"type":"string"},"slug":{"type":"string"},"tagline":{"type":["string","null"]},"theme":{"$ref":"#/components/schemas/TenantTheme"},"logoUrl":{"type":["string","null"],"description":"mflow-SIGNED /media serving path (never a raw bucket URL)"},"customHost":{"type":["string","null"],"description":"present only when the custom host is ACTIVE (verified)"}}},"TenantAffiliation":{"type":"object","required":["affiliated","entity"],"description":"DISCLOSURE metadata only (LEGAL.md control #8): whether the vendor and this L2 operator share ownership. NEUTRAL + uniformly derived from env; NO commerce/pricing/fulfillment path branches on it.","properties":{"affiliated":{"type":"boolean","description":"true iff the store’s tenant id is in the affiliated set"},"entity":{"type":["string","null"],"description":"the shared-ownership entity name to disclose; null when not affiliated"}}},"TenantPublicConfig":{"type":"object","required":["tenantId","name","legalEntity","host","market","destinationCountries","currency","taxInclusiveDisplay","taxDisplayNote","termsVersion","consumerTermsVersion","walletsEnabled","supportEmail","theme","pixels","branding","storefrontMode","canonicalStorefrontUrl","affiliation","stripePublishableKey"],"description":"PUBLIC store identity + presentation. No payment account, KYB state, credit, or readiness ever appears here.","properties":{"tenantId":{"type":"string"},"name":{"type":"string"},"legalEntity":{"type":"string","description":"the L2 merchant-of-record legal entity (RA 11967 disclosure source)"},"host":{"type":"string"},"market":{"type":"string","description":"primary GA market (AU|NZ|HK|MO|PH)"},"destinationCountries":{"type":"array","items":{"type":"string"},"description":"served GA destination countries"},"currency":{"type":"string"},"taxInclusiveDisplay":{"type":"boolean","description":"present prices tax-inclusive (AU/NZ by law; per-tenant override)"},"taxDisplayNote":{"type":["string","null"],"description":"Shopper-facing tax-disclosure note, DERIVED to stay consistent with taxInclusiveDisplay (never contradicts it): an \"included in the price\" note appears ONLY when taxInclusiveDisplay is true; when false it is null or a note that does not assert inclusion (e.g. free-port \"no sales tax\"). Neutral, uniformly-applied platform display policy."},"termsVersion":{"type":"string","description":"the MoR terms version the shopper must accept at checkout"},"consumerTermsVersion":{"type":"string","description":"the CONSUMER Terms of Sale version in force for this store — render it on your terms page and freeze it into any review submitted against this store. DISTINCT from termsVersion, which is the B2B operator<->platform document that /checkout/intent validates."},"walletsEnabled":{"type":"boolean"},"supportEmail":{"type":["string","null"]},"theme":{"$ref":"#/components/schemas/TenantTheme"},"pixels":{"$ref":"#/components/schemas/TenantPixels"},"branding":{"$ref":"#/components/schemas/TenantBranding"},"storefrontMode":{"type":"string","enum":["hosted","headless","disabled"],"description":"Presentation lifecycle of the HOSTED template (migration 0080). hosted = the hosted .mflow template is indexable; headless = the operator’s self-hosted SPA is canonical (hosted noindexes + canonicals to canonicalStorefrontUrl); disabled = hosted retired (noindex + a \"moved\" notice). PRESENTATION ONLY — one tenant = one catalog/pricing/orders/MoR, never a second data path."},"canonicalStorefrontUrl":{"type":["string","null"],"description":"The operator’s self-hosted storefront URL the hosted template canonicals/links to when headless/disabled; null in hosted mode."},"affiliation":{"$ref":"#/components/schemas/TenantAffiliation"},"stripePublishableKey":{"type":["string","null"],"description":"The PLATFORM Stripe publishable key (non-secret) for Elements preload; null when STRIPE_PUBLISHABLE_KEY is unset. The secret key is NEVER exposed."}}},"TenantResolveResponse":{"type":"object","additionalProperties":false,"required":["tenant"],"description":"The GET /tenants/resolve envelope — the store public config nested under `tenant`.","properties":{"tenant":{"$ref":"#/components/schemas/TenantPublicConfig"}}},"CustomsValue":{"type":"object","required":["minor","currency"],"properties":{"minor":{"type":"integer"},"currency":{"type":"string"}}},"Dimensions":{"type":"object","required":["length","width","height"],"properties":{"length":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}}},"SkuListability":{"type":"object","description":"DERIVED sellability the reader computed (engine-authoritative); a shopper only ever sees listable skus.","properties":{"listable":{"type":"boolean"},"available":{"type":"integer","description":"reservable units right now (engine snapshot)"}},"additionalProperties":true},"AllocationSnapshot":{"type":"object","description":"Backing allocation the storefront cart addresses for a hold (empty on a pool sku).","required":["allocationId","available"],"properties":{"allocationId":{"type":"string"},"lotId":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","RELEASED"]},"windowClosed":{"type":"boolean"},"available":{"type":"integer","description":"reservable units on this allocation"},"rotationExpiry":{"type":["string","null"]}}},"PoolListingAddress":{"type":"object","description":"Present ONLY on a pooled sku — the pool keyspace address + the store’s OWN price over the shared frozen basis.","required":["poolId","skuId","consumerTenantId","sharedBasisMinor"],"properties":{"poolId":{"type":"string"},"skuId":{"type":"string"},"consumerTenantId":{"type":"string"},"priceMinor":{"type":["integer","null"],"description":"the store’s OWN consumer price; null = listed-but-unpriced"},"currency":{"type":["string","null"]},"sharedBasisMinor":{"type":"integer","description":"the shared FROZEN vendor basis the store prices at/above"}}},"CatalogSku":{"type":"object","required":["id","conditionGrade","authenticityStatus","origin","sizeToken","attributes","allocations","listability"],"properties":{"id":{"type":"string"},"vendorSku":{"type":["string","null"]},"variant":{"type":["string","null"]},"conditionGrade":{"type":"string","description":"honest condition grade (authenticity disclosure)"},"authenticityStatus":{"type":"string"},"barcode":{"type":["string","null"]},"taxCode":{"type":["string","null"]},"origin":{"type":"string"},"sizeToken":{"type":"string","description":"normalized size axis value; \"\" when no size axis applies"},"sizeLabel":{"type":"string","description":"shopper-ready size label from sizeToken (e.g. shoe-eu-41 → \"EU 41\"); \"\" when no size axis"},"nextDropAt":{"type":["string","null"],"description":"ISO of this sku's NEXT falling-price drop from the store's markdown schedule; null when no future drop / no schedule. Render a per-card countdown off the LIST read with no per-sku markdown() call."},"attributes":{"type":"object","additionalProperties":true,"description":"neutral per-sku attribute bag ({} when none)"},"hsCode":{"type":["string","null"]},"customsValue":{"anyOf":[{"$ref":"#/components/schemas/CustomsValue"},{"type":"null"}]},"hazmat":{"type":"boolean"},"shipWeightG":{"type":["number","null"]},"dimsMm":{"anyOf":[{"$ref":"#/components/schemas/Dimensions"},{"type":"null"}]},"expiresAt":{"type":["string","null"]},"allocations":{"type":"array","items":{"$ref":"#/components/schemas/AllocationSnapshot"}},"poolListing":{"$ref":"#/components/schemas/PoolListingAddress"},"listability":{"$ref":"#/components/schemas/SkuListability"}},"additionalProperties":true},"ProductReviewSummary":{"type":"object","description":"Consumer-review summary for a product. TOTAL — present on every product on both the full and the card view, never absent, so `product.reviews.state` is always safe to read. Discriminated by `state`: `rated` (a real mean over real reviews), `none` (NO reviews — render \"New\", never 0 stars), `off` (the operator disabled reviews for this store; the suppression counts still publish), `unavailable` (the aggregate could not be read — DO NOT render this as \"no reviews yet\"), `not-loaded` (an internal read that did not request aggregates; never reaches a consumer surface). THERE IS NO ARM IN WHICH A RATING EXISTS WITHOUT REVIEWS BEHIND IT: `rating` is a number only under `state: \"rated\"`, and is null under `none`. A store with no reviews has NO rating — a platform-authored default would be misleading aggregate consumer-review information (UK DMCC Act 2024 Sch. 20, US FTC 16 CFR 465.2, EU UCPD Annex I 23b/23c). RATING-NEUTRAL MODERATION: `rating` and `count` are computed over displayed AND operator-hidden reviews, so hiding a critical review cannot raise a store rating; `publishedCount` is how many have visible TEXT. `hiddenCount` (withdrawn by THIS STORE, on a stated ground) and `withheldCount` (withdrawn by the platform screen) are separate and must not be summed or attributed to each other.","required":["state"],"properties":{"state":{"type":"string","enum":["rated","none","off","unavailable","not-loaded"]},"count":{"type":"integer","description":"reviews behind the rating (displayed + operator-hidden)"},"rating":{"type":["number","null"],"description":"arithmetic mean to one decimal; null unless state is \"rated\""},"publishedCount":{"type":"integer","description":"reviews whose TEXT is displayed"},"hiddenCount":{"type":"integer","description":"text withdrawn by this store on a stated ground"},"withheldCount":{"type":"integer","description":"withdrawn by the platform screen — NOT an operator act"},"distribution":{"type":"array","items":{"type":"integer"},"description":"exactly 5 counts, one-star first"},"byGrade":{"type":"array","description":"per-condition-grade breakdown. A product row spans every condition grade of a supplier SKU, so the headline mean can mix NEW and SALVAGE units — this is the disclosure that makes that honest.","items":{"type":"object","required":["grade","count","rating"],"properties":{"grade":{"type":"string"},"count":{"type":"integer"},"rating":{"type":"number"}}}}}},"CatalogProduct":{"type":"object","required":["id","title","status","media","skus","reviews"],"properties":{"id":{"type":"string"},"title":{"type":"string"},"displayName":{"type":"string","description":"brand-deduped shopper name so brand + displayName never doubles (brand \"361 Degrees\" + \"361 Degrees 361 Degrees Big3\" → \"Big3\"); equals title when no brand prefix"},"slug":{"type":["string","null"]},"brand":{"type":["string","null"]},"category":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":"string"},"media":{"type":"array","items":{"type":"string"},"description":"R2 object keys only — resolvable via the media proxy"},"reviews":{"$ref":"#/components/schemas/ProductReviewSummary"},"mediaUrls":{"type":"array","items":{"type":"string"},"description":"mflow-SIGNED serving paths for `media`, index 0 = the hero. LIST + SEARCH sign only the hero (mediaUrls[0]); the product DETAIL endpoint signs the full gallery. Omitted when the media lane is unbound; a kill-switched key is dropped (never a raw bucket URL). Raw `media` keys resolve ONLY via the media proxy."},"skus":{"type":"array","items":{"$ref":"#/components/schemas/CatalogSku"}}},"additionalProperties":true},"CatalogProductCard":{"type":"object","description":"LIST-LITE card projection returned per product when GET /catalog/products?view=card or /catalog/search?view=card. A PURE field-trim of the SAME fully-hydrated, curation-filtered, availability-derived product the full view returns — listability, pricing and availability are byte-identical to the full view; only the response fields are trimmed. Carries NO skus[]/allocations[]: render an image + inStock + metadata grid with ZERO per-card calls, and bulk-price the page in ONE call by passing `skuIds` to POST /pricing/skus/effective-prices.","required":["id","slug","title","displayName","brand","category","status","imageUrl","priceFromMinor","currency","inStock","conditionGrades","skuCount","skuIds","nextDropAt","reviews"],"properties":{"reviews":{"$ref":"#/components/schemas/ProductReviewSummary"},"id":{"type":"string"},"slug":{"type":["string","null"]},"title":{"type":"string"},"displayName":{"type":"string","description":"brand-deduped shopper name (see CatalogProduct.displayName)"},"brand":{"type":["string","null"]},"category":{"type":["string","null"]},"status":{"type":"string"},"imageUrl":{"type":["string","null"],"description":"the signed hero = mediaUrls[0]; null when no served image"},"priceFromMinor":{"type":["integer","null"],"description":"MIN of the store's OWN consumer price (minor units) across listable skus that carry a price in the hydrated view; null when none is priced here. A per-tenant sku surfaces its price_book DTC price (from the page's ONE price_book batch); a pooled sku surfaces its poolListing price (which wins when both are present) — so a per-tenant store WITH a price_book gets a real 'from' price on a 1-call grid, and a store with none stays null. Derived from the already-hydrated skus — NO per-sku pricing call. For destination-accurate figures use POST /pricing/skus/effective-prices. Always the L2’s OWN price, never an L1-set price."},"currency":{"type":["string","null"],"description":"currency of the priceFromMinor sku (its price_book / poolListing currency); null when unpriced here"},"inStock":{"type":"boolean","description":"any listable sku has reservable units right now (engine-derived availability)"},"conditionGrades":{"type":"array","items":{"type":"string"},"description":"distinct condition grades among the listable skus"},"skuCount":{"type":"integer","description":"count of listable skus"},"skuIds":{"type":"array","items":{"type":"string"},"description":"the listable sku ids on this card (skus[] itself is trimmed) — pass the page’s skuIds to POST /pricing/skus/effective-prices to price the whole grid in one call."},"nextDropAt":{"type":["string","null"],"description":"SOONEST upcoming falling-price drop (ISO) across this card's listable skus, from the store's OWN markdown schedule; null when none has a future drop. Render ONE per-card countdown off the LIST read with no per-sku markdown() call. A neutral read of the L2 schedule, never an L1 price."}},"additionalProperties":false},"CatalogProductsResponse":{"type":"object","required":["tenantId","products","page"],"properties":{"tenantId":{"type":"string"},"products":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/CatalogProduct"},{"$ref":"#/components/schemas/CatalogProductCard"}]},"description":"view=full (default) ⇒ CatalogProduct items; view=card ⇒ the trimmed CatalogProductCard projection"},"page":{"type":"object","required":["limit","hasMore","nextCursor"],"description":"keyset pagination meta — pass page.nextCursor back as ?cursor to fetch the next page","properties":{"limit":{"type":"integer","description":"the page bound applied (clamped 1..250; default 100)"},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"opaque keyset token for the next page; null when the book is exhausted"}}}}},"CatalogProductResponse":{"type":"object","required":["tenantId","product"],"properties":{"tenantId":{"type":"string"},"product":{"$ref":"#/components/schemas/CatalogProduct"}}},"CatalogSearchResponse":{"type":"object","required":["tenantId","query","page","products"],"properties":{"tenantId":{"type":"string"},"query":{"type":"object","description":"the normalized query echo (facets the store-visible set was narrowed by)","properties":{"q":{"type":["string","null"]},"condition":{"type":"array","items":{"type":"string"}},"inStock":{"type":"boolean"},"sort":{"type":"string","enum":["relevance","newest","oldest","title","available"]},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"page":{"type":"object","required":["limit","offset","total","hasMore"],"properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"total":{"type":"integer","description":"store-visible products matching the facets, BEFORE pagination"},"hasMore":{"type":"boolean"}}},"products":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/CatalogProduct"},{"$ref":"#/components/schemas/CatalogProductCard"}]},"description":"view=full (default) ⇒ CatalogProduct items; view=card ⇒ the trimmed CatalogProductCard projection"}}},"MarkdownStep":{"type":"object","required":["afterHours","priceMinor"],"properties":{"afterHours":{"type":"number","description":"hours after the anchor at which this price takes effect (>= 0)"},"priceMinor":{"type":"integer","description":"the effective consumer price from this step onward"}}},"EffectivePrice":{"type":"object","required":["tenantId","skuId","currency","basePriceMinor","effectivePriceMinor","at"],"properties":{"tenantId":{"type":"string"},"skuId":{"type":"string"},"priceBookId":{"type":"string"},"currency":{"type":"string"},"basePriceMinor":{"type":"integer","description":"dtc_price before markdown (pre-tax merchandise subtotal)"},"effectivePriceMinor":{"type":"integer","description":"the effective consumer price at `at`, after markdown"},"at":{"type":"string","format":"date-time","description":"the instant the price was resolved at"},"taxDisplay":{"type":"object","additionalProperties":true,"description":"GST-inclusive display convention (dual ex-tax/inclusive figures) where the market presents inclusive"}},"additionalProperties":true},"EffectivePricesRequest":{"type":"object","required":["skuIds"],"description":"BULK effective-price request. Batches the SAME per-sku computation as GET /pricing/skus/{skuId}/effective-price for a whole card page in one READ — L1 computes nothing new; it returns the L2's OWN effective price per sku.","properties":{"tenantId":{"type":"string","description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own (a mismatch ⇒ 403)"},"destination":{"type":"string","description":"OPTIONAL destination country for the GST-inclusive display convention; omitted ⇒ ex-tax figures only (never presents pre-tax as all-in)"},"skuIds":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":250,"description":"the skus to price. 1..250 (mirrors the catalog page bound MAX_CATALOG_LIMIT); empty or >250 ⇒ 400 PRICING_INVALID_INPUT."},"at":{"type":"string","format":"date-time","description":"OPTIONAL instant to resolve the markdown at (defaults to now, like the single endpoint)"}},"additionalProperties":false},"EffectivePriceError":{"type":"object","required":["skuId","error"],"description":"A per-sku FAILURE entry in a bulk effective-prices response — the single endpoint’s error body, keyed by skuId, so one unknown/invalid/unpriced id never fails the whole batch.","properties":{"skuId":{"type":"string"},"error":{"type":"string","description":"stable pricing error code (e.g. PRICING_INVALID_INPUT, or the no-price code)"},"message":{"type":"string","description":"human-readable message"}}},"EffectivePricesResponse":{"type":"object","required":["prices"],"description":"One entry per requested skuId, in REQUEST ORDER. A priced sku carries the SAME body as the single GET /pricing/skus/{skuId}/effective-price (EffectivePrice); an unknown/invalid/unpriced sku carries an EffectivePriceError instead.","properties":{"prices":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/EffectivePrice"},{"$ref":"#/components/schemas/EffectivePriceError"}]}}}},"MarkdownState":{"type":"object","description":"GET /pricing/skus/{skuId}/markdown — the full falling-price step schedule + next-drop countdown.","required":["tenantId","skuId","currency","basePriceMinor","currentPriceMinor","floorPriceMinor","activeStepIndex","nextDropAt","steps","at"],"properties":{"tenantId":{"type":"string"},"skuId":{"type":"string"},"currency":{"type":"string"},"basePriceMinor":{"type":"integer"},"currentPriceMinor":{"type":"integer","description":"the effective price right now"},"floorPriceMinor":{"type":"integer","description":"the lowest price the schedule ever reaches (base included)"},"activeStepIndex":{"type":["integer","null"],"description":"index of the step in effect, or null = base price"},"nextDropAt":{"type":["string","null"],"format":"date-time","description":"the next scheduled drop after `at`, or null"},"nextDropPriceMinor":{"type":["integer","null"]},"steps":{"type":"array","items":{"$ref":"#/components/schemas/MarkdownStep"},"description":"normalized + ascending by afterHours"},"at":{"type":"string","format":"date-time"}}},"HoldRequest":{"type":"object","description":"Place a short-lived checkout hold, keyed on skuId + contextRef. allocationId is OPTIONAL: when omitted, the allocation engine (the SINGLE oversell firewall) resolves the current available allocation SERVER-SIDE — never bypassed. Pass allocationId only to pin a specific backing allocation (back-compat; byte-identical to the prior contract). A persisted cart should NOT carry a client allocationId — a stale/sold one would 409 the shopper against their OWN cart; omit it and let the engine resolve.","required":["skuId","contextRef"],"properties":{"tenantId":{"type":"string","description":"a scoped shopper may only address its own tenant (derived from the guest token)"},"skuId":{"type":"string"},"allocationId":{"type":"string","description":"OPTIONAL (ITEM 1). Omit to have the engine resolve the current available allocation for this sku server-side (the oversell firewall is never bypassed); pass it to pin a specific allocation, which reinstates the exact legacy guards (SKU_ALLOCATION_MISMATCH / ALLOCATION_INSUFFICIENT_AVAILABLE). A stale/missing client allocationId is no longer a 400."},"reservationId":{"type":"string","description":"OPTIONAL client id; minted server-side when omitted. Re-holding the SAME reservationId returns the STALE hold (idempotent — it never refreshes the TTL). At checkout, RELEASE then RE-HOLD with a NEW reservationId."},"contextRef":{"type":"string","description":"the cart context the hold binds to — equals the guest token’s cartRef; every hold’s contextRef must equal it"},"qty":{"type":"integer","description":"units to hold (default 1; most skus are single-unit)"},"ttlSeconds":{"type":"integer","description":"hold lifetime in seconds (default 900 = 15 min); an expired hold frees the unit"}},"additionalProperties":false},"HoldResponse":{"type":"object","description":"ONE round-trip: engine reserve THEN price-at-reservation capture. A hold whose price cannot be captured is released.","required":["reservation","idempotentReplay"],"properties":{"reservation":{"type":"object","additionalProperties":true},"allocation":{"type":"object","additionalProperties":true},"capture":{"type":"object","additionalProperties":true,"description":"the captured price-at-reservation"},"idempotentReplay":{"type":"boolean"}}},"ReleaseHoldRequest":{"type":"object","description":"Release a HELD reservation (frees the unit). allocationId is the one the hold RESOLVED to — read it from HoldResponse.allocation, even when the hold itself was placed without a client allocationId.","required":["allocationId","reservationId"],"properties":{"tenantId":{"type":"string"},"allocationId":{"type":"string","description":"the allocation the hold resolved to (HoldResponse.allocation)"},"reservationId":{"type":"string"}},"additionalProperties":false},"ReleaseHoldResponse":{"type":"object","required":["idempotentReplay"],"properties":{"reservation":{"type":"object","additionalProperties":true},"allocation":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"idempotentReplay":{"type":"boolean"}}},"ReserveRequest":{"type":"object","required":["allocationId","contextRef"],"properties":{"tenantId":{"type":"string"},"allocationId":{"type":"string"},"reservationId":{"type":"string","description":"OPTIONAL client id; minted server-side when omitted"},"contextRef":{"type":"string"},"qty":{"type":"integer"},"ttlSeconds":{"type":"integer"}},"additionalProperties":false},"ReserveResponse":{"type":"object","description":"The oversell-safe reservation the allocation engine arbitrated (single write-time authority).","properties":{"reservation":{"type":"object","additionalProperties":true},"allocation":{"type":"object","additionalProperties":true},"idempotentReplay":{"type":"boolean"}},"additionalProperties":true},"CheckoutQuoteRequest":{"type":"object","description":"Price-only — NEVER reserves and NEVER charges. The tenant is DERIVED from the principal, not trusted from the body (a guest token omits `tenant`; only an operator names it). Send EXACTLY ONE of `cartId` or `lines`.","required":["destination"],"properties":{"tenant":{"type":"string","description":"operator callers name the tenant; a scoped shopper is pinned to its own (omit it)"},"cartId":{"type":"string","description":"price a stored DB cart (mutually exclusive with `lines`)"},"lines":{"type":"array","description":"literal / reservation-backed lines (mutually exclusive with `cartId`)","items":{"type":"object","required":["skuId","qty"],"properties":{"skuId":{"type":"string"},"qty":{"type":"integer","minimum":1},"reservationId":{"type":"string","description":"when set, the CAPTURED price-at-reservation is quoted"}}}},"destination":{"type":"object","required":["country"],"properties":{"country":{"type":"string","description":"two-letter ISO (required; drives tax + duties)"},"region":{"type":"string"},"postcode":{"type":"string"}}},"shippingMethod":{"type":"string","description":"§3e: OPTIONAL chosen shipping method id (from a prior quote’s `shipping_methods[].id`). Prices this quote with that method; an unknown id ⇒ 422 SHIPPING_METHOD_INVALID. Omit ⇒ the default (Standard) tier."}},"additionalProperties":true},"QuoteShippingMethod":{"type":"object","description":"A selectable, priced shipping option DERIVED from the L2’s configured tiers (§3e). L1 surfaces + charges only what the L2 set. CASING (field-report #4): the server emits BOTH `amount_minor` (snake_case, DEPRECATED) and its camelCase alias `amountMinor` (CANONICAL) — read the camelCase form.","required":["id","label","amount_minor"],"properties":{"id":{"type":"string","description":"stable method id — echo back as `shippingMethod` on the next quote / on /checkout/intent"},"label":{"type":"string","description":"neutral display label (title-cased id)"},"amount_minor":{"type":"integer","description":"the L2’s OWN configured price for this method, minor units (snake_case; deprecated)"},"amountMinor":{"type":"integer","description":"CANONICAL camelCase alias of amount_minor (same value)"}}},"QuotePerLine":{"type":"object","description":"One priced quote line. CASING (field-report #4): every snake_case key ships with a CANONICAL camelCase alias of the same value (`sku_id`+`skuId`, `unit_price_minor`+`unitPriceMinor`, …) — read the camelCase form.","required":["sku_id","qty","unit_price_minor","line_subtotal_minor","tax_minor"],"properties":{"sku_id":{"type":"string","description":"snake_case; deprecated"},"skuId":{"type":"string","description":"CANONICAL camelCase alias of sku_id"},"qty":{"type":"integer"},"unit_price_minor":{"type":"integer","description":"snake_case; deprecated"},"unitPriceMinor":{"type":"integer","description":"CANONICAL camelCase alias of unit_price_minor"},"line_subtotal_minor":{"type":"integer","description":"snake_case; deprecated"},"lineSubtotalMinor":{"type":"integer","description":"CANONICAL camelCase alias of line_subtotal_minor"},"tax_minor":{"type":"integer","description":"snake_case; deprecated"},"taxMinor":{"type":"integer","description":"CANONICAL camelCase alias of tax_minor"}}},"QuoteResult":{"type":"object","description":"The priced quote (POST /checkout/quote). CASING RECONCILIATION (field-report #4): the response carries BOTH casings — every legacy snake_case key (listed in `required`, retained for back-compat) ships with a CANONICAL camelCase alias of the identical value, INCLUDING nested `perLine[]` and `shippingMethods[]` elements. camelCase is canonical; snake_case is DEPRECATED. A contract test locks the alias set so it cannot drift from the SDK `QuoteResult`. Identity: totalMinor = subtotalMinor + shippingMinor + dutiesMinor + taxMinor — EXCEPT for a VAT-registered Philippine store (PH VAT posture, D-PH-8), whose prices already INCLUDE 12 % VAT: there taxMinor is the VAT embedded in the subtotal/shipping (render it as \"VAT included\", never add it back onto the subtotal) and totalMinor = subtotalMinor + shippingMinor + dutiesMinor. Such a quote carries `taxEmbedded: true` (also `taxInclusiveDisplay: true`); branch on taxEmbedded FIRST — the AU/NZ inclusive-display rendering (pre-tax subtotal plus GST) double-counts an embedded tax.","required":["currency","subtotal_minor","shipping_minor","duties_minor","tax_minor","total_minor","tax_inclusive_display","per_line","duties_regime","shipping_methods","selected_shipping_method"],"properties":{"currency":{"type":"string"},"subtotal_minor":{"type":"integer","description":"snake_case; deprecated"},"subtotalMinor":{"type":"integer","description":"CANONICAL camelCase alias of subtotal_minor"},"shipping_minor":{"type":"integer","description":"the price of the SELECTED method (§3e); snake_case; deprecated"},"shippingMinor":{"type":"integer","description":"CANONICAL camelCase alias of shipping_minor"},"duties_minor":{"type":"integer","description":"snake_case; deprecated"},"dutiesMinor":{"type":"integer","description":"CANONICAL camelCase alias of duties_minor"},"tax_minor":{"type":"integer","description":"snake_case; deprecated"},"taxMinor":{"type":"integer","description":"CANONICAL camelCase alias of tax_minor"},"total_minor":{"type":"integer","description":"snake_case; deprecated"},"totalMinor":{"type":"integer","description":"CANONICAL camelCase alias of total_minor"},"tax_inclusive_display":{"type":"boolean","description":"snake_case; deprecated"},"taxInclusiveDisplay":{"type":"boolean","description":"CANONICAL camelCase alias of tax_inclusive_display"},"per_line":{"type":"array","items":{"$ref":"#/components/schemas/QuotePerLine"},"description":"snake_case; deprecated"},"perLine":{"type":"array","items":{"$ref":"#/components/schemas/QuotePerLine"},"description":"CANONICAL camelCase alias of per_line"},"tax_reason":{"type":"string","description":"present when tax_minor is 0 by posture (HK/MO no GST; PH VAT note); snake_case; deprecated"},"taxReason":{"type":"string","description":"CANONICAL camelCase alias of tax_reason (present only when tax_reason is)"},"tax_embedded":{"type":"boolean","enum":[true],"description":"PRESENT (always true) only for a VAT-registered Philippine store: tax_minor is ALREADY INSIDE subtotal_minor / shipping_minor, so total_minor = subtotal_minor + shipping_minor + duties_minor. ABSENT everywhere else (tax added on top). snake_case; deprecated"},"taxEmbedded":{"type":"boolean","enum":[true],"description":"CANONICAL camelCase alias of tax_embedded (present only when tax_embedded is)"},"duties_regime":{"type":"string","description":"snake_case; deprecated"},"dutiesRegime":{"type":"string","description":"CANONICAL camelCase alias of duties_regime"},"shipping_methods":{"type":"array","description":"§3e: the shipping methods available for the destination — the storefront’s real, priced options (displayed == charged). Always ≥1. snake_case; deprecated","items":{"$ref":"#/components/schemas/QuoteShippingMethod"}},"shippingMethods":{"type":"array","description":"CANONICAL camelCase alias of shipping_methods","items":{"$ref":"#/components/schemas/QuoteShippingMethod"}},"selected_shipping_method":{"type":"string","description":"§3e: the method id this quote was priced with (the chosen one, or the default); snake_case; deprecated"},"selectedShippingMethod":{"type":"string","description":"CANONICAL camelCase alias of selected_shipping_method"},"offered_methods":{"type":"array","items":{"$ref":"#/components/schemas/OfferedPaymentMethod"},"description":"PH wallet rail (additive; docs/PAYMENT_RAILS_PH.md App. B.1): the payment methods THIS store can take for THIS quote. PRESENT ONLY on a deployment with the wallet seam bound (PayMongo configured) — absent ⇒ the card-only contract. `card` is listed only when the store has a Stripe account and the Stripe adapter is bound; `gcash` / `qrph` only when the rail is enabled, presentment is PHP, the PH VAT posture is declared, the total is within the method limits and the store’s own PayMongo account is ACTIVE with that method usable, webhook confirmed and processor-verified. ADVISORY: /checkout/intent re-checks every fact. snake_case; deprecated"},"offeredMethods":{"type":"array","items":{"$ref":"#/components/schemas/OfferedPaymentMethod"},"description":"CANONICAL camelCase alias of offered_methods (present only when offered_methods is)"}}},"OfferedPaymentMethod":{"type":"object","description":"One payment method a quote offers (inner keys are already camelCase; no snake_case twins).","required":["method","provider","label","minMinor","maxMinor"],"properties":{"method":{"type":"string","enum":["card","gcash","qrph"],"description":"echo back as `paymentMethod` on /checkout/intent"},"provider":{"type":"string","enum":["stripe","paymongo"]},"label":{"type":"string","description":"neutral display label: Card | GCash | QR Ph"},"minMinor":{"type":["integer","null"],"description":"inclusive provider minimum in minor units (wallets: 100 = ₱1.00); null ⇒ none published"},"maxMinor":{"type":["integer","null"],"description":"inclusive provider maximum in minor units (GCash: 10000000 = ₱100,000.00); null ⇒ set by the payer’s bank (QR Ph) / not published"}}},"CheckoutIntentRequest":{"type":"object","description":"Create the DIRECT-charge intent on the L2-owned connected account (L1 is never the MoR). Guest/cart-scoped: the token must have been minted WITH a cartRef (else 403 SHOPPER_SCOPE_REQUIRED). Wire gotchas the first operator reverse-engineered from 4xx: send `lines` (NOT `items`); `email` is TOP-LEVEL; the address field is `postcode` (NOT `postal`); and OMIT `cartId` for the reservation-backed flow. Accepts both camelCase and snake_case keys.","required":["email","shipping_address","terms_accepted","terms_version"],"properties":{"tenant":{"type":"string","description":"operator callers name the tenant; a scoped shopper is pinned to its own"},"cartId":{"type":"string","description":"DB-cart flow ONLY. For the headless / reservation-backed flow OMIT cartId entirely — a NON-EMPTY cartId routes to the DB-cart path, where a missing/expired/uncaptured hold ⇒ CART_INVALID. Send `lines` instead."},"lines":{"type":"array","items":{"type":"object","required":["skuId","qty","reservationId"],"properties":{"skuId":{"type":"string"},"qty":{"type":"integer","minimum":1},"reservationId":{"type":"string"},"customization":{"type":"object","description":"OPTIONAL per-line buyer personalization, persisted to order_line.customization and shown to the vendor, the warehouse and the operator. Omit it for an ordinary line (the line then stores {}). Only these top-level fields are accepted — anything else is REFUSED (422 CART_INVALID) rather than dropped: `kind`, `model`, `spec`, `printFileKey`, `previewFileKey`. `printFileKey` and `previewFileKey` must name an object under `customization/` — the tenant is applied by the server and must NOT appear in the key. `kind` and `model` are short identifiers, not free text. The payload must serialize under 16 KB and must carry no commercial figure at any depth — upload artwork as an object and reference it, never inline the bytes. There is no customization upcharge: /checkout/quote deliberately ignores this field, so a personalized line prices exactly as a plain one.","properties":{"kind":{"type":"string","description":"Kind discriminator, e.g. \"case-print\"."},"model":{"type":"string","description":"Product model the design was composed against."},"spec":{"type":"object","description":"Resolution-independent design spec (normalized coordinates)."},"printFileKey":{"type":"string","description":"Print-ready artefact key in your own media namespace."},"previewFileKey":{"type":"string","description":"Optional preview key, same namespace rule."}},"additionalProperties":false}}},"description":"reservation-backed lines (mutually exclusive with `cartId`): each must be a LIVE HELD reservation with a captured price, owned by THIS shopper — its hold’s contextRef must equal the token’s cartRef, else 404 ORDER_NOT_FOUND. Because holds expire (~15 min), release + re-hold each line fresh right before intent. NOTE: this spec is SERVED, not enforced (no addSchema / setValidatorCompiler) — the line mapper in payments/routes.ts is what actually accepts these fields, and payments/customization.ts is what validates `customization`."},"email":{"type":"string","format":"email","description":"TOP-LEVEL shopper email (not nested); must match the order’s cartRef scope"},"terms_accepted":{"type":"boolean","description":"must be true"},"terms_version":{"type":"string","description":"must equal the tenant MoR terms version (else 422 TERMS_NOT_ACCEPTED). READ it from GET /tenants/resolve → `tenant.termsVersion` and echo it back — NEVER hardcode a literal (a terms revision would then 422 every checkout)."},"shipping_address":{"type":"object","description":"the camelCase alias `shippingAddress` is also accepted","required":["name","line1","city","postcode","country"],"properties":{"name":{"type":"string"},"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postcode":{"type":"string"},"country":{"type":"string","description":"two-letter ISO"},"phone":{"type":"string"}}},"utm":{"type":"object","additionalProperties":{"type":"string"}},"redeemVaultCredit":{"type":"boolean","description":"apply closed-loop Vault Credit as a discount (default true)"},"paymentMethod":{"type":"string","enum":["card","gcash","qrph"],"description":"PH wallet rail (additive): `card` (the DEFAULT when absent — the Stripe Payment Element flow, unchanged) | `gcash` | `qrph` (a charge on the store’s OWN PayMongo account; the platform fee is a fixed split to the platform account, taken on the pre-tax merchandise subtotal). Pick only a method the quote offered. Any other value ⇒ 400 INVALID_PAYMENT_METHOD. The snake_case alias `payment_method` is also accepted."},"payment_method":{"type":"string","enum":["card","gcash","qrph"],"description":"snake_case alias of paymentMethod (camelCase wins when both are sent)"},"returnUrl":{"type":"string","format":"uri","description":"GCash ONLY, and REQUIRED for it: `https://<store host>/checkout/complete`, where the host is the store’s `<tenantId|slug>.mflow.fuxitrading.com`, its ACTIVE custom host, or an https origin in its storefront CORS allowlist (`http://localhost`, `http://127.0.0.1` and `http://*.localhost` accepted outside production). Credentials and any query string are dropped; the API appends `?orderId=…&paymentRef=…` itself. Anything else ⇒ 400 WALLET_RETURN_URL_INVALID. Ignored for QR Ph and card. The snake_case alias `return_url` is also accepted."},"return_url":{"type":"string","format":"uri","description":"snake_case alias of returnUrl"},"shippingMethod":{"type":"string","description":"§3e: OPTIONAL chosen shipping method id (one of the quote’s `shipping_methods[].id`). The order total + funding reflect THAT method’s amount, priced server-authoritatively; an unknown id ⇒ 422 SHIPPING_METHOD_INVALID (the client picks an offered id, never a price). Omit ⇒ the default (Standard) tier, unchanged."}},"additionalProperties":true},"CheckoutIntentResponse":{"type":"object","description":"The Payment Element config. L1 is NOT the merchant of record: the charge is a DIRECT charge on payment_element.stripe_account (the L2-owned CONNECTED account). Mount Elements with loadStripe(stripePublishableKey, { stripeAccount: payment_element.stripe_account }). CASING RECONCILIATION (field-report #4): the response carries BOTH casings — every legacy snake_case key ships with a CANONICAL camelCase alias of the identical value, INCLUDING nested `paymentElement.*` and `quote.*` (the ONLY exception is `walletOptions`, a wallet-id→enabled MAP whose inner keys — apple_pay/google_pay — stay UNCHANGED). camelCase is canonical; snake_case is DEPRECATED. `client_secret`/`clientSecret` is OPTIONAL — it is present only when the provider returned a client secret (an adapter path that yields none omits it), so a client MUST treat it as possibly-absent (mirrored by the SDK `IntentResult.clientSecret?`).","required":["orderId","paymentRef","amount_minor","applied_credit_minor","currency","status","wallet_options","payment_element","quote","stripePublishableKey"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"amount_minor":{"type":"integer","description":"what the consumer is charged = quote total − applied_credit_minor; snake_case; deprecated"},"amountMinor":{"type":"integer","description":"CANONICAL camelCase alias of amount_minor"},"applied_credit_minor":{"type":"integer","description":"closed-loop Vault Credit applied as a discount (0 when none); snake_case; deprecated"},"appliedCreditMinor":{"type":"integer","description":"CANONICAL camelCase alias of applied_credit_minor"},"currency":{"type":"string"},"status":{"type":"string","enum":["requires_confirmation"]},"wallet_options":{"type":"object","additionalProperties":true,"description":"wallet-id→enabled map; snake_case; deprecated (inner keys are NOT re-cased)"},"walletOptions":{"type":"object","additionalProperties":true,"description":"CANONICAL camelCase alias of wallet_options (same map; inner apple_pay/google_pay keys unchanged)"},"payment_element":{"type":"object","description":"snake_case; deprecated. Also carries camelCase inner aliases (paymentMethodTypes/stripeAccount).","required":["payment_method_types","stripe_account"],"properties":{"payment_method_types":{"type":"array","items":{"type":"string"},"description":"snake_case; deprecated"},"paymentMethodTypes":{"type":"array","items":{"type":"string"},"description":"CANONICAL camelCase alias of payment_method_types"},"stripe_account":{"type":"string","description":"the L2-owned CONNECTED account the direct charge runs on (the MoR); snake_case; deprecated"},"stripeAccount":{"type":"string","description":"CANONICAL camelCase alias of stripe_account"}}},"paymentElement":{"type":"object","description":"CANONICAL camelCase alias of payment_element (same object; carries both snake_case + camelCase inner keys)","properties":{"payment_method_types":{"type":"array","items":{"type":"string"}},"paymentMethodTypes":{"type":"array","items":{"type":"string"}},"stripe_account":{"type":"string"},"stripeAccount":{"type":"string"}},"additionalProperties":true},"client_secret":{"type":"string","description":"OPTIONAL — the PaymentIntent client secret (created on the connected account); present only when the provider returned one; snake_case; deprecated"},"clientSecret":{"type":"string","description":"OPTIONAL — CANONICAL camelCase alias of client_secret (absent when the provider returned no client secret)"},"quote":{"type":"object","description":"the priced quote snapshot; carries BOTH snake_case + CANONICAL camelCase keys of each field","required":["subtotal_minor","shipping_minor","duties_minor","tax_minor","total_minor","tax_inclusive_display"],"properties":{"subtotal_minor":{"type":"integer","description":"snake_case; deprecated"},"subtotalMinor":{"type":"integer","description":"CANONICAL camelCase alias of subtotal_minor"},"shipping_minor":{"type":"integer","description":"snake_case; deprecated"},"shippingMinor":{"type":"integer","description":"CANONICAL camelCase alias of shipping_minor"},"duties_minor":{"type":"integer","description":"snake_case; deprecated"},"dutiesMinor":{"type":"integer","description":"CANONICAL camelCase alias of duties_minor"},"tax_minor":{"type":"integer","description":"snake_case; deprecated"},"taxMinor":{"type":"integer","description":"CANONICAL camelCase alias of tax_minor"},"total_minor":{"type":"integer","description":"snake_case; deprecated"},"totalMinor":{"type":"integer","description":"CANONICAL camelCase alias of total_minor"},"tax_inclusive_display":{"type":"boolean","description":"snake_case; deprecated"},"taxInclusiveDisplay":{"type":"boolean","description":"CANONICAL camelCase alias of tax_inclusive_display"},"tax_embedded":{"type":"boolean","enum":[true],"description":"present only when VAT is already INSIDE subtotal/shipping (PH VAT-registered store) — never add tax back; snake_case; deprecated"},"taxEmbedded":{"type":"boolean","enum":[true],"description":"CANONICAL camelCase alias of tax_embedded (present only when tax_embedded is)"}}},"stripePublishableKey":{"type":["string","null"],"description":"The PLATFORM Stripe publishable key (non-secret) so a headless front can loadStripe(pk, { stripeAccount }); null when unset. The secret key is NEVER exposed."}}},"WalletRedirectAction":{"type":"object","description":"GCash: navigate the shopper to `url` (PayMongo’s hosted authorization page). Returns to the intent’s returnUrl.","required":["kind","provider","method","environment","url","providerActionExpiresAt","reservationExpiresAt"],"properties":{"kind":{"type":"string","enum":["redirect"]},"provider":{"type":"string","enum":["paymongo"]},"method":{"type":"string","enum":["gcash"]},"environment":{"type":"string","enum":["test","live"],"description":"the PayMongo environment; `test` moves no real money (PayMongo’s test authorization page)"},"url":{"type":"string","format":"uri","description":"https URL of the provider’s authorization page"},"providerActionExpiresAt":{"type":"string","format":"date-time","description":"the PROVIDER’s window (GCash: 4 hours)"},"reservationExpiresAt":{"type":"string","format":"date-time","description":"the store’s stock-hold deadline — for GCash it covers PayMongo’s 4-hour window plus a margin; once it passes, the status no longer offers this action"}}},"WalletQrAction":{"type":"object","description":"QR Ph (live): render `qrImageDataUrl`; the shopper scans or uploads it in GCash, Maya or a bank app.","required":["kind","provider","method","environment","qrImageDataUrl","providerActionExpiresAt","reservationExpiresAt"],"properties":{"kind":{"type":"string","enum":["qr"]},"provider":{"type":"string","enum":["paymongo"]},"method":{"type":"string","enum":["qrph"]},"environment":{"type":"string","enum":["live"]},"qrImageDataUrl":{"type":"string","description":"the QR Ph code image, normalized from PayMongo: a `data:image/…;base64,` URL OR an `https://` image URL (despite the name). Render it as an image; anything else is an unknown outcome the API never sends."},"providerActionExpiresAt":{"type":"string","format":"date-time","description":"the QR’s own expiry (set to the reservation window)"},"reservationExpiresAt":{"type":"string","format":"date-time","description":"the store’s stock-hold deadline"}}},"WalletTestQrAction":{"type":"object","description":"QR Ph in PayMongo TEST mode. It carries NO QR image: PayMongo documents that test-mode QR Ph codes are real and that scanning one “will process a real transaction”. Show a clear “test mode — do not scan or pay” notice and, when present, a link to `testSimulatorUrl` (PayMongo’s simulator; its location in PayMongo’s response is undocumented, so it may be absent).","required":["kind","provider","method","environment","testMode","providerActionExpiresAt","reservationExpiresAt"],"properties":{"kind":{"type":"string","enum":["qr"]},"provider":{"type":"string","enum":["paymongo"]},"method":{"type":"string","enum":["qrph"]},"environment":{"type":"string","enum":["test"]},"testMode":{"type":"boolean","enum":[true]},"testSimulatorUrl":{"type":"string","format":"uri","description":"https link to PayMongo’s test payment simulator, when PayMongo returned one"},"providerActionExpiresAt":{"type":"string","format":"date-time"},"reservationExpiresAt":{"type":"string","format":"date-time"}}},"WalletPaymentAction":{"description":"The discriminated (by `kind`, then `environment`) customer action for a wallet intent. An unknown kind must fail visibly — never fall through to Stripe Elements.","oneOf":[{"$ref":"#/components/schemas/WalletRedirectAction"},{"$ref":"#/components/schemas/WalletQrAction"},{"$ref":"#/components/schemas/WalletTestQrAction"}]},"WalletCheckoutIntentResponse":{"type":"object","description":"A WALLET intent (paymentMethod gcash | qrph) — 201. The order, its frozen lines and the payment row are persisted BEFORE any provider call; the charge runs on the store’s OWN PayMongo account (the L2 is the merchant of record) with the platform fee as a fixed split. There is NO client_secret / payment_element, and /checkout/confirm is never used (a wallet paymentRef 404s there): poll /checkout/status with { orderId, paymentRef }. Same casing reconciliation as CheckoutIntentResponse (snake_case + CANONICAL camelCase aliases).","required":["orderId","paymentRef","amount_minor","applied_credit_minor","currency","status","payment_action","quote"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string","description":"the PayMongo payment intent reference (pi_…)"},"amount_minor":{"type":"integer","description":"what the shopper pays = quote total − applied_credit_minor; snake_case; deprecated"},"amountMinor":{"type":"integer","description":"CANONICAL camelCase alias of amount_minor"},"applied_credit_minor":{"type":"integer","description":"closed-loop Vault Credit applied (0 when none); snake_case; deprecated"},"appliedCreditMinor":{"type":"integer","description":"CANONICAL camelCase alias of applied_credit_minor"},"currency":{"type":"string","enum":["PHP"]},"status":{"type":"string","enum":["requires_action"]},"payment_action":{"$ref":"#/components/schemas/WalletPaymentAction","description":"snake_case; deprecated"},"paymentAction":{"$ref":"#/components/schemas/WalletPaymentAction","description":"CANONICAL camelCase alias of payment_action"},"quote":{"type":"object","description":"the priced quote snapshot; carries BOTH snake_case + CANONICAL camelCase keys of each field","required":["subtotal_minor","shipping_minor","duties_minor","tax_minor","total_minor","tax_inclusive_display"],"properties":{"subtotal_minor":{"type":"integer","description":"snake_case; deprecated"},"subtotalMinor":{"type":"integer","description":"CANONICAL camelCase alias of subtotal_minor"},"shipping_minor":{"type":"integer","description":"snake_case; deprecated"},"shippingMinor":{"type":"integer","description":"CANONICAL camelCase alias of shipping_minor"},"duties_minor":{"type":"integer","description":"snake_case; deprecated"},"dutiesMinor":{"type":"integer","description":"CANONICAL camelCase alias of duties_minor"},"tax_minor":{"type":"integer","description":"PH VAT extracted from the inclusive price when the store is VAT-registered; snake_case; deprecated"},"taxMinor":{"type":"integer","description":"CANONICAL camelCase alias of tax_minor"},"total_minor":{"type":"integer","description":"snake_case; deprecated"},"totalMinor":{"type":"integer","description":"CANONICAL camelCase alias of total_minor"},"tax_inclusive_display":{"type":"boolean","description":"snake_case; deprecated"},"taxInclusiveDisplay":{"type":"boolean","description":"CANONICAL camelCase alias of tax_inclusive_display"},"tax_embedded":{"type":"boolean","enum":[true],"description":"present only when VAT is already INSIDE subtotal/shipping (PH VAT-registered store) — never add tax back; snake_case; deprecated"},"taxEmbedded":{"type":"boolean","enum":[true],"description":"CANONICAL camelCase alias of tax_embedded (present only when tax_embedded is)"}}}}},"CheckoutIntentResult":{"description":"POST /checkout/intent 201. EITHER the card Payment Element config (CheckoutIntentResponse, status requires_confirmation) OR a PH wallet intent (WalletCheckoutIntentResponse, status requires_action + payment_action). Dispatch on `paymentAction` BEFORE any Stripe Elements setup.","oneOf":[{"$ref":"#/components/schemas/CheckoutIntentResponse"},{"$ref":"#/components/schemas/WalletCheckoutIntentResponse"}]},"CheckoutConfirmRequest":{"type":"object","required":["paymentRef"],"properties":{"paymentRef":{"type":"string"}},"additionalProperties":true},"CheckoutConfirmResponse":{"type":"object","description":"Reports the provider status; state stays WEBHOOK-driven (fulfillment subscribes to funding.cleared, never payment.captured).","required":["orderId","paymentRef","status"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"status":{"type":"string"}}},"CheckoutStatusRequest":{"type":"object","required":["orderId","paymentRef"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"returnToken":{"type":"string","description":"PH wallet (GCash) only: the `returnToken` query parameter the API appended to the GCash return URL. Send it when the return opened in a browser WITHOUT the shopper’s guest token (GCash / the wallet app often reopens the link elsewhere). It proves ownership of exactly that tenant + order + paymentRef for ~5 hours and unlocks only the WalletCheckoutStatusReturnTokenResponse. A shopper principal that owns the order always gets the full projection. A bearer credential: keep it in memory for the page, never store or log it. (`return_token` accepted.)"},"tenant":{"type":"string","description":"The store the return landed on — required only when calling with a returnToken and NO guest token (it binds the token)."}},"additionalProperties":true},"CheckoutStatusResponse":{"type":"object","description":"Authoritative readback (native camelCase): binds tenant+shopper+order+payment in our DB, then validates every money field against the provider. Never infer success from the client — fulfillment waits for funding.cleared, NEVER payment.captured; conversion (HELD→CONVERTED→SOLD) is webhook-driven post-authorization.","required":["orderId","paymentRef","orderStatus","paymentStatus","providerStatus","outcome","clearCart"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"orderStatus":{"type":"string"},"paymentStatus":{"type":"string"},"providerStatus":{"type":"string"},"outcome":{"type":"string","enum":["authorized","captured","processing","pending","failed"]},"clearCart":{"type":"boolean"}}},"WalletRefundProjection":{"type":"object","description":"The latest refund on a wallet payment. A QR Ph refund carries a claim link the shopper must open to receive the money.","required":["amountMinor","status"],"properties":{"amountMinor":{"type":"integer"},"status":{"type":"string","enum":["PENDING","SUCCEEDED","FAILED"]},"claimUrl":{"type":"string","format":"uri","description":"QR Ph only, and ONLY on customerState REFUND_CLAIM_REQUIRED: the PayMongo claim link (show it to the shopper)"},"claimExpiresAt":{"type":"string","format":"date-time","description":"3 days after the link was issued"}}},"WalletCheckoutStatusResponse":{"type":"object","description":"The WALLET projection of POST /checkout/status (native camelCase): ONE server answer combining payment, order disposition, funding and refund state. Distinguish it by `rail === \"PAYMONGO\"` (a card payment keeps CheckoutStatusResponse with `outcome`). Use `customerState` — never `paymentStatus` — for copy and terminality: a captured wallet payment can still end CANCELED_REFUND_ARRANGED when stock could not be confirmed, and fulfillment waits for funding.cleared (ORDER_CONFIRMED). Clear the cart ONLY when clearCart is true.","required":["orderId","paymentRef","rail","method","amountMinor","currency","orderStatus","paymentStatus","providerStatus","customerState","reservationExpiresAt","providerActionExpiresAt","clearCart"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"rail":{"type":"string","enum":["PAYMONGO"]},"method":{"type":["string","null"],"enum":["gcash","qrph",null]},"amountMinor":{"type":"integer","description":"what the shopper pays (minor units of currency)"},"currency":{"type":"string","enum":["PHP"]},"paymentAction":{"$ref":"#/components/schemas/WalletPaymentAction","description":"RESUME: present only while customerState is AWAITING_PAYMENT and PayMongo still holds the shopper’s action open — the SAME QR / redirect as the intent, so a reload or return visit continues this payment instead of starting a second order."},"orderStatus":{"type":"string"},"paymentStatus":{"type":"string","description":"the platform payment row status (a money fact)"},"providerStatus":{"type":["string","null"],"description":"PayMongo’s intent status when re-read on this request; null otherwise or when unavailable"},"customerState":{"type":"string","enum":["AWAITING_PAYMENT","CHECKING","PAYMENT_RECEIVED_CONFIRMING","ORDER_CONFIRMED","CANCELED_REFUND_ARRANGED","REFUND_CLAIM_REQUIRED","REFUNDED","REFUND_ATTENTION","NOT_COMPLETED"],"description":"AWAITING_PAYMENT (provider action live) · CHECKING (do not pay again) · PAYMENT_RECEIVED_CONFIRMING (paid; stock + funding being confirmed) · ORDER_CONFIRMED · CANCELED_REFUND_ARRANGED (paid, order could not be completed, refund being arranged) · REFUND_CLAIM_REQUIRED (see refund.claimUrl) · REFUNDED · REFUND_ATTENTION (refund failed or the claim expired) · NOT_COMPLETED (the provider says the payment was not made)."},"reservationExpiresAt":{"type":["string","null"],"format":"date-time"},"providerActionExpiresAt":{"type":["string","null"],"format":"date-time"},"clearCart":{"type":"boolean","description":"true only for ORDER_CONFIRMED / PAYMENT_RECEIVED_CONFIRMING"},"refund":{"$ref":"#/components/schemas/WalletRefundProjection"},"access":{"type":"string","enum":["PRINCIPAL"],"description":"ownership proven by the caller’s own principal (compare WalletCheckoutStatusReturnTokenResponse)"},"checkoutRef":{"$ref":"#/components/schemas/WalletCheckoutRef"},"receipt":{"$ref":"#/components/schemas/WalletReceipt","description":"The SHOPPER’s own order snapshot (guest principal only; absent for an L1 support session and withheld if the frozen rows do not add up)."}}},"WalletReceiptLine":{"type":"object","required":["title","qty","unitPriceMinor","lineTotalMinor"],"properties":{"title":{"type":"string","description":"display label (the product title; \"Item\" when unresolvable) — the only field not frozen at intent"},"qty":{"type":"integer"},"unitPriceMinor":{"type":"integer","description":"the unit price saved on the order line at intent"},"lineTotalMinor":{"type":"integer"}}},"WalletReceipt":{"type":"object","description":"The order AS PLACED, from the rows frozen at intent (never the current cart or catalog). Identity: subtotalMinor − creditAppliedMinor + shippingMinor + dutiesMinor (+ taxMinor when taxEmbedded is false) = totalMinor.","required":["placedAt","currency","lines","subtotalMinor","creditAppliedMinor","shippingMinor","dutiesMinor","taxMinor","taxEmbedded","totalMinor"],"properties":{"placedAt":{"type":"string","format":"date-time"},"currency":{"type":"string"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/WalletReceiptLine"}},"subtotalMinor":{"type":"integer","description":"Σ line totals as charged (VAT-inclusive when taxEmbedded)"},"creditAppliedMinor":{"type":"integer","description":"closed-loop store credit applied at checkout"},"shippingMinor":{"type":"integer","description":"shipping as charged (VAT-inclusive when taxEmbedded)"},"dutiesMinor":{"type":"integer"},"taxMinor":{"type":"integer"},"taxEmbedded":{"type":"boolean","description":"true ⇒ taxMinor is already INSIDE the amounts above (\"VAT included\", PH VAT-registered store); false ⇒ added on top"},"totalMinor":{"type":"integer","description":"what the shopper paid"}}},"WalletCheckoutStatusReturnTokenResponse":{"type":"object","description":"The wallet /checkout/status answer when ownership was proven ONLY by a GCash `returnToken` (another browser). Deliberately minimal: the customer answer, the amount and the order locators — never the refund claim link, the resumable payment action, deadlines, a receipt or anything about the shopper. Show the customerState copy and point the shopper to their original browser or the secure order link for details. Never clears a cart.","required":["orderId","paymentRef","checkoutRef","rail","access","amountMinor","currency","customerState","clearCart"],"additionalProperties":false,"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"checkoutRef":{"$ref":"#/components/schemas/WalletCheckoutRef"},"rail":{"type":"string","enum":["PAYMONGO"]},"access":{"type":"string","enum":["RETURN_TOKEN"]},"amountMinor":{"type":"integer"},"currency":{"type":"string","enum":["PHP"]},"customerState":{"type":"string","enum":["AWAITING_PAYMENT","CHECKING","PAYMENT_RECEIVED_CONFIRMING","ORDER_CONFIRMED","CANCELED_REFUND_ARRANGED","REFUND_CLAIM_REQUIRED","REFUNDED","REFUND_ATTENTION","NOT_COMPLETED"]},"clearCart":{"type":"boolean","enum":[false]}}},"WalletCheckoutRef":{"type":"object","description":"The locator pair to resume / re-read this wallet checkout.","required":["orderId","paymentRef"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"}}},"CheckoutStatusResult":{"description":"POST /checkout/status 200: the card readback (CheckoutStatusResponse, `outcome`) OR the wallet projection (WalletCheckoutStatusResponse, `rail: \"PAYMONGO\"` + `access: \"PRINCIPAL\"`) OR — ownership proven only by a GCash returnToken — the minimal WalletCheckoutStatusReturnTokenResponse (`access: \"RETURN_TOKEN\"`).","oneOf":[{"$ref":"#/components/schemas/CheckoutStatusResponse"},{"$ref":"#/components/schemas/WalletCheckoutStatusResponse"},{"$ref":"#/components/schemas/WalletCheckoutStatusReturnTokenResponse"}]},"PaymentRailEligibility":{"type":"object","required":["provider","eligible","reasons","methods"],"properties":{"provider":{"type":"string","enum":["stripe","paymongo"]},"eligible":{"type":"boolean"},"reasons":{"type":"array","items":{"type":"string"},"description":"PH_WALLET_RAIL_UNCONFIGURED · PH_WALLET_RAIL_DISABLED · MERCHANT_COUNTRY_NOT_PH · PRESENTMENT_NOT_PHP · MERCHANT_COUNTRY_NOT_STRIPE"},"methods":{"type":"array","items":{"type":"string"},"description":"card; gcash + qrph"}}},"PlatformFeeSettlementView":{"type":"object","description":"How a statement adjustment is being settled. mflow executes it (a fee refund to the store, or a charge the store pays); only the state, the route in plain language and the payment provider’s own reference are shown — never mflow’s internal executor name.","required":["id","direction","amountMinor","status","settledAmountMinor"],"properties":{"id":{"type":"string"},"direction":{"type":"string","enum":["FEE_REFUND","ADDITIONAL_CHARGE"]},"amountMinor":{"type":"integer","minimum":1},"status":{"type":"string","enum":["PENDING","SETTLED","FAILED","NETTED"],"description":"FAILED/NETTED amounts are carried into a later statement."},"settledAmountMinor":{"type":"integer","minimum":0},"executorLabel":{"type":"string","description":"Where the money went, in the store’s own words — e.g. “through your card payment provider”, “to your store wallet”."},"providerRef":{"type":["string","null"],"description":"The payment provider’s own reference for the money that moved (e.g. a Stripe fee-refund id, a PayMongo transfer id), with no mflow prefix."},"absorbedByStatementId":{"type":["string","null"]},"resolvedAt":{"type":["string","null"],"format":"date-time"}}},"PlatformFeeStatement":{"type":"object","description":"A FINALIZED (immutable) monthly platform-fee statement for one currency of the operator’s own store. Months are Asia/Manila for PHP, UTC otherwise. Sign convention: a positive total is owed by the store to mflow, a negative total by mflow to the store. Policy pf-policy-2026-09-v1: the fee is retained on fulfilled orders (refunds after shipping do not change it), waived on orders refunded in full before shipping, prorated on partial refunds before shipping; the collected fee is the payment provider’s own record.","required":["id","currency","period","currentAssessedMinor","currentExpectedMinor","currentCollectedMinor","totalDueMinor","instruction","instructionAmountMinor","balanced"],"properties":{"id":{"type":"string"},"currency":{"type":"string"},"period":{"type":"object","properties":{"month":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}$"},"timeZone":{"type":"string","enum":["UTC","Asia/Manila"]},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"}}},"currentPaymentsCount":{"type":"integer"},"priorAdjustmentsCount":{"type":"integer"},"currentAssessedMinor":{"type":"integer","description":"fee charged at payment time on the month’s payments"},"currentWaivedMinor":{"type":"integer"},"currentExpectedMinor":{"type":"integer","description":"fee mflow is entitled to after the final order state"},"currentCollectedMinor":{"type":"integer","description":"fee the payment provider’s records show mflow received"},"priorExpectedDeltaMinor":{"type":"integer"},"priorCollectedDeltaMinor":{"type":"integer"},"netAdjustmentMinor":{"type":"integer"},"carryInMinor":{"type":"integer"},"absorbedSettlementsMinor":{"type":"integer"},"totalDueMinor":{"type":"integer"},"minimumSettlementMinor":{"type":"integer"},"instruction":{"type":"string","enum":["NONE","FEE_REFUND","ADDITIONAL_CHARGE","CARRY_FORWARD"]},"instructionAmountMinor":{"type":"integer","minimum":0},"carryOutMinor":{"type":"integer"},"evidenceGapCount":{"type":"integer","description":"lines without a provider record after the evidence window (counted as not collected)"},"evidenceComplete":{"type":"boolean"},"balanced":{"type":"boolean","description":"true only when nothing is due AND every line is provider-verified"},"finalizedAt":{"type":"string","format":"date-time"},"settlement":{"oneOf":[{"$ref":"#/components/schemas/PlatformFeeSettlementView"},{"type":"null"}]}}},"PlatformFeeStatementsResponse":{"type":"object","required":["statements"],"properties":{"statements":{"type":"array","items":{"$ref":"#/components/schemas/PlatformFeeStatement"}}}},"PlatformFeeStatementLine":{"type":"object","required":["paymentId","orderId","lineKind","assessedMinor","expectedMinor","collectedMinor","adjustmentMinor"],"properties":{"paymentId":{"type":"string"},"orderId":{"type":"string"},"lineKind":{"type":"string","enum":["CURRENT","PRIOR_PERIOD_ADJUSTMENT"]},"rail":{"type":"string","enum":["STRIPE","PAYMONGO"]},"capturedAt":{"type":"string","format":"date-time"},"assessedMinor":{"type":"integer"},"expectedMinor":{"type":"integer"},"collectedMinor":{"type":"integer"},"adjustmentMinor":{"type":"integer"},"expectedRule":{"type":"string","enum":["RETAINED","WAIVED_UNFULFILLED_REFUND","PRORATED_PRE_FULFILLMENT_REFUND"]},"collectionStatus":{"type":"string","enum":["VERIFIED","MISSING_AFTER_WINDOW"]},"collectionBasis":{"type":["string","null"]},"refundIds":{"type":"array","items":{"type":"string"}},"fulfilledAt":{"type":["string","null"],"format":"date-time"}}},"PlatformFeeStatementDetail":{"type":"object","required":["statement","lines"],"properties":{"statement":{"$ref":"#/components/schemas/PlatformFeeStatement"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/PlatformFeeStatementLine"}},"settlement":{"oneOf":[{"$ref":"#/components/schemas/PlatformFeeSettlementView"},{"type":"null"}]}}},"PaymentRailsResponse":{"type":"object","description":"Server-side rail eligibility for the operator’s own store. On a deployment without PayMongo the paymongo entry is ineligible with PH_WALLET_RAIL_UNCONFIGURED and legalCountry/presentmentCurrency are null.","required":["rails","legalCountry","presentmentCurrency"],"properties":{"rails":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRailEligibility"}},"legalCountry":{"type":["string","null"]},"presentmentCurrency":{"type":["string","null"]}}},"PaymentAccountNextAction":{"type":"object","required":["key","owner","blocking"],"properties":{"key":{"type":"string","enum":["PROVIDE_DETAILS","VERIFY_IDENTITY","NEW_VERIFICATION_SESSION","SUBMIT_ACTIVATION","WAIT_PROVIDER_REVIEW","FINISH_PAYMENT_SETUP","COMPLETE_VERIFICATION","DECLARE_TAX_POSTURE","OPTIONAL_GCASH_APPROVAL","NONE","CONTACT_SUPPORT"]},"owner":{"type":"string","enum":["operator","provider","mflow","platform"]},"deadline":{"type":"string","format":"date-time","description":"VERIFY_IDENTITY: when the hosted identity-check link expires"},"blocking":{"type":"boolean","description":"false ⇒ does not stop checkout (OPTIONAL_GCASH_APPROVAL, NONE)"}}},"PayMongoPaymentAccount":{"type":"object","description":"The store’s OWN PayMongo linked account (the L2’s merchant account). Redacted: no secrets and no personal data, except the hosted identity-check link (verificationSession.url), which is returned to the owner only (the operator session or a full-scoped key) — never to a manage-scoped key.","required":["provider","environment","accountRef","status","identityStatus","activationStatus","businessType","capabilities","webhookConfirmed","webhookRegisteredAt","webhookLastVerifiedDeliveryAt","methodRefusals","replaceable","supersededAt","verified","verificationSession","nextAction","missingFields","lastCheckedAt","statusAvailable","taxPosture"],"properties":{"provider":{"type":"string","enum":["paymongo"]},"environment":{"type":"string","enum":["test","live"]},"accountRef":{"type":"string","description":"PayMongo account id (org_…)"},"status":{"type":"string","enum":["CREATED","DETAILS_REQUIRED","IDENTITY_PENDING","IDENTITY_FAILED","READY_TO_ACTIVATE","ACTIVATION_REVIEW","ACTIVE","DECLINED","SUSPENDED","CLOSED"]},"identityStatus":{"type":["string","null"]},"activationStatus":{"type":["string","null"],"description":"pending | under_review | activated | declined"},"businessType":{"type":["string","null"],"enum":["sole_proprietor","partnership","corporation",null]},"capabilities":{"type":"object","additionalProperties":{"type":"string","enum":["active","under_review","not_requested","declined"]},"description":"{ qrph, gcash }"},"webhookConfirmed":{"type":"boolean","description":"PayMongo accepted the store’s webhook registration (the checkout eligibility fact) — not proof of delivery"},"webhookRegisteredAt":{"type":["string","null"],"format":"date-time","description":"when PayMongo accepted the CURRENT webhook registration"},"webhookLastVerifiedDeliveryAt":{"type":["string","null"],"format":"date-time","description":"the last signed delivery verified against the current webhook secret (null: none yet — normal for a store with no payments)"},"methodRefusals":{"type":"object","description":"for each method currently withdrawn (`declined`) because PayMongo refused a charge with it: the provider code and when. Restored only when PayMongo shows the method usable again.","additionalProperties":{"type":"object","required":["code","observedAt"],"properties":{"code":{"type":"string","enum":["payment_method_not_allowed"]},"observedAt":{"type":"string","format":"date-time"}}}},"replaceable":{"type":"boolean","description":"true on a DECLINED / CLOSED current account while the rail admits new accounts ⇒ the owner may POST /operator/payment-accounts/paymongo/replace"},"supersededAt":{"type":["string","null"],"format":"date-time","description":"set on a replaced (history) account, which is listed after the current one and keeps servicing its own orders and refunds"},"verified":{"type":"boolean","description":"processor verification recorded for THIS account"},"verificationSession":{"type":["object","null"],"description":"the hosted identity check for the authorized representative (72 h; no return URL — poll). `url` is returned ONLY to the owner (the operator session or a full-scoped key); a manage-scoped key receives `expiresAt` alone. Hand the link only to the owner.","required":["expiresAt"],"properties":{"url":{"type":"string","format":"uri","description":"owner only (session or full-scoped key); omitted for a manage-scoped key"},"expiresAt":{"type":"string","format":"date-time"}}},"nextAction":{"$ref":"#/components/schemas/PaymentAccountNextAction"},"missingFields":{"type":"array","items":{"type":"string"},"description":"PayMongo field pointers still required (names only)"},"lastCheckedAt":{"type":["string","null"],"format":"date-time"},"statusAvailable":{"type":"boolean","description":"false ⇒ PayMongo could not be reached on refresh; the facts are the last known ones"},"taxPosture":{"type":"object","required":["phVat"],"properties":{"phVat":{"type":["string","null"],"enum":["VAT_REGISTERED","NON_VAT",null]}}}}},"StripePaymentAccountEntry":{"type":"object","description":"The legacy Stripe binding, synthesized into the list (its status is read at GET /operator/connect-account).","required":["provider","accountRef","status","statusAvailable"],"properties":{"provider":{"type":"string","enum":["stripe"]},"accountRef":{"type":"string"},"status":{"type":"string","enum":["BOUND"]},"statusAvailable":{"type":"boolean","enum":[false]}}},"PaymentAccountsResponse":{"type":"object","required":["paymentAccounts"],"properties":{"paymentAccounts":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/StripePaymentAccountEntry"},{"$ref":"#/components/schemas/PayMongoPaymentAccount"}]}}}},"CreatePaymentAccountRequest":{"type":"object","required":["provider"],"properties":{"provider":{"type":"string","enum":["paymongo"]}}},"CreatePaymentAccountResponse":{"type":"object","required":["created","account"],"properties":{"created":{"type":"boolean"},"account":{"$ref":"#/components/schemas/PayMongoPaymentAccount"}}},"PaymentAccountEnvelope":{"type":"object","required":["account"],"properties":{"account":{"$ref":"#/components/schemas/PayMongoPaymentAccount"}}},"PaymentAccountDetailsRequest":{"type":"object","description":"One saveable section, passed through to PayMongo (vendor field names) and NEVER stored or logged by mflow. PERSONAL DATA: collect it only in the store owner’s own authenticated form. business.type is limited to sole_proprietor | partnership | corporation (individual ⇒ 422 PAYMENT_ACCOUNT_BUSINESS_TYPE_NOT_ELIGIBLE).","required":["section","fields"],"properties":{"section":{"type":"string","enum":["representative","business"]},"fields":{"type":"object","additionalProperties":true}}},"PaymentAccountReplaceResponse":{"type":"object","required":["created","account","previous"],"properties":{"created":{"type":"boolean","description":"false ⇒ an earlier attempt (or a concurrent one) already opened the replacement; `account` is the current one"},"account":{"$ref":"#/components/schemas/PayMongoPaymentAccount"},"previous":{"type":["object","null"],"description":"the declined / closed account that was superseded (kept, with its history)","properties":{"accountRef":{"type":"string"},"status":{"type":"string","enum":["DECLINED","CLOSED"]}}}}},"PaymentAccountWebhookRotateRequest":{"type":"object","properties":{"overlapHours":{"type":"integer","minimum":0,"maximum":72,"description":"how long the previous webhook secret keeps verifying deliveries PayMongo already queued through the old hook (default 24). 0 ⇒ the old hook is disabled at PayMongo at once — use it for a suspected secret exposure."}}},"PaymentAccountWebhookRotateResponse":{"type":"object","required":["account","previousWebhookRetiresAt"],"properties":{"account":{"$ref":"#/components/schemas/PayMongoPaymentAccount"},"previousWebhookRetiresAt":{"type":["string","null"],"format":"date-time","description":"when the old secret stops verifying and the old hook is disabled (null: already disabled)"}}},"PaymentAccountRefreshRequest":{"type":"object","properties":{"force":{"type":"boolean","description":"bypass the 30 s re-read throttle"}}},"SelfServeProviderRequest":{"type":"object","description":"Which payment rail’s OWN merchant verification the self-serve lane relies on. Omitted ⇒ the store’s only bound rail (a PayMongo account counts only where the PH wallet rail is configured); required when the store has both a Stripe and a PayMongo account.","properties":{"provider":{"type":"string","enum":["stripe","paymongo"],"description":"stripe — the Connect account reports charges + payouts enabled with no blocking requirements. paymongo — the store’s own PayMongo linked account, re-read from PayMongo: ACTIVE and activated by PayMongo, representative identity passed PayMongo identity verification or its KYC reliance (a self-attestation form is refused), a registered business type (sole_proprietor / partnership / corporation), its own webhook registered, and a current processor verification for that account."}}},"PaymentAccountDocumentsRequest":{"type":"object","description":"BIR Form 2303 + DTI/SEC registration numbers and the uploaded certificates, recorded as a PENDING KYB case in the restricted compliance vault (the commerce tables keep no copy).","required":["birCorNumber","registrationType","registrationNumber","documentRefs"],"properties":{"birCorNumber":{"type":"string","pattern":"^[0-9-]{9,20}$","description":"the TIN on BIR Form 2303"},"registrationType":{"type":"string","enum":["DTI","SEC"]},"registrationNumber":{"type":"string"},"documentRefs":{"type":"array","items":{"type":"string","pattern":"^pmdoc_[0-9a-f]{32}$"},"description":"documentRef values from POST …/documents/uploads for THIS store: a BIR_2303 and the certificate matching registrationType (DTI_REGISTRATION | SEC_REGISTRATION) are required; any other reference is refused"}}},"PaymentAccountDocumentUploadRequest":{"type":"object","description":"ONE registration document, base64-encoded (at most 10 MiB decoded). The content type is decided from the file’s magic bytes (PDF, JPEG or PNG only); a declared contentType must agree. COMPLIANCE EVIDENCE — send only from the store owner’s own authenticated form.","required":["documentType","bodyBase64"],"properties":{"documentType":{"type":"string","enum":["BIR_2303","DTI_REGISTRATION","SEC_REGISTRATION"]},"contentType":{"type":"string","enum":["application/pdf","image/jpeg","image/png"],"description":"optional; must match the bytes"},"bodyBase64":{"type":"string","description":"the file, canonical base64"}}},"PaymentAccountDocument":{"type":"object","description":"Metadata of an uploaded registration document. There is no filename and no download link: the bytes are readable only by mflow’s audited review.","required":["documentRef","documentType","version","contentType","byteSize","sha256","uploadedAt","current"],"properties":{"documentRef":{"type":"string","pattern":"^pmdoc_[0-9a-f]{32}$","description":"opaque, store-scoped reference"},"documentType":{"type":"string","enum":["BIR_2303","DTI_REGISTRATION","SEC_REGISTRATION"]},"version":{"type":"integer","minimum":1,"description":"per-type version; a new upload of the same type appends the next version"},"contentType":{"type":"string","enum":["application/pdf","image/jpeg","image/png"]},"byteSize":{"type":"integer","minimum":1},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"uploadedAt":{"type":"string","format":"date-time"},"current":{"type":"boolean"}}},"PaymentAccountDocumentUploadResponse":{"type":"object","required":["created","document"],"properties":{"created":{"type":"boolean","description":"false when the same bytes are already the current version of that type (idempotent retry)"},"document":{"$ref":"#/components/schemas/PaymentAccountDocument"}}},"PaymentAccountDocumentList":{"type":"object","required":["documents","review","limits"],"properties":{"documents":{"type":"array","items":{"$ref":"#/components/schemas/PaymentAccountDocument"},"description":"the current document of each uploaded type"},"review":{"type":"object","required":["submittedAt","businessVerification"],"properties":{"submittedAt":{"type":["string","null"],"format":"date-time","description":"when the registration was last submitted for mflow’s review"},"businessVerification":{"type":["string","null"],"enum":["PENDING","IN_REVIEW","VERIFIED","REJECTED",null],"description":"the store’s latest KYB status, whichever review recorded it"}}},"limits":{"type":"object","required":["maxBytes","contentTypes"],"properties":{"maxBytes":{"type":"integer"},"contentTypes":{"type":"array","items":{"type":"string"}}}}}},"PaymentAccountDocumentsResponse":{"type":"object","required":["recorded","caseId","review"],"properties":{"recorded":{"type":"boolean","enum":[true]},"caseId":{"type":["string","null"],"description":"the PENDING KYB case; null when the store is already KYB-verified (documents filed on record)"},"review":{"type":"string","enum":["PENDING","ON_FILE"]}}},"PaymentAccountTaxPosture":{"type":"object","required":["phVat"],"properties":{"phVat":{"type":["string","null"],"enum":["VAT_REGISTERED","NON_VAT",null]}}},"PaymentAccountTaxPostureRequest":{"type":"object","required":["phVat"],"properties":{"phVat":{"type":"string","enum":["VAT_REGISTERED","NON_VAT"],"description":"the store’s own declaration from its BIR Form 2303"}}},"PaymentAccountError":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string"},"code":{"type":"string"},"fieldErrors":{"type":"array","items":{"type":"object","required":["pointer","message"],"properties":{"pointer":{"type":"string"},"message":{"type":"string"}}},"description":"provider field errors (PAYMENT_ACCOUNT_PROVIDER_REJECTED / PAYMENT_ACCOUNT_DETAILS_REQUIRED)"}}},"PayMongoWebhookAck":{"type":"object","description":"The acknowledgement PayMongo receives. 200 = applied / ignored / duplicate; 409 and 500 ask for a retry.","properties":{"received":{"type":"boolean"},"duplicate":{"type":"boolean"},"result":{"type":"string","description":"APPLIED | IGNORED | … (the receipt’s terminal result)"},"ignored":{"type":"string"},"retry":{"type":"boolean"},"processing":{"type":"boolean"},"error":{"type":"string"}}},"TimelineEvent":{"type":"object","required":["eventType","occurredAt"],"properties":{"eventType":{"type":"string"},"fromStatus":{"type":["string","null"]},"toStatus":{"type":["string","null"]},"detail":{"type":"object","additionalProperties":true},"occurredAt":{"type":"string","format":"date-time"}}},"TrackingPlaceholder":{"type":"object","required":["shipmentId","status"],"properties":{"shipmentId":{"type":"string"},"carrier":{"type":["string","null"]},"trackingRef":{"type":["string","null"]},"status":{"type":"string"}}},"OrderTimeline":{"type":"object","description":"Guest-scoped (magic-link token) OR operator-support view. Order existence never leaks across shoppers (both misses → 404).","required":["events","tracking"],"properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/TimelineEvent"}},"tracking":{"type":"array","items":{"$ref":"#/components/schemas/TrackingPlaceholder"},"description":"populated by the fulfillment lane’s shipment rows"}},"additionalProperties":true},"DropSummary":{"type":"object","required":["id","slug","title"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"subtitle":{"type":["string","null"]},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}}},"ListDropsResponse":{"type":"object","required":["drops"],"properties":{"drops":{"type":"array","items":{"$ref":"#/components/schemas/DropSummary"}}}},"DropItemScarcity":{"type":"object","description":"LIVE stock from the allocation engine (never a fabricated count).","required":["available","qtyAllocated","qtyReserved","qtySold","soldOut","low"],"properties":{"available":{"type":"integer"},"qtyAllocated":{"type":"integer"},"qtyReserved":{"type":"integer"},"qtySold":{"type":"integer"},"soldOut":{"type":"boolean"},"low":{"type":"boolean"},"windowClosed":{"type":"boolean"}},"additionalProperties":true},"DropItemPrice":{"type":"object","required":["currency","basePriceMinor","effectivePriceMinor","floorPriceMinor"],"properties":{"currency":{"type":"string"},"basePriceMinor":{"type":"integer"},"effectivePriceMinor":{"type":"integer"},"nextDrop":{"anyOf":[{"type":"object","required":["at","priceMinor"],"properties":{"at":{"type":"string","format":"date-time"},"priceMinor":{"type":"integer"}}},{"type":"null"}],"description":"the next scheduled markdown (falling-price countdown), or null at the floor"},"floorPriceMinor":{"type":"integer"}}},"DropItemView":{"type":"object","required":["allocationId","skuId","scarcity","price"],"properties":{"allocationId":{"type":"string"},"skuId":{"type":"string"},"scarcity":{"$ref":"#/components/schemas/DropItemScarcity"},"price":{"anyOf":[{"$ref":"#/components/schemas/DropItemPrice"},{"type":"null"}]}}},"EarlyAccessWindow":{"type":"object","required":["tier","opensAt"],"properties":{"tier":{"type":"string","description":"the membership tier this window opens for (timing gate metadata)"},"opensAt":{"type":"string","format":"date-time"}}},"DropView":{"type":"object","required":["id","slug","title","status","startsAt","endsAt","live","seo","items","earlyAccess"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"subtitle":{"type":["string","null"]},"status":{"type":"string"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"live":{"type":"boolean"},"seo":{"type":"object","additionalProperties":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/DropItemView"}},"earlyAccess":{"type":"array","items":{"$ref":"#/components/schemas/EarlyAccessWindow"}}}},"GroupBuyTier":{"type":"object","description":"One rung of a group-buy price ladder (deterministic; more verified buyers never cost more).","required":["minBuyers","unitPriceMinor"],"properties":{"minBuyers":{"type":"integer","description":"minimum VERIFIED buyers for this tier to apply (>= 1)"},"unitPriceMinor":{"type":"integer","description":"the unit price once this tier is reached, minor units (>= 0)"}}},"GroupBuyResolution":{"type":"object","description":"The deterministic price at the current verified-buyer count — a PURE function of the count + ladder (no chance).","required":["reached","tierIndex","unitPriceMinor","tiers"],"properties":{"reached":{"type":"boolean","description":"true once the verified count reaches the lowest tier"},"tierIndex":{"type":["integer","null"],"description":"index into the sorted tiers in effect, or null when unreached"},"unitPriceMinor":{"type":["integer","null"],"description":"the unit price to charge (clamped to the MAP floor), or null when unreached"},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/GroupBuyTier"},"description":"the ladder, normalized + ascending by minBuyers"}}},"GroupBuyStanding":{"type":"object","description":"GET /group-buys/{id} — the deterministic current standing (verified count → price). Public browse read.","required":["groupBuyId","status","verifiedCount","currency","mapFloorMinor","resolution","tiers"],"properties":{"groupBuyId":{"type":"string"},"status":{"type":"string","description":"lifecycle status (e.g. OPEN | SETTLED | CANCELED)"},"verifiedCount":{"type":"integer","description":"count of VERIFIED (funded) commitments right now"},"currency":{"type":"string"},"mapFloorMinor":{"type":"integer","description":"the MAP floor the resolved price is clamped to"},"resolution":{"$ref":"#/components/schemas/GroupBuyResolution"},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/GroupBuyTier"}}}},"DropReserveRequest":{"type":"object","description":"POST /drops/{dropId}/reserve body. All four fields are required; the tenant + shopper are DERIVED from the magic-link guest token.","required":["allocationId","reservationId","contextRef","qty"],"properties":{"allocationId":{"type":"string","description":"the drop item’s backing allocation to reserve against"},"reservationId":{"type":"string","description":"the client reservation id to create"},"contextRef":{"type":"string","description":"the cart/context handle the hold binds to"},"qty":{"type":"integer","minimum":1,"description":"units to reserve"},"ttlSeconds":{"type":"integer","description":"OPTIONAL hold lifetime (default 900 = 15 min)"}},"additionalProperties":false},"DropReserveResult":{"type":"object","description":"POST /drops/{dropId}/reserve — the early-access-gated reservation. The gate is TIMING ONLY; the allocation engine still arbitrates oversell (never a bypass). A NARROW projection with NO contextRef (the owning cart is never echoed).","required":["reservation"],"properties":{"reservation":{"type":"object","required":["reservationId","allocationId","qty","expiresAt","status"],"properties":{"reservationId":{"type":"string"},"allocationId":{"type":"string"},"qty":{"type":"integer"},"expiresAt":{"type":"string","format":"date-time"},"status":{"type":"string"}}}}},"ReservationCaptureRequest":{"type":"object","description":"POST /pricing/reservations/{reservationId}/capture body. `skuId` is required; a guest omits `tenantId` (derived from the token).","required":["skuId"],"properties":{"tenantId":{"type":"string","description":"operator callers name the tenant; a scoped shopper/guest is pinned to its own"},"skuId":{"type":"string","description":"the sku the reservation holds (the captured price is for this sku)"},"allocationId":{"type":"string","description":"OPTIONAL — the allocation the hold is on; backfilled from the reservation when absent"}},"additionalProperties":false},"ReservationCheckoutPrice":{"type":"object","description":"GET /pricing/reservations/{reservationId}/checkout-price — the price-at-reservation policy result: a LIVE captured hold is honored at its captured price; an expired/released/missing hold re-quotes at the current effective price.","required":["priceMinor","currency","source","policy","capturedPriceMinor","currentPriceMinor","reservationStatus","reservationLive","skuId"],"properties":{"priceMinor":{"type":"integer","description":"the checkout price to honor (minor units)"},"currency":{"type":"string"},"source":{"type":"string","description":"which basis the price came from (captured vs current effective)"},"policy":{"type":"string","description":"the price policy applied (e.g. LOCK_AT_RESERVATION)"},"capturedPriceMinor":{"type":"integer","description":"the price captured at reservation time"},"currentPriceMinor":{"type":"integer","description":"the current effective (marked-down) price now"},"reservationStatus":{"type":"string","enum":["HELD","CONVERTED","EXPIRED","RELEASED","MISSING"]},"reservationLive":{"type":"boolean","description":"true when the reservation is still a live HELD hold"},"skuId":{"type":"string"}},"additionalProperties":true},"ReservationPriceCapture":{"type":"object","description":"POST /pricing/reservations/{reservationId}/capture — the recorded price-at-reservation (idempotent; the FIRST capture wins and is replayed thereafter, 200 on replay / 201 on a fresh capture).","required":["tenantId","reservationId","allocationId","skuId","priceBookId","priceMinor","currency","policy","capturedAt","idempotentReplay"],"properties":{"tenantId":{"type":"string"},"reservationId":{"type":"string"},"allocationId":{"type":"string"},"skuId":{"type":"string"},"priceBookId":{"type":"string"},"priceMinor":{"type":"integer"},"currency":{"type":"string"},"policy":{"type":"string"},"capturedAt":{"type":"string","format":"date-time"},"idempotentReplay":{"type":"boolean","description":"true when this call re-observed an existing capture (200), false on a fresh capture (201)"}}},"StoreOriginsBody":{"type":"object","required":["origins"],"properties":{"origins":{"type":"array","maxItems":20,"items":{"type":"string","description":"a canonical https:// origin (no wildcard, path, or credentials)"},"description":"full-replacement CORS allowlist for the store’s OWN browser origins"}},"additionalProperties":false},"StoreOriginsResponse":{"type":"object","required":["tenantId","allowedOrigins"],"properties":{"tenantId":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}}}},"OperatorWhoami":{"type":"object","description":"Capability self-check for a key-holding AI — the money/irreversibility firewall posture, echoed (the server ENFORCES it).","required":["principal","authMethod","capabilities","allowedOrigins"],"properties":{"principal":{"type":"object","required":["kind","tenantId"],"properties":{"kind":{"type":"string","enum":["l2"]},"tenantId":{"type":"string"}}},"authMethod":{"type":"string","enum":["key","session"]},"testMode":{"type":"boolean"},"capabilities":{"type":"object","properties":{"manageStore":{"type":"boolean"},"configureCors":{"type":"boolean"},"moveMoney":{"type":"boolean"},"takeStoreLiveInProduction":{"type":"boolean"},"issueOrRotateKeys":{"type":"boolean"},"deleteStore":{"type":"boolean"}}},"allowedOrigins":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"CustomDomainDnsRecord":{"type":"object","required":["type","name","value"],"properties":{"type":{"type":"string","enum":["CNAME","TXT"]},"name":{"type":"string"},"value":{"type":"string"},"purpose":{"type":"string","enum":["routing","ownership","ssl"]}}},"AttachCustomDomainBody":{"type":"object","required":["host"],"properties":{"host":{"type":"string","description":"the operator’s OWN FQDN (e.g. shop.yourbrand.com), never a platform host"}},"additionalProperties":false},"CustomDomainResponse":{"type":"object","description":"The custom-domain state + the DNS records the operator must set. A claimed-but-unverified host is NEVER served.","required":["host","status","verified","dnsRecords"],"properties":{"host":{"type":["string","null"]},"status":{"type":"string","description":"none | pending | active | failed"},"hostnameRef":{"type":["string","null"]},"verified":{"type":"boolean"},"served":{"type":"boolean"},"cfStatus":{"type":"string"},"sslStatus":{"type":"string"},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/CustomDomainDnsRecord"}}},"additionalProperties":true},"BulkError":{"type":"object","description":"The bulk lane error body. NOTE (finding): unlike the DTC `Error` schema ({error, code}), the bulk lane sends `{code, message, detail?}` — a stable machine code + a human message + an OPTIONAL structured detail.","required":["code","message"],"properties":{"code":{"type":"string","description":"stable machine-readable code (see x-mflow-error-codes)"},"message":{"type":"string","description":"human-readable message"},"detail":{"type":"object","additionalProperties":true,"description":"structured refusal context (e.g. the BULK_PRICE_MOVED numbers)"}},"additionalProperties":true},"BulkQuoteBand":{"type":"object","description":"One completeness band (the vendor’s own tier row): a qty threshold + the vendor’s price.","required":["qty","priceMinor"],"properties":{"qty":{"type":"integer","description":"units in this band"},"priceMinor":{"type":"integer","description":"the vendor’s exact price for this band, integer minor units"}}},"BulkSellerOfRecord":{"type":"object","description":"§14 disclosure: the bulk SELLER OF RECORD is the vendor (\"Sold and shipped by {name}\"), never L1/L2.","required":["vendorId","name"],"properties":{"vendorId":{"type":"string"},"name":{"type":"string"}}},"BulkDestination":{"type":"object","description":"Bulk delivery destination. FD-2 DOMESTIC-ONLY: the buyer country must equal the vendor’s registered warehouse country (a foreign country ⇒ 422 DESTINATION_NOT_SUPPORTED — stricter than the tenant destination set).","required":["country"],"properties":{"country":{"type":"string","description":"two-letter ISO (required)"},"region":{"type":"string"},"postcode":{"type":"string"},"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"}},"additionalProperties":false},"BulkBuyer":{"type":"object","description":"FD-4 buyer BUSINESS identity — REQUIRED for a bulk intent (recorded verbatim, rides the existing sanctions/geo screening lane; a first purchase / over-threshold order is flagged PENDING for ops review post-funding / pre-ship).","required":["businessName","businessTaxId","email"],"properties":{"businessName":{"type":"string","description":"the buyer’s registered business name"},"businessTaxId":{"type":"string","description":"the buyer’s business registration / tax id (AU: ABN)"},"email":{"type":"string","format":"email","description":"order contact for readback / magic-link lookup"}},"additionalProperties":false},"BulkQuoteRequest":{"type":"object","description":"POST /checkout/bulk/quote — INDICATIVE pricing; never charges, never reserves. The tenant is DERIVED from the guest token: OMIT `tenant`/`tenantId` (a body tenant that disagrees ⇒ 403 TENANT_SCOPE_VIOLATION). `shape` is REMAINDER (the whole current remainder) or TIER (a configured tier size — then `tierQty` is required).","required":["lotConfigId","shape","destination"],"properties":{"lotConfigId":{"type":"string","description":"the lot the store LISTED (a missing/foreign one ⇒ 404 BULK_CONFIG_MISSING, B-12 posture)"},"shape":{"type":"string","enum":["REMAINDER","TIER"]},"tierQty":{"type":"integer","description":"TIER shape only: the configured tier size being purchased (a non-positive qty ⇒ 400 BULK_INVALID_INPUT)"},"destination":{"$ref":"#/components/schemas/BulkDestination"}},"additionalProperties":true},"BulkQuoteResponse":{"type":"object","description":"The INDICATIVE priced quote (all camelCase). Bulk availability MOVES with DTC sales on the SAME counters, so `indicative` is always true: carry `qty` + `basisMinor` into POST /checkout/bulk/intent as `expectedQty` + `expectedPriceMinor` and re-quote on a 409 BULK_PRICE_MOVED. The buyer pays `totalMinor` into the VENDOR’s own account.","required":["shape","qty","basisMinor","freightMinor","taxMinor","feeTier","totalMinor","currency","band","sellerOfRecord","indicative"],"properties":{"shape":{"type":"string","enum":["REMAINDER","TIER"]},"qty":{"type":"integer","description":"units this quote prices (the tier size, or the CURRENT remainder)"},"basisMinor":{"type":"integer","description":"the VENDOR’s sale price for the offer (merchandise only), integer minor units"},"freightMinor":{"type":"integer","description":"FD-7 vendor-set flat freight (0 = included) — server-authoritative, never client-priced"},"taxMinor":{"type":"integer","description":"GST computed for the VENDOR’s own remittance (remitter = VENDOR)"},"feeTier":{"type":"string","enum":["STANDARD","BOOSTED"],"description":"the vendor’s fee TIER — a service level on L1’s uniform published menu, never a payee/rate"},"totalMinor":{"type":"integer","description":"basis + freight + tax — what the buyer pays into the VENDOR’s own account"},"currency":{"type":"string"},"band":{"anyOf":[{"$ref":"#/components/schemas/BulkQuoteBand"},{"type":"null"}],"description":"the governing completeness band for a REMAINDER quote (null for TIER)"},"sellerOfRecord":{"$ref":"#/components/schemas/BulkSellerOfRecord"},"indicative":{"type":"boolean","enum":[true],"description":"always true — the price is INDICATIVE (re-derived authoritatively at intent time)"}},"additionalProperties":true},"BulkIntentRequest":{"type":"object","description":"POST /checkout/bulk/intent — reserve → optimistic confirm → the DIRECT charge on the VENDOR’s own connected account. Carries the optimistic-confirm expectations read off the quote (`expectedQty` = quote.qty, `expectedPriceMinor` = quote.basisMinor), the FD-4 `buyer` identity, and an `idempotencyKey` (a replay returns the ORIGINAL order/intent). Tenant DERIVED from the token.","required":["lotConfigId","shape","destination","expectedQty","expectedPriceMinor","buyer","idempotencyKey"],"properties":{"lotConfigId":{"type":"string"},"shape":{"type":"string","enum":["REMAINDER","TIER"]},"tierQty":{"type":"integer","description":"TIER shape only"},"destination":{"$ref":"#/components/schemas/BulkDestination"},"expectedQty":{"type":"integer","description":"from the quote’s `qty` — the intent refuses 409 BULK_PRICE_MOVED if availability moved"},"expectedPriceMinor":{"type":"integer","description":"from the quote’s `basisMinor` — the expected merchandise basis (pre-freight/pre-tax)"},"buyer":{"$ref":"#/components/schemas/BulkBuyer"},"idempotencyKey":{"type":"string","description":"caller idempotency key ([A-Za-z0-9_-]{8,64}); a replay returns the original order/intent"}},"additionalProperties":true},"BulkIntentResponse":{"type":"object","description":"The Payment Element config + the vendor DIRECT-charge intent. L1 is NOT the MoR — the charge runs on `payment_element.stripe_account` (the APPROVED VENDOR’s OWN connected account). CASING: the bulk lane ships a MIXED shape — each key appears EXACTLY ONCE (camelCase `orderId`/`paymentRef`/`sellerOfRecord`/`buyerReviewStatus` alongside snake_case `amount_minor`/`wallet_options`/`payment_element`/`quote.*`); there are NO snake↔camel dual aliases (unlike CheckoutIntentResponse). `client_secret` is OPTIONAL (present only when the provider returned one). Fulfillment still waits for `funding.cleared`, never `payment.captured`; `buyerReviewStatus:\"PENDING\"` interlocks the hand-off (never the charge) until ops CLEARS the FD-4 review.","required":["orderId","paymentRef","amount_minor","currency","status","wallet_options","payment_element","stripePublishableKey","quote","sellerOfRecord","buyerReviewStatus","idempotentReplay"],"properties":{"orderId":{"type":"string"},"paymentRef":{"type":"string"},"amount_minor":{"type":"integer","description":"what the buyer is charged into the VENDOR’s account (basis + freight + tax); snake_case (NO camelCase twin on the bulk lane)"},"currency":{"type":"string"},"status":{"type":"string","enum":["requires_confirmation"]},"wallet_options":{"type":"object","additionalProperties":true,"description":"wallet-id → enabled map; snake_case (NO camelCase twin)"},"payment_element":{"type":"object","description":"snake_case (NO camelCase twin on the bulk lane).","required":["payment_method_types","stripe_account"],"properties":{"payment_method_types":{"type":"array","items":{"type":"string"}},"stripe_account":{"type":"string","description":"the APPROVED VENDOR’s OWN connected account the direct charge runs on (the bulk MoR, §14)"}}},"stripePublishableKey":{"type":["string","null"],"description":"the PLATFORM (non-secret) publishable key for loadStripe(pk, { stripeAccount }); null when unset. The secret key is NEVER exposed."},"client_secret":{"type":"string","description":"OPTIONAL — the PaymentIntent client secret (created on the vendor’s connected account); present only when the provider returned one"},"quote":{"type":"object","description":"the priced snapshot; snake_case money fields (NO camelCase twin on the bulk lane)","required":["shape","qty","basis_minor","freight_minor","tax_minor","total_minor"],"properties":{"shape":{"type":"string","enum":["REMAINDER","TIER"]},"qty":{"type":"integer"},"basis_minor":{"type":"integer"},"freight_minor":{"type":"integer"},"tax_minor":{"type":"integer"},"total_minor":{"type":"integer"}}},"sellerOfRecord":{"$ref":"#/components/schemas/BulkSellerOfRecord"},"buyerReviewStatus":{"type":"string","enum":["PENDING","CLEARED"],"description":"FD-4 review state — PENDING interlocks fulfillment until ops clears it (never blocks the charge)"},"idempotentReplay":{"type":"boolean","description":"true when this call replayed an existing intent for the same idempotencyKey"}},"additionalProperties":true},"BulkPriceMovedError":{"type":"object","description":"The 409 BULK_PRICE_MOVED body — bulk availability moved between quote and intent (the shared counters); the hold was released. Re-quote against `detail` (the AUTHORITATIVE current numbers) and re-confirm.","required":["code","message","detail"],"properties":{"code":{"type":"string","enum":["BULK_PRICE_MOVED"]},"message":{"type":"string"},"detail":{"type":"object","required":["qtyNow","priceMinorNow","band"],"properties":{"qtyNow":{"type":"integer","description":"the current reservable remainder qty"},"priceMinorNow":{"type":"integer","description":"the current merchandise basis (minor units) at that qty"},"band":{"anyOf":[{"$ref":"#/components/schemas/BulkQuoteBand"},{"type":"null"}],"description":"the governing completeness band at that qty (null when none)"}}}},"additionalProperties":true}},"responses":{"Unauthorized":{"description":"No live operator credential (deny by default). code: OPERATOR_UNAUTHENTICATED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"A manage-scoped key attempted a privileged (money/irreversible) action. code: OPERATOR_KEY_INSUFFICIENT_SCOPE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unconfigured":{"description":"The lane is not configured (fail closed). code: *_UNCONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}