{
  "openapi": "3.1.0",
  "info": {
    "title": "DYLI Commerce API",
    "version": "1.3.0",
    "description": "Build a box storefront with DYLI. Commerce v1 is boxes-only, with 1–10 of the same box per checkout, vaulting, sell-backs and physical redemptions. The starter includes card and Abstract USDC checkout. Custom checkouts can accept other crypto through a swap or bridge, then settle in Abstract USDC with the exact quote transfer and payer authorization. Conversion is not built into the starter. Secondary marketplace, P2P trading and eBay integration are coming soon, not included in v1. Additional catalog types in this schema do not imply availability for your app. Every request is server-to-server and requires an app-bound Commerce key from an active DYLI Pro account; customers do not need Pro. Keep your own login, use your own Privy app or request managed login. Default limits are 300 reads and 120 writes per minute. Check returned capabilities before enabling checkout."
  },
  "servers": [
    { "url": "https://www.dyli.io/api/commerce/v1", "description": "Production" }
  ],
  "security": [
    { "ApiKeyAuth": [] },
    { "BearerAuth": [] }
  ],
  "tags": [
    { "name": "Readiness" },
    { "name": "Configuration" },
    { "name": "Catalog" },
    { "name": "Customers" },
    { "name": "Quotes" },
    { "name": "Payments" },
    { "name": "Orders" },
    { "name": "Boxes" },
    { "name": "Redemptions" },
    { "name": "Events" }
  ],
  "paths": {
    "/storefront/limits": {
      "post": {
        "tags": ["Readiness"],
        "summary": "Check a shared storefront request budget",
        "description": "Server-only protection using the Commerce key. Separate from normal Commerce read/write quota; capped at 1800 checks/minute. Hash subjects with HMAC-SHA-256 using the server key. Global upstream budgets cannot be partitioned by subject. No payment or order is created. Stop the protected operation on 429 or 503.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object", "additionalProperties": false, "required": ["budget", "subject_hash"],
          "properties": {
            "budget": { "type": "string", "enum": ["client-read", "client-write", "customer", "upstream-read", "upstream-write"] },
            "subject_hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
          }
        } } } },
        "responses": {
          "200": { "description": "Request permitted", "content": { "application/json": { "schema": {
            "type": "object", "required": ["allowed", "retry_after_seconds"],
            "properties": { "allowed": { "const": true }, "retry_after_seconds": { "type": "integer", "minimum": 1, "maximum": 60 } }
          } } } },
          "400": { "description": "Unsupported budget or invalid subject hash" },
          "401": { "description": "Invalid Commerce key" },
          "403": { "description": "Commerce membership or application access denied" },
          "429": { "description": "Budget exceeded; honor Retry-After and preserve pending payments" },
          "503": { "description": "Protection unavailable; fail closed" }
        }
      }
    },
    "/bootstrap": {
      "get": {
        "operationId": "getCommerceBootstrap",
        "tags": ["Configuration"],
        "summary": "Discover public runtime settings for the selected partner",
        "description": "Server-to-server. Managed auth requires DYLI operator activation; an API key alone does not provision auth or a sandbox. No private auth or wallet credentials are returned.",
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }],
        "responses": {
          "200": { "description": "Public runtime config; inspect auth.available and root readiness before enabling checkout", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CommerceBootstrap" } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/auth/session": {
      "post": {
        "operationId": "verifyManagedCustomerSession",
        "tags": ["Customers"],
        "summary": "Verify a customer token against this partner's dedicated managed auth app",
        "description": "Requires Commerce scope and the normal API key. Customer token is a separate header and is not payment evidence. Identity is derived from verified provider records, not caller-supplied IDs. Does not create a payment, order or customer record.",
        "parameters": [
          { "$ref": "#/components/parameters/PartnerSlug" },
          { "name": "x-customer-access-token", "in": "header", "required": true, "description": "Customer Privy access token. Never persist or log.", "schema": { "type": "string", "minLength": 1, "maxLength": 16384 } }
        ],
        "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "wallet_address": { "$ref": "#/components/schemas/EvmAddress" } } } } } },
        "responses": {
          "200": { "description": "Verified identity for server-side customer sync and ownership checks", "content": { "application/json": { "schema": { "type": "object", "required": ["identity"], "properties": { "identity": { "$ref": "#/components/schemas/ManagedCustomerIdentity" } } } } } },
          "401": { "$ref": "#/components/responses/Error" },
          "403": { "$ref": "#/components/responses/Error" },
          "409": { "$ref": "#/components/responses/Error" },
          "503": { "$ref": "#/components/responses/Error" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/": {
      "get": {
        "operationId": "getCommerceReadiness",
        "tags": ["Readiness"],
        "summary": "Get partner configuration and runtime capabilities",
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }],
        "responses": {
          "200": { "description": "Runtime readiness", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Readiness" } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/config": {
      "get": {
        "operationId": "getPartnerConfig",
        "tags": ["Configuration"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }],
        "responses": {
          "200": { "description": "Partner config", "content": { "application/json": { "schema": { "type": "object", "required": ["partner"], "properties": { "partner": { "$ref": "#/components/schemas/PartnerConfig" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      },
      "patch": {
        "operationId": "updatePartnerConfig",
        "tags": ["Configuration"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerConfigPatch" } } } },
        "responses": {
          "200": { "description": "Updated config; webhook_secret is returned once when created or rotated", "content": { "application/json": { "schema": { "type": "object", "required": ["partner"], "properties": { "partner": { "$ref": "#/components/schemas/PartnerConfig" }, "webhook_secret": { "type": "string" }, "warning": { "type": "string" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/catalog/{surface}": {
      "get": {
        "operationId": "getCatalogSurface",
        "tags": ["Catalog"],
        "summary": "Read a partner-filtered catalog surface",
        "parameters": [
          { "$ref": "#/components/parameters/PartnerSlug" },
          { "name": "surface", "in": "path", "required": true, "schema": { "type": "string", "enum": ["explore", "listings", "secondary-listings", "boxes", "redemptions", "ebay", "collections", "fair-drops", "digital-packs", "search", "options"] } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0 } },
          { "name": "q", "in": "query", "schema": { "type": "string" } },
          { "name": "product_id", "in": "query", "schema": { "type": "integer" } },
          { "name": "token_id", "in": "query", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Surface-specific catalog payload. Purchasable rows include purchase.quote_item.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/catalog/{surface}/{identifier}": {
      "get": {
        "operationId": "getCatalogItem",
        "tags": ["Catalog"],
        "summary": "Read a supported catalog item or collection",
        "description": "Item detail is supported for boxes and digital-packs; collection detail uses the collection slug.",
        "parameters": [
          { "$ref": "#/components/parameters/PartnerSlug" },
          { "name": "surface", "in": "path", "required": true, "schema": { "type": "string", "enum": ["boxes", "digital-packs", "collections"] } },
          { "name": "identifier", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Partner-filtered item payload", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "tags": ["Customers"],
        "parameters": [
          { "$ref": "#/components/parameters/PartnerSlug" },
          { "$ref": "#/components/parameters/Limit" },
          { "$ref": "#/components/parameters/Offset" }
        ],
        "responses": {
          "200": { "description": "Customers", "content": { "application/json": { "schema": { "type": "object", "required": ["customers", "pagination"], "properties": { "customers": { "type": "array", "items": { "$ref": "#/components/schemas/Customer" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/customers/{externalCustomerId}": {
      "put": {
        "operationId": "putCustomer",
        "tags": ["Customers"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/ExternalCustomerId" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerInput" } } } },
        "responses": {
          "200": { "description": "Synchronized customer", "content": { "application/json": { "schema": { "type": "object", "required": ["customer"], "properties": { "customer": { "$ref": "#/components/schemas/Customer" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      },
      "get": {
        "operationId": "getCustomer",
        "tags": ["Customers"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/ExternalCustomerId" }],
        "responses": {
          "200": { "description": "Customer", "content": { "application/json": { "schema": { "type": "object", "required": ["customer"], "properties": { "customer": { "$ref": "#/components/schemas/Customer" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/analytics": {
      "get": {
        "operationId": "getCommerceAnalytics",
        "summary": "Private application orders, box profit and earnings",
        "description": "Server-to-server, scoped to the key's app. Do not expose owner financials to storefront customers. Totals cover all history; only the orders array is paginated. Profile aggregates all the owner's apps and uses the existing Claim flow.",
        "tags": ["Configuration"],
        "parameters": [
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 } }
        ],
        "responses": {
          "200": { "description": "Commerce report", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CommerceAnalytics" } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/quotes": {
      "post": {
        "operationId": "createQuote",
        "tags": ["Quotes"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/IdempotencyKey" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateQuoteRequest" } } } },
        "responses": {
          "201": { "$ref": "#/components/responses/Quote" },
          "200": { "$ref": "#/components/responses/Quote" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/quotes/{quoteId}": {
      "get": {
        "operationId": "getQuote",
        "tags": ["Quotes"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/QuoteId" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Quote" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/quotes/{quoteId}/payment-authorization": {
      "post": {
        "operationId": "createPaymentAuthorization",
        "tags": ["Payments"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/QuoteId" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentAuthorizationRequest" } } } },
        "responses": {
          "200": { "description": "Exact message for the payer to sign", "content": { "application/json": { "schema": { "type": "object", "required": ["authorization"], "properties": { "authorization": { "$ref": "#/components/schemas/PaymentAuthorization" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/quotes/{quoteId}/stripe-checkout": {
      "post": {
        "operationId": "createStripeCheckout",
        "tags": ["Payments"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/QuoteId" }, { "$ref": "#/components/parameters/IdempotencyKey" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StripeCheckoutRequest" } } } },
        "responses": {
          "201": { "$ref": "#/components/responses/StripeCheckout" },
          "200": { "$ref": "#/components/responses/StripeCheckout" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/stripe-checkouts/{paymentSessionId}": {
      "get": {
        "operationId": "getStripeCheckout",
        "tags": ["Payments"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/PaymentSessionId" }],
        "responses": {
          "200": { "$ref": "#/components/responses/StripeCheckout" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/stripe-checkouts/resolve": {
      "get": {
        "operationId": "resolveStripeCheckout",
        "tags": ["Payments"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "name": "stripe_session_id", "in": "query", "required": true, "schema": { "type": "string", "pattern": "^cs_(test|live)_" } }],
        "responses": {
          "200": { "$ref": "#/components/responses/StripeCheckout" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/stripe-checkouts/{paymentSessionId}/cancel": {
      "post": {
        "operationId": "cancelStripeCheckout",
        "summary": "Expire an unpaid Checkout Session before discarding local recovery",
        "description": "Scoped to the authenticated Commerce account. The partner must also verify customer ownership. Stripe must confirm the session is unpaid and expired; completed, processing or uncertain payments are not discarded. This does not refund a payment or cancel an order. Repeating cancellation is safe.",
        "tags": ["Payments"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/PaymentSessionId" }],
        "responses": {
          "200": { "description": "Unpaid checkout expired", "content": { "application/json": { "schema": { "type": "object", "required": ["cancelled", "checkout"], "properties": { "cancelled": { "const": true }, "checkout": { "$ref": "#/components/schemas/StripeCheckout" } } } } } },
          "409": { "$ref": "#/components/responses/Error" },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/stripe-checkouts/{paymentSessionId}/confirm": {
      "post": {
        "operationId": "confirmStripeCheckout",
        "tags": ["Payments"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/PaymentSessionId" }],
        "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "stripe_session_id": { "type": "string", "pattern": "^cs_" } } } } } },
        "responses": {
          "201": { "description": "Stripe payment finalized", "content": { "application/json": { "schema": { "type": "object", "required": ["order", "checkout"], "properties": { "order": { "$ref": "#/components/schemas/Order" }, "checkout": { "$ref": "#/components/schemas/StripeCheckout" }, "idempotent": { "type": "boolean" } } } } } },
          "200": { "description": "Previously finalized Stripe payment", "content": { "application/json": { "schema": { "type": "object", "required": ["order", "checkout"], "properties": { "order": { "$ref": "#/components/schemas/Order" }, "checkout": { "$ref": "#/components/schemas/StripeCheckout" }, "idempotent": { "type": "boolean" } } } } } },
          "default": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/orders": {"post":{"operationId":"createUsdcOrder","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/PartnerSlug"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Order"},"201":{"$ref":"#/components/responses/Order"},"default":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"listOrders","tags":["Orders"],"parameters":[{"$ref":"#/components/parameters/PartnerSlug"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Offset"},{"name":"external_customer_id","in":"query","schema":{"$ref":"#/components/schemas/ExternalId"}},{"name":"external_order_id","in":"query","schema":{"$ref":"#/components/schemas/ExternalId"}}],"responses":{"200":{"description":"Orders","content":{"application/json":{"schema":{"type":"object","required":["orders","pagination"],"properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"default":{"$ref":"#/components/responses/Error"}}}},
    "/orders/{orderId}": {
      "get": {
        "operationId": "getOrder",
        "tags": ["Orders"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/OrderId" }],
        "responses": { "200": { "$ref": "#/components/responses/Order" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/box-plays": {
      "get": {
        "operationId": "listBoxPlays",
        "tags": ["Boxes"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/Limit" }, { "$ref": "#/components/parameters/Offset" }, { "name": "external_customer_id", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/ExternalId" } }],
        "responses": { "200": { "description": "Customer Box plays", "content": { "application/json": { "schema": { "type": "object", "required": ["box_plays", "pagination"], "properties": { "box_plays": { "type": "array", "items": { "$ref": "#/components/schemas/BoxPlay" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } } } } } }, "default": { "$ref": "#/components/responses/Error" } }
      },
      "post": {
        "operationId": "createBoxPlay",
        "tags": ["Boxes"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["order_id"], "properties": { "order_id": { "$ref": "#/components/schemas/Uuid" }, "external_customer_id": { "$ref": "#/components/schemas/ExternalId" } } } } } },
        "responses": { "201": { "$ref": "#/components/responses/BoxPlay" }, "200": { "$ref": "#/components/responses/BoxPlay" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/box-plays/{boxPlayId}": {
      "get": {
        "operationId": "getBoxPlay",
        "tags": ["Boxes"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/BoxPlayId" }],
        "responses": { "200": { "$ref": "#/components/responses/BoxPlay" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/box-plays/{boxPlayId}/results": {"post":{"operationId":"getBoxResults","tags":["Boxes"],"parameters":[{"$ref":"#/components/parameters/PartnerSlug"},{"$ref":"#/components/parameters/BoxPlayId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionConfirmation"}}}},"responses":{"200":{"$ref":"#/components/responses/BoxPlay"},"default":{"$ref":"#/components/responses/Error"}},"summary":"Verify gacha buy and draw the paid batch; poll ready/retry_after_ms"}},
    "/box-plays/{boxPlayId}/commit": {"post":{"operationId":"confirmBoxCommit","tags":["Boxes"],"parameters":[{"$ref":"#/components/parameters/PartnerSlug"},{"$ref":"#/components/parameters/BoxPlayId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionConfirmation"}}}},"responses":{"200":{"$ref":"#/components/responses/BoxPlay"},"default":{"$ref":"#/components/responses/Error"}},"summary":"Alias of results; no automatic claim or defer_decision behavior.","deprecated":true}},
    "/box-plays/{boxPlayId}/decision": {"post":{"operationId":"chooseBoxDisposition","tags":["Boxes"],"parameters":[{"$ref":"#/components/parameters/PartnerSlug"},{"$ref":"#/components/parameters/BoxPlayId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["decisions"],"properties":{"decisions":{"type":"array","minItems":1,"maxItems":10,"items":{"enum":["claim","sell_back"]},"description":"One choice per reward, in index order."},"tx_hash":{"$ref":"#/components/schemas/TransactionHash"}}}}}},"responses":{"200":{"$ref":"#/components/responses/BoxPlay"},"default":{"$ref":"#/components/responses/Error"}}}},
    "/box-plays/{boxPlayId}/finalize": {
      "post": {
        "operationId": "confirmBoxFinalize",
        "tags": ["Boxes"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/BoxPlayId" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TransactionConfirmation" } } } },
        "responses": { "200": { "$ref": "#/components/responses/BoxPlay" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/redemptions/address-validation": {
      "post": {
        "operationId": "validateRedemptionAddress",
        "tags": ["Redemptions"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["external_customer_id", "address"], "properties": { "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "address": { "$ref": "#/components/schemas/Address" } } } } } },
        "responses": { "200": { "description": "Validated address", "content": { "application/json": { "schema": { "type": "object", "required": ["valid", "address"], "properties": { "valid": { "const": true }, "address": { "$ref": "#/components/schemas/Address" } } } } } }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/redemptions": {
      "post": {
        "operationId": "createRedemptionQuote",
        "tags": ["Redemptions"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/IdempotencyKey" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateRedemptionRequest" } } } },
        "responses": { "201": { "$ref": "#/components/responses/Redemption" }, "200": { "$ref": "#/components/responses/Redemption" }, "default": { "$ref": "#/components/responses/Error" } }
      },
      "get": {
        "operationId": "listRedemptions",
        "tags": ["Redemptions"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/Limit" }, { "$ref": "#/components/parameters/Offset" }, { "name": "external_customer_id", "in": "query", "schema": { "$ref": "#/components/schemas/ExternalId" } }],
        "responses": { "200": { "description": "Redemptions", "content": { "application/json": { "schema": { "type": "object", "required": ["redemptions", "pagination"], "properties": { "redemptions": { "type": "array", "items": { "$ref": "#/components/schemas/Redemption" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } } } } } }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/redemptions/{redemptionId}": {
      "get": {
        "operationId": "getRedemption",
        "tags": ["Redemptions"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/RedemptionId" }],
        "responses": { "200": { "$ref": "#/components/responses/Redemption" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/redemptions/{redemptionId}/prepare": {
      "post": {
        "operationId": "prepareRedemption",
        "description": "Reprice the selected delivery service and return a fresh 10-minute payment window. Prefer courier_id in shipping_selection, otherwise use the option id. A disappeared service returns shipping_option_unavailable instead of substituting another carrier. Refresh unpaid expired quotes with a new idempotency key; never replace a possibly submitted transaction.",
        "tags": ["Redemptions"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/RedemptionId" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PrepareRedemptionRequest" } } } },
        "responses": { "200": { "$ref": "#/components/responses/Redemption" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/redemptions/{redemptionId}/confirm": {
      "post": {
        "operationId": "confirmRedemption",
        "tags": ["Redemptions"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/RedemptionId" }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TransactionConfirmation" } } } },
        "responses": { "201": { "$ref": "#/components/responses/Redemption" }, "200": { "$ref": "#/components/responses/Redemption" }, "default": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/events": {
      "get": {
        "operationId": "listEvents",
        "tags": ["Events"],
        "parameters": [{ "$ref": "#/components/parameters/PartnerSlug" }, { "$ref": "#/components/parameters/Limit" }],
        "responses": { "200": { "description": "At-least-once event ledger", "content": { "application/json": { "schema": { "type": "object", "required": ["events"], "properties": { "events": { "type": "array", "items": { "$ref": "#/components/schemas/Event" } } } } } } }, "default": { "$ref": "#/components/responses/Error" } }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "x-api-key" },
      "BearerAuth": { "type": "http", "scheme": "bearer" }
    },
    "parameters": {
      "PartnerSlug": { "name": "x-partner-slug", "in": "header", "required": false, "description": "Optional compatibility assertion. The Commerce key identifies its registered application automatically; GET /bootstrap returns partner.slug. If supplied, this slug must match that application or the API returns commerce_app_mismatch. It cannot select another app, including one owned by the same account.", "schema": { "type": "string", "minLength": 1, "maxLength": 80, "example": "example-store" } },
      "IdempotencyKey": { "name": "Idempotency-Key", "in": "header", "required": true, "schema": { "$ref": "#/components/schemas/ExternalId" } },
      "Limit": { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 } },
      "Offset": { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } },
      "ExternalCustomerId": { "name": "externalCustomerId", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/ExternalId" } },
      "QuoteId": { "name": "quoteId", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/Uuid" } },
      "PaymentSessionId": { "name": "paymentSessionId", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/Uuid" } },
      "OrderId": { "name": "orderId", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/Uuid" } },
      "BoxPlayId": { "name": "boxPlayId", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/Uuid" } },
      "RedemptionId": { "name": "redemptionId", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/Uuid" } }
    },
    "responses": {
      "Error": {
        "description": "Error response",
        "headers": {
          "x-request-id": { "schema": { "type": "string", "format": "uuid" } },
          "Retry-After": { "schema": { "type": "integer" } }
        },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Quote": { "description": "Quote and current chain payment instructions", "content": { "application/json": { "schema": { "type": "object", "required": ["quote", "payment"], "properties": { "quote": { "$ref": "#/components/schemas/Quote" }, "payment": { "$ref": "#/components/schemas/PaymentInstructions" }, "idempotent": { "type": "boolean" } } } } } },
      "Order": { "description": "Commerce order", "content": { "application/json": { "schema": { "type": "object", "required": ["order"], "properties": { "order": { "$ref": "#/components/schemas/Order" }, "idempotent": { "type": "boolean" } } } } } },
      "StripeCheckout": { "description": "Stripe checkout state", "content": { "application/json": { "schema": { "type": "object", "required": ["checkout"], "properties": { "checkout": { "$ref": "#/components/schemas/StripeCheckout" }, "idempotent": { "type": "boolean" } } } } } },
      "BoxPlay": {"description":"Box play state and next transaction when applicable","content":{"application/json":{"schema":{"type":"object","required":["box_play"],"properties":{"box_play":{"$ref":"#/components/schemas/BoxPlay"},"idempotent":{"type":"boolean"},"ready":{"type":"boolean"},"restart":{"type":"boolean"},"retry_after_ms":{"type":["integer","null"]},"finalize_tx_hash":{"type":["string","null"]}}}}}},
      "Redemption": { "description": "Redemption state", "content": { "application/json": { "schema": { "type": "object", "required": ["redemption"], "properties": { "redemption": { "$ref": "#/components/schemas/Redemption" }, "idempotent": { "type": "boolean" } } } } } }
    },
    "schemas": {
      "CommerceBootstrap": {
        "type": "object", "required": ["version", "bootstrap_version", "environment", "partner", "auth", "wallet", "storefront"],
        "properties": {
          "version": { "type": "string" }, "bootstrap_version": { "const": 1 }, "environment": { "enum": ["lab", "production"] },
          "partner": { "$ref": "#/components/schemas/PartnerConfig" },
          "auth": {
            "type": "object", "additionalProperties": false,
            "required": ["mode", "available", "provider", "allowed_origins", "storefront_origin", "session_endpoint"],
            "properties": {
              "mode": { "enum": ["dyli_managed", "existing", "privy"] }, "available": { "type": "boolean", "description": "For existing/privy, the integration mode is registered; this does not certify partner auth implementation." }, "provider": { "type": "string" },
              "verification": { "const": "partner_server" },
              "app_id": { "type": ["string", "null"] }, "allowed_origins": { "type": "array", "items": { "type": "string", "format": "uri" } },
              "storefront_origin": { "type": ["string", "null"], "format": "uri" }, "session_endpoint": { "enum": ["/auth/session", null] }, "sponsor_transactions": { "const": false }
            }
          },
          "integration": { "type": ["object", "null"], "properties": { "application_id": { "$ref": "#/components/schemas/Uuid" }, "auth_mode": { "enum": ["existing", "privy", "dyli_managed"] }, "wallet_mode": { "enum": ["existing", "embedded", "managed"] }, "payment_mode": { "enum": ["dyli", "partner", "both"] }, "app_type": { "enum": ["web", "mobile", "both", "api"] } } },
          "wallet": { "type": "object", "required": ["chain", "chain_id"], "properties": { "chain": { "const": "abstract" }, "chain_id": { "enum": [2741, 11124] } } },
          "storefront": { "type": "object", "required": ["name", "boxes_only"], "properties": { "name": { "type": "string" }, "boxes_only": { "type": "boolean" } } }
        }
      },
      "ManagedCustomerIdentity": {
        "type": "object", "additionalProperties": false, "required": ["userId", "externalCustomerId", "walletAddress", "email", "name"],
        "properties": {
          "userId": { "type": "string" }, "externalCustomerId": { "$ref": "#/components/schemas/ExternalId" },
          "walletAddress": { "$ref": "#/components/schemas/EvmAddress" }, "email": { "type": ["string", "null"] }, "name": { "type": ["string", "null"] }
        }
      },
      "Uuid": { "type": "string", "format": "uuid" },
      "ExternalId": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/|\\-]{0,199}$" },
      "EvmAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" },
      "TransactionHash": { "type": "string", "description": "EVM 0x-prefixed 32-byte hash or Solana base58 signature" },
      "Pagination": { "type": "object", "required": ["limit", "offset", "total"], "properties": { "limit": { "type": "integer" }, "offset": { "type": "integer" }, "total": { "type": "integer" } } },
      "Readiness": {"type":"object","required":["name","version","environment","partner","capabilities","payment"],"properties":{"name":{"type":"string"},"version":{"type":"string"},"environment":{"enum":["production","lab"]},"partner":{"$ref":"#/components/schemas/PartnerConfig"},"capabilities":{"type":"object","required":["payments","writes","purchasing_ready","fulfillment"],"properties":{"payments":{"type":"array","items":{"enum":["usdc","stripe_card"]}},"writes":{"type":"object","properties":{"enabled":{"type":"boolean"},"status":{"type":"string"}},"required":["enabled","status"]},"purchasing_ready":{"type":"boolean"},"fulfillment":{"type":"object","required":["ready","live_ready","test_ready","mode","environment","environment_valid"],"properties":{"ready":{"type":"boolean"},"live_ready":{"type":"boolean"},"test_ready":{"type":"boolean"},"mode":{"enum":["executor","manual_queue","test_queue","unconfigured"]},"environment":{"enum":["production","lab"]},"environment_valid":{"type":"boolean"}}},"box_play":{"type":"object","required":["ready","contract_version","chain_id","max_quantity"],"properties":{"ready":{"type":"boolean"},"enabled":{"type":"boolean"},"contract_version":{"const":"gacha"},"chain_id":{"enum":[2741,11124]},"max_quantity":{"const":10},"network_valid":{"type":"boolean"},"flow":{"type":"array","items":{"enum":["buy","results","decision","finalize"]}}}}},"additionalProperties":true},"payment":{"type":"object","additionalProperties":true}}},
      "PartnerConfig": { "type": "object", "required": ["slug", "branding", "catalog_rules", "fee_rules", "webhook"], "properties": { "slug": { "type": "string" }, "display_name": { "type": ["string", "null"] }, "branding": { "type": "object", "additionalProperties": true }, "catalog_rules": { "type": "object", "additionalProperties": true }, "fee_rules": { "$ref": "#/components/schemas/FeeRules" }, "webhook": { "type": "object", "properties": { "url": { "type": ["string", "null"], "format": "uri" }, "configured": { "type": "boolean" }, "has_secret": { "type": "boolean" } }, "required": ["url", "configured", "has_secret"] }, "updated_at": { "type": "string", "format": "date-time" } } },
      "PartnerConfigPatch": { "type": "object", "properties": { "display_name": { "type": ["string", "null"], "maxLength": 100 }, "branding": { "type": "object", "additionalProperties": true }, "catalog_rules": { "type": "object", "additionalProperties": true }, "fee_rules": { "$ref": "#/components/schemas/FeeRules" }, "webhook_url": { "type": ["string", "null"], "format": "uri" }, "rotate_webhook_secret": { "type": "boolean" } } },
      "FeeRules": {"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean"},"type":{"enum":["percent","fixed","fixed_plus_percent"]},"percent":{"type":"number","minimum":0,"maximum":100},"fixed_amount":{"type":"number","minimum":0,"maximum":100000},"per_unit":{"type":"boolean","default":false,"description":"Multiply fixed_amount by box quantity. Percentages always use subtotal."},"minimum":{"type":["number","null"],"minimum":0,"maximum":100000},"maximum":{"type":["number","null"],"minimum":0,"maximum":100000},"label":{"type":"string","maxLength":80}},"description":"Trusted partner-server fee policy, in account config or as a quote-only override. enabled:false disables it. Default is zero. Fixed fees are per order unless per_unit:true. Does not waive box price, processing, gas or shipping."},
      "CommerceAnalytics": {
        "type": "object", "required": ["enabled", "summary", "boxes", "orders", "pagination", "share_percent", "as_of"],
        "properties": {
          "enabled": { "type": "boolean" }, "share_percent": { "const": 10 },
          "summary": { "$ref": "#/components/schemas/CommerceMetrics" },
          "boxes": { "type": "array", "items": { "allOf": [{ "$ref": "#/components/schemas/CommerceMetrics" }, { "type": "object", "properties": { "box_id": { "type": "integer" }, "name": { "type": "string" }, "image_url": { "type": ["string", "null"] } } }] } },
          "orders": { "type": "array", "items": { "type": "object", "additionalProperties": true, "properties": { "order_id": { "type": "string", "format": "uuid" }, "quantity": { "type": "integer" }, "earnings_status": { "enum": ["settled", "pending", "excluded", "failed", "refunded", "cancelled"] } } } },
          "applications": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "pagination": { "type": "object", "properties": { "offset": { "type": "integer" }, "limit": { "type": "integer" }, "total": { "type": "integer" } } },
          "as_of": { "type": "string", "format": "date-time" }
        }
      },
      "CommerceMetrics": { "type": "object", "description": "Money in USD/USDC. Net profit = settled base sales minus buybacks and refunds. Owner share = max(0, net profit × 10%); Your fee is additional. Per-box shares retain signed contributions and are not independently claimable.", "properties": { "orders": { "type": "integer" }, "completed_orders": { "type": "integer" }, "boxes_opened": { "type": "integer" }, "buyback_count": { "type": "integer" }, "sales": { "type": "number" }, "buybacks": { "type": "number" }, "refunds": { "type": "number" }, "profit": { "type": "number" }, "profit_share": { "type": "number" }, "your_fee": { "type": "number" }, "earnings": { "type": "number" } } },
      "PartnerAuth": { "type": "object", "required": ["provider", "subject"], "properties": { "provider": { "type": "string", "maxLength": 50 }, "subject": { "type": "string", "maxLength": 250 } } },
      "CustomerInput": { "type": "object", "required": ["wallet_address"], "properties": { "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "wallet_address": { "$ref": "#/components/schemas/EvmAddress" }, "wallet_chain": { "const": "abstract" }, "email": { "type": "string", "format": "email" }, "name": { "type": "string", "maxLength": 200 }, "partner_auth": { "$ref": "#/components/schemas/PartnerAuth" } } },
      "Customer": { "allOf": [{ "$ref": "#/components/schemas/CustomerInput" }, { "type": "object", "required": ["id", "external_customer_id", "dyli_user_linked"], "properties": { "id": { "$ref": "#/components/schemas/Uuid" }, "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "dyli_user_linked": { "type": "boolean" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" }, "last_seen_at": { "type": "string", "format": "date-time" } } }] },
      "QuoteItem": { "oneOf": [
        { "type": "object", "required": ["type", "listing_id", "quantity"], "properties": { "type": { "const": "listing" }, "listing_id": { "type": "string" }, "quantity": { "const": 1 } } },
        { "type": "object", "required": ["type", "listing_id", "product_id", "token_id", "quantity"], "properties": { "type": { "const": "secondary-listing" }, "listing_id": { "type": "string" }, "product_id": { "type": "integer" }, "token_id": { "type": "string" }, "quantity": { "const": 1 } } },
        { "type": "object", "required": ["type", "box_id", "quantity"], "properties": { "type": { "const": "box" }, "box_id": { "type": "integer" }, "quantity": { "type": "integer", "minimum": 1, "maximum": 10 } } },
        { "type": "object", "required": ["type", "item_id", "quantity"], "properties": { "type": { "const": "ebay" }, "item_id": { "type": "string" }, "quantity": { "const": 1 } } }
      ] },
      "CreateQuoteRequest": { "type": "object", "required": ["items"], "properties": { "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "items": { "type": "array", "minItems": 1, "maxItems": 1, "items": { "$ref": "#/components/schemas/QuoteItem" } }, "fee_rules": { "$ref": "#/components/schemas/FeeRules" } } },
      "PriceBreakdown": { "type": "object", "required": ["subtotal_cents", "partner_fee_cents", "total_cents", "subtotal", "partner_fee", "total", "currency"], "properties": { "subtotal_cents": { "type": "integer" }, "partner_fee_cents": { "type": "integer" }, "total_cents": { "type": "integer" }, "subtotal": { "type": "number" }, "partner_fee": { "type": "number" }, "total": { "type": "number" }, "currency": { "type": "string" }, "fee_label": { "type": "string" }, "fee_rules": { "$ref": "#/components/schemas/FeeRules" }, "fee_quantity": { "type": "integer", "minimum": 1 }, "stripe_discount_cents": { "type": "integer", "minimum": 0, "description": "Stripe-verified discount on a completed card order. total_cents is the actual amount paid." }, "stripe_item_discount_cents": { "type": "integer", "minimum": 0 }, "stripe_partner_fee_discount_cents": { "type": "integer", "minimum": 0 }, "stripe_card_fee_discount_cents": { "type": "integer", "minimum": 0 } }, "additionalProperties": true },
      "Quote": { "type": "object", "required": ["id", "currency", "items", "price_breakdown", "status", "expires_at"], "properties": { "id": { "$ref": "#/components/schemas/Uuid" }, "external_customer_id": { "type": ["string", "null"] }, "currency": { "const": "USDC" }, "items": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "price_breakdown": { "$ref": "#/components/schemas/PriceBreakdown" }, "status": { "type": "string" }, "expires_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } },
      "PaymentInstructions": { "type": "object", "required": ["currency", "supported_chains", "recipients", "tokens"], "properties": { "amount": { "type": ["string", "number", "null"] }, "currency": { "const": "USDC" }, "supported_chains": { "type": "array", "items": { "$ref": "#/components/schemas/PaymentChain" } }, "recipients": { "type": "object", "additionalProperties": { "type": "string" } }, "tokens": { "type": "object", "additionalProperties": { "type": "string" } } }, "additionalProperties": true },
      "PaymentChain": { "enum": ["abstract", "avalanche", "ethereum", "base", "arbitrum", "optimism", "polygon", "hyperevm", "monad", "solana"] },
      "FulfillmentInput": { "type": "object", "properties": { "mode": { "const": "vault", "default": "vault" } } },
      "PaymentAuthorizationRequest": { "type": "object", "required": ["external_customer_id", "customer", "payment"], "properties": { "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "customer": { "$ref": "#/components/schemas/CustomerInput" }, "fulfillment": { "$ref": "#/components/schemas/FulfillmentInput" }, "payment": { "type": "object", "required": ["chain", "tx_hash", "payer"], "properties": { "chain": { "$ref": "#/components/schemas/PaymentChain" }, "tx_hash": { "$ref": "#/components/schemas/TransactionHash" }, "payer": { "type": "string" } } } } },
      "PaymentAuthorization": { "type": "object", "required": ["message", "chain", "tx_hash", "payer", "intent_hash", "signature_method"], "properties": { "message": { "type": "string" }, "chain": { "$ref": "#/components/schemas/PaymentChain" }, "tx_hash": { "$ref": "#/components/schemas/TransactionHash" }, "payer": { "type": "string" }, "intent_hash": { "type": "string" }, "signature_method": { "type": "string" } } },
      "PaymentInput": { "type": "object", "required": ["chain", "tx_hash", "payer", "payer_signature"], "properties": { "chain": { "$ref": "#/components/schemas/PaymentChain" }, "tx_hash": { "$ref": "#/components/schemas/TransactionHash" }, "payer": { "type": "string" }, "payer_signature": { "type": "string" } } },
      "CreateOrderRequest": { "type": "object", "required": ["quote_id", "external_customer_id", "customer", "payment"], "properties": { "quote_id": { "$ref": "#/components/schemas/Uuid" }, "external_order_id": { "$ref": "#/components/schemas/ExternalId" }, "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "customer": { "$ref": "#/components/schemas/CustomerInput" }, "fulfillment": { "$ref": "#/components/schemas/FulfillmentInput" }, "payment": { "$ref": "#/components/schemas/PaymentInput" } } },
      "Order": {"type":"object","required":["id","quote_id","external_customer_id","customer","delivery","price_breakdown","payment","status","fulfillment_status"],"properties":{"id":{"$ref":"#/components/schemas/Uuid"},"quote_id":{"$ref":"#/components/schemas/Uuid"},"external_order_id":{"type":["string","null"]},"external_customer_id":{"$ref":"#/components/schemas/ExternalId"},"dyli_customer_id":{"type":["string","null"]},"customer":{"type":"object","additionalProperties":true},"fulfillment":{"type":"object","additionalProperties":true},"delivery":{"type":"object","required":["mode","wallet_address","status"],"properties":{"mode":{"const":"collection"},"wallet_address":{"$ref":"#/components/schemas/EvmAddress"},"status":{"type":"string"}}},"price_breakdown":{"$ref":"#/components/schemas/PriceBreakdown"},"currency":{"type":"string"},"payment":{"type":"object","additionalProperties":true},"status":{"type":"string"},"fulfillment_status":{"type":"string"},"dyli_order_ids":{"type":"array","description":"Normal DYLI order records created for this Commerce order. A live order cannot complete until these records are successful, activity-ready, and owned by the linked customer.","items":{"type":"string"}},"error":{"type":["object","null"],"additionalProperties":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"items":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Paid quote snapshots included on GET reads for recovery."}}},
      "StripeCheckoutRequest": { "type": "object", "required": ["external_customer_id", "customer", "ui_mode"], "properties": { "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "external_order_id": { "$ref": "#/components/schemas/ExternalId" }, "customer": { "$ref": "#/components/schemas/CustomerInput" }, "fulfillment": { "$ref": "#/components/schemas/FulfillmentInput" }, "ui_mode": { "enum": ["hosted", "embedded"] }, "success_url": { "type": "string", "format": "uri" }, "cancel_url": { "type": "string", "format": "uri" }, "return_url": { "type": "string", "format": "uri" } } },
      "StripeCheckout": { "type": "object", "required": ["id", "status"], "properties": { "id": { "$ref": "#/components/schemas/Uuid" }, "quote_id": { "$ref": "#/components/schemas/Uuid" }, "stripe_session_id": { "type": ["string", "null"] }, "checkout_url": { "type": ["string", "null"], "format": "uri" }, "client_secret": { "type": ["string", "null"] }, "publishable_key": { "type": ["string", "null"] }, "status": { "type": "string" }, "order_id": { "type": ["string", "null"], "format": "uuid" }, "expires_at": { "type": ["string", "null"], "format": "date-time" } }, "additionalProperties": true },
      "Transaction": { "type": "object", "required": ["chain", "from", "to", "data", "value"], "properties": { "chain": { "const": "abstract" }, "chain_id": { "type": "integer" }, "from": { "$ref": "#/components/schemas/EvmAddress" }, "to": { "$ref": "#/components/schemas/EvmAddress" }, "data": { "type": "string" }, "value": { "const": "0" }, "phase": { "type": "string" } } },
      "TransactionConfirmation": { "type": "object", "required": ["tx_hash"], "properties": { "tx_hash": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" } } },
      "BoxPlay": {"type":"object","required":["id","order_id","external_customer_id","box_id","wallet_address","status","quantity","contract_version","rewards","opening_reference"],"properties":{"id":{"$ref":"#/components/schemas/Uuid"},"order_id":{"$ref":"#/components/schemas/Uuid"},"external_customer_id":{"$ref":"#/components/schemas/ExternalId"},"box_id":{"type":"integer"},"wallet_address":{"$ref":"#/components/schemas/EvmAddress"},"status":{"enum":["buy_prepared","drawing","revealed","finalize_prepared","completed","restart_required"]},"finalize_tx_hash":{"type":["string","null"]},"transaction":{"oneOf":[{"$ref":"#/components/schemas/Transaction"},{"type":"null"}]},"quantity":{"type":"integer","minimum":1,"maximum":10},"contract_version":{"const":"gacha"},"opening_reference":{"type":"string","description":"Changes after a safe restart; discard old transaction hashes/decisions when it changes."},"buy_tx_hash":{"type":["string","null"]},"rewards":{"type":"array","maxItems":10,"items":{"type":"object","required":["index","product_id","token_id","product","buyback_amount"],"properties":{"index":{"type":"integer","minimum":0,"maximum":9},"product_id":{"type":"integer"},"token_id":{"type":"string"},"product":{"type":"object","additionalProperties":true},"rarity":{"type":["string","null"]},"buyback_amount":{"type":"number","minimum":0,"description":"USD buyback amount"},"disposition":{"enum":["claim","sell_back",null]}}}},"decisions":{"type":"array","maxItems":10,"items":{"enum":["claim","sell_back"]}},"dyli_order_ids":{"type":"array","items":{"type":"string"}}}},
      "Address": { "type": "object", "required": ["name", "email", "phone", "address_line_1", "city", "state", "postal_code", "country_alpha2"], "properties": { "name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "phone": { "type": "string" }, "address_line_1": { "type": "string" }, "address_line_2": { "type": ["string", "null"] }, "city": { "type": "string" }, "state": { "type": "string" }, "postal_code": { "type": "string" }, "country_alpha2": { "type": "string", "minLength": 2, "maxLength": 2 } }, "additionalProperties": true },
      "CreateRedemptionRequest": { "type": "object", "required": ["external_customer_id", "items", "address"], "properties": { "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "items": { "type": "array", "minItems": 1, "maxItems": 20, "items": { "type": "object", "required": ["token_id", "quantity"], "properties": { "token_id": { "type": "string", "pattern": "^\\d+$" }, "quantity": { "type": "integer", "minimum": 1 } } } }, "address": { "$ref": "#/components/schemas/Address" }, "include_ddp": { "type": "boolean" }, "insurance": { "type": "boolean" }, "declared_value_overrides": { "type": "object", "additionalProperties": { "type": "number" } } } },
      "PrepareRedemptionRequest": { "type": "object", "required": ["shipping_selection"], "properties": { "shipping_selection": { "type": "object", "additionalProperties": true }, "redemption_collection_responses": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } },
      "Redemption": { "type": "object", "required": ["id", "external_customer_id", "wallet_address", "items", "address", "status"], "properties": { "id": { "$ref": "#/components/schemas/Uuid" }, "external_customer_id": { "$ref": "#/components/schemas/ExternalId" }, "dyli_customer_id": { "$ref": "#/components/schemas/Uuid" }, "wallet_address": { "$ref": "#/components/schemas/EvmAddress" }, "items": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "address": { "$ref": "#/components/schemas/Address" }, "shipping_options": { "type": "object", "additionalProperties": true }, "selected_shipping_option": { "type": ["object", "null"], "additionalProperties": true }, "pricing": { "type": ["object", "null"], "additionalProperties": true }, "payment": { "type": ["object", "null"], "additionalProperties": true }, "transaction": { "anyOf": [{ "$ref": "#/components/schemas/Transaction" }, { "type": "null" }] }, "redemption_tx_hash": { "type": ["string", "null"] }, "status": { "type": "string" }, "result": { "type": ["object", "null"], "additionalProperties": true }, "error": { "type": ["object", "null"], "additionalProperties": true }, "expires_at": { "type": ["string", "null"], "format": "date-time" } } },
      "Event": { "type": "object", "required": ["id", "event_type", "payload", "delivery_status", "created_at"], "properties": { "id": { "$ref": "#/components/schemas/Uuid" }, "order_id": { "type": ["string", "null"], "format": "uuid" }, "event_type": { "type": "string" }, "payload": { "type": "object", "additionalProperties": true }, "delivery_status": { "type": "string" }, "delivery_attempts": { "type": "integer" }, "delivered_at": { "type": ["string", "null"], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" } } },
      "Error": { "type": "object", "required": ["error"], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": { "type": "object", "additionalProperties": true }, "request_id": { "type": "string", "format": "uuid" } } }
    }
  }
}
