{
  "openapi": "3.0.0",
  "paths": {
    "/api/v1/merchant/auth/session": {
      "get": {
        "operationId": "AuthController_getSession",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantSessionResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Return the current user + all their memberships.",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/profile": {
      "patch": {
        "operationId": "AuthController_updateProfile",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMerchantProfileDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantProfileResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Update the current user's own profile (name).",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships": {
      "get": {
        "operationId": "AuthController_listMemberships",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantMembershipListItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "List memberships for the active organization.",
        "tags": [
          "auth"
        ]
      },
      "post": {
        "operationId": "AuthController_createMembership",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMembershipDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantMembershipCreateResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Grant a membership to a user (permission required).",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/permission-presets": {
      "get": {
        "operationId": "AuthController_listPermissionPresets",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantPermissionPresetDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "List permission presets for the active organization.",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships/{id}": {
      "patch": {
        "operationId": "AuthController_updateMembership",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMembershipDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantMembershipUpdateResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Update a membership role or Staff permission assignments.",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships/{id}/invitation/resend": {
      "post": {
        "description": "Queues a fresh invite email and makes it the only one that can still be delivered; the previous link stops working once the new one is issued. 409 `RESOURCE_CONFLICT` carries `details.reason`: `INVITATION_ACCEPTED` (they have already used this organization; activity in their other organizations does not count), `INVITATION_IN_FLIGHT` (an invite is being sent right now), `INVITATION_COOLDOWN` (an invite was sent within the last minute; `details.retryAfterSeconds` says when to try again) or `REQUEST_ID_REUSED`. 404 when the membership is not in this organization or has no teammate invite, for example a founding owner who has not signed in yet.",
        "operationId": "AuthController_resendMembershipInvitation",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResendMembershipInvitationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantMembershipInvitationResendResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Resend the invite for a teammate who has not joined this organization yet (permission required).",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships/{id}/invitation/cancel": {
      "post": {
        "description": "Removes the pending membership, frees its seat, stops any queued invite and revokes any staging invite link; an audit entry keeps the email, role and permissions. Invite the email again to restore it. 409 `RESOURCE_CONFLICT` carries `details.reason`: `INVITATION_ACCEPTED` (they have already used this organization, so this route does not remove members; activity in their other organizations does not count) or `INVITATION_IN_FLIGHT` (an invite is being sent right now). 404 when the membership is not in this organization or has no teammate invite, for example a founding owner who has not signed in yet.",
        "operationId": "AuthController_cancelMembershipInvitation",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantMembershipInvitationCancelResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Cancel the invite of a teammate who has not joined this organization yet (permission required).",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships/deactivated": {
      "get": {
        "description": "One page of teammates removed after signing in, newest removal first. Each keeps its membership id, role and permissions; `POST …/memberships/{id}/restore` brings it back. Visible to every member, like the team list. 503 `TEAM_REMOVAL_UNAVAILABLE` until the schema this needs is in place during a rollout.",
        "operationId": "AuthController_listDeactivatedMemberships",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100000,
              "default": 1,
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantDeactivatedMembershipPageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Removing and restoring teammates is not available yet (`TEAM_REMOVAL_UNAVAILABLE`) while the database change that supports it rolls out. Retry in a few minutes. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "List deactivated memberships for the active organization.",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships/{id}/deactivate": {
      "post": {
        "description": "Deactivates the membership: the teammate has no access to this organization from their next request, including POS, and their seat is freed. An audit entry is written, and their history and attribution stay. `POST …/{id}/restore` brings the membership back. A repeat after success answers 200 with `replayed: true`. 409 `RESOURCE_CONFLICT` carries `details.reason`: `INVITATION_PENDING` (they have never signed in; cancel their invite instead), `SELF_REMOVAL` (your own membership), `LAST_OWNER` (one Owner must remain) or `TEAM_CHANGED` (a concurrent team change; refresh and try again). 404 when the membership is not in this organization. 503 `TEAM_REMOVAL_UNAVAILABLE` until the schema this needs is in place.",
        "operationId": "AuthController_deactivateMembership",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantMembershipDeactivateResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Removing and restoring teammates is not available yet (`TEAM_REMOVAL_UNAVAILABLE`) while the database change that supports it rolls out. Retry in a few minutes. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Remove a teammate who has signed in (permission required).",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/auth/memberships/{id}/restore": {
      "post": {
        "description": "Undoes the removal named by `deactivationId`, bringing the membership back under the same id with the role and permissions it had, so their access returns at their next request. It takes a staff seat, so 402 `LIMIT_EXCEEDED` applies at the seat limit, as for an invite. A repeat after that removal was undone answers 200 with `replayed: true`. 409 `RESOURCE_CONFLICT` carries `details.reason`: `TEAM_CHANGED` (the teammate was restored or removed again after that removal, or a concurrent team change; refresh and try again) or `MEMBERSHIP_EXISTS` (they are on the team and that removal was never undone). 404 when the membership is not in this organization. 503 `TEAM_REMOVAL_UNAVAILABLE` until the schema this needs is in place.",
        "operationId": "AuthController_restoreMembership",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreMembershipDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantMembershipRestoreResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Removing and restoring teammates is not available yet (`TEAM_REMOVAL_UNAVAILABLE`) while the database change that supports it rolls out. Retry in a few minutes. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Restore a deactivated teammate (permission required).",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/merchant/onboarding": {
      "get": {
        "description": "Returns the full canonical step set for the org bound to the request (resolved by `x-organization-slug`). On first call, the service lazy-seeds any missing rows from the canonical step list so the client never has to handle a 404 or a partial list.\n\nResponse shape: `{ steps: OnboardingStep[], summary: { totalSteps, completedSteps, percent } }`. `steps` is ordered to match the canonical key list; `summary.percent` is an integer 0-100.\n\nOpen to any authenticated member of the org (Staff included).",
        "operationId": "MerchantOnboardingController_listOnboarding",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOnboardingStateDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the active org's onboarding checklist.",
        "tags": [
          "merchant-onboarding"
        ]
      }
    },
    "/api/v1/merchant/onboarding/steps/{stepKey}": {
      "patch": {
        "description": "Body `{ \"completed\": true }` stamps `completedAt = now()` and `completedBy = <actor user id>`. Body `{ \"completed\": false }` clears both fields back to `null` (reopen).\n\nThe `:stepKey` path param must be one of the canonical step keys enumerated on the `stepKey` parameter below — unrecognized keys return 404.\n\nIf no prior GET has materialized the row, the service lazy-creates it in the requested state — the merchant never needs to read the list first to make a write succeed.\n\nEmits `onboarding.step_completed` or `onboarding.step_reopened` to the audit log; metadata records only `{ stepKey }`.",
        "operationId": "MerchantOnboardingController_setStepCompleted",
        "parameters": [
          {
            "name": "stepKey",
            "required": true,
            "in": "path",
            "description": "Canonical step key (e.g. `business_profile`, `first_product`). The full set is returned by `GET /api/v1/merchant/onboarding`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOnboardingStepDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOnboardingStepDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Toggle a single onboarding step's completion state (Owner/Admin only).",
        "tags": [
          "merchant-onboarding"
        ]
      }
    },
    "/api/v1/merchant/email-templates": {
      "get": {
        "description": "Returns the fixed set of tenant-editable transactional email types, their defaults, current overrides, available merge variables, resolved sample copy, and sender/compliance defaults for the active org. Any authenticated member can read this surface.",
        "operationId": "MerchantEmailTemplateController_list",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListEmailTemplatesResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List editable transactional email template slots.",
        "tags": [
          "merchant-email-templates"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}": {
      "patch": {
        "description": "Upserts the active org override for one fixed email type. Only approved copy slots are writable: subject, heading, body text, CTA label, from display name, and reply-to. Unknown merge variables are rejected. System links, unsubscribe links, and compliance footer copy are not client-writable. Emits `email_template.updated` to the audit log with field names only, never copy values.",
        "operationId": "MerchantEmailTemplateController_update",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailTemplateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update one transactional email template override.",
        "tags": [
          "merchant-email-templates"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/preview": {
      "post": {
        "description": "Resolves the saved override plus an optional unsaved draft against sample merge variables. This powers live admin preview without persisting partial form state.",
        "operationId": "MerchantEmailTemplateController_preview",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewEmailTemplateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplatePreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Render a sample preview for one email template.",
        "tags": [
          "merchant-email-templates"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/send-test": {
      "post": {
        "description": "Sends the resolved sample template to the server-resolved authenticated merchant user by default. The temporary CUSTOM_ADDRESS mode accepts a raw candidate only for the #3358 persistent-staging bridge; centralized server email policy still evaluates it before provider I/O. #1744 replaces that mode with an opaque verified destination identifier. The optional draft body lets the admin test unsaved changes.",
        "operationId": "MerchantEmailTemplateController_sendTest",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendTestEmailTemplateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendTestEmailTemplateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Send a sample email to an explicitly selected test recipient.",
        "tags": [
          "merchant-email-templates"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/versions": {
      "post": {
        "description": "Default off. Requires settings:manage and this organization’s eligible verified sending domain. Source is validated against server-generated sample variables and mandatory compliance. expectedVersion fences concurrent edits; creation never activates or sends a template. RETURN_APPROVED generic source retains its legacy synthetic-only contract and is not usable by approval-layout business delivery; use the additive approval-layout route for complete system-owned approval sections.",
        "operationId": "MerchantTenantEmailTemplateController_create",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTenantEmailTemplateVersionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateVersionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Authoring is disabled, or the version does not belong to the active organization and type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the API parser limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "An eligible verified tenant sending domain or configured physical address is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create an immutable full-template authoring version.",
        "tags": [
          "merchant-email-template-versions"
        ]
      },
      "get": {
        "description": "Default off and settings:manage protected, with the same verified-domain gate as creation. Returns a bounded newest-first metadata page; does not expose customer variables or select a template for delivery.",
        "operationId": "MerchantTenantEmailTemplateController_list",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 20,
              "type": "number"
            }
          },
          {
            "name": "beforeVersion",
            "required": false,
            "in": "query",
            "description": "Return versions below this exclusive cursor, supplied as nextBeforeVersion by the preceding page.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateVersionListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Authoring is disabled, or the version does not belong to the active organization and type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "An eligible verified tenant sending domain or configured physical address is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List this tenant’s full-template authoring versions.",
        "tags": [
          "merchant-email-template-versions"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/versions/approval-layout": {
      "post": {
        "description": "Accepts only RETURN_APPROVED. Requires the authoring gate, settings:manage, an eligible verified tenant sending domain and configured physical address. A layout may reorder complete system sections and choose bounded presentation; all approval facts, subject, shipping qualifications and compliance remain system-owned. Uses the same compositor with synthetic sample facts as preview and SELF tests. Creation never selects, sends or activates delivery; existing generic versions remain unchanged and are not silently converted.",
        "operationId": "MerchantTenantEmailTemplateController_createApprovalLayout",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReturnApprovalLayoutVersionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateVersionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Authoring is disabled, or the version does not belong to the active organization and type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the API parser limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "An eligible verified tenant sending domain or configured physical address is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create an immutable return approval layout version.",
        "tags": [
          "merchant-email-template-versions"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/versions/{versionId}": {
      "get": {
        "description": "Default off; requires settings:manage and current eligible verified-domain attachment. Unknown and cross-tenant identifiers share a neutral 404. Source is returned in JSON; this route does not render or deliver it.",
        "operationId": "MerchantTenantEmailTemplateController_read",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateVersionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Authoring is disabled, or the version does not belong to the active organization and type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "An eligible verified tenant sending domain or configured physical address is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read an immutable full-template source version.",
        "tags": [
          "merchant-email-template-versions"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/versions/{versionId}/preview": {
      "get": {
        "description": "Default off; requires settings:manage and this organization’s current eligible verified sending domain. Uses only server-generated sample context and the configured physical-address field. return-approval-layout-v1 uses the complete approval compositor with sample dated facts; legacy liquid-interpolation-v1 approval source remains a distinguishable synthetic preview and does not establish business-delivery parity. No customer context, test-send, provider call, live token or delivery activation is available.",
        "operationId": "MerchantTenantEmailTemplateController_preview",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplatePreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Authoring is disabled, or the version does not belong to the active organization and type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "An eligible verified tenant sending domain or configured physical address is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Render a safe synthetic full-template preview.",
        "tags": [
          "merchant-email-template-versions"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/selection": {
      "get": {
        "description": "Default off; requires authoring and selection flags plus settings:manage. Returns revision zero and null versionId/updatedAt when no row exists. Reading remains available when domain eligibility is lost, so configuration can be cleared. Selection records intent for separately gated consumers and does not activate delivery. RETURN_APPROVED legacy generic versions remain synthetic-only; ordinary delivery requires return-approval-layout-v1.",
        "operationId": "MerchantTenantEmailTemplateSelectionController_read",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateSelectionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Either authoring or selection is disabled, or a requested version is not owned by the active organization and email type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the configured immutable template selection.",
        "tags": [
          "merchant-email-template-versions"
        ]
      },
      "patch": {
        "description": "Default off; requires both authoring and selection flags plus settings:manage. expectedRevision prevents stale or concurrent updates. Selecting any saved version of this tenant/type requires existing current verified-domain, renderer and physical-address eligibility. Explicit null clears configuration even when that eligibility is lost. Every accepted mutation increments the retained revision atomically with its metadata-only audit; creating a newer authoring version never changes selection. This operation performs no provider call and grants no activation or fallback. For RETURN_APPROVED, only return-approval-layout-v1 qualifies for the separately gated ordinary consumer; selecting a legacy generic version does not grant approval delivery parity.",
        "operationId": "MerchantTenantEmailTemplateSelectionController_update",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTenantEmailTemplateSelectionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateSelectionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Either authoring or selection is disabled, or a requested version is not owned by the active organization and email type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Select or clear a saved immutable template version.",
        "tags": [
          "merchant-email-template-versions"
        ]
      }
    },
    "/api/v1/merchant/email-templates/{type}/versions/{versionId}/send-test": {
      "post": {
        "description": "Requires both default-off authoring and test-send gates, settings:manage, a currently verified authenticated merchant email, and an eligible tenant sending domain. Accepts no body or query fields. Sends only server-generated sample context with mandatory compliance through a pinned TENANT sender. Production retains its existing admission; exact persistent staging additionally requires enabled nonproduction delivery and tenant sender resolution, and the confirmed account email must satisfy the existing staging recipient policy without redirection. Other Preview, development and Sandbox environments are unavailable. Each POST creates a fresh one-shot attempt: no replay key or durable rendered-body recovery is provided, and a timeout may mean unknown provider acceptance. Never selects an active template or changes customer delivery.",
        "operationId": "MerchantTenantEmailTemplateTestController_sendTest",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CUSTOMER_AUTH",
                "ORDER_CONFIRMATION",
                "ABANDONED_CART_RECOVERY",
                "BACK_IN_STOCK",
                "STOCK_NOTIFICATION_CONFIRMATION",
                "NEWSLETTER_CONFIRMATION",
                "RETURN_REQUESTED",
                "RETURN_APPROVED",
                "RETURN_RECEIVED",
                "RETURN_COMPLETED",
                "RETURN_REJECTED",
                "COMMERCE_QUOTE_SEND",
                "COMMERCE_INVOICE_SEND",
                "COMMERCE_CONTRACT_SEND",
                "COMMERCE_CONTRACT_COUNTERSIGNED",
                "COMMERCE_CONTRACT_VOIDED",
                "COMMERCE_QUOTE_EXPIRED",
                "BOOKING_NOTIFICATION",
                "COMMERCE_PAYMENT_RECEIVED",
                "ORDER_SHIPPED",
                "SUBSCRIPTION_PAYMENT_RECOVERY"
              ],
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantEmailTemplateTestSendResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Either feature is disabled, or the version does not belong to the active organization and type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "Verified SELF email, current eligible tenant domain, or configured physical address is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Delivery is unavailable or policy blocked. Provider acceptance may be unknown after a timeout; another POST is a new attempt. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Send a saved full-template version as a synthetic SELF test.",
        "tags": [
          "merchant-email-template-versions"
        ]
      }
    },
    "/api/v1/public/items/{itemId}/stock-notifications": {
      "post": {
        "description": "Public-facing capture for the \"email me when available\" PDP form. Idempotent: re-submitting the same (item, variant, email) returns the existing signup row instead of erroring. Fresh signups and still-subscribed re-arms send a confirmation email; an existing opt-out remains inactive.",
        "operationId": "PublicStockNotificationController_subscribe",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStockNotificationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockNotificationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The product is being updated. Retry the signup shortly; no signup or confirmation was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Subscribe to a back-in-stock notification for an item.",
        "tags": [
          "public-stock-notifications"
        ]
      }
    },
    "/api/v1/merchant/stock-notifications": {
      "get": {
        "description": "Newest first. Filter by lifecycle status: `pending` (default — still un-notified and still subscribed, the actionable list), `sent` (already notified, historical), `unsubscribed` (opted out, historical), `all` (every row). Cursor-paginated via `limit` (default 50, max 200) + the returned `nextCursor`.",
        "operationId": "MerchantStockNotificationController_list",
        "parameters": [
          {
            "name": "filter",
            "required": false,
            "in": "query",
            "description": "Lifecycle filter: `pending` (default — un-sent + still subscribed, the actionable list), `sent` (already notified, historical), `unsubscribed` (opted out, historical), `all` (every row).",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "sent",
                "unsubscribed",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of signups to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (the `nextCursor` field). Currently a stringified signup id; treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantStockNotificationPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List back-in-stock signup signups for the active org.",
        "tags": [
          "merchant-stock-notifications"
        ]
      }
    },
    "/api/v1/public/newsletter/subscribe": {
      "post": {
        "description": "Public-facing capture for a storefront newsletter signup widget. Creates a PENDING subscriber and sends a confirmation email; the subscriber is only added to the mailing list after they click the confirm link. Idempotent and enumeration-safe: the response is the same regardless of whether the address was new, pending, already confirmed, or resubscribing.",
        "operationId": "PublicNewsletterController_subscribe",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscribeNewsletterDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewsletterSubscribeResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Subscribe to a tenant newsletter / mailing list (double opt-in).",
        "tags": [
          "public-newsletter"
        ]
      }
    },
    "/api/v1/merchant/newsletter/subscribers": {
      "get": {
        "description": "Newest first. Filter by lifecycle status: `confirmed` (default — completed double opt-in, the real mailing list), `pending` (awaiting confirmation), `unsubscribed` (opted out, historical), `all` (every row). Cursor-paginated via `limit` (default 50, max 200) + the returned `nextCursor`; the full set is available via the `/export` CSV route.",
        "operationId": "MerchantNewsletterController_list",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over email and source.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "required": false,
            "in": "query",
            "description": "Lifecycle filter: `confirmed` (default — completed double opt-in, the real mailing list), `pending` (awaiting confirmation), `unsubscribed` (opted out, historical), `all` (every row).",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "confirmed",
                "unsubscribed",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of subscribers to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (the `nextCursor` field). Currently a stringified subscriber id; treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantNewsletterSubscriberPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List newsletter subscribers for the active org.",
        "tags": [
          "merchant-newsletter"
        ]
      }
    },
    "/api/v1/merchant/newsletter/subscribers/export": {
      "get": {
        "description": "Streams the FULL set of subscribers matching the given `filter` (same values as the list endpoint; default `confirmed`) as `text/csv`, in the same `createdAt DESC` order, with NO pagination or row cap. Columns: email, status, source, createdAt, confirmedAt, unsubscribedAt. Served as an attachment download; an empty result still returns a header-only CSV. Exporting the mailing list is a bulk PII read, so it requires the `customers:support` permission group (Owner/Admin always; Staff need the group) — unlike the list read, which stays open to all org members. The export is recorded in the audit log.",
        "operationId": "MerchantNewsletterController_export",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over email and source.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "pending",
                "confirmed",
                "unsubscribed",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV stream of the matching subscribers (attachment).",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Export newsletter subscribers as CSV.",
        "tags": [
          "merchant-newsletter"
        ]
      }
    },
    "/api/v1/public/abandoned-carts": {
      "post": {
        "description": "Public-facing capture for the storefront's abandoned-cart hooks. Idempotent on (organizationId, sessionId): re-submitting with the same sessionId updates the existing row in-place rather than creating a duplicate — EXCEPT when that row has passed the retention window, in which case the expired record is deleted and the capture starts a fresh one, so the response reports `wasCreated: true`. The storefront generates a high-entropy `captureToken` and sends it on EVERY capture: the first binds it, and later updates to that session MUST present the same token — the sessionId alone is not proof of ownership. An update without the matching token is rejected with 403.",
        "operationId": "PublicAbandonedCartController_upsert",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertAbandonedCartDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbandonedCartCaptureResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "The sessionId already exists and no valid captureToken was supplied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Capture or update an abandoned-cart snapshot.",
        "tags": [
          "public-abandoned-carts"
        ]
      }
    },
    "/api/v1/merchant/abandoned-carts": {
      "get": {
        "description": "Newest captures first. Filter by lifecycle status: `pending` (default — recoveredAt IS NULL, the actionable list), `recovered` (matched to an order, historical), `all` (both). Cursor-paginated via `limit` (default 50, max 200) + the returned `nextCursor`. List rows omit the full cart `snapshot` blob to keep the response light.",
        "operationId": "MerchantAbandonedCartController_list",
        "parameters": [
          {
            "name": "filter",
            "required": false,
            "in": "query",
            "description": "Lifecycle filter: `pending` (default — recoveredAt IS NULL, the actionable list), `recovered` (matched to an order, historical), `all` (both).",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "recovered",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of carts to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (the `nextCursor` field). Currently a stringified cart id; treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantAbandonedCartPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List captured abandoned carts for the active org.",
        "tags": [
          "merchant-abandoned-carts"
        ]
      }
    },
    "/api/v1/public/items": {
      "get": {
        "description": "Always filters to `status = ACTIVE` and excludes archived rows regardless of query params. A caller passing `?status=DRAFT` is silently ignored — DRAFT and ARCHIVED items are not visible to public storefront callers. Defense-in-depth: previously this route honored the caller-supplied status and could leak drafts. #1206 — when `limit` is omitted the response is bounded to a conservative default page size (24); oversized values are clamped to a hard maximum (200). Pass an explicit `limit` (up to 200) for a larger page. The response is a flat array; to page past the bound, pass the `id` of the last item you received as the `cursor` query param on the next request (keyset pagination). A page shorter than `limit` (or empty) means there are no more items.",
        "operationId": "PublicCatalogController_listItems",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over name, description, tags.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of items to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating large lists — the `id` of the last item from the previous page. The merchant paginated list returns this value as `nextCursor`; the public list endpoint returns a flat array, so use the `id` of the last item you received. Treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Filter by item type.",
            "schema": {
              "type": "string",
              "enum": [
                "RENTAL",
                "SALE",
                "SERVICE"
              ]
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by item status. On the public route this is forced to ACTIVE. On the merchant route the default is \"any status\".",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "DRAFT",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "description": "Merchant-only. When true, soft-deleted (archivedAt != null) items are included in the result. Public reads ignore this and never expose archived data. Accepts: `true`/`1`/`yes` (case-insensitive) for true, `false`/`0`/`no` for false. Any other value is rejected as 400.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List ACTIVE items (public).",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/items/featured": {
      "get": {
        "operationId": "PublicCatalogController_getFeaturedItems",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of featured items to return.",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "format": "int32",
              "default": 6,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Featured items for storefront hero.",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/items/search": {
      "get": {
        "description": "#1206 — results are bounded server-side: a conservative default page size (24) when `limit` is omitted, clamped to a hard maximum (200) for oversized values.",
        "operationId": "PublicCatalogController_searchItems",
        "parameters": [
          {
            "name": "q",
            "required": true,
            "in": "query",
            "description": "Search active public catalog items. Literal matches are preserved; short multi-word queries can also match terms across public product name, slug, descriptions, tags, and live variant names. Results remain bounded and merchant-ordered, not relevance-ranked.",
            "schema": {
              "minLength": 1,
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of search results to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Search active public catalog items.",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/items/resolve": {
      "post": {
        "description": "Accepts at most 200 distinct slugs and returns one minimal, tenant-safe catalog projection per currently ACTIVE item. Missing, DRAFT, and archived slugs are omitted. This lets a storefront validate a saved cart through one tenant-wide public API rate-limit admission instead of one request per line. This is a slug-only item projection (id, slug and composition), not a variant resolver or an old-to-new identifier map. Read the full current parent to validate an exact variant; a different returned item id requires explicit shopper reselection.",
        "operationId": "PublicCatalogController_resolveCartItems",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolvePublicCartItemsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicCartCatalogItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Resolve bounded ACTIVE item projections for saved-cart restore.",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/items/{slug}": {
      "get": {
        "description": "Missing, DRAFT, or archived slugs are masked as 404 so storefronts cannot probe for unpublished slugs.",
        "operationId": "PublicCatalogController_getItemBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The ACTIVE item matching the slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicItemDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No ACTIVE item matches the slug (unknown, DRAFT, or archived) — neutral `RESOURCE_NOT_FOUND`, matching the merchant read (#1221).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch a single ACTIVE item by slug.",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/collections": {
      "get": {
        "description": "Always filters to `status = ACTIVE` and excludes archived rows. Storefronts use this.",
        "operationId": "PublicCatalogController_getCollections",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicCollectionDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List ACTIVE collections (public).",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/collections/{slug}": {
      "get": {
        "description": "DRAFT or archived collections are masked as 404 so storefronts cannot probe for unpublished slugs.",
        "operationId": "PublicCatalogController_getCollectionBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The ACTIVE collection matching the slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCollectionDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No ACTIVE collection matches the slug (unknown, DRAFT, or archived) — neutral `RESOURCE_NOT_FOUND` (#1221).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch an ACTIVE collection by slug.",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/public/collections/{slug}/items": {
      "get": {
        "description": "Hides archived items. If the parent collection is DRAFT or archived the response is an empty array (same as \"no items\"), preserving the storefront-cannot-probe property.",
        "operationId": "PublicCatalogController_getCollectionItems",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Items belonging to an ACTIVE collection.",
        "tags": [
          "public-catalog"
        ]
      }
    },
    "/api/v1/merchant/items": {
      "get": {
        "description": "Returns items ordered by merchant-controlled `sortOrder` ascending, then `createdAt` descending + `id` descending as stable tiebreakers, with cursor pagination. By default soft-deleted (`archivedAt`) items are hidden. Pass `?archived=true` to include them, optionally with `?status=ARCHIVED` to see only soft-deleted rows. Each page item is decorated like the public read (`salePriceInCents`, `ratingAverage`, `collectionIds`), unlike the raw single-item GET.",
        "operationId": "MerchantCatalogController_listItems",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over name, description, tags.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of items to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating large lists — the `id` of the last item from the previous page. The merchant paginated list returns this value as `nextCursor`; the public list endpoint returns a flat array, so use the `id` of the last item you received. Treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Filter by item type.",
            "schema": {
              "type": "string",
              "enum": [
                "RENTAL",
                "SALE",
                "SERVICE"
              ]
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by item status. On the public route this is forced to ACTIVE. On the merchant route the default is \"any status\".",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "DRAFT",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "description": "Merchant-only. When true, soft-deleted (archivedAt != null) items are included in the result. Public reads ignore this and never expose archived data. Accepts: `true`/`1`/`yes` (case-insensitive) for true, `false`/`0`/`no` for false. Any other value is rejected as 400.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "compositionCandidate",
            "required": false,
            "in": "query",
            "description": "When true, return only Items that do not already own a package/kit composition, for server-backed component discovery. Accepts the same explicit boolean forms as `archived`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemListDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List items for the active org.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "post": {
        "operationId": "MerchantCatalogController_createItem",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateItemDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create an item (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/by-slug/{slug}": {
      "get": {
        "operationId": "MerchantCatalogController_getItemBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a single item by slug (includes archived).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{id}": {
      "get": {
        "operationId": "MerchantCatalogController_getItemById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a single item by id (includes archived).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "patch": {
        "operationId": "MerchantCatalogController_updateItem",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateItemDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update an item (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/reorder": {
      "patch": {
        "description": "M2 / #306 — bulk \"set the whole order\" reorder. Assigns each item `sortOrder = its index` in `orderedIds` inside a transaction, so the result is always unique + contiguous (tie-free by construction). The supplied array MUST be the complete set of the tenant's non-archived items; any missing, extra, or foreign id returns 400 so a stale client cannot partially reorder. Archived items are excluded from the ordering — archive/restore is the membership lever.",
        "operationId": "MerchantCatalogController_reorderItems",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderItemsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReorderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reorder the tenant's items (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{id}/archive": {
      "post": {
        "description": "Sets `archivedAt = now()` and `status = ARCHIVED`. The prior status is preserved in `metafields.__archivedFromStatus` so `restore` can return the item to its previous lifecycle state. Idempotent — archiving an already-archived item returns the same row.",
        "operationId": "MerchantCatalogController_archiveItem",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive (soft-delete) an item.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{id}/restore": {
      "post": {
        "description": "Clears `archivedAt` and restores `status` from `metafields.__archivedFromStatus` (falls back to `DRAFT`). Idempotent.",
        "operationId": "MerchantCatalogController_restoreItem",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a soft-deleted item.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants": {
      "get": {
        "operationId": "MerchantCatalogController_listVariants",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "archived",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantVariantDto"
                  }
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List variants for an item.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "post": {
        "operationId": "MerchantCatalogController_createVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVariantDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantVariantDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a variant.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants/{variantId}": {
      "get": {
        "operationId": "MerchantCatalogController_getVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantVariantDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a single variant.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "patch": {
        "operationId": "MerchantCatalogController_updateVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVariantDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantVariantDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a variant.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants/reorder": {
      "patch": {
        "description": "M2 / #290 — bulk \"set the whole order\" reorder scoped to one item's variants. Assigns each variant `sortOrder = its index` in `orderedVariantIds` inside a transaction (tie-free by construction). The supplied array MUST be the complete set of the item's non-archived variants; any missing, extra, or foreign id returns 400. Archived variants are excluded from the ordering.",
        "operationId": "MerchantCatalogController_reorderVariants",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderVariantsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReorderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reorder an item's variants (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants/{variantId}/archive": {
      "post": {
        "operationId": "MerchantCatalogController_archiveVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantVariantDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive (soft-delete) a variant. Idempotent.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants/{variantId}/restore": {
      "post": {
        "operationId": "MerchantCatalogController_restoreVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantVariantDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a soft-deleted variant. Idempotent.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections": {
      "get": {
        "description": "Returns ACTIVE + DRAFT collections by default; pass `?archived=true` to include soft-deleted rows, optionally with `?status=ARCHIVED` to see only archived ones.",
        "operationId": "MerchantCatalogController_listCollections",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over name and description.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by collection status. On the public route this is forced to ACTIVE. On the merchant route the default is \"any non-archived\".",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "DRAFT",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "description": "Merchant-only. When true, soft-deleted (`archivedAt != null`) collections are included. Public reads ignore this and never expose archived data. Accepts: `true`/`1`/`yes` for true, `false`/`0`/`no` for false. Any other value is rejected as 400.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantCollectionWithImagesDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List collections for the active org.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "post": {
        "operationId": "MerchantCatalogController_createCollection",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCollectionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCollectionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a collection (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/by-slug/{slug}": {
      "get": {
        "operationId": "MerchantCatalogController_getCollectionBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCollectionDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a collection by slug (merchant — includes DRAFT + archived).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}": {
      "get": {
        "operationId": "MerchantCatalogController_getCollectionById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCollectionDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a collection by id (merchant — includes DRAFT + archived).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "patch": {
        "operationId": "MerchantCatalogController_updateCollection",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCollectionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCollectionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a collection (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/by-slug/{slug}/items": {
      "get": {
        "description": "Merchant view: includes archived items and shows items even when the parent collection is DRAFT or archived. Public storefront callers should use the equivalent `/public/collections/.../items` route which hides those.",
        "operationId": "MerchantCatalogController_getCollectionItemsBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List items in a collection by slug (merchant).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/order": {
      "patch": {
        "description": "Replaces the sortOrder sequence for every non-archived collection in the tenant. The supplied array MUST be the full current set; partial lists return 400.",
        "operationId": "MerchantCatalogController_reorderCollections",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderCollectionsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReorderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reorder the tenant's collections (permission required).",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/archive": {
      "post": {
        "description": "Sets `archivedAt = now()` and `status = ARCHIVED`. Idempotent. Item assignments are preserved so restore returns the same lineup.",
        "operationId": "MerchantCatalogController_archiveCollection",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCollectionDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive (soft-delete) a collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/restore": {
      "post": {
        "description": "Clears `archivedAt` and sets `status = DRAFT` (conservative — merchant must republish to make it visible). Idempotent.",
        "operationId": "MerchantCatalogController_restoreCollection",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCollectionDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a soft-deleted collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/items": {
      "post": {
        "description": "Items already in the collection are silently skipped. Items not belonging to the tenant fail the call with a 404. New items are appended after the existing highest `sortOrder`.",
        "operationId": "MerchantCatalogController_assignItemsToCollection",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignCollectionItemsDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssignCollectionItemsResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Bulk-add items to a collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/items/{itemId}": {
      "delete": {
        "description": "Idempotent — re-removing an absent item returns `{removed: 0}`. The item itself is not deleted.",
        "operationId": "MerchantCatalogController_removeItemFromCollection",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionItemRemovalResultDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove an item from a collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/items/order": {
      "patch": {
        "description": "Replaces the sortOrder sequence for every item. The supplied array MUST be the complete set currently in the collection; submitting a partial list returns 400 to prevent accidental half-removes.",
        "operationId": "MerchantCatalogController_reorderCollectionItems",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderCollectionItemsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReorderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reorder all items in a collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{id}/images": {
      "get": {
        "description": "Returns the image metadata rows ordered by sortOrder ascending. Includes the full structured-media columns (storagePath, focal points, dimensions, mime type).",
        "operationId": "MerchantCatalogController_listItemImages",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantItemImageDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List images attached to an item.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "post": {
        "description": "Writes the metadata row for an image uploaded via the signed-URL endpoint. `imageId`, `url`, and `storagePath` should be propagated verbatim from the signed-URL response. `isPrimary=true` clears the flag on every other image for the item, atomically.",
        "operationId": "MerchantCatalogController_confirmItemImage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmItemImageDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemImageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Confirm an item image after upload.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{id}/images/order": {
      "patch": {
        "description": "Replaces the sortOrder sequence for every image. The supplied array MUST be the complete set currently on the item; submitting a partial list returns 400 to prevent accidental half-removes.",
        "operationId": "MerchantCatalogController_reorderItemImages",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderImagesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReorderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reorder all images attached to an item.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{id}/images/{imageId}": {
      "patch": {
        "description": "Only metadata fields (alt, focalX/Y, isPrimary) are mutable. To swap bytes, upload a new image and delete the old one. `isPrimary=true` clears the flag on every other image for the item, atomically.",
        "operationId": "MerchantCatalogController_updateItemImage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "imageId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateItemImageDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantItemImageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update item image metadata.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "delete": {
        "description": "Hard-deletes the metadata row. The storage object is NOT deleted synchronously — a future bucket-sweep job reconciles orphaned objects against the row table. The audit log captures the storagePath so the sweeper can confirm the delete intent.",
        "operationId": "MerchantCatalogController_removeItemImage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "imageId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteImageResultDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete an item image.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/images": {
      "get": {
        "description": "Returns the image metadata rows ordered by sortOrder ascending. Mirrors the item-image endpoint; rows live in `collection_images`.",
        "operationId": "MerchantCatalogController_listCollectionImages",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicCollectionImageDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List images attached to a collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "post": {
        "description": "Writes the metadata row for an image uploaded via the signed-URL endpoint. Same shape as the item-image confirm endpoint.",
        "operationId": "MerchantCatalogController_confirmCollectionImage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmCollectionImageDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCollectionImageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Confirm a collection image after upload.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/images/order": {
      "patch": {
        "description": "Replaces the sortOrder sequence for every image. The supplied array MUST be the complete set currently on the collection.",
        "operationId": "MerchantCatalogController_reorderCollectionImages",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderImagesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReorderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reorder all images attached to a collection.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/collections/{id}/images/{imageId}": {
      "patch": {
        "description": "Only metadata fields (alt, focalX/Y, isPrimary) are mutable. `isPrimary=true` clears the flag on every other image for the collection, atomically.",
        "operationId": "MerchantCatalogController_updateCollectionImage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "imageId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCollectionImageDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCollectionImageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update collection image metadata.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      },
      "delete": {
        "description": "Hard-deletes the metadata row. The storage object is NOT deleted synchronously — a future bucket-sweep job reconciles orphans.",
        "operationId": "MerchantCatalogController_removeCollectionImage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "imageId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteImageResultDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete a collection image.",
        "tags": [
          "merchant-items",
          "merchant-collections"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/customs-profile": {
      "get": {
        "description": "Requires merchant membership and current shipping pilot eligibility.",
        "operationId": "MerchantCustomsProfileController_readItem",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "An admitted profile, or PILOT_ACCESS_UNAVAILABLE when eligibility is off, absent or unavailable. The unavailable result is returned before target lookup.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MerchantCustomsProfileDto"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantCustomsPilotUnavailableDto"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request body or commerce environment is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Merchant membership or tenant access is required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Target missing or outside the authorized item and tenant scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT with details.reason PROFILE_REVISION_INVALID when the stored revision is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Tenant access or profile storage is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the item customs profile.",
        "tags": [
          "merchant-items"
        ]
      },
      "put": {
        "description": "Replaces all facts at the expected revision and invalidates the prior review. Three null facts clear the profile. After a stale revision or an uncertain response, read the profile again under current eligibility before issuing another command.",
        "operationId": "MerchantCustomsProfileController_replaceItem",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceCustomsProfileDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomsProfileDto"
                }
              }
            }
          },
          "400": {
            "description": "The request body or commerce environment is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Merchant membership and catalog:write authority are required. CUSTOMS_PROFILE_UNAVAILABLE means current pilot eligibility did not admit the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Target missing or outside the authorized item and tenant scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT with details.reason PROFILE_REVISION_MISMATCH, PROFILE_REVISION_INVALID, or PROFILE_NOT_REVIEWABLE. A review refusal also gives details.unavailableReason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Tenant access or profile storage is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace or clear the item customs profile.",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants/{variantId}/customs-profile": {
      "get": {
        "description": "Requires merchant membership and current shipping pilot eligibility. A wholly unset variant inherits the item profile.",
        "operationId": "MerchantCustomsProfileController_readVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "An admitted profile, or PILOT_ACCESS_UNAVAILABLE when eligibility is off, absent or unavailable. The unavailable result is returned before target lookup.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MerchantCustomsProfileDto"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantCustomsPilotUnavailableDto"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request body or commerce environment is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Merchant membership or tenant access is required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Target missing or outside the authorized item and tenant scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT with details.reason PROFILE_REVISION_INVALID when the stored revision is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Tenant access or profile storage is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the owned variant customs profile.",
        "tags": [
          "merchant-items"
        ]
      },
      "put": {
        "description": "Replaces the whole variant override at the expected revision. Three null facts clear it and restore item inheritance. After a stale revision or an uncertain response, read the profile again under current eligibility before issuing another command.",
        "operationId": "MerchantCustomsProfileController_replaceVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceCustomsProfileDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomsProfileDto"
                }
              }
            }
          },
          "400": {
            "description": "The request body or commerce environment is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Merchant membership and catalog:write authority are required. CUSTOMS_PROFILE_UNAVAILABLE means current pilot eligibility did not admit the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Target missing or outside the authorized item and tenant scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT with details.reason PROFILE_REVISION_MISMATCH, PROFILE_REVISION_INVALID, or PROFILE_NOT_REVIEWABLE. A review refusal also gives details.unavailableReason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Tenant access or profile storage is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace or clear the owned variant customs profile.",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/customs-profile/review": {
      "post": {
        "description": "Reviews complete saved facts at the expected revision and returns the new revision after committing its review receipt. After a stale revision or an uncertain response, read the profile again under current eligibility before issuing another command.",
        "operationId": "MerchantCustomsProfileController_reviewItem",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewCustomsProfileDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomsProfileDto"
                }
              }
            }
          },
          "400": {
            "description": "The request body or commerce environment is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Merchant membership and catalog:write authority are required. CUSTOMS_PROFILE_UNAVAILABLE means current pilot eligibility did not admit the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Target missing or outside the authorized item and tenant scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT with details.reason PROFILE_REVISION_MISMATCH, PROFILE_REVISION_INVALID, or PROFILE_NOT_REVIEWABLE. A review refusal also gives details.unavailableReason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Tenant access or profile storage is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review the saved item customs profile.",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/variants/{variantId}/customs-profile/review": {
      "post": {
        "description": "Reviews this variant’s complete saved facts at the expected revision. Review an inherited profile on its source item. After a stale revision or an uncertain response, read the profile again under current eligibility before issuing another command.",
        "operationId": "MerchantCustomsProfileController_reviewVariant",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "variantId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewCustomsProfileDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomsProfileDto"
                }
              }
            }
          },
          "400": {
            "description": "The request body or commerce environment is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Merchant membership and catalog:write authority are required. CUSTOMS_PROFILE_UNAVAILABLE means current pilot eligibility did not admit the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Target missing or outside the authorized item and tenant scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT with details.reason PROFILE_REVISION_MISMATCH, PROFILE_REVISION_INVALID, or PROFILE_NOT_REVIEWABLE. A review refusal also gives details.unavailableReason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Tenant access or profile storage is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review the saved owned variant customs profile.",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/composition": {
      "get": {
        "description": "Member-readable merchant projection of one ordered PACKAGE/KIT definition. Missing, foreign-tenant, and not-yet-composed parents share one neutral 404 response.",
        "operationId": "MerchantItemCompositionController_getComposition",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemCompositionDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active tenant’s Item composition.",
        "tags": [
          "merchant-items"
        ]
      },
      "put": {
        "description": "Revision-guarded whole-definition write. expectedRevision 0 creates revision 1; replacing revision N requires N and returns N+1. Array order becomes contiguous server-owned position. The parent must remain a non-archived DRAFT and no pricing, capacity, checkout, or public behavior is activated by this route.",
        "operationId": "MerchantItemCompositionController_putComposition",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutItemCompositionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemCompositionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create or replace an Item composition (permission required).",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/item-compositions": {
      "get": {
        "description": "Member-readable catalog-backed package picker. Returns current Inventory / BookingService mapping readiness and derived component pricing without creating capacity, fulfillment, or package-owned state.",
        "operationId": "MerchantItemCompositionPreviewController_listPreviews",
        "parameters": [
          {
            "name": "selectedQuantity",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "format": "int32",
              "default": 1,
              "type": "integer"
            }
          },
          {
            "name": "servicePeriodStartsAt",
            "required": false,
            "in": "query",
            "description": "Optional operational window start. Required with servicePeriodEndsAt when a tracked booking-service component is selected.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "servicePeriodEndsAt",
            "required": false,
            "in": "query",
            "description": "Optional operational window end. Required with servicePeriodStartsAt when a tracked booking-service component is selected.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Case-insensitive parent Item name or slug search.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemCompositionPreviewListDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List current package/kit previews for the active tenant.",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/items/{itemId}/composition/preview": {
      "get": {
        "description": "Member-readable derived projection. Mapping readiness follows Inventory for SALE components and active BookingService authority for RENTAL/SERVICE components. FIXED_PRICE commercial quantity remains one while effectiveQuantity preserves operational units.",
        "operationId": "MerchantItemCompositionPreviewController_getPreview",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "selectedQuantity",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "format": "int32",
              "default": 1,
              "type": "integer"
            }
          },
          {
            "name": "servicePeriodStartsAt",
            "required": false,
            "in": "query",
            "description": "Optional operational window start. Required with servicePeriodEndsAt when a tracked booking-service component is selected.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "servicePeriodEndsAt",
            "required": false,
            "in": "query",
            "description": "Optional operational window end. Required with servicePeriodStartsAt when a tracked booking-service component is selected.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemCompositionPreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preview one package/kit from current domain authorities.",
        "tags": [
          "merchant-items"
        ]
      }
    },
    "/api/v1/merchant/sale-windows": {
      "get": {
        "description": "Optional `status` filter narrows by derived lifecycle bucket (upcoming / active / expired / all). Newest first by `createdAt`. Reads are open to any org member.",
        "operationId": "MerchantSaleWindowController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "all",
                "upcoming",
                "active",
                "expired"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SaleWindowResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List sale windows for the active org.",
        "tags": [
          "merchant-sale-windows"
        ]
      },
      "post": {
        "description": "Choose FIXED_PRICE, AMOUNT_OFF, or PERCENT_OFF and provide exactly its matching value field. A legacy body that omits valueType remains FIXED_PRICE. Amount Off clamps at $0.00; Percent Off uses basis points and floor-rounds each resolved discount. endsAt must be strictly after startsAt. variantId (when set) must belong to itemId. The service enforces no-overlap against existing windows for the same (itemId, variantId) tuple — half-open intervals, so back-to-back schedules are allowed.",
        "operationId": "MerchantSaleWindowController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSaleWindowDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaleWindowResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a sale window (permission required).",
        "tags": [
          "merchant-sale-windows"
        ]
      }
    },
    "/api/v1/merchant/sale-windows/{id}": {
      "get": {
        "operationId": "MerchantSaleWindowController_getById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaleWindowResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a sale window by id.",
        "tags": [
          "merchant-sale-windows"
        ]
      },
      "patch": {
        "description": "Patch-style: provided fields overwrite, omitted fields are left alone. `variantId` accepts explicit `null` to clear the per-variant scope back to item-level. itemId is NOT updatable — delete + recreate if the target item should change. Supplying `valueType` requires exactly its matching value field and atomically switches arms; omitting all value fields keeps the current arm. The resulting (startsAt, endsAt) and (itemId, variantId) tuple are re-validated against sibling rows for overlap.",
        "operationId": "MerchantSaleWindowController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSaleWindowDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaleWindowResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a sale window (permission required).",
        "tags": [
          "merchant-sale-windows"
        ]
      },
      "delete": {
        "description": "Removes the row outright. Sale windows are usage-agnostic — no `usageCount`, no customer-visible code — so there is no value in preserving disabled rows. Audit trail lives in `audit_logs` (action `sale_window.deleted`) and requires a reason.",
        "operationId": "MerchantSaleWindowController_delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaleWindowDeleteResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Hard-delete a sale window (permission required).",
        "tags": [
          "merchant-sale-windows"
        ]
      }
    },
    "/api/v1/public/inventory": {
      "get": {
        "description": "Covers publicly visible items only — ACTIVE and not archived. Stock rows for DRAFT or archived items are not returned, and neither are rows for composed (bundle-parent) items, which the public catalog does still list. New rows are auto-initialized for SALE items only, so SERVICE and RENTAL items normally have none, and a SALE item predating auto-initialization (or whose row was removed) may also have none. Treat the array as publicly eligible rows, not every row that exists. For SALE items, an item-level row (`variantId: null`) is publicly eligible only when the item has never had a variant. Any live or archived variant history retires only that SALE item-level target. A legacy item-level row on a SERVICE or RENTAL item remains publicly eligible even when the item has variant history, because those types do not use SALE stock targeting. An empty array means no publicly eligible rows matched; it does not prove that no inventory rows are stored. Read the public catalog for current variants; this inventory surface does not disclose archived variant details. TRUNCATION: this response is capped at 5000 rows and is a bare array — no envelope, cursor or total — so a truncated response is INDISTINGUISHABLE from a complete one. The per-item read carries the identical cap and is not a workaround.",
        "operationId": "PublicInventoryController_getInventory",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicInventoryDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List inventory snapshots for the tenant.",
        "tags": [
          "public-inventory"
        ]
      }
    },
    "/api/v1/public/inventory/{itemId}": {
      "get": {
        "description": "Returns an ARRAY of the publicly eligible stock rows for the item, not a single object and not one row per variant. Non-archived variant rows are returned when present. For SALE items, an item-level row (`variantId: null`) is publicly eligible only when the item has never had a variant. Any live or archived variant history retires only that SALE item-level target. A legacy item-level row on a SERVICE or RENTAL item remains publicly eligible even when the item has variant history, because those types do not use SALE stock targeting. An empty array means no publicly eligible rows matched; it does not prove that no inventory rows are stored. Read the public catalog for current variants; this inventory surface does not disclose archived variant details. A current variant may be absent because no row was ever created for it. Row creation is auto-initialized for SALE items only, so a SERVICE or RENTAL item normally yields an empty array, while a SALE item predating auto-initialization (or whose row was removed) may yield nothing. A DRAFT, archived, or composed (bundle-parent) item always yields an empty array. TRUNCATION: this response carries the same 5000-row cap as the list read, with no envelope, cursor or total, so a truncated response is INDISTINGUISHABLE from a complete one.",
        "operationId": "PublicInventoryController_getInventoryByItemId",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicInventoryDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Inventory rows for a specific item.",
        "tags": [
          "public-inventory"
        ]
      }
    },
    "/api/v1/public/availability/check": {
      "post": {
        "operationId": "PublicInventoryController_checkAvailability",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckAvailabilityDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityCheckResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Check availability of an item across a date range.",
        "tags": [
          "public-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/stock-locations": {
      "get": {
        "description": "Any admitted organization member can read active locations in the selected commerce environment. Only the documented query parameters are accepted, once each. Send no body. Each page and its total describe one snapshot, ordered by location ID. A later page may reflect intervening changes. A page beyond the end retains the matching total. After a lost create reply, use the list to find candidates. Duplicate labels and concurrent creates prevent reliable attempt attribution. After a stale rename, look up the exact ID on page 1 and review the label before retrying with the observed revision. A subsequent change can conflict again. Missing, retired and foreign IDs all have total zero.",
        "operationId": "MerchantStockholdingLocationReadController_list",
        "parameters": [
          {
            "name": "stockLocationId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991,
              "default": 1
            },
            "description": "One-based page. The computed offset must also be a safe integer."
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockholdingLocationListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the size limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "STOCK_LOCATION_LOOKUP_UNAVAILABLE when the location read cannot be qualified, or ORGANIZATION_ACCESS_UNAVAILABLE during admission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List current stockholding locations",
        "tags": [
          "merchant-inventory"
        ]
      },
      "post": {
        "description": "Creates a new identity at revision 1 in the selected commerce environment. Requires a reason and permission to manage settings. Each admitted request creates a new identity. Treat a lost response as ambiguous.",
        "operationId": "MerchantStockholdingLocationController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStockholdingLocationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockholdingLocationWriteResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid route, environment, JSON body, query, or required reason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the size limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "STOCK_LOCATION_WRITES_UNAVAILABLE when the location write cannot be admitted on this backend. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a stockholding location",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory": {
      "get": {
        "description": "Returns inventory rows with the joined `item` summary (`id`, `name`, `slug`, `status`, `type`) and, for variant-scoped rows, a `variant` summary (`id`, `name`, `sku`, `options`) so the admin viewer can render a readable row without a second roundtrip. Optional `?stockStatus=`, `?itemId=`, `?itemStatus=`, `?itemType=` and `?currentOnly=` filters compose as AND terms. Without filters, rows for DRAFT and archived items, archived variants and retired SALE item-level targets are returned too. The list is not paginated. (The anonymous `/public/inventory` endpoints omit the `variant` summary and the item `status` and `type`.)",
        "operationId": "MerchantInventoryController_listInventory",
        "parameters": [
          {
            "name": "stockStatus",
            "required": false,
            "in": "query",
            "description": "Filter by derived stock status. Maps directly to the row's `stockStatus` column which the service keeps in sync with `availableQuantity` and `lowStockThreshold` on every mutation.",
            "schema": {
              "$ref": "#/components/schemas/StockStatus"
            }
          },
          {
            "name": "itemId",
            "required": false,
            "in": "query",
            "description": "Restrict to inventory rows for a single item (any variant). Useful for the item-detail view in the admin. Supply the canonical item UUID; the service checks existence and tenant ownership.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "itemStatus",
            "required": false,
            "in": "query",
            "description": "Keep only rows whose item has this lifecycle status (the row's `item.status`). `ACTIVE` also leaves out an item that has an archive timestamp, as the anonymous reads do. Omitted, rows of every status are returned, including DRAFT and ARCHIVED items.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "DRAFT",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "itemType",
            "required": false,
            "in": "query",
            "description": "Keep only rows whose item has this type (the row's `item.type`). Omitted, rows of every type are returned.",
            "schema": {
              "type": "string",
              "enum": [
                "RENTAL",
                "SALE",
                "SERVICE"
              ]
            }
          },
          {
            "name": "currentOnly",
            "required": false,
            "in": "query",
            "description": "`true` keeps only current rows, by the same rule the anonymous `/public/inventory` reads apply: a variant row only while its variant is not archived, and an item-level row (`variantId: null`) only when the item is not SALE or has never had a variant. Omitted or `false`, retained rows for archived variants and retired SALE item-level targets are returned too. This filter does not consider the item's own lifecycle: a DRAFT or archived item's rows can still be current, so combine it with `itemStatus` for active items only. Accepts `true`/`false`, `1`/`0` or `yes`/`no`; any other value is a 400.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantInventoryRowDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List inventory rows for the active org (enriched).",
        "tags": [
          "merchant-inventory"
        ]
      },
      "post": {
        "description": "Creates the inventory row for a tenant-owned item, optionally scoped to one of its variants (`variantId`). A matching pre-existing item-level row may be returned unchanged with `created: false`, even when the item now has variant history. Only creation of a new item-level row is rejected when variant history exists; varianted items otherwise require an exact variant. This is the supported path to (re)establish a MISSING row — catalog create now auto-initializes rows, so this covers items/variants that predate that or whose row was removed (#1850). Idempotent: if a row already exists for the `(itemId, variantId)` pair it is returned unchanged rather than duplicated — so the handler is a create-OR-return and always responds `200` (not `201`), since it may not have created anything. The response `created` flag says which happened; when `false` the request's `totalQuantity`/`lowStockThreshold` were NOT applied (use `:id/adjust`). Only stock-managed (SALE) items are accepted — RENTAL/SERVICE get a `400`. Staff needs `inventory:adjust`.",
        "operationId": "MerchantInventoryController_createInventoryRow",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInventoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnsureInventoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create the stock row for an existing item/variant (idempotent).",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/summary": {
      "get": {
        "description": "Returns one count per `stockStatus` value plus a `total`. Powers the admin dashboard's low-stock widget. Available to any authenticated org member (reads are not policy-gated on this controller). Missing statuses are normalized to `0` so the response shape is stable.",
        "operationId": "MerchantInventoryController_getSummary",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantInventorySummaryDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Aggregate inventory counts by stock status.",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/targets": {
      "get": {
        "description": "The lookup behind the admin inventory picker (#1857). Returns a bounded, merged page of stock-managed targets: variants of SALE items (`kind: 'variant'`) and no-variant SALE items' item-level default rows (`kind: 'item-default'`, `variantId: null`). `search` is a case-insensitive fuzzy match over variant name/SKU and item name; `sku` is a separate exact match; `missingInventory=true` restricts to targets whose row does not exist (the #1850 create-missing repair surface). Identity fields (`itemName`, `variantName`, `sku`) are for rendering — operators never see ids.",
        "operationId": "MerchantInventoryController_listInventoryTargets",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Case-insensitive substring match against variant name, variant SKU, and item name. A blank/absent term returns the first page of targets (a useful default list for the picker).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sku",
            "required": false,
            "in": "query",
            "description": "Exact SKU match (variant targets only — items have no SKU). Separate from `search` so an exact lookup can never be diluted by fuzzy matches; when both are sent, `sku` takes precedence and `search` is ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variantId",
            "required": false,
            "in": "query",
            "description": "Resolve ONE variant target directly by its id (exact match; variant targets only — the item-default side drops out, and `search` is ignored, mirroring `sku` precedence). Used by the admin filter to re-resolve a URL-selected variant to its label without scanning pages — an item may have up to 1,000 variants, so a first-page scan cannot guarantee a hit.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "required": false,
            "in": "query",
            "description": "Restrict to targets of a single item. Used by the picker to enumerate one item's variants and by the admin filter bar to re-resolve a URL-selected target to its label. Supply the canonical item UUID.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "missingInventory",
            "required": false,
            "in": "query",
            "description": "Only targets whose inventory row does not exist yet — the create-missing repair surface (#1850 modal). The audited mint paths are closed by #2008, so this population is normally the legacy tail plus anything a future writer slips past the invariant.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size (default 20, max 50). The lookup is a bounded typeahead-style read — narrow the search rather than paging deep.",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Merged-list offset for the next page (`nextOffset` from the previous response). Bounded (max 500): the union spans two models, so deep paging is deliberately unsupported — refine the search instead.",
            "schema": {
              "minimum": 0,
              "maximum": 500,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryTargetListDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Search selectable inventory targets (variant | item-default).",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{itemId}": {
      "get": {
        "description": "Returns the item's inventory rows with the joined `item` summary (`id`, `name`, `slug`, `status`, `type`) and, for variant-scoped rows, a `variant` summary (`id`, `name`, `sku`, `options`).",
        "operationId": "MerchantInventoryController_getInventoryByItemId",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantInventoryRowDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Inventory rows for a specific item.",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{id}/adjust": {
      "post": {
        "description": "Adjusts both `totalQuantity` and `availableQuantity` by the same signed delta (`reservedQuantity` is unchanged). Recomputes `stockStatus` in the same transaction. Rejects deltas that would push availableQuantity (or totalQuantity) negative.",
        "operationId": "MerchantInventoryController_adjust",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdjustInventoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantInventoryRowDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Apply a signed delta to total + available quantities.",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{id}/threshold": {
      "post": {
        "description": "Updates `lowStockThreshold` (>= 0; 0 disables the alarm). Recomputes `stockStatus` in the same transaction so a threshold change can flip a row IN_STOCK ↔ LOW_STOCK without a separate mutation. Staff needs `inventory:adjust` to set thresholds.",
        "operationId": "MerchantInventoryController_updateThreshold",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateThresholdDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantInventoryRowDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set the low-stock threshold for an inventory row.",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{id}/reserve": {
      "post": {
        "description": "Decrements `availableQuantity` and increments `reservedQuantity` by the same amount. `totalQuantity` is unchanged. Rejects requests where quantity > availableQuantity (negative-available guard runs against the locked row to prevent double-spend on concurrent reserves).",
        "operationId": "MerchantInventoryController_reserve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReserveInventoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantInventoryRowDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reserve units (move available → reserved).",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{id}/release": {
      "post": {
        "description": "Inverse of reserve. Decrements `reservedQuantity` and increments `availableQuantity` by the same amount. `totalQuantity` is unchanged. Rejects requests where quantity > reservedQuantity, where `reservedQuantity` is already below the capacity protected by live booking inventory claims and POS order-line reservations, or where the requested release would cross their combined protected floor.",
        "operationId": "MerchantInventoryController_release",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseInventoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantInventoryRowDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Reserved inventory already violates the combined live booking/POS reservation floor, or the requested release would cross that floor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Release units (move reserved → available).",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/stock-locations/{stockLocationId}": {
      "patch": {
        "description": "Appends a label revision to a stockholding location in the selected commerce environment. Requires a reason, the expected current revision and permission to manage settings.",
        "operationId": "MerchantStockholdingLocationController_rename",
        "parameters": [
          {
            "name": "stockLocationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameStockholdingLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockholdingLocationWriteResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid route, environment, JSON body, query, or required reason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Location state conflict. A stale expected revision carries details.reason STALE_REVISION.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the size limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "STOCK_LOCATION_WRITES_UNAVAILABLE when the location write cannot be admitted on this backend. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Rename a stockholding location",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{inventoryId}/stock-locations/{stockLocationId}/opening-stock": {
      "post": {
        "description": "Assigns verified free units of one Inventory row (SKU) to one stockholding location in the selected commerce environment, moving them from the unassigned remainder. The row's totals do not change, reserved units are never assigned, and a location can receive its opening stock once. Requires Owner/Admin or Staff with inventory:adjust, a reason and an evidence reference. Retrying with the same x-idempotency-key and the same request returns the original result; the same key with a different request is a conflict.",
        "operationId": "MerchantStockPositionController_assignOpeningStock",
        "parameters": [
          {
            "name": "inventoryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "stockLocationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Mint one key per assignment attempt and reuse it on its retries. 1 to 128 characters.",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignOpeningStockDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpeningStockAssignmentResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid route, environment, JSON body, query, idempotency key, reason or evidence reference.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The Inventory row or stockholding location is not available to this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason is ALREADY_ASSIGNED, LOCATION_RETIRED, INSUFFICIENT_FREE_STOCK, ANCHOR_INCONSISTENT, GENERATION_EXHAUSTED, IDEMPOTENCY_CONFLICT, or RETRY (retry with the same key).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the size limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "STOCK_LOCATION_WRITES_UNAVAILABLE when the stock write cannot be admitted on this backend. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Assign opening stock to a stockholding location",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/merchant/inventory/{inventoryId}/stock-positions": {
      "get": {
        "description": "Any admitted organization member can read where one Inventory row (SKU) stands in the selected commerce environment. The response holds the SKU's own counters, the sum of every position at every location, what no location holds yet, and one page of positions ordered by location ID. The sums and the unlocated remainder always cover the whole SKU, whatever the page or the stockLocationId filter, and one snapshot produces the whole response. A later page may reflect intervening changes. Only the documented query parameters are accepted, once each. Send no body. This is a display observation; an opening-stock assignment checks permission, target and availability again when it commits.",
        "operationId": "MerchantStockPositionReadController_list",
        "parameters": [
          {
            "name": "stockLocationId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "description": "Only the position at this location. A location with no position here gives an empty page and the same SKU totals."
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991,
              "default": 1
            },
            "description": "One-based page. The computed offset must also be a safe integer."
          },
          {
            "name": "inventoryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockPositionListDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid route, environment, query or body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The Inventory row is not available to this organization in this environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason is ANCHOR_INCONSISTENT when the SKU's counters and its positions do not add up.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the size limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "STOCK_LOCATION_LOOKUP_UNAVAILABLE when the position read cannot be qualified, or ORGANIZATION_ACCESS_UNAVAILABLE during admission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List one SKU's stock positions",
        "tags": [
          "merchant-inventory"
        ]
      }
    },
    "/api/v1/public/bookings/{id}": {
      "get": {
        "operationId": "PublicBookingController_getBookingById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch a booking by id.",
        "tags": [
          "public-bookings"
        ]
      }
    },
    "/api/v1/public/bookings": {
      "post": {
        "operationId": "PublicBookingController_createBooking",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT when the item has moved to the booking-service hold and checkout flow.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Create a booking (storefront checkout flow).",
        "tags": [
          "public-bookings"
        ]
      }
    },
    "/api/v1/public/booking-holds/{id}/checkout": {
      "post": {
        "description": "Auto-confirm payment services return a bearer c-token that remains reusable until checkout expiry and must be retained for reads/payment. Manual-approval and pay-later services create a capacity-free REQUESTED booking.",
        "operationId": "PublicBookingCheckoutController_create",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "The same possession/idempotency key used to create the hold.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingCheckoutDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingCheckoutResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "BOOKING_PRICE_CONFIRMATION_REQUIRED returns the typed two-phase confirmation challenge. Other operation-specific conflicts use the canonical API error envelope. TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/BookingPriceConfirmationRequiredErrorDto"
                    },
                    {
                      "$ref": "#/components/schemas/ApiErrorDto"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Convert a live booking hold into checkout or an approval request.",
        "tags": [
          "public-booking-checkout"
        ]
      }
    },
    "/api/v1/public/booking-groups/quote": {
      "post": {
        "description": "Returns a short-lived, request-bound tax-inclusive cart quote and customer-safe frozen pricing presentation. It creates no BookingGroup, BookingHold, Booking, Commerce record, CheckoutSession, PaymentAttempt, or provider payment object. The create operation always performs a fresh server evaluation before a PAY_NOW hold.",
        "operationId": "PublicBookingGroupController_quoteCart",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePublicBookingGroupDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupCartQuoteResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "BOOKING_PRICE_CONFIRMATION_UNAVAILABLE or BOOKING_DELIVERY_UNAVAILABLE. PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Evaluate one complete booking cart without creating capacity.",
        "tags": [
          "public-booking-groups"
        ]
      }
    },
    "/api/v1/public/booking-groups": {
      "post": {
        "description": "Normalizes the complete booking.group/v1 intent, enforces 20 submitted selections, 20 normalized members, 100 server-expanded capacity anchors, and—when any selection is composed—100 total materialized Commerce lines before provider or durable domain work, then rejects incompatible groups or either creates all request-first bookings without capacity or claims every member hold under one globally ordered transaction. HELD responses contain only capacity/expiry and sanitized frozen delivery evidence; checkout totals and processor state are out of scope.",
        "operationId": "PublicBookingGroupController_create",
        "parameters": [
          {
            "name": "booking-group-create-recovery-key",
            "in": "header",
            "description": "A separate caller-generated CSPRNG capability matching r[a-z0-9]{25}. Required before the initial POST and exact lost-response replay; stored only as SHA-256.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 26,
              "maxLength": 26,
              "pattern": "^r[a-z0-9]{25}$"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "8-255 character caller-generated key. Same key plus the same canonical complete intent replays only with the exact create-recovery proof; a changed intent returns 409.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePublicBookingGroupDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Can include VALIDATION_FAILED for malformed input, including PICKUP with destinationAddress; COMPOSITION_INVALID; BOOKING_DELIVERY_INVALID; BOOKING_DELIVERY_DESTINATION_INVALID; or BOOKING_DELIVERY_OUT_OF_RANGE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "RESOURCE_NOT_FOUND for an unavailable booking service or an invalid, expired, or revoked create-recovery proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "BOOKING_PRICE_CONFIRMATION_REQUIRED with CART_QUOTE_STALE returns the prior rendered and fresh tax-inclusive totals. Other create conflicts use the canonical API error envelope: BOOKING_GROUP_IDEMPOTENCY_CONFLICT, BOOKING_CAPACITY_UNAVAILABLE, BOOKING_DELIVERY_CONFIGURATION_CHANGED, COMPOSITION_REVISION_STALE, COMPOSITION_COMPONENT_MAPPING_MISSING, COMPOSITION_COMPONENT_MAPPING_AMBIGUOUS, COMPOSITION_INVALID, or RESOURCE_CONFLICT. TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/BookingCartQuoteStaleErrorDto"
                    },
                    {
                      "$ref": "#/components/schemas/ApiErrorDto"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "BOOKING_GROUP_LIMIT_EXCEEDED for more than 20 selections, 20 normalized members, 100 expanded capacity anchors, or (for a composed group) 100 materialized Commerce lines; BOOKING_GROUP_INCOMPATIBLE; or BOOKING_GROUP_SECURITY_AUTH_UNSUPPORTED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMIT_EXCEEDED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "BOOKING_DELIVERY_UNAVAILABLE when server-owned delivery evaluation cannot complete safely. PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Atomically create a bounded booking group.",
        "tags": [
          "public-booking-groups"
        ]
      }
    },
    "/api/v1/public/booking-groups/{publicRef}/request": {
      "post": {
        "description": "Reuses the exact normalized OPEN intent and its server-held original create idempotency identity after the booking-request agreement is satisfied. It revalidates the current native or verified-external satisfaction transactionally, then advances the same group without accepting new member input or creating a duplicate group. Pending agreement, wrong proof, or cross-tenant authority fail without capacity, Commerce, CheckoutSession, or PaymentAttempt writes.",
        "operationId": "PublicBookingGroupController_resumeRequest",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^b[a-z0-9]{25}$"
            }
          },
          {
            "name": "booking-group-resume-key",
            "in": "header",
            "description": "The response-only group resume proof. It is distinct from the public reference, idempotency key, and create-recovery capability and is stored only as SHA-256.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^g[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingPriceConfirmationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "BOOKING_PRICE_CONFIRMATION_REQUIRED returns the typed two-phase confirmation challenge. Other operation-specific conflicts use the canonical API error envelope. TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/BookingPriceConfirmationRequiredErrorDto"
                    },
                    {
                      "$ref": "#/components/schemas/ApiErrorDto"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Resume an agreement-gated booking request.",
        "tags": [
          "public-booking-groups"
        ]
      }
    },
    "/api/v1/public/booking-groups/{publicRef}": {
      "get": {
        "description": "Unknown, cross-tenant, malformed, expired-proof, and wrong-proof requests are the same neutral 404. After commercial binding, pricing comes only from the persisted CheckoutSession or exact member Sales records and never exposes a checkout capability. A successful resume-authenticated read acknowledges the separate create-recovery proof.",
        "operationId": "PublicBookingGroupController_get",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^b[a-z0-9]{25}$"
            }
          },
          {
            "name": "booking-group-resume-key",
            "in": "header",
            "description": "The response-only group resume proof. It is distinct from the public reference, idempotency key, and create-recovery capability and is stored only as SHA-256.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^g[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "BOOKING_GROUP_ACTION_INVALID with details.reason PAYMENT_RECONCILIATION_PENDING when an expired payment-bound group cannot yet prove authoritative payment absence. Retry the same proof-bound read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read one proof-bound booking group status.",
        "tags": [
          "public-booking-groups"
        ]
      },
      "delete": {
        "description": "Cancels every live child hold or request-first booking in one transaction. Unknown/cross-tenant/wrong-proof requests are neutral 404s; confirmed groups cannot be rewound.",
        "operationId": "PublicBookingGroupController_cancel",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^b[a-z0-9]{25}$"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Caller-generated key that serializes this proof-bound cancellation. Replays are terminal no-ops.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "name": "booking-group-resume-key",
            "in": "header",
            "description": "The response-only group resume proof. It is distinct from the public reference, idempotency key, and create-recovery capability and is stored only as SHA-256.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^g[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Cancelled or already cancelled."
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Cancel one proof-bound pre-confirmation booking group.",
        "tags": [
          "public-booking-groups"
        ]
      }
    },
    "/api/v1/public/booking-groups/{publicRef}/hosted-handoffs": {
      "post": {
        "description": "Dormant contract: not activated until the additive migration and separately authorized workload configuration are present. Limited to the verified environment-current idahoprogear source. ADR-030 §10 / booking.group.hosted-handoff/v1. Requires present exact approved current gear Origin and either a current group resume proof or the exact authenticated customer owner. Same mint operation, action and fingerprint replay metadata only. A fresh key/action with expected current capability generation replaces one active capability without extending the fixed min(15 minutes, proof ceiling) lineage or its eight-exchange/eight-candidate budgets. All misses, stale authority and scope failures are neutral. Submit the caller-held action and canonical ES256 compact JWS only in a top-level application/x-www-form-urlencoded POST to actionUrl. The JWS protected header is exactly alg=ES256 and typ=litecommerce-booking-group-hosted-handoff-v1+jws; its exact string payload fields are actionUrl, method=POST, actionHash, capabilityGeneration, exchangeOperationId, nonce and expiresAt. Both JSON segments use RFC 8785 and canonical unpadded base64url; signature is 64-byte P1363. No group, checkout, attempt, payment, business transition, resume proof or workload credential is created or returned by mint. Public REST/OpenAPI is the consumer contract; internal completion is not a consumer API.",
        "operationId": "PublicHostedHandoffController_mint",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "booking-group-resume-key",
            "in": "header",
            "description": "Current group g-proof, or use the exact owning CustomerSession bearer. Never place either in a URL.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Origin",
            "in": "header",
            "description": "Exact verified environment-current gear source origin; absent/null is denied.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MintHostedHandoffDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedHandoffMetadataDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BookingGroupResume": []
          },
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Admit a hosted booking-group handoff (not yet activated).",
        "tags": [
          "public-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/booking-groups/{id}": {
      "get": {
        "operationId": "MerchantBookingGroupController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one tenant-scoped booking aggregate.",
        "tags": [
          "merchant-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/booking-groups/{id}/approve": {
      "post": {
        "operationId": "MerchantBookingGroupController_approve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Atomically approve every member in a booking aggregate.",
        "tags": [
          "merchant-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/booking-groups/{id}/decline": {
      "post": {
        "operationId": "MerchantBookingGroupController_decline",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Decline every request member atomically.",
        "tags": [
          "merchant-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/booking-groups/{id}/cancel": {
      "post": {
        "operationId": "MerchantBookingGroupController_cancel",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel one pre-confirmation booking aggregate atomically.",
        "tags": [
          "merchant-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/booking-groups/{id}/refunds/stripe": {
      "post": {
        "operationId": "MerchantBookingGroupController_issueSharedRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Required idempotency key. One key maps to one frozen allocation plan and one provider refund.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueBookingGroupRefundDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGroupSharedRefundResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Issue one shared Stripe refund across an exact set of booking-group member amounts.",
        "tags": [
          "merchant-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/booking-groups/{id}/refunds/{refundPaymentAttemptId}/reconcile": {
      "post": {
        "operationId": "MerchantBookingGroupController_reconcileImportedRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundPaymentAttemptId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Required idempotency key. Reuse the same key and body to resume a partially converged reconciliation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileBookingGroupRefundDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGroupRefundReconciliationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Freeze exact member allocations for an imported shared-payment refund and reconcile it into Sales.",
        "tags": [
          "merchant-booking-groups"
        ]
      }
    },
    "/api/v1/merchant/bookings": {
      "post": {
        "description": "DRAFT and REQUEST create no capacity or Sales state. RESERVE performs the guarded capacity claim and creates the canonical booking-linked Sales projection atomically.",
        "operationId": "MerchantBookingController_createBooking",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMerchantBookingDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a merchant-authored draft, request, or reserved booking.",
        "tags": [
          "merchant-bookings"
        ]
      },
      "get": {
        "description": "Returns a bounded page of bookings (newest first) plus a `nextCursor` for the following page. Pass `?limit=` (1–200, default 50) to size the page. Staff reads are always limited to bookings actively assigned through a linked tenant resource; Owner/Admin reads may opt into that scope with `?mine=true`. `#1469` — replaces the former unbounded list.",
        "operationId": "MerchantBookingController_getBookings",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of bookings to return. Defaults to 50.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating — the `id` of the last booking from the previous page (returned as `nextCursor`). Treat it as opaque.",
            "schema": {
              "minLength": 1,
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Case-insensitive search over customer name/email, service name, and Sales display number.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "CONFIRMED",
                "ACTIVE",
                "COMPLETED",
                "CANCELLED",
                "DRAFT",
                "REQUESTED",
                "PENDING_PAYMENT",
                "DECLINED",
                "EXPIRED"
              ]
            }
          },
          {
            "name": "bookingType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "APPOINTMENT",
                "RESOURCE_RENTAL",
                "EVENT",
                "CLASS"
              ]
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "paymentStatus",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "NOT_REQUIRED",
                "UNPAID",
                "PARTIALLY_PAID",
                "PAID",
                "PARTIALLY_REFUNDED",
                "REFUNDED",
                "FAILED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "attention",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "NEEDS_APPROVAL",
                "PAYMENT_DUE",
                "UNASSIGNED",
                "SHORTAGE",
                "ALLOCATION_CONFLICT",
                "OVERRIDDEN"
              ]
            }
          },
          {
            "name": "mine",
            "required": false,
            "in": "query",
            "description": "Owner/Admin only: when true, return bookings currently allocated to a resource linked to the signed-in member. Staff reads are always assignment-scoped regardless of this value. The member identity is derived from the authenticated session.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Inclusive overlap-window start. Must be supplied together with `to` and include a timezone offset.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Exclusive overlap-window end. Must be supplied together with `from` and include a timezone offset.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List bookings for the active org (cursor-paginated).",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/availability/preflight": {
      "post": {
        "operationId": "MerchantBookingController_preflightAvailability",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBookingAvailabilitySearchDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingAvailabilityResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preflight a merchant-selected booking window and capacity.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/reserve": {
      "post": {
        "operationId": "MerchantBookingController_reserve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reserve a merchant-authored draft or request through the guarded capacity and Sales boundary.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/calendar": {
      "get": {
        "description": "Returns tenant-scoped bookings plus expanded one-off/recurring blackout blockers for a positive half-open range of at most 62 days. Staff booking entries are always limited to active assignments through linked tenant resources; Owner/Admin reads may opt into that scope with `?mine=true`. No customer slots are generated.",
        "operationId": "MerchantBookingController_getCalendar",
        "parameters": [
          {
            "name": "from",
            "required": true,
            "in": "query",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "CONFIRMED",
                "ACTIVE",
                "COMPLETED",
                "CANCELLED",
                "DRAFT",
                "REQUESTED",
                "PENDING_PAYMENT",
                "DECLINED",
                "EXPIRED"
              ]
            }
          },
          {
            "name": "bookingType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "APPOINTMENT",
                "RESOURCE_RENTAL",
                "EVENT",
                "CLASS"
              ]
            }
          },
          {
            "name": "mine",
            "required": false,
            "in": "query",
            "description": "Owner/Admin only: when true, return booking entries currently allocated to a resource linked to the signed-in member. Staff booking entries are always assignment-scoped regardless of this value. The member identity is derived from the authenticated session.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingCalendarDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a bounded booking operations calendar projection.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}": {
      "get": {
        "description": "Staff may read only bookings actively assigned through a linked tenant resource. An unassigned, missing, or cross-tenant id returns the same neutral 404.",
        "operationId": "MerchantBookingController_getBookingById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a booking by id.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/tax-addresses": {
      "patch": {
        "description": "Only DRAFT or REQUESTED singular bookings may be amended. Omitted fields retain their value; null clears a pickup address. Frozen delivery destinations remain authoritative.",
        "operationId": "MerchantBookingController_updateTaxAddresses",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMerchantBookingTaxAddressesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Amend normalized shipping or billing tax input before a singular booking is reserved.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/physical-plan": {
      "patch": {
        "operationId": "MerchantBookingController_updatePhysicalPlan",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingPhysicalPlanDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update shared outbound/inbound physical-fulfillment mode and due posture for a booking.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/allocations/{allocationId}/resolve-shortage": {
      "post": {
        "operationId": "MerchantBookingController_resolveShortage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "allocationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveBookingShortageDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record how an approved controlled shortage was concretely resolved.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/approve": {
      "post": {
        "operationId": "MerchantBookingController_approve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Approve a requested booking and recheck capacity.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/approve-with-shortage": {
      "post": {
        "operationId": "MerchantBookingController_approveWithShortage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Approve a requested booking with an explicitly policy-enabled controlled shortage.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/decline": {
      "post": {
        "operationId": "MerchantBookingController_decline",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Decline a requested booking.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/cancel": {
      "post": {
        "operationId": "MerchantBookingController_cancel",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel a booking and release capacity.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/reschedule": {
      "post": {
        "operationId": "MerchantBookingController_reschedule",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleBookingDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reschedule a confirmed booking under a fresh capacity claim.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/reschedule-with-shortage": {
      "post": {
        "operationId": "MerchantBookingController_rescheduleWithShortage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleBookingDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reschedule with a policy-enabled, reasoned controlled shortage.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/change-requests/{requestId}/decline": {
      "post": {
        "operationId": "MerchantBookingController_declineChangeRequest",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Decline a pending customer booking change request.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/start": {
      "post": {
        "operationId": "MerchantBookingController_start",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Start a confirmed booking.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/complete": {
      "post": {
        "operationId": "MerchantBookingController_complete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Complete an active booking.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/archive": {
      "post": {
        "operationId": "MerchantBookingController_archive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a terminal booking.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/assignments": {
      "get": {
        "description": "Returns the current live BookingAllocation fence, service requirements, eligible resources, linked tenant staff snapshots, remaining capacity, and conflict signals for one tenant-scoped booking.",
        "operationId": "MerchantBookingAssignmentController_getWorkspace",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingAssignmentWorkspaceDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the guarded resource and named-provider assignment workspace.",
        "tags": [
          "merchant-booking-assignments"
        ]
      },
      "post": {
        "description": "Normal assignment is strict: closed windows, blackouts, shared-provider overlap, pooled shortage, and exact-unit conflicts fail without modifying the current live allocation set.",
        "operationId": "MerchantBookingAssignmentController_replace",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceMerchantBookingAssignmentsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingAssignmentWorkspaceDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace live booking assignments through the capacity guard.",
        "tags": [
          "merchant-booking-assignments"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/assignments-with-shortage": {
      "post": {
        "description": "Requires both bookings:operate and bookings:override plus the high-risk reason. The effective booking policy must allow controlled shortage. Serialized-unit conflicts are never overridable.",
        "operationId": "MerchantBookingAssignmentController_replaceWithShortage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceMerchantBookingAssignmentsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBookingAssignmentWorkspaceDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace assignments with an audited controlled-shortage override.",
        "tags": [
          "merchant-booking-assignments"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/fulfillment-checklist": {
      "get": {
        "description": "Derives prep/load-out/return tasks from the current booking allocation cycle and positive PRODUCT Sales lines, then projects physical fulfillment and returns from their shared ledgers. Staff may read only actively assigned bookings; unassigned, missing, and cross-tenant ids return the same neutral 404. The JSON response is a bounded single-booking export; it does not copy shipment, return, condition, or restock state into Bookings.",
        "operationId": "MerchantBookingChecklistController_getChecklist",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingFulfillmentChecklistDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a printable booking prep and fulfillment checklist.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/bookings/{id}/fulfillment-checklist/{taskKey}": {
      "patch": {
        "description": "Upserts only the operator task status, completion audit, and note. The task must still derive from the current allocation cycle or a positive PRODUCT Sales line. Archived bookings are read-only and reject checklist mutations with 409.",
        "operationId": "MerchantBookingChecklistController_updateTask",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "taskKey",
            "required": true,
            "in": "path",
            "description": "Stable taskKey returned by the checklist read.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingChecklistTaskDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingFulfillmentChecklistDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update booking-owned checklist task state or notes.",
        "tags": [
          "merchant-bookings"
        ]
      }
    },
    "/api/v1/merchant/booking-reports/dimensions": {
      "get": {
        "description": "Returns only service/resource ids, names, and archive posture needed by report filters. It does not expose booking setup configuration.",
        "operationId": "MerchantBookingReportController_dimensions",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingReportDimensionsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List tenant-scoped booking report filter dimensions.",
        "tags": [
          "merchant-booking-reports"
        ]
      }
    },
    "/api/v1/merchant/booking-reports/availability": {
      "get": {
        "description": "Aggregates configured/open windows, active units, half-open hold/booking claims, blackouts, and controlled shortages for one tenant-scoped service. This is an operator diagnostic, not a public customer-slot response. Maximum range: 31 days.",
        "operationId": "MerchantBookingReportController_availability",
        "parameters": [
          {
            "name": "from",
            "required": true,
            "in": "query",
            "description": "Inclusive range start. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "description": "Exclusive range end. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "description": "Required service scope. A service outside the active tenant returns an empty report.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingAvailabilityReportDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read booking availability and shortage diagnostics.",
        "tags": [
          "merchant-booking-reports"
        ]
      }
    },
    "/api/v1/merchant/booking-reports/fulfillment-demand": {
      "get": {
        "description": "Projects bookings whose service window overlaps the half-open report range, plus bookings with outbound/inbound shared-commerce fulfillment milestones inside it. Includes active allocations, exact assets, and canonical fulfillment state. Maximum range: 366 days.",
        "operationId": "MerchantBookingReportController_fulfillmentDemand",
        "parameters": [
          {
            "name": "from",
            "required": true,
            "in": "query",
            "description": "Inclusive range start. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "description": "Exclusive range end. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingFulfillmentDemandReportDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read booking fulfillment demand and assignment diagnostics.",
        "tags": [
          "merchant-booking-reports"
        ]
      }
    },
    "/api/v1/merchant/booking-reports/lifecycle-revenue": {
      "get": {
        "description": "Reports bookings by booking-start range. Revenue is explicitly one of booked order, finalized invoice, or completed cash/payment-ledger basis; it never mixes those facts. Maximum range: 366 days.",
        "operationId": "MerchantBookingReportController_lifecycleRevenue",
        "parameters": [
          {
            "name": "from",
            "required": true,
            "in": "query",
            "description": "Inclusive range start. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "description": "Exclusive range end. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "revenueBasis",
            "required": false,
            "in": "query",
            "schema": {
              "default": "BOOKED_ORDER",
              "type": "string",
              "enum": [
                "BOOKED_ORDER",
                "FINALIZED_INVOICE",
                "CASH_PAYMENT"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingLifecycleRevenueReportDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read booking lifecycle and explicit-basis revenue diagnostics.",
        "tags": [
          "merchant-booking-reports"
        ]
      }
    },
    "/api/v1/merchant/booking-reports/document-payment-aging": {
      "get": {
        "description": "Projects shared quote/invoice/contract records and open customer action links. Rows are selected by due/expiry timestamp (or sent timestamp for undated open documents). Maximum range: 366 days.",
        "operationId": "MerchantBookingReportController_documentPaymentAging",
        "parameters": [
          {
            "name": "from",
            "required": true,
            "in": "query",
            "description": "Inclusive range start. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "description": "Exclusive range end. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingDocumentPaymentAgingReportDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read booking document and payment aging diagnostics.",
        "tags": [
          "merchant-booking-reports"
        ]
      }
    },
    "/api/v1/merchant/booking-reports/{kind}/export": {
      "get": {
        "description": "Uses the same tenant scope, range limits, filters, row cap, and revenue-basis semantics as the corresponding JSON report.",
        "operationId": "MerchantBookingReportController_export",
        "parameters": [
          {
            "name": "kind",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "availability",
                "fulfillment-demand",
                "lifecycle-revenue",
                "document-payment-aging"
              ],
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": true,
            "in": "query",
            "description": "Inclusive range start. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "description": "Exclusive range end. A timezone offset is required.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "revenueBasis",
            "required": false,
            "in": "query",
            "description": "Used only by the lifecycle-revenue export.",
            "schema": {
              "default": "BOOKED_ORDER",
              "type": "string",
              "enum": [
                "BOOKED_ORDER",
                "FINALIZED_INVOICE",
                "CASH_PAYMENT"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV attachment for the selected report.",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Export one bounded booking report as formula-safe CSV.",
        "tags": [
          "merchant-booking-reports"
        ]
      }
    },
    "/api/v1/merchant/agreements/workspace": {
      "get": {
        "description": "Returns tenant-scoped requirements, native/external executions, retained artifact status, verification history, and commerce projection links without exposing action authority, storage coordinates, private actor ids, or payment mutation controls.",
        "operationId": "MerchantAgreementController_getWorkspace",
        "parameters": [
          {
            "name": "kind",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "COMMERCE_RECORD",
                "COMMERCE_REVISION",
                "BOOKING",
                "BOOKING_GROUP"
              ]
            }
          },
          {
            "name": "targetId",
            "required": true,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantAgreementWorkspaceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the agreement workspace for one typed merchant subject.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/requirements": {
      "post": {
        "description": "The server resolves and freezes tenant-owned applicability for the selected sale, revision, booking, or booking group. It never accepts a caller-authored subject snapshot and never reads or mutates payment state.",
        "operationId": "MerchantAgreementController_attachRequirement",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachMerchantAgreementRequirementDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachMerchantAgreementRequirementResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Attach one immutable agreement requirement to a typed subject.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/requirements/{requirementId}/waive": {
      "post": {
        "description": "A privileged, reason-bearing exception for one tenant-scoped requirement. The immutable waiver event is the audit authority; terminal or cross-tenant requirements fail without exposing their existence.",
        "operationId": "MerchantAgreementController_waiveRequirement",
        "parameters": [
          {
            "name": "requirementId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WaiveAgreementRequirementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequirementWaiverResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Waive one exact active agreement requirement.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/templates": {
      "get": {
        "operationId": "MerchantAgreementController_listTemplates",
        "parameters": [
          {
            "name": "includeVersions",
            "required": false,
            "in": "query",
            "description": "Include every immutable template version in the list response. The default response includes only latestVersion.",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgreementTemplateResponseDto"
                  }
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List tenant agreement templates.",
        "tags": [
          "merchant-agreements"
        ]
      },
      "post": {
        "operationId": "MerchantAgreementController_createTemplate",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAgreementTemplateDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementTemplateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a tenant agreement template identity.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/templates/{templateId}": {
      "get": {
        "operationId": "MerchantAgreementController_getTemplate",
        "parameters": [
          {
            "name": "templateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementTemplateResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a template and its immutable version history.",
        "tags": [
          "merchant-agreements"
        ]
      },
      "patch": {
        "operationId": "MerchantAgreementController_updateTemplate",
        "parameters": [
          {
            "name": "templateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAgreementTemplateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementTemplateResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update template name or description only.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/templates/{templateId}/archive": {
      "post": {
        "operationId": "MerchantAgreementController_archiveTemplate",
        "parameters": [
          {
            "name": "templateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementTemplateResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a template identity without changing issued history.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/templates/{templateId}/versions": {
      "post": {
        "operationId": "MerchantAgreementController_appendTemplateVersion",
        "parameters": [
          {
            "name": "templateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppendAgreementTemplateVersionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementTemplateVersionResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Append an immutable server-digested template version.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/disclosures": {
      "get": {
        "operationId": "MerchantAgreementController_listDisclosures",
        "parameters": [
          {
            "name": "disclosureKey",
            "required": false,
            "in": "query",
            "schema": {
              "maxLength": 128,
              "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgreementDisclosureVersionResponseDto"
                  }
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List immutable disclosure versions.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/disclosures/versions": {
      "post": {
        "operationId": "MerchantAgreementController_appendDisclosureVersion",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppendAgreementDisclosureVersionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementDisclosureVersionResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Append an immutable approved disclosure version.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/preview": {
      "post": {
        "description": "Callers cannot supply merge values; unresolved or inapplicable fields fail closed.",
        "operationId": "MerchantAgreementController_preview",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewAgreementTemplateDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementPreviewResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preview a template with tenant-owned subject facts.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/subjects/{subjectId}/revisions": {
      "get": {
        "operationId": "MerchantAgreementController_listRevisions",
        "parameters": [
          {
            "name": "subjectId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgreementRevisionResponseDto"
                  }
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List complete immutable revision history for a subject.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/revisions/{revisionId}": {
      "get": {
        "operationId": "MerchantAgreementController_getRevision",
        "parameters": [
          {
            "name": "revisionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRevisionResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read exact immutable terms for one revision.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/revisions/{revisionId}/rendered-pdf": {
      "post": {
        "operationId": "MerchantAgreementController_grantRenderedPdf",
        "parameters": [
          {
            "name": "revisionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementArtifactGrantDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementArtifactGrantResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a short-lived grant for the verified rendered PDF.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreement-history": {
      "get": {
        "description": "The optional booking filter is ownership-checked against the active tenant/customer. The response preserves provider provenance and exact native digests while omitting raw action authority, source external ids, storage coordinates, and private audit evidence.",
        "operationId": "CustomerAgreementHistoryController_list",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "bookingId",
            "required": false,
            "in": "query",
            "description": "Restrict history to one booking owned by the signed-in customer.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Pass the previous page’s nextCursor unchanged for the same history query.",
            "schema": {
              "pattern": "^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}(?:-[fF]{4}){3}-[fF]{12}|agreement-execution:[a-f0-9]{64})$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerAgreementHistoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the signed-in customer's canonical native and external agreement history.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreement-history/external/{executionId}/artifacts/{artifactId}/download": {
      "post": {
        "description": "Unknown, another customer’s, cross-tenant, pending, quarantined, destroyed, or integrity-invalid evidence fails without revealing which ownership or safety check failed. External evidence remains labeled as external and is never represented as a cartonium-native signature.",
        "operationId": "CustomerAgreementHistoryController_grantExternalArtifact",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^(?:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|agreement-execution:[a-f0-9]{64})$"
            },
            "description": "Execution ID from the customer’s external agreement history row."
          },
          {
            "name": "artifactId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^(?:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|external-artifact:[a-f0-9]{64})$"
            },
            "description": "Artifact ID from the customer’s external agreement history row."
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerExternalAgreementArtifactGrantDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDownloadDto"
                }
              }
            }
          },
          "400": {
            "description": "Malformed execution or artifact ID, invalid expiry, or missing or malformed storefront origin context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Authorize an owned external-agreement evidence download.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external": {
      "post": {
        "description": "Stores validated bytes in private quarantine and records honest outside-system provenance. Attachment and scanning do not verify evidence or satisfy a requirement, create a native signature, send mail, touch payment, or transition booking/commerce state.",
        "operationId": "MerchantExternalAgreementController_attach",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "document",
                  "subjectId",
                  "sourceSystem",
                  "externalId",
                  "signedAt",
                  "signersJson"
                ],
                "properties": {
                  "document": {
                    "type": "string",
                    "format": "binary"
                  },
                  "certificate": {
                    "type": "string",
                    "format": "binary"
                  },
                  "subjectId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "sourceSystem": {
                    "type": "string",
                    "enum": [
                      "booqable",
                      "wet-signed",
                      "docusign",
                      "pandadoc",
                      "authentisign",
                      "other-external"
                    ]
                  },
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "displayNumber": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "signedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "countersignedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "termsVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "signersJson": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20000
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Attach an externally executed agreement PDF.",
        "tags": [
          "merchant-agreements"
        ]
      },
      "get": {
        "operationId": "MerchantExternalAgreementController_list",
        "parameters": [
          {
            "name": "subjectId",
            "required": false,
            "in": "query",
            "description": "Filter to one exact agreement subject.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementListDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List tenant-scoped external agreement evidence.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external/{executionId}": {
      "get": {
        "operationId": "MerchantExternalAgreementController_get",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch external agreement evidence metadata.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external/{executionId}/decisions": {
      "post": {
        "description": "Verification is a separate audited decision and succeeds only after every retained evidence artifact has a scanner-owned SAFE disposition.",
        "operationId": "MerchantExternalAgreementController_decide",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalAgreementDecisionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Verify, reject, or mark external evidence insufficient.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external/{executionId}/satisfactions": {
      "post": {
        "operationId": "MerchantExternalAgreementController_satisfy",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SatisfyExternalAgreementRequirementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Use current verified evidence for one exact compatible requirement.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external/{executionId}/decisions/{verificationId}/revoke": {
      "post": {
        "description": "Revokes active satisfactions first and appends a forward-remediation exception. It never rewinds a completed payment, booking, fulfillment, or commerce command.",
        "operationId": "MerchantExternalAgreementController_revoke",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "verificationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeExternalAgreementVerificationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revoke an incorrect external-evidence verification.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external/{executionId}/artifacts/{artifactId}/destroy": {
      "post": {
        "description": "Records an authorized retention/offboarding/privacy disposition before deleting private bytes, then retains an immutable DESTROYED tombstone and completion event. It never changes payment, booking, fulfillment, or signature state.",
        "operationId": "MerchantExternalAgreementController_destroyArtifact",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artifactId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DestroyExternalAgreementArtifactDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementArtifactDestructionDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Govern destruction of one retained external-agreement artifact.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/external/{executionId}/artifacts/{artifactId}/download": {
      "get": {
        "description": "Returns the same neutral 404 for missing, cross-tenant, pending, quarantined, rejected, or destroyed evidence. An integrity mismatch returns 409 and temporary private-storage failure returns 503. Storage bucket/key metadata is never returned.",
        "operationId": "MerchantExternalAgreementController_download",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artifactId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalAgreementDownloadDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Authorize a short-lived private evidence download.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions": {
      "post": {
        "description": "Server-issues one immutable revision from the exact template/disclosure versions, then binds one customer signer, an optional merchant countersigner, and an optional exact requirement. Optional digest expectations fail closed on drift; the server returns authoritative revision/digests and no action token.",
        "operationId": "MerchantNativeAgreementController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNativeAgreementExecutionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a draft native agreement execution.",
        "tags": [
          "merchant-agreements"
        ]
      },
      "get": {
        "description": "Cursor-paginated and tenant-scoped. Projections omit tokens, recipient email, audit IP/user-agent evidence, private actor ids, and storage coordinates.",
        "operationId": "MerchantNativeAgreementController_list",
        "parameters": [
          {
            "name": "subjectId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "state",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ISSUED",
                "IN_PROGRESS",
                "EXECUTED",
                "DECLINED",
                "EXPIRED",
                "VOIDED",
                "REPLACED"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List tenant-scoped native agreement executions.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}": {
      "get": {
        "description": "Unknown and cross-tenant execution identities return the same neutral 404.",
        "operationId": "MerchantNativeAgreementController_get",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one tenant-scoped native execution.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/issue": {
      "post": {
        "description": "DRAFT→ISSUED only after revalidating the exact revision, rendered artifact, disclosure, participants, expiry, and optional requirement binding. This does not send authority or touch money.",
        "operationId": "MerchantNativeAgreementController_issue",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementReasonedCommandDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Issue one immutable draft execution.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/send": {
      "post": {
        "description": "Mints hashed, expiring, participant-scoped action authority inside the transaction and queues delivery. Raw authority is never returned by this merchant API.",
        "operationId": "MerchantNativeAgreementController_send",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementReasonedCommandDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Send an issued native agreement through the durable outbox.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/resend": {
      "post": {
        "description": "Revocation, replacement authority, lifecycle event, and durable outbox intent are one transaction. A resend never returns the raw token.",
        "operationId": "MerchantNativeAgreementController_resend",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementReasonedCommandDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revoke prior action authority and resend a fresh scoped link.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/presentation": {
      "post": {
        "description": "Persists an immutable shown event bound to the exact revision, content digest, disclosure identity/version/digest, participant, and actor. Server-observed request evidence is retained with the resulting assent; the response contains no private audit fields.",
        "operationId": "MerchantNativeAgreementController_present",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementPresentationResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Present exact terms to the authenticated merchant countersigner.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/countersign": {
      "post": {
        "description": "Requires the exact presentation event plus affirmative agreement/disclosure acceptance and a typed signer identity. It cannot sign for a different tenant, user, participant, revision, digest, or disclosure.",
        "operationId": "MerchantNativeAgreementController_countersign",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantCountersignNativeAgreementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Countersign after exact presentation and explicit assent.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/decline": {
      "post": {
        "description": "Records a forward-only participant/execution decline. It never cancels or refunds a payment and never rewinds booking or commerce state.",
        "operationId": "MerchantNativeAgreementController_decline",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantDeclineNativeAgreementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Decline as the authenticated merchant countersigner.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/void": {
      "post": {
        "description": "Records a forward-only VOIDED disposition and revokes live action authority without erasing predecessor evidence or touching payment, booking, commerce, or fulfillment state.",
        "operationId": "MerchantNativeAgreementController_void",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementReasonedCommandDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Void a non-executed native agreement request.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/reissue": {
      "post": {
        "description": "Creates immutable predecessor/successor lineage and requires a fresh exact revision, disclosure, participants, and assent. Prior authority and assent are never reused.",
        "operationId": "MerchantNativeAgreementController_reissue",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReissueNativeAgreementExecutionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace an unexecuted request with a newly bound execution.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/merchant/agreements/native/executions/{executionId}/artifacts/{artifactId}/download": {
      "post": {
        "description": "Only retained safe EXECUTED_PDF and EXECUTION_CERTIFICATE artifacts are eligible. Missing, cross-tenant, unavailable, destroyed, or other-kind artifacts use the same neutral 404; storage coordinates never leave the service.",
        "operationId": "MerchantNativeAgreementController_grantArtifact",
        "parameters": [
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artifactId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementArtifactGrantDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementArtifactGrantResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Authorize a short-lived executed PDF or certificate download.",
        "tags": [
          "merchant-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreements": {
      "get": {
        "description": "Ownership comes only from the authenticated customer session and active tenant. The response never exposes raw action authority, recipient email, private audit evidence, storage coordinates, or merchant-only metadata.",
        "operationId": "CustomerNativeAgreementController_list",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "state",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ISSUED",
                "IN_PROGRESS",
                "EXECUTED",
                "DECLINED",
                "EXPIRED",
                "VOIDED",
                "REPLACED"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the signed-in customer's native agreements.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreements/{executionId}": {
      "get": {
        "description": "Unknown, cross-tenant, and another customer’s execution return the same neutral 404.",
        "operationId": "CustomerNativeAgreementController_get",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read one native agreement owned by the signed-in customer.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreements/{executionId}/presentation": {
      "post": {
        "description": "Creates an immutable shown event bound to this customer, participant, revision/content digest, and disclosure identity/version/digest. A later Sign call must name this exact presentation event; server-observed request evidence is retained with the resulting assent.",
        "operationId": "CustomerNativeAgreementController_present",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementPresentationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Present exact immutable terms to the signed-in customer.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreements/{executionId}/sign": {
      "post": {
        "description": "Requires true agreement and disclosure acceptance, typed signer identity, and the exact presentation/revision/digests. Wrong customer, tenant, participant, stale presentation, changed terms, or changed disclosure fail without revealing which check failed.",
        "operationId": "CustomerNativeAgreementController_sign",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignNativeAgreementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Sign after exact presentation and explicit affirmative assent.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreements/{executionId}/decline": {
      "post": {
        "description": "Records a forward-only decline and revokes live action authority. Decline does not cancel, refund, authorize, or otherwise mutate payment, booking, commerce, or fulfillment state.",
        "operationId": "CustomerNativeAgreementController_decline",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclineNativeAgreementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Decline an owned native agreement request.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/account/agreements/{executionId}/artifacts/{artifactId}/download": {
      "post": {
        "description": "Only retained safe execution artifacts belonging to an owned agreement are eligible. Unknown, cross-tenant, another customer’s, unavailable, destroyed, or wrong-kind artifacts return the same neutral 404.",
        "operationId": "CustomerNativeAgreementController_grantArtifact",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "executionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artifactId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementArtifactGrantDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementArtifactGrantResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Authorize an owned executed PDF or certificate download.",
        "tags": [
          "customer-agreements"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}": {
      "get": {
        "description": "Pure read: does not consume the token or record disclosure shown. The response is a whitelist without the token, recipient email, audit IP/user-agent evidence, private actor ids, or storage coordinates.",
        "operationId": "ActionNativeAgreementController_get",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family native-agreement participant action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Preview one participant-scoped native agreement action.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}/context": {
      "get": {
        "description": "Requires the same participant-scoped token as the agreement preview. Booking-group context comes from the immutable subject member snapshot and exposes only a non-authorizing public reference; raw intent, customer ids, internal group/member ids, and payment capabilities are excluded.",
        "operationId": "ActionNativeAgreementController_context",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerAgreementActionContextResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read customer-safe subject context for a native agreement action.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}/presentation": {
      "post": {
        "description": "Persists an immutable shown event bound to the token recipient, participant, exact revision/content digest, and exact disclosure identity/version/digest. Server-observed request evidence is retained with the resulting assent; the action remains unconsumed until a successful terminal participant action.",
        "operationId": "ActionNativeAgreementController_present",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementPresentationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Present the exact agreement and disclosure for this action.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}/sign": {
      "post": {
        "description": "Requires the exact presentation event, revision and disclosure digests, explicit true agreement/disclosure acceptance, and typed signer identity. Successful completion consumes this authority idempotently; stale or mismatched authority fails neutrally.",
        "operationId": "ActionNativeAgreementController_sign",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignNativeAgreementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Sign through exact participant-scoped action authority.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}/decline": {
      "post": {
        "description": "Records a forward-only decline and consumes the action authority idempotently. It never cancels or refunds payment and never rewinds booking, commerce, or fulfillment state.",
        "operationId": "ActionNativeAgreementController_decline",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclineNativeAgreementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Decline through participant-scoped action authority.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}/artifacts/{artifactId}/download": {
      "post": {
        "description": "The action token must still authorize the exact participant/execution and the artifact must be retained and safe. A successfully consumed token may read its exact completed result until expiry/revocation; unknown, expired, revoked, wrong-target, cross-tenant, unavailable, destroyed, or wrong-kind cases return the same neutral 404.",
        "operationId": "ActionNativeAgreementController_grantArtifact",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artifactId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NativeAgreementArtifactGrantDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeAgreementArtifactGrantResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Authorize a scoped executed PDF or certificate download.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/public/customer/auth/request-link": {
      "post": {
        "description": "Sends a one-click sign-in link (and a fallback OTP) to the email if it belongs to a customer of this tenant. Always returns a neutral 200 — the response never reveals whether an account exists. Throttled per-email and per-IP. An optional account-local return target may be carried into the emailed magic link after server-side validation.",
        "operationId": "PublicCustomerAuthController_requestLink",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestLinkDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestChallengeResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a passwordless magic-link login email.",
        "tags": [
          "public-customer-auth"
        ]
      }
    },
    "/api/v1/public/customer/auth/request-otp": {
      "post": {
        "description": "Identical neutral, throttled issuance to request-link: the email always carries BOTH the magic link and the numeric OTP. The only difference is a shorter challenge TTL. Always returns a neutral 200. An optional account-local return target may be carried into the emailed magic link after server-side validation.",
        "operationId": "PublicCustomerAuthController_requestOtp",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestLinkDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestChallengeResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a passwordless one-time-code login email.",
        "tags": [
          "public-customer-auth"
        ]
      }
    },
    "/api/v1/public/customer/auth/verify": {
      "post": {
        "description": "Accepts `{ token }` (magic link) OR `{ email, code }` (OTP). On success mints a FRESH session: sets an httpOnly Secure cookie (hosted cartonium checkout) AND returns a bearer token in the body (BYO frontends). Proof consumption, the eligible Customer claim, and session issuance commit atomically (E28, `DR-3340-08-C`). The session enforces a 6-hour idle / 24-hour absolute window by default; `persistSession: true` — an affirmative \"keep me signed in\" choice — mints 30-day idle / 365-day absolute windows instead (`DR-3340-10-C`). Any failure is a neutral 401.",
        "operationId": "PublicCustomerAuthController_verify",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifySessionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired challenge (neutral — cause not disclosed).",
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Verify a magic-link token or OTP and start a session.",
        "tags": [
          "public-customer-auth"
        ]
      }
    },
    "/api/v1/public/customer/auth/order-recovery/request-link": {
      "post": {
        "operationId": "OrderRecoveryController_requestLink",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderRecoveryRequestDto"
              }
            }
          }
        },
        "responses": {
          "202": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderRecoveryRequestResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a neutral Order-recovery sign-in link.",
        "tags": [
          "public-customer-auth"
        ]
      }
    },
    "/api/v1/public/customer/auth/order-recovery/request-otp": {
      "post": {
        "operationId": "OrderRecoveryController_requestOtp",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderRecoveryRequestDto"
              }
            }
          }
        },
        "responses": {
          "202": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderRecoveryRequestResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Response varies only by trusted tenant selection.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a neutral Order-recovery one-time code.",
        "tags": [
          "public-customer-auth"
        ]
      }
    },
    "/api/v1/customer/auth/logout": {
      "post": {
        "description": "Revokes the session presented via cookie or bearer and clears the hosted session cookie. Idempotent. Tenant-scoped — a session can only be revoked within its own organization. Session revocation remains available after daily API allowances are exhausted and does not consume them.",
        "operationId": "CustomerAuthController_logout",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Session revoked (or already gone)."
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Revoke the current customer session (logout).",
        "tags": [
          "customer-auth"
        ]
      }
    },
    "/api/v1/public/booking-services": {
      "get": {
        "description": "Tenant-scoped, bounded keyset list. Draft, archived, and foreign-tenant services are never returned. Responses carry evaluated pricing context and are served with Cache-Control: private, no-store (ADR-043).",
        "operationId": "PublicBookingAvailabilityController_listServices",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 24,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingServiceListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List ACTIVE public booking services.",
        "tags": [
          "public-booking-availability"
        ]
      }
    },
    "/api/v1/public/booking-services/{slug}": {
      "get": {
        "description": "Unknown, draft, archived, and cross-tenant slugs are the same neutral 404. Responses carry evaluated pricing context and are served with Cache-Control: private, no-store (ADR-043).",
        "operationId": "PublicBookingAvailabilityController_getService",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "maxLength": 100,
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingServiceDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch an ACTIVE booking service by slug.",
        "tags": [
          "public-booking-availability"
        ]
      }
    },
    "/api/v1/public/booking-availability/search": {
      "post": {
        "description": "Derives candidates from recurring service/resource rules, then subtracts blackouts, live holds, and capacity-holding bookings. Slots are generated on demand and are not durable claims; create a hold before checkout. An unpriceable requested duration is a distinct 400 PRICING_POLICY_INCOMPATIBLE pricing failure (reason DURATION_OUTSIDE_POLICY carries maxElapsedMinutes recovery), never presented as unavailable inventory. Served with Cache-Control: private, no-store (ADR-043).",
        "operationId": "PublicBookingAvailabilityController_search",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBookingAvailabilitySearchDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingAvailabilityResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Generate currently available booking slots.",
        "tags": [
          "public-booking-availability"
        ]
      }
    },
    "/api/v1/public/booking-holds": {
      "post": {
        "description": "Validates pickup/delivery server-side (including transient geocoding and an inclusive radius-band match), then rechecks delivery configuration and the exact window under deterministic locks before creating a durable 30-minute hold. The response carries the frozen delivery selection plus serverTime and expiresInSeconds; checkout reuses that snapshot instead of repricing the route. Pricing failures are typed no-quote 400s (PRICING_POLICY_INCOMPATIBLE with a reason code; DURATION_OUTSIDE_POLICY carries maxElapsedMinutes recovery) evaluated before any capacity write, so a failed quote never consumes a hold. A contended tenant configuration fence returns retryable 409 BOOKING_CONFIGURATION_BUSY. Served with Cache-Control: private, no-store (ADR-043).",
        "operationId": "PublicBookingAvailabilityController_createHold",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "8-255 character caller-generated key. Same key + same canonical intent replays the original hold; a different intent returns 409.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePublicBookingHoldDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingHoldResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Transactionally claim temporary booking capacity.",
        "tags": [
          "public-booking-availability"
        ]
      }
    },
    "/api/v1/public/booking-holds/{id}": {
      "delete": {
        "description": "Idempotent for cancelled/expired holds. Unknown, cross-tenant, and wrong-key holds are the same neutral 404; consumed holds return 409.",
        "operationId": "PublicBookingAvailabilityController_releaseHold",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "The same caller-generated key used to create the hold. Retain it as a possession check; it is not a substitute for customer authentication.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Released or already terminal."
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Release a temporary booking hold early.",
        "tags": [
          "public-booking-availability"
        ]
      }
    },
    "/api/v1/merchant/booking-delivery/config": {
      "get": {
        "description": "Returns the merchant-entered origin, provider place id, verification timestamp, revision, and ordered integer-meter/integer-cent radius bands. A tenant with no saved setup receives a stable disabled empty state.",
        "operationId": "MerchantBookingDeliveryController_getConfiguration",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingDeliveryConfigurationResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active tenant's booking-delivery origin and radius bands.",
        "tags": [
          "merchant-booking-delivery"
        ]
      },
      "put": {
        "description": "Atomically replaces the merchant origin and full ordered radius-band set. The origin is geocoded server-side with the tenant-owned credential; coordinates are transient and only the merchant input plus provider place id are stored. Bands must have strictly increasing meter bounds. A disabled null-origin/empty-band payload clears setup without calling the provider.",
        "operationId": "MerchantBookingDeliveryController_replaceConfiguration",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingDeliveryConfigurationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingDeliveryConfigurationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace booking-delivery setup (bookings operations permission required).",
        "tags": [
          "merchant-booking-delivery"
        ]
      }
    },
    "/api/v1/merchant/booking-delivery/provider": {
      "get": {
        "description": "Owner/Admin-only masked read. The API key is write-only and never returned; this response carries only its last-four fingerprint and connection health timestamps.",
        "operationId": "MerchantBookingDeliveryController_getProviderStatus",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGeocodingProviderStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active tenant's Google geocoding connection status.",
        "tags": [
          "merchant-booking-delivery"
        ]
      },
      "put": {
        "description": "Owner/Admin-only reasoned high-risk action. The key is checked against Google live before encrypted storage. It is write-only and never appears in logs, audit metadata, or responses.",
        "operationId": "MerchantBookingDeliveryController_connectProvider",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectBookingGeocodingProviderDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGeocodingProviderStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Connect or replace the tenant's Google Geocoding API key.",
        "tags": [
          "merchant-booking-delivery"
        ]
      }
    },
    "/api/v1/merchant/booking-delivery/provider/test": {
      "post": {
        "description": "Returns HTTP 200 with a coarse, sanitized result. Provider/cipher failures never expose the key, address, or provider response body.",
        "operationId": "MerchantBookingDeliveryController_testProvider",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestBookingGeocodingProviderResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Live-test the stored Google geocoding credential.",
        "tags": [
          "merchant-booking-delivery"
        ]
      }
    },
    "/api/v1/merchant/booking-delivery/provider/disconnect": {
      "post": {
        "description": "Owner/Admin-only reasoned high-risk action. Hard-deletes the encrypted credential; saved delivery setup remains but cannot be used until a credential is reconnected.",
        "operationId": "MerchantBookingDeliveryController_disconnectProvider",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGeocodingProviderStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Disconnect the tenant's Google geocoding credential.",
        "tags": [
          "merchant-booking-delivery"
        ]
      }
    },
    "/api/v1/merchant/checkout/sessions": {
      "get": {
        "description": "Newest sessions first. Supports status, email, limit, and cursor filters for support workbench triage. Returns a latest payment-attempt summary, but no raw processor payload.",
        "operationId": "MerchantCheckoutSupportController_listCheckoutSessions",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Currently the row id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "PENDING_PAYMENT",
                "CONFIRMED",
                "EXPIRED",
                "ABANDONED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "customerEmail",
            "required": false,
            "in": "query",
            "description": "Case-insensitive customer email contains filter, scoped inside the active org.",
            "schema": {
              "maxLength": 320,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListMerchantCheckoutSessionsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List checkout sessions for the active org.",
        "tags": [
          "merchant-checkout-support"
        ]
      }
    },
    "/api/v1/merchant/checkout/sessions/{id}": {
      "get": {
        "description": "Returns the tenant-scoped checkout session detail, repriced lines, session lifecycle events, payment attempts, and processor event summaries. Raw processor webhook payloads are intentionally omitted.",
        "operationId": "MerchantCheckoutSupportController_getCheckoutSession",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSupportSessionDetailDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Inspect a checkout session with support timeline.",
        "tags": [
          "merchant-checkout-support"
        ]
      }
    },
    "/api/v1/merchant/payments": {
      "get": {
        "description": "Newest payment attempts first. Supports status, kind, checkoutSessionId, limit, and cursor filters. Includes the related checkout session summary and recent processor event summaries for support triage.",
        "operationId": "MerchantCheckoutSupportController_listPayments",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Currently the row id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "REQUIRES_PAYMENT_METHOD",
                "REQUIRES_ACTION",
                "PROCESSING",
                "REQUIRES_CAPTURE",
                "SUCCEEDED",
                "FAILED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "kind",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PAYMENT",
                "AUTHORIZATION",
                "SETUP",
                "REFUND"
              ]
            }
          },
          {
            "name": "checkoutSessionId",
            "required": false,
            "in": "query",
            "description": "Filter payment attempts to a specific checkout session id.",
            "schema": {
              "maxLength": 100,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListMerchantPaymentsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List checkout payment attempts for the active org.",
        "tags": [
          "merchant-checkout-support"
        ]
      }
    },
    "/api/v1/merchant/abandoned-checkouts": {
      "get": {
        "description": "Tenant-scoped, newest first. Includes one-time hosted checkouts inactive for at least one hour, with contact email and no completed purchase or unsafe payment. A recovery link returns to the storefront cart, never revives an expired payment session.",
        "operationId": "MerchantAbandonedCheckoutController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Currently the row id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "required": false,
            "in": "query",
            "description": "Case-insensitive email search inside the active tenant.",
            "schema": {
              "maxLength": 320,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAbandonedCheckoutsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List abandoned hosted checkouts.",
        "tags": [
          "merchant-abandoned-checkouts"
        ]
      }
    },
    "/api/v1/merchant/abandoned-checkouts/{id}/recovery-email": {
      "post": {
        "description": "Owner/Admin or staff with orders:operate. Recipient and cart details come from the tenant checkout. Repeated requests reuse one durable intent per unchanged checkout revision. Later shopper activity supersedes an unsent intent and starts a new inactivity window. Current completion, contact, suppression and transport are rechecked before sending. No scheduled or automatic recovery is enabled.",
        "operationId": "MerchantAbandonedCheckoutController_request",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestCheckoutRecoveryResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Request one manual abandoned-checkout recovery email.",
        "tags": [
          "merchant-abandoned-checkouts"
        ]
      }
    },
    "/api/v1/customer/checkout/sessions/{token}": {
      "get": {
        "description": "Returns the normal checkout session summary. Captured customer contact and shipping address are populated only when the signed-in customer matches the session's captured email; otherwise those fields are null.",
        "operationId": "CustomerCheckoutSessionController_getSession",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Session not found or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read a checkout session as the authenticated customer.",
        "tags": [
          "customer-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/payment-entry": {
      "get": {
        "description": "Token-authenticated, PII-free configuration for an ordinary one-time checkout. Returns no client secret and creates no customer, payment attempt or provider object. The amount is provisional. Clients must bind current billing and prepare payment on submission, verify the returned key/account/amount against this display, and request review of any changed total before confirmation. Booking, subscription, expired, terminal and no-charge checkouts are unavailable. This read grants no payment or saved-card authority. When the checkout carries a frozen payment policy and its current payment generation can be read, the response adds `paymentPresentation` for configuring the Payment Element (ADR-050 §16); the payment hand-off remains the authority for the payment it prepares. A server that provides `paymentDisplayPreview` adds it to every successful response, before bind as well as after: what the checkout may display for payment, from its frozen payment policy, for the payment generation this read observed (`UNMARKED` when the checkout carries none). It is display only, one unlocked observation and not a lease: it grants no payment or saved-card authority, and the payment hand-off decides again. An older server omits it; treat its absence as no preview and keep today’s card entry.",
        "operationId": "PublicCheckoutPaymentController_getPaymentEntry",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentEntryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Ordinary one-time checkout activation is temporarily unavailable; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE` is a different case: the checkout's frozen payment policy refuses payment for its current payment generation, exactly as the payment hand-off would. A checkout that carries no payment policy receives the same refusal, with `details.reason` `NOT_ACTIVATED`, once it can no longer hand off a payment. `details.reason` names the refusal and `details.retry` is `NOT_RETRYABLE`: do not repeat the identical request, and do not offer card entry for this checkout. No payment, customer or provider object was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "summary": "Read card-entry display configuration before binding billing.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/payment-session": {
      "post": {
        "description": "Resolves the binding CheckoutSession by its opaque token, creates a PaymentAttempt + a Stripe PaymentIntent for the server-authoritative charge-now amount (the session `amountDueNowInCents` — the full total for a cart / full payment, the smaller deposit for a booking deposit), and returns the client secret for the Payment Element. For an ordinary one-time checkout, payment-session replay identity is the current binding semantic digest and payment generation, not the charge-now amount alone: re-calling while both remain current reuses the same healthy intent, and an exact semantic bind replay preserves that intent and generation. Any semantic bind change — even when the charge-now amount is unchanged — invalidates every linked prepared PaymentIntent. All linked prepared intents, if any, must be provider-proven canceled before bind commits; an attempt-free semantic change can advance without provider I/O. Once that gate succeeds, bind advances the generation and the client must request a fresh payment session and client secret. The service also re-evaluates the current checkout email before issuing or reusing an intent. If that email currently belongs to a verified customer, the request must carry a live CustomerSession for the same organization and normalized email. BYO and cross-origin hosted clients supply it as bearer authority; a cookie scoped to another hosted origin does not cross to this API. An earlier identity `proceed` result does not grant payment authority. For an ordinary checkout already in `PENDING_PAYMENT`, a live successor CustomerSession may replace an effectively expired or revoked frozen session only when organization, normalized email, identity version, and Customer all match. A missing or still-live predecessor remains behind the neutral identity fence without payment mutation. The server first fences the exact old payment generation and provider-proves every linked intent canceled; processing, requires-capture, succeeded, ambiguous, or contended money does not rotate identity or create a new generation. A successful transition preserves the checkout/commercial snapshot and immutable old PaymentAttempt identity, advances the payment generation, and continues this same request against the successor session. Booking and booking-group handoffs retain their separately scoped authorization, due-now amount, and replay contracts. The client secret is never persisted. For a checkout that carries a frozen payment policy, the response adds `paymentPresentation`: the admitted payment method types and the Payment Element `wallets` option from the frozen admission this payment was prepared under (ADR-050 §16). It is omitted for every other checkout. On ordinary policy-bearing create, reuse and same-card retry handoffs, `paymentContext` is paired with that presentation from the same final ADMISSION: `{ version: 1, paymentGeneration }`. It is optional, never null; UNMARKED and excluded booking/group handoffs and older API builds omit it. It is a generation witness for this handoff, distinct from PaymentAttempt.paymentContextType and paymentContextId. It is not a lease or authority; no request accepts it and it never permits automatic confirmation. The shopper’s Pay action and applicable consent remain required. A DISPLAY generation may differ compatibly when ordered rails and all wallets agree. The optional body states the saved-card choice the page presents. Payment preparation attaches a recorded saved card or applies recorded save consent only when the request presents exactly that choice; a request without it presents new-card entry without save consent. A recorded preference that selects no card and grants no consent applies nothing, so it never blocks that request. Same-card retry (dormant until its rollout activates it): after the issuer declines the recorded saved card on the checkout's PaymentIntent, a request that sends `supportsSameCardRetry: true` and presents the same choice receives the same PaymentIntent and client secret again, in the same payment generation, with `sameCardRetry.paymentMethod` naming that card. The server writes nothing to the payment provider for this: the browser confirms the secret with exactly that card, as a deliberate shopper action. The server first answers paid truth, then requires current provider proof that the latest failure is an issuer decline (Charge outcome `issuer_declined`, including an issuer fraud alert the shopper cleared with their bank) of exactly that card, and decides authority, admission and the presented choice again under its final locks. A Radar block, a failed authentication, another card, a newer or cleared failure, or an undeclared request gets no retry. Once a client secret has been released, no server path writes a payment method into the PaymentIntent. Earlier client secrets remain valid, and a holder can still confirm directly with the payment provider, with any card.",
        "operationId": "PublicCheckoutPaymentController_createPaymentSession",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePaymentSessionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSessionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Session total is not yet binding (bind first), the bound amount must use `confirm-free`, or an ordinary one-time checkout lacks a current complete canonical billing address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Session not found or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The booking delivery snapshot is not ready for payment, or the checkout session is already paid because the existing PaymentIntent succeeded, or the current verified checkout email lacks a live matching CustomerSession. `CHECKOUT_ALREADY_PAID` means the linked PaymentIntent has succeeded, including an idempotent create replay. No client secret is returned. Discard payment controls and poll `GET /public/checkout/sessions/{token}` for authoritative confirmation, even while its status remains OPEN or PENDING_PAYMENT. Present payment received / order finalizing; do not prepare, submit, or invite another payment. If bounded polling is exhausted, retain that posture and offer a non-payment recheck or support path. Only authoritative CONFIRMED state establishes the order outcome; this response does not create an order or replace webhook/reconciliation authority. A generic 409 or RESOURCE_CONFLICT does not establish that payment succeeded. `CHECKOUT_IDENTITY_VERIFICATION_REQUIRED` requires that live matching session; `CHECKOUT_IDENTITY_CHANGED` requires refresh and a new bind unless the server can prove the bounded same-customer successor transition described above. Prepared-payment conflicts remain fail-closed and issue no new payment session. `CHECKOUT_SAVED_CARD_CHOICE_MISMATCH` means the checkout's current payment generation recorded a saved card or save consent that the request does not present, or the request presents a choice that is not recorded. No PaymentAttempt, save enrolment, card attachment, future-usage setting, or client secret was created for that choice. The checkout customer admission that precedes every payment preparation may already have run. Do not show card entry as a substitute. Present the recorded choice, or record a new one with `PUT /public/checkout/sessions/{token}/saved-card-preference`, then request the payment session again. When this checkout already holds a PaymentIntent, its provider state is read first, so an already-paid checkout still answers `CHECKOUT_ALREADY_PAID`, even before its webhook is processed. Three `CHECKOUT_PREPARED_PAYMENT_CONFLICT` reasons belong to this route alone, outside the shared prepared-payment catalog. `PREPARED_PAYMENT_SAME_CARD_RETRY_UNAVAILABLE`: the recorded saved card cannot be confirmed again on this payment, because there is no current provider proof of an issuer decline of it or the request did not declare `supportsSameCardRetry`. Offer another way to pay; repeating the request does not help. `PREPARED_PAYMENT_RECOVERY_REQUIRED`: the payment provider finally cancelled this saved card's PaymentIntent after its client secret could have been released, and no replacement is prepared automatically. Recover deliberately: `POST /public/checkout/sessions/{token}/reprice` (an unchanged reprice still advances the payment generation once the cancellation is proven), `POST /public/checkout/sessions/{token}/bind`, let the shopper review the refreshed checkout and choose a payment method again (`PUT /public/checkout/sessions/{token}/saved-card-preference`; the same saved card is allowed), then request a payment session. `PREPARED_PAYMENT_DELIBERATE_RECOVERY_REQUIRED`: an earlier provider write for this checkout's payment has no recorded outcome yet and may still execute: either the saved card's write into the PaymentIntent, or the PaymentIntent create itself. No client secret is released for that payment while that outcome stays unresolved, and an unresolved create is never sent again. If the request that made the write later receives the payment provider's answer, it resolves the outcome, and a later payment session can then return the same PaymentIntent's client secret without a reprice. Recover with the same deliberate sequence, which does not depend on that answer. The reprice cancels a known PaymentIntent and advances the payment generation only once the payment provider confirms the cancellation; with no known PaymentIntent it advances the generation without cancelling one. If it cannot prove the cancellation, the reprice answers `PREPARED_PAYMENT_CANCEL_AMBIGUOUS` and advances neither the generation nor the bound total, so the shopper can try again later. If another request changed the checkout first, it answers `PREPARED_PAYMENT_CANCEL_CONTENDED`: this reprice was not saved, so refresh and follow the current checkout state under the shared prepared-payment refresh policy. If a payment is already processing, it answers `PREPARED_PAYMENT_IN_FLIGHT`. For all three of this route's own reasons, no client secret is returned, and `details.preparedPaymentReleased` is true only when this request's own provider read proved the PaymentIntent cancelled; it is always false for `PREPARED_PAYMENT_DELIBERATE_RECOVERY_REQUIRED`. A same-card retry request whose PaymentIntent is already processing a confirmation made through an earlier client secret answers the shared `PREPARED_PAYMENT_IN_FLIGHT` reason: wait for payment status.\n\n`CHECKOUT_PREPARED_PAYMENT_CONFLICT`: the requested checkout mutation was not persisted. This does not guarantee that the previous prepared PaymentIntent remains usable; discard any held client secret. Branch on the scalar `details.reason`. `PREPARED_PAYMENT_SESSION_MOVED` and `PREPARED_PAYMENT_CANCEL_CONTENDED` can each represent either permanent legacy NULL-digest quarantine or a current lineage whose generation was already invalidated/admitted or moved concurrently. The envelope exposes neither digest nor generation and adds no discriminator, detail field, or reason. For either value, refresh and follow current state and discard any prior secret. If refreshed state is CONFIRMED, render/follow the durable completed order or status; do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon the session and start a new checkout. If it is active, follow the current binding and server-bound zero-vs-positive path: re-bind only if needed, retry `confirm-free` for zero, or request `payment-session` for positive, with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard any prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope. `PREPARED_PAYMENT_LINKAGE_CONTENDED` means refresh checkout state, bind if needed, and follow the server-bound zero-vs-positive path; `PREPARED_PAYMENT_LINKAGE_CONVERGED` is a benign concurrent convergence and means retry the matching completion flow after refresh; `PREPARED_PAYMENT_IN_FLIGHT` means freeze editing and wait for payment status; `PREPARED_PAYMENT_CANCEL_AMBIGUOUS` means refresh state and retry the checkout operation. The scalar `details.preparedPaymentReleased` is a boolean and is true only when cancellation of the exact PaymentIntent was confirmed by the payment provider. False means release was not proven; on the zero-total `confirm-free` compatibility path, it can also mean no PaymentIntent existed for that operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "sessionMoved": {
                    "summary": "Session moved during checkout completion",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed during completion. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_SESSION_MOVED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageContended": {
                    "summary": "Prepared-payment linkage was contended",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while completion was in progress. Refresh checkout state, bind if needed, then retry confirm-free for a zero total or request payment-session for a positive total.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageConverged": {
                    "summary": "Concurrent preparation converged safely",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "Another completion attempt for this checkout already converged safely. Refresh checkout state and retry the matching completion flow.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONVERGED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "paymentInFlight": {
                    "summary": "Payment is already in flight",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "A payment for this checkout is already being processed, so the total cannot change. Wait for it to complete before editing.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_IN_FLIGHT",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationAmbiguous": {
                    "summary": "Prepared-payment cancellation was not proven",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "We could not release the payment already prepared for this checkout. Refresh and try again.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_AMBIGUOUS",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationContended": {
                    "summary": "Prepared-payment cancellation lost a linkage race",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while its prepared payment was being released. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "Payment processor unavailable / not configured, or the persisted PaymentIntent is in an unusable state (e.g. amount/currency mismatch with the binding total, or an unhandled status). A same-card retry whose provider evidence could not be read (a timeout or provider error) also returns 502, with no client secret; nothing was written, and the request can be repeated. An impossible final ordinary payment policy returns INTERNAL_ERROR with details.reason PAYMENT_HANDOFF_POLICY_INVARIANT_VIOLATION and the generic message below. That server-contract breach returns no client secret, but attempt or provider effects may already exist; it promises neither cancellation nor no prior work, and supplies no automatic retry instruction.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "paymentHandoffPolicyInvariant": {
                    "summary": "Impossible final ordinary payment policy; no secret in this response",
                    "value": {
                      "code": "INTERNAL_ERROR",
                      "message": "An unexpected error occurred",
                      "details": {
                        "reason": "PAYMENT_HANDOFF_POLICY_INVARIANT_VIOLATION"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Ordinary one-time checkout activation is temporarily unavailable. No PaymentAttempt or provider operation was started; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE` is a different case: the checkout's frozen payment policy refuses payment for its current payment generation. A checkout that carries no payment policy receives the same refusal, with `details.reason` `NOT_ACTIVATED`, once it can no longer hand off a payment. `details.reason` names the refusal and `details.retry` is `NOT_RETRYABLE`: the identical request cannot succeed until activation, a correction or different input, so do not repeat it. No client secret is returned, although a PaymentAttempt or PaymentIntent may already exist for the generation. Paid truth answers first: a checkout whose PaymentIntent already succeeded returns `CHECKOUT_ALREADY_PAID` (409) instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "summary": "Create or refresh the Stripe payment session for a checkout.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions": {
      "post": {
        "description": "Runs an initial server-authoritative reprice over the submitted cart and persists the session + repriced lines + totals + discount snapshot. Returns the RAW token exactly once (store it client-side; the server keeps only its hash) plus the repriced summary. `isBinding` is false — call bind before requesting a payment session. Before persisting, checks server-resolved SALE quantities against catalog stock, including expanded package components. This read reserves nothing and is not a stock guarantee: confirmation remains authoritative and callers must handle every checkout error path.",
        "operationId": "PublicCheckoutSessionController_createSession",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "headers": {
              "X-Cartonium-GA4-Replacement-In-Force": {
                "description": "Optional public store setting. The literal 1 means that the tenant in the origin-selected commerce environment had adopted the GA4 replacement on this deployment plane before this original cart was written. Adoption remains in force after disable or invalidation. A closed deployment gate, failed lookup or result that arrives after the write begins leaves the header absent. Checkout proceeds independently. A storefront server may use the header on its own fresh cart response to prepare the consent handoff and must strip it from its shopper response. Shopper choice and permission to collect are evaluated separately. Checkout requires no API key or extra request for this signal.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "1"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCheckoutSessionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "A line references a non-purchasable item/variant. An item that becomes inactive, archived or missing between repricing and admission returns VALIDATION_FAILED with details: {field: \"lines\", itemId, variantId}. At admission, a selected SALE variant that is no longer live on its item returns VALIDATION_FAILED with details: {field: \"lines.variantId\", itemId, variantId}. Both catalog refusals have no stock reason or counts. An item-level SALE target with any variant history returns VALIDATION_FAILED with details.reason: ITEM_LEVEL_INVENTORY_REQUIRES_NO_VARIANTS and field: \"lines.variantId\" at either repricing or admission; select an exact variant. These are catalog validation errors, not INSUFFICIENT_INVENTORY shortfalls.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "A line references an item sold through booking availability; choose a booking window before checkout. A measured SALE stock shortfall also returns RESOURCE_CONFLICT with details.reason: INSUFFICIENT_INVENTORY and details.lines[] naming every offending exact item/variant target. Each entry has {itemId, variantId, name, requested?, available?}, the same per-line shape as confirm-free details.line. Repeated targets are grouped: requested is their summed quantity and name joins their names. Counts are published only together and only when requested > available; absent counts never mean zero. Missing inventory rows, ambiguous duplicate rows, and malformed stock evidence cannot establish a shortfall and do not cause this refusal. A null variantId means the item-level target, allowed only for an item with no variant history (including archived variants); invalid catalog targets remain 400 validation errors. No session is created on refusal: correct the quantity in the originating storefront and submit create again. This check applies regardless of reserveDuringCheckout, creates no hold, and does not change token resume or confirmation authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "insufficientInventory": {
                    "summary": "Correct the short quantities before creating a checkout",
                    "value": {
                      "code": "RESOURCE_CONFLICT",
                      "message": "Items in this checkout are no longer available",
                      "details": {
                        "reason": "INSUFFICIENT_INVENTORY",
                        "lines": [
                          {
                            "itemId": "2f0d9a6c-6e2f-4a71-9a63-0f2f1a5b7c31",
                            "variantId": null,
                            "name": "Facial Serum Unscented 30ml",
                            "requested": 2,
                            "available": 1
                          },
                          {
                            "itemId": "a0d1cb48-dd2e-408f-9b45-b6fd767e75bc",
                            "variantId": "1f60dcbb-db69-4527-83d9-dc49a2ddfa1a",
                            "name": "Hand Cream — Unscented",
                            "requested": 1,
                            "available": 0
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. A 503 with `CHECKOUT_UNAVAILABLE` and `details.retry` `NOT_RETRYABLE` means this storefront cannot create a checkout now: do not repeat the identical request or fall back to another checkout or payment path; show checkout as unavailable. No checkout was created, and the response carries no reason. While checkout payment policy applies to this storefront, a transient policy fault can instead return `HOSTED_CHECKOUT_POLICY_UNAVAILABLE` with `details.retry` `SAME_REQUEST_LATER`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "checkoutUnavailable": {
                    "summary": "Checkout is unavailable for this storefront",
                    "value": {
                      "code": "CHECKOUT_UNAVAILABLE",
                      "message": "Checkout is unavailable",
                      "details": {
                        "retry": "NOT_RETRYABLE"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Create a checkout session (mints the opaque session token).",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/reprice": {
      "post": {
        "description": "Recomputes lines + totals + discount snapshot from the submitted cart and persists them. `isBinding` stays false — this is a mutable estimate, not a commitment.\n\nA reprice never rejects the shipping selection: an unresolvable `shippingRateId` (stale/rotated live rate, destination change, subtotal floor) degrades the preview to no shipping (`200`, shipping dropped) and the refreshed `availableShippingOptions` re-drive selection. Only **bind** rejects it (`400` with a stable `details.reason`) — a preview will NOT reveal a dead selection, so drive recovery from the bind failure.\n\nA live carrier-rate quote that fails during the preview is still a `200`, but the response carries `shippingQuoteFailure` (#4673) so an empty or flat-only option list caused by a provider timeout or outage is not mistaken for an unserviceable address. Recover with an explicit reprice that sets `refreshShippingRates: true` — never an automatic loop, bind, or payment replay.",
        "operationId": "PublicCheckoutSessionController_reprice",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepriceCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Session not found, expired, or not OPEN.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "A line references an item sold through booking availability; choose a booking window before checkout.\n\n`CHECKOUT_PREPARED_PAYMENT_CONFLICT`: the requested checkout mutation was not persisted. This does not guarantee that the previous prepared PaymentIntent remains usable; discard any held client secret. Branch on the scalar `details.reason`. `PREPARED_PAYMENT_SESSION_MOVED` and `PREPARED_PAYMENT_CANCEL_CONTENDED` can each represent either permanent legacy NULL-digest quarantine or a current lineage whose generation was already invalidated/admitted or moved concurrently. The envelope exposes neither digest nor generation and adds no discriminator, detail field, or reason. For either value, refresh and follow current state and discard any prior secret. If refreshed state is CONFIRMED, render/follow the durable completed order or status; do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon the session and start a new checkout. If it is active, follow the current binding and server-bound zero-vs-positive path: re-bind only if needed, retry `confirm-free` for zero, or request `payment-session` for positive, with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard any prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope. `PREPARED_PAYMENT_LINKAGE_CONTENDED` means refresh checkout state, bind if needed, and follow the server-bound zero-vs-positive path; `PREPARED_PAYMENT_LINKAGE_CONVERGED` is a benign concurrent convergence and means retry the matching completion flow after refresh; `PREPARED_PAYMENT_IN_FLIGHT` means freeze editing and wait for payment status; `PREPARED_PAYMENT_CANCEL_AMBIGUOUS` means refresh state and retry the checkout operation. The scalar `details.preparedPaymentReleased` is a boolean and is true only when cancellation of the exact PaymentIntent was confirmed by the payment provider. False means release was not proven; on the zero-total `confirm-free` compatibility path, it can also mean no PaymentIntent existed for that operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "sessionMoved": {
                    "summary": "Session moved during checkout completion",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed during completion. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_SESSION_MOVED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageContended": {
                    "summary": "Prepared-payment linkage was contended",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while completion was in progress. Refresh checkout state, bind if needed, then retry confirm-free for a zero total or request payment-session for a positive total.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageConverged": {
                    "summary": "Concurrent preparation converged safely",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "Another completion attempt for this checkout already converged safely. Refresh checkout state and retry the matching completion flow.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONVERGED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "paymentInFlight": {
                    "summary": "Payment is already in flight",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "A payment for this checkout is already being processed, so the total cannot change. Wait for it to complete before editing.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_IN_FLIGHT",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationAmbiguous": {
                    "summary": "Prepared-payment cancellation was not proven",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "We could not release the payment already prepared for this checkout. Refresh and try again.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_AMBIGUOUS",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationContended": {
                    "summary": "Prepared-payment cancellation lost a linkage race",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while its prepared payment was being released. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. Ordinary one-time checkout activation is temporarily unavailable. No checkout mutation or provider operation was started; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Reprice a checkout session (cart/coupon changed).",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/contact": {
      "put": {
        "description": "Requires the checkout token and matching tenant. Saves email and optional name/phone on an OPEN, unbound, unexpired ordinary checkout without changing pricing, expiry or payment state. This is draft contact, not proof of account ownership: a registered address still requires verification at binding/payment. This does not attach a customer, subscribe an address, or authorize recovery delivery.",
        "operationId": "PublicCheckoutSessionController_saveContact",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCheckoutContactDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveCheckoutContactResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Neutral response for unavailable, foreign, expired, bound or completed checkout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Save hosted checkout contact before payment.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/tax-preview": {
      "post": {
        "description": "Tenant-scoped checkout-token read with draft inputs in a POST body. Reprices merchandise and shipping server-side and calculates tax on the tenant account. Creates a Stripe Tax Calculation when needed, with bounded short-lived estimate reuse. On enabled persistent staging, an unresolved Buy/Get comparison may use one additional ordinary-cart tax calculation. Does not persist addresses or checkout state, reserve coupons, bind, or create a payment intent. For ordinary one-time checkout only; shipping wins for shippable carts, otherwise billing. Bind always recalculates before payment. Invalid, cross-tenant, expired and unsupported tokens return the same neutral 404.",
        "operationId": "PublicCheckoutSessionController_previewTax",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutTaxPreviewRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutTaxPreviewResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Estimate checkout tax before payment.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/bind": {
      "post": {
        "description": "Re-reprices the submitted cart server-side and locks the result as binding (`isBinding = true`) so the total reflects live prices at the moment of commitment. `status` stays OPEN. This is the step #604 depends on — a payment session can only be created once bound.\n\nUnlike create/reprice, bind is the pay step, so `customer` is REQUIRED here and `customer.name` must be non-blank: a CONFIRMED order must carry a real customer name (#741). A non-blank `customer.email` is likewise required before payment (#605). Either may have been supplied at create or an earlier reprice; a bind that would commit without a usable name or email is rejected with a `400`. When the tenant public config reports `phoneRequired: true`, the same effective-value rule applies to `customer.phone` for ordinary cart checkout; omission is rejected with a field-keyed `400`. Subscription and booking checkout are excluded.\n\nFor an ordinary one-time checkout, the binding semantic identity covers normalized line identity, variant, quantity, and pricing references; discount attribution and snapshot; recipient and fulfillment/tax address facts; shipping method/rate/package basis; tax basis and snapshot; amount; and currency. An exact semantic bind replay preserves a healthy prepared PaymentIntent and its payment generation. Any semantic change — even when the total is equal — invalidates every linked prepared PaymentIntent. All linked prepared intents, if any, must be provider-proven canceled before the new bind commits; an attempt-free semantic change can advance without provider I/O. Once that gate succeeds, the bind advances the generation and requires a fresh payment-session/client secret. If the effective checkout email currently belongs to a verified customer, bind also requires a live CustomerSession for that same organization and normalized email. BYO and cross-origin hosted clients supply it as bearer authority; only a client on the API origin can send the API-scoped `__Host-` cookie, because a cookie scoped to another hosted origin never crosses to this API. Checkout remains guest-capable for an unverified email, and an earlier identity `proceed` result never waives this live re-check. An ambiguous or contended release returns `CHECKOUT_PREPARED_PAYMENT_CONFLICT` without persisting the requested bind.\n\nAfter the current binding lineage is verified under the session lock, bind rechecks server-repriced SALE/component stock before persistence. A measured shortfall returns RESOURCE_CONFLICT / INSUFFICIENT_INVENTORY with details.lines[] in the create-time shape. The session stays OPEN and re-bindable: correct the quantity or retry after stock is replenished. Every bind request, including an exact semantic replay, rechecks stock. A refused exact replay preserves the existing binding and any prepared PaymentIntent; it does not cancel that payment or refresh the session TTL. A semantic correction still requires the cancellation proof described above. Missing inventory is not zero, and this advisory read creates no hold. Confirmation remains authoritative.",
        "operationId": "PublicCheckoutSessionController_bind",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Shipping or address rejection (`code: BAD_REQUEST` with a scalar `details.reason`) — bind is the commitment, so these reasons fail here and ONLY here. An unresolvable selection silently degrades a reprice to no shipping (`200`, shipping dropped), while address validation rides the successful preview response as guidance. Branch on `details.reason`, never on `message`: `SHIPPING_RATE_NOT_QUOTABLE` (the selected rate cannot be re-quoted — for live carrier rates the quote-scoped `rateId` may simply have rotated past its quote), `SHIPPING_RATE_NOT_APPLICABLE_TO_DESTINATION` (no active zone serves the captured destination), `SHIPPING_RATE_BELOW_SUBTOTAL_MINIMUM` (the cart no longer meets the rate's configured minimum), and `SHIPPING_DELIVERY_PROMISE_UNAVAILABLE` (the selected delivery promise can no longer be presented) all share one recovery: re-quote via reprice, replace the entire option set from `availableShippingOptions`, require the shopper to explicitly reconfirm a delivery method from the fresh set (never auto-restore a prior selection by label and never bind an unconfirmed substitute), then bind again. `SHIPPING_ADDRESS_REQUIRED` means a rate was selected before any shipping/billing address. `SHIPPING_ADDRESS_INVALID` means either the provider rejected the address or its normalized address materially changes the U.S. country, state, or five-digit ZIP, regardless of a non-invalid provider verdict. In either case, use the shopper-safe `violations` and any `details.addressValidation.normalized` suggestion to correct or apply the address before re-quoting. `SHIPPING_ADDRESS_REVIEW_REQUIRED` leaves the session unbound because the provider suggested a non-blocking correction. Show `details.addressValidation.normalized`; the shopper may either reprice with that suggestion and bind normally, or repeat bind with `shippingAddressValidationDecision: KEEP_ENTERED`. The repeat bind revalidates and the decision never overrides an invalid address, a material country/state/five-digit-ZIP correction, or provider failure. A classified live-provider bind failure additionally carries `details.shippingFailure`: `stage: shipping_rate_bind`, a normalized `category`, same-input `retryable`, `paymentAttempted: false`, and an opaque `supportReference` that correlates to a redacted server event. `retryAfterSeconds` is optional and rate-limit-only. The public shape accepts it only as an integer from 1 through 86400. The support reference grammar is `^lrb_[A-Za-z0-9_-]{16}$`. Categories are `invalid_address`, `unknown_provider_rejection`, `configuration_failure`, `authentication_failure`, `rate_limited`, `timeout`, `network_failure`, `provider_outage`, and `no_usable_rates`; retryability is canonical for each category. The diagnostic and correlated log metadata never include provider prose, response bodies, field values, checkout tokens, addresses, customer data, or credentials. `invalid_address` may additionally retain the existing shopper-safe `violations` and `addressValidation` suggestion contract. A classified failure must return the shopper to Delivery; retryable is evidence about a later rate request, not authority for an automatic bind or payment replay.\n\nValidation failed (e.g. missing/blank `customer.name`), or the effective customer name / email is still blank, the effective customer phone is blank when the tenant requires it. Every ordinary one-time checkout also requires a complete canonical billing address (`billingAddress`) before binding, regardless of tax-provider configuration; a fulfillment-required cart must also satisfy its shipping-address and shipping-method rules. Catalog-target refusals remain VALIDATION_FAILED without stock counts: a missing, inactive or archived item identifies lines; an unavailable selected SALE variant identifies lines.variantId. An item-level SALE target with any variant history identifies lines.variantId with ITEM_LEVEL_INVENTORY_REQUIRES_NO_VARIANTS. These validation errors must not render a numeric shortfall sentence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "rateNotQuotable": {
                    "summary": "Selected rate can no longer be quoted",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the selected shipping rate is not available",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE"
                      }
                    }
                  },
                  "unknownProviderRejection": {
                    "summary": "Provider rejected the quote without an actionable reason",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "We couldn't confirm a shipping rate, so payment was not attempted. Review the delivery address or try the rates again. If the problem continues, contact support.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "unknown_provider_rejection",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableProviderOutage": {
                    "summary": "Live-rate provider outage before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "Shipping rates are temporarily unavailable, so payment was not attempted. Try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "provider_outage",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableConfigurationFailure": {
                    "summary": "Merchant shipping configuration rejected before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The store's shipping setup couldn't provide a rate, so payment was not attempted. Contact support for help.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "configuration_failure",
                          "retryable": false,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableAuthenticationFailure": {
                    "summary": "Live-rate provider authentication failed before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The store's shipping service needs attention before it can provide rates, so payment was not attempted. Contact support for help.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "authentication_failure",
                          "retryable": false,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableTimeout": {
                    "summary": "Live-rate provider timed out before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The shipping service took too long to confirm a rate, so payment was not attempted. Try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "timeout",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableNetworkFailure": {
                    "summary": "Live-rate provider could not be reached before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "We couldn't reach the shipping service to confirm a rate, so payment was not attempted. Try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "network_failure",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableNoUsableRates": {
                    "summary": "Live-rate provider returned no usable rates before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "No shipping rates are currently available for this delivery, so payment was not attempted. Review the delivery address or try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "no_usable_rates",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableRateLimited": {
                    "summary": "Live-rate provider asked the caller to retry later",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "Shipping rates are temporarily busy, so payment was not attempted. Wait a moment, then try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "rate_limited",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL",
                          "retryAfterSeconds": 30
                        }
                      }
                    }
                  },
                  "rateNotQuotableExcludedByPresentation": {
                    "summary": "Every quoted service excluded while a selection was supplied",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "no shipping methods are currently available for this destination — please contact the store",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE"
                      }
                    }
                  },
                  "rateNotQuotableShippingUnconfigured": {
                    "summary": "Shipping zones deactivated while a selection was supplied",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "this order requires shipping, but the store has not set up shipping yet",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE"
                      }
                    }
                  },
                  "rateNotApplicableToDestination": {
                    "summary": "Selected rate does not serve this destination",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the selected shipping rate is not available for this destination",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_APPLICABLE_TO_DESTINATION"
                      }
                    }
                  },
                  "rateNotApplicableUnservedDestination": {
                    "summary": "No active zone serves the destination while a selection was supplied",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "we do not ship to the selected destination",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_APPLICABLE_TO_DESTINATION"
                      }
                    }
                  },
                  "rateBelowSubtotalMinimum": {
                    "summary": "Cart fell below the selected rate's minimum",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the selected shipping rate is not available for this order subtotal",
                      "details": {
                        "reason": "SHIPPING_RATE_BELOW_SUBTOTAL_MINIMUM"
                      }
                    }
                  },
                  "deliveryPromiseUnavailable": {
                    "summary": "Selected delivery promise can no longer be presented",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The selected delivery promise is no longer available.",
                      "details": {
                        "reason": "SHIPPING_DELIVERY_PROMISE_UNAVAILABLE"
                      }
                    }
                  },
                  "addressRequired": {
                    "summary": "Rate selected before an address exists",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "a shipping or billing address is required to apply a shipping rate",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_REQUIRED"
                      }
                    }
                  },
                  "addressInvalid": {
                    "summary": "Carrier confirmed the delivery address is invalid before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The delivery address could not be verified, so payment was not attempted. Check the street address, city, state, and ZIP or postal code, then update the address before continuing.",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_INVALID",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "invalid_address",
                          "retryable": false,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        },
                        "violations": [
                          "shippingAddress.postalCode was rejected by the fulfillment provider"
                        ],
                        "addressValidation": {
                          "status": "invalid",
                          "messages": [],
                          "normalized": null
                        }
                      }
                    }
                  },
                  "addressMaterialCorrection": {
                    "summary": "Verified suggestion materially changes the U.S. routing locality",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the delivery address could not be verified — check the city, state, and ZIP or postal code and try again",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_INVALID",
                        "violations": [
                          "shippingAddress.state differs from the provider-suggested address",
                          "shippingAddress.postalCode differs from the provider-suggested address"
                        ],
                        "addressValidation": {
                          "status": "verified",
                          "messages": [
                            "A corrected delivery locality is available."
                          ],
                          "normalized": {
                            "line1": "10 Market St",
                            "line2": null,
                            "city": "San Jose",
                            "state": "CA",
                            "postalCode": "95113-1903",
                            "country": "US"
                          }
                        }
                      }
                    }
                  },
                  "addressReviewRequired": {
                    "summary": "Provider suggested a non-blocking address correction",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "review the suggested delivery address before continuing",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_REVIEW_REQUIRED",
                        "addressValidation": {
                          "status": "verified",
                          "messages": [
                            "A more precise delivery address is available."
                          ],
                          "normalized": {
                            "line1": "123 Main St",
                            "line2": null,
                            "city": "Boise",
                            "state": "ID",
                            "postalCode": "83702-1234",
                            "country": "US"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Session not found, expired, or not OPEN at initial resolution. A same-lineage session that becomes terminal or expires before the locked write also returns 404; a successor binding detected after resolution returns 409 PREPARED_PAYMENT_SESSION_MOVED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "A line references an item sold through booking availability; choose a booking window before checkout. RESOURCE_CONFLICT with details.checkoutCouponRemovalQuote supplies the ordinary currency and total when the promo code result is unresolved or an accepted ordinary price changed. After explicit shopper confirmation, omit couponCode and bind with that amount in acceptedCouponRemovalQuote. RESOURCE_CONFLICT with details.reason CHECKOUT_TAX_POLICY_CHANGED requires a fresh bind because the stored tax policy changed during this request. TENANT_TAX_NOT_CONFIGURED means the stored manual tax acknowledgement is invalid, or a stored Stripe Tax policy has a tax base but its connected payment account or Tax settings are incomplete. A fully discounted cart with no charged shipping needs no connected-account Tax calculation, but still requires platform tax availability for stored Stripe Tax. `CHECKOUT_IDENTITY_VERIFICATION_REQUIRED` requires a live CustomerSession matching the current organization and normalized email; `CHECKOUT_IDENTITY_CHANGED` requires refresh and a new bind against the current identity version. A measured SALE stock shortfall returns RESOURCE_CONFLICT with details.reason INSUFFICIENT_INVENTORY and details.lines[] containing every short target: {itemId, variantId, name, requested, available}. Counts are units of the exact item/variant stock target; composed selections use expanded component units, not package quantities. Both counts appear together only for requested > available. The session remains recoverable. A successor binding lineage wins over an obsolete stock result: CHECKOUT_PREPARED_PAYMENT_CONFLICT with PREPARED_PAYMENT_SESSION_MOVED requires refresh and following current state, without a shortfall line or counts. Every bind request, including an exact semantic replay, rechecks stock. A refused exact replay rolls back this request's session, TTL and coupon changes while preserving the existing binding and any prepared PaymentIntent; it does not cancel that payment. A semantic correction still follows the cancellation-proof path and can separately return PREPARED_PAYMENT_CANCEL_AMBIGUOUS or PREPARED_PAYMENT_IN_FLIGHT. Confirmation remains authoritative.\n\n`CHECKOUT_PREPARED_PAYMENT_CONFLICT`: the requested checkout mutation was not persisted. This does not guarantee that the previous prepared PaymentIntent remains usable; discard any held client secret. Branch on the scalar `details.reason`. `PREPARED_PAYMENT_SESSION_MOVED` and `PREPARED_PAYMENT_CANCEL_CONTENDED` can each represent either permanent legacy NULL-digest quarantine or a current lineage whose generation was already invalidated/admitted or moved concurrently. The envelope exposes neither digest nor generation and adds no discriminator, detail field, or reason. For either value, refresh and follow current state and discard any prior secret. If refreshed state is CONFIRMED, render/follow the durable completed order or status; do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon the session and start a new checkout. If it is active, follow the current binding and server-bound zero-vs-positive path: re-bind only if needed, retry `confirm-free` for zero, or request `payment-session` for positive, with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard any prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope. `PREPARED_PAYMENT_LINKAGE_CONTENDED` means refresh checkout state, bind if needed, and follow the server-bound zero-vs-positive path; `PREPARED_PAYMENT_LINKAGE_CONVERGED` is a benign concurrent convergence and means retry the matching completion flow after refresh; `PREPARED_PAYMENT_IN_FLIGHT` means freeze editing and wait for payment status; `PREPARED_PAYMENT_CANCEL_AMBIGUOUS` means refresh state and retry the checkout operation. The scalar `details.preparedPaymentReleased` is a boolean and is true only when cancellation of the exact PaymentIntent was confirmed by the payment provider. False means release was not proven; on the zero-total `confirm-free` compatibility path, it can also mean no PaymentIntent existed for that operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "sessionMoved": {
                    "summary": "Session moved during checkout completion",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed during completion. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_SESSION_MOVED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageContended": {
                    "summary": "Prepared-payment linkage was contended",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while completion was in progress. Refresh checkout state, bind if needed, then retry confirm-free for a zero total or request payment-session for a positive total.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageConverged": {
                    "summary": "Concurrent preparation converged safely",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "Another completion attempt for this checkout already converged safely. Refresh checkout state and retry the matching completion flow.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONVERGED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "paymentInFlight": {
                    "summary": "Payment is already in flight",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "A payment for this checkout is already being processed, so the total cannot change. Wait for it to complete before editing.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_IN_FLIGHT",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationAmbiguous": {
                    "summary": "Prepared-payment cancellation was not proven",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "We could not release the payment already prepared for this checkout. Refresh and try again.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_AMBIGUOUS",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationContended": {
                    "summary": "Prepared-payment cancellation lost a linkage race",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while its prepared payment was being released. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "Tax provider error (#875). When the tenant has Stripe Tax enabled (ADR-008), an upstream tax-calculation failure during bind surfaces as a 502 — `computeTaxForBind` is fail-closed, so the bind did NOT commit and no total was locked. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. PLATFORM_TAX_UNAVAILABLE when stored taxMode is stripe_tax (including the default persisted by an ordinary Checkout settings save) but the connected tax provider is unavailable; contact cartonium support. This includes fully discounted carts. No binding total, order or payment is committed. A separate 503 may indicate ordinary one-time checkout activation is temporarily unavailable; in that case no checkout mutation or provider operation was started. Retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Bind a checkout session to its authoritative total.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{checkoutToken}/identity/next-action": {
      "post": {
        "description": "Evaluates the submitted checkout email for the session identified by the opaque checkout token and returns exactly one of two ordinary outcomes: `verify` when the tenant/email customer is already verified, otherwise `proceed`. Both use this same status and schema; the response never states whether an account exists and carries no customer identifier, verification timestamp, or profile data.\n\nThe email is normalized server-side (trim + lowercase). Repeating a normalization-equivalent email is idempotent and returns the durable cached outcome for the current server-owned identity version; a meaningful change advances that version by one and invalidates the prior server-side continuation. Each new version is admitted through durable per-tenant evaluation windows (5 per 15 minutes per normalized email, 100 per 15 minutes per trusted client IP, reserved atomically); when a window is exhausted the version durably resolves to the ordinary `proceed` — never a throttle-shaped response — and an already evaluated version always keeps its cached outcome.\n\nThe result is a non-authoritative hint that drives the checkout UI: it grants no authentication, payment, account, or account-history authority, and no later checkout step derives authority from this response. Requires the valid current checkout credential; `Origin`, CORS, and headers are not authority.",
        "operationId": "PublicCheckoutSessionController_identityNextAction",
        "parameters": [
          {
            "name": "checkoutToken",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutIdentityNextActionRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutIdentityNextActionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed (missing or malformed `email`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Session not found, expired, or not OPEN.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Resolve the neutral identity next action for the checkout email.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/confirm-free": {
      "post": {
        "description": "Completes a *binding* checkout session whose server-computed total cannot be charged, into a CONFIRMED order with no Stripe payment.\n\n**Do not decide between this endpoint and `payment-session` by inspecting the total yourself.** Branch on the bound session summary's `requiresFreeConfirmation` flag: `true` means use this endpoint, `false` means use `POST …/{token}/payment-session`. The threshold is a payment-provider fact that varies by currency and changes on the provider's schedule, so a client-side comparison will drift from the server (#3263).\n\nTwo kinds of total qualify: exactly `0` (e.g. a 100%-off or fixed-amount-≥-subtotal coupon — #873, the free-order path ADR-006 deferred), and a total above `0` but below the provider's per-currency minimum, which the provider rejects and which therefore surfaced as an unactionable `500` before #3263. Both are RE-VERIFIED server-side from the bound session at confirm time: a chargeable total is rejected with a `400` and must pay through `payment-session` instead — a client can never opt a priced cart into a free completion.\n\nBooking, booking-group, and subscription checkouts have no no-charge completion path and are refused here regardless of total; `requiresFreeConfirmation` is always `false` for them.\n\nAt the final atomic gate, the server re-checks current checkout identity authority before creating an order, reserving inventory, redeeming a coupon, or making any terminal mutation. If the effective email is now verified, the request must carry a live CustomerSession for the same organization and normalized email. BYO and cross-origin hosted clients supply it as bearer authority; a cookie scoped to another hosted origin does not cross to this API. An earlier identity `proceed` result does not waive this check.\n\nFor an ordinary one-time checkout already in `PENDING_PAYMENT` and frozen to verified CustomerSession A, an expired or revoked A may be renewed to live successor B only when B matches the same organization, normalized email, identity version, and Customer. The server first admits and fences A's exact payment generation, proves every linked provider object cannot produce successful or ambiguous money, then installs B and advances exactly one generation before the no-charge order gate runs. An attempt-free no-charge generation performs no provider call and creates no PaymentAttempt, PaymentIntent, client secret, or replacement payment money. A missing or still-live predecessor, a wrong-tenant/email/customer successor, or an ambiguous, processing, requires-capture, succeeded, or contended old payment fails closed without rotating identity or creating a no-charge order. If the exact A payment has succeeded, paid finalization remains authoritative and converges on exactly one A-linked order. Concurrent renewal/confirmation retries converge only from the durable confirmed checkout and never let stale A regain authority.\n\nRuns the same confirmation machinery as the webhook-authoritative paid path (atomic exactly-one-order gate, inventory reservation, coupon redemption, confirmation email), so the call is idempotent: repeating it (or racing a duplicate) returns the same CONFIRMED summary and never creates a second order. On success the returned summary is already `status: CONFIRMED` — surfaces should render their confirmed state from it directly (no webhook wait, no polling).\n\nAn ordinary one-time session whose legacy binding has no semantic digest, whose current payment generation is already invalidated, or whose binding lineage moves during the final locked order-link gate fails closed with `CHECKOUT_PREPARED_PAYMENT_CONFLICT`, `details.reason: PREPARED_PAYMENT_SESSION_MOVED`, and `details.preparedPaymentReleased: false`. This request's transaction commits no order, but refresh may reveal that another lineage already confirmed and linked one. The wire envelope exposes neither digest nor generation, so it cannot distinguish permanent legacy quarantine from a current lineage whose generation was already invalidated or moved in a race, and it adds no new discriminator, detail field, or reason. Refresh and follow current state and discard any prior secret. If state is CONFIRMED, render/follow the durable completed order/status and do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon it and start a new checkout. If it is active, follow the current binding and server-bound total: re-bind only if needed, then follow `requiresFreeConfirmation` on the refreshed summary — retry `confirm-free` when it is `true`, or request payment-session when it is `false` — with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively dead/nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard every prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope.",
        "operationId": "PublicCheckoutSessionController_confirmFree",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Session is not yet binding (reprice/bind first), the bound total is chargeable (use the payment session), the session lacks the customer email/name bind normally enforces, or an ordinary one-time checkout lacks a current complete canonical billing address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Session not found, expired, or in a terminal state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`CHECKOUT_IDENTITY_VERIFICATION_REQUIRED` requires a live CustomerSession matching the current organization and normalized email; `CHECKOUT_IDENTITY_CHANGED` requires refresh and a new bind against the current identity version. A bounded verified successor renewal also fails closed when the frozen predecessor is missing or still live, the successor does not exactly match tenant and identity authority, or old-generation money is ambiguous, in flight, successful, or contended; no successor generation or no-charge order is created by this request in those cases, while exact successful A money remains authoritative for paid finalization. Items could not be reserved (no longer available); the session is cancelled and a fresh checkout is required. That arm is published as `RESOURCE_CONFLICT` with `details.reason: INSUFFICIENT_INVENTORY` and a `details.line` naming the offending item (`itemId`, `variantId`, `name`) and, for a measured shortfall, the `requested` and `available` quantities. The engine stops at the FIRST short line, so exactly one line is reported even when several are short. Every `details.line` field is nullable or absent: `itemId`, `variantId` and `name` may each be `null` (the envelope degrades to nulls when the engine's failure details cannot be read, while `details.reason` still classifies it), and `requested`/`available` are OMITTED when the reservation failed for a missing item, a vanished inventory row, or an item-level catalog target that became invalid after variants were added rather than a measured shortfall, so read them defensively. The session is already CANCELLED when this response is returned — it is terminal: a later `confirm-free` or `payment-session` call on the token is the neutral 404, while the session read still returns the CANCELLED summary, and the remedy is a NEW checkout at the corrected quantity, never a retry of this one. `CHECKOUT_PREPARED_PAYMENT_CONFLICT` with `details.reason: PREPARED_PAYMENT_SESSION_MOVED` means the ordinary one-time binding has no trustworthy current semantic lineage; this request's transaction commits no order, while refreshed state may already be CONFIRMED after another lineage won. `details.preparedPaymentReleased` is `false`. The envelope exposes neither digest nor generation and adds no new discriminator, detail field, or reason, so permanent legacy quarantine cannot be distinguished from a current lineage whose generation was already invalidated or moved in a race. Refresh and follow current state and discard any prior secret. If state is CONFIRMED, render/follow the durable completed order/status and do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon it and start a new checkout. If it is active, follow the current binding and server-bound total: re-bind only if needed, retry `confirm-free` for zero, or request payment-session for positive, with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively dead/nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard every prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope.\n\n`CHECKOUT_PREPARED_PAYMENT_CONFLICT`: the requested checkout mutation was not persisted. This does not guarantee that the previous prepared PaymentIntent remains usable; discard any held client secret. Branch on the scalar `details.reason`. `PREPARED_PAYMENT_SESSION_MOVED` and `PREPARED_PAYMENT_CANCEL_CONTENDED` can each represent either permanent legacy NULL-digest quarantine or a current lineage whose generation was already invalidated/admitted or moved concurrently. The envelope exposes neither digest nor generation and adds no discriminator, detail field, or reason. For either value, refresh and follow current state and discard any prior secret. If refreshed state is CONFIRMED, render/follow the durable completed order or status; do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon the session and start a new checkout. If it is active, follow the current binding and server-bound zero-vs-positive path: re-bind only if needed, retry `confirm-free` for zero, or request `payment-session` for positive, with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard any prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope. `PREPARED_PAYMENT_LINKAGE_CONTENDED` means refresh checkout state, bind if needed, and follow the server-bound zero-vs-positive path; `PREPARED_PAYMENT_LINKAGE_CONVERGED` is a benign concurrent convergence and means retry the matching completion flow after refresh; `PREPARED_PAYMENT_IN_FLIGHT` means freeze editing and wait for payment status; `PREPARED_PAYMENT_CANCEL_AMBIGUOUS` means refresh state and retry the checkout operation. The scalar `details.preparedPaymentReleased` is a boolean and is true only when cancellation of the exact PaymentIntent was confirmed by the payment provider. False means release was not proven; on the zero-total `confirm-free` compatibility path, it can also mean no PaymentIntent existed for that operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "sessionMoved": {
                    "summary": "Session moved during checkout completion",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed during completion. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_SESSION_MOVED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "insufficientInventory": {
                    "summary": "A line could not be reserved; the session is cancelled",
                    "value": {
                      "code": "RESOURCE_CONFLICT",
                      "message": "Items in this checkout are no longer available",
                      "details": {
                        "reason": "INSUFFICIENT_INVENTORY",
                        "line": {
                          "itemId": "2f0d9a6c-6e2f-4a71-9a63-0f2f1a5b7c31",
                          "variantId": null,
                          "name": "Facial Serum Unscented 30ml",
                          "requested": 2,
                          "available": 1
                        }
                      }
                    }
                  },
                  "linkageContended": {
                    "summary": "Prepared-payment linkage was contended",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while completion was in progress. Refresh checkout state, bind if needed, then retry confirm-free for a zero total or request payment-session for a positive total.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageConverged": {
                    "summary": "Concurrent preparation converged safely",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "Another completion attempt for this checkout already converged safely. Refresh checkout state and retry the matching completion flow.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONVERGED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "paymentInFlight": {
                    "summary": "Payment is already in flight",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "A payment for this checkout is already being processed, so the total cannot change. Wait for it to complete before editing.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_IN_FLIGHT",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationAmbiguous": {
                    "summary": "Prepared-payment cancellation was not proven",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "We could not release the payment already prepared for this checkout. Refresh and try again.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_AMBIGUOUS",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationContended": {
                    "summary": "Prepared-payment cancellation lost a linkage race",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while its prepared payment was being released. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "Ordinary one-time checkout activation is temporarily unavailable. This request committed no order; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Confirm a checkout whose total cannot be charged — no payment taken.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/saved-payment-methods": {
      "get": {
        "description": "Serves hosted cartonium checkout and tenant-built (BYO) one-time checkouts alike. Requires a live verified CustomerSession that exactly matches the checkout binding. Cards are returned only from the checkout’s frozen connected account, and only when both the checkout’s immutable payment-policy snapshot and its current payment generation admit Cards; hosted applicability alone never decides this. Provider/platform fallbacks are never used. A listed card is not purchase authority: payment preparation re-checks the same policy under its own locks.",
        "operationId": "PublicCheckoutSessionController_savedPaymentMethods",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedCheckoutSavedCardOptionsDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "Checkout, exact verified identity binding, connected account, or Cards policy is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "The stored selected card is no longer selectable. Submit a new saved-card preference with a current method or null for a new card, then list the methods again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "Ordinary one-time checkout activation is temporarily unavailable. No saved card was read and nothing changed; retry after the service becomes ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List saved cards available to this checkout.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/saved-card-preference": {
      "put": {
        "description": "Persists an affirmative save choice and/or a customer-safe existing-card selection for the exact checkout identity and connected account. A semantic change first retires any prepared PaymentIntent, then advances the checkout payment generation so stale consent or card selection can never be reused. An identical replay is a no-op.",
        "operationId": "PublicCheckoutSessionController_savedCardPreference",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCheckoutSavedCardPreferenceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedCheckoutSavedCardOptionsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`CHECKOUT_PREPARED_PAYMENT_CONFLICT`: the requested checkout mutation was not persisted. This does not guarantee that the previous prepared PaymentIntent remains usable; discard any held client secret. Branch on the scalar `details.reason`. `PREPARED_PAYMENT_SESSION_MOVED` and `PREPARED_PAYMENT_CANCEL_CONTENDED` can each represent either permanent legacy NULL-digest quarantine or a current lineage whose generation was already invalidated/admitted or moved concurrently. The envelope exposes neither digest nor generation and adds no discriminator, detail field, or reason. For either value, refresh and follow current state and discard any prior secret. If refreshed state is CONFIRMED, render/follow the durable completed order or status; do not retry or start a new checkout. If it is definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable, abandon the session and start a new checkout. If it is active, follow the current binding and server-bound zero-vs-positive path: re-bind only if needed, retry `confirm-free` for zero, or request `payment-session` for positive, with at most one appropriate retry. If the same conflict persists, refresh once more. Latest CONFIRMED state still wins and must be followed; a latest definitively CANCELLED, EXPIRED, ABANDONED, or otherwise nonpayable state may restart. If latest state remains active, stop automatic retry and automatic restart, discard any prior secret, keep following durable checkout/payment status, and surface a blocked recovery state for explicit safe resolution. Do not infer legacy quarantine from this envelope. `PREPARED_PAYMENT_LINKAGE_CONTENDED` means refresh checkout state, bind if needed, and follow the server-bound zero-vs-positive path; `PREPARED_PAYMENT_LINKAGE_CONVERGED` is a benign concurrent convergence and means retry the matching completion flow after refresh; `PREPARED_PAYMENT_IN_FLIGHT` means freeze editing and wait for payment status; `PREPARED_PAYMENT_CANCEL_AMBIGUOUS` means refresh state and retry the checkout operation. The scalar `details.preparedPaymentReleased` is a boolean and is true only when cancellation of the exact PaymentIntent was confirmed by the payment provider. False means release was not proven; on the zero-total `confirm-free` compatibility path, it can also mean no PaymentIntent existed for that operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "sessionMoved": {
                    "summary": "Session moved during checkout completion",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed during completion. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_SESSION_MOVED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageContended": {
                    "summary": "Prepared-payment linkage was contended",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while completion was in progress. Refresh checkout state, bind if needed, then retry confirm-free for a zero total or request payment-session for a positive total.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "linkageConverged": {
                    "summary": "Concurrent preparation converged safely",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "Another completion attempt for this checkout already converged safely. Refresh checkout state and retry the matching completion flow.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_LINKAGE_CONVERGED",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "paymentInFlight": {
                    "summary": "Payment is already in flight",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "A payment for this checkout is already being processed, so the total cannot change. Wait for it to complete before editing.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_IN_FLIGHT",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationAmbiguous": {
                    "summary": "Prepared-payment cancellation was not proven",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "We could not release the payment already prepared for this checkout. Refresh and try again.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_AMBIGUOUS",
                        "preparedPaymentReleased": false
                      }
                    }
                  },
                  "cancellationContended": {
                    "summary": "Prepared-payment cancellation lost a linkage race",
                    "value": {
                      "code": "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
                      "message": "This checkout changed while its prepared payment was being released. Refresh and follow current checkout status before at most one eligible completion retry.",
                      "details": {
                        "reason": "PREPARED_PAYMENT_CANCEL_CONTENDED",
                        "preparedPaymentReleased": false
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "Ordinary one-time checkout activation is temporarily unavailable. No preference, prepared payment or payment generation changed; retry after the service becomes ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Set saved-card consent and the card selected for this checkout.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/saved-card-availability": {
      "get": {
        "description": "Serves hosted cartonium checkout and tenant-built (BYO) one-time checkouts alike, under the same gates as the saved-card list: a live verified CustomerSession that exactly matches the checkout binding. Whether the checkout’s current payment generation admits Cards comes only from its immutable payment-policy snapshot and that generation’s admission, never from the store’s current payment-policy settings. Every read also applies the payment path’s gate on the store’s current charging account, from its stored settings and without a provider request. A payment account not verified for live charges, or a store with no connected account while the platform account is blocked, answers `PAYMENTS_UNAVAILABLE`. An unmarked checkout is then classified first and answers `NOT_POLICY_BEARING`: it keeps the legacy card path. A policy-bearing checkout charges only on its snapshot’s connected account, so a store with none answers `PAYMENTS_UNAVAILABLE`, and another connected account answers `ACCOUNT_CHANGED`. A disconnect, relink or account block can therefore change the answer within the same payment generation, so `paymentGeneration` alone does not make an answer stable or safe to cache, and responses are private and never stored. `AVAILABLE` is visibility, not purchase authority: payment preparation re-checks the same policy under its own locks and may still refuse. Reasons carry no account identifier, provider detail or other shopper’s data.",
        "operationId": "PublicCheckoutSessionController_savedCardAvailability",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSavedCardAvailabilityDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "Checkout or exact verified identity binding is unavailable. Every such case returns the same neutral response as the saved-card list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "Ordinary one-time checkout activation is temporarily unavailable. No availability was read; retry after the service becomes ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read whether saved cards are available for this checkout, and why not.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}": {
      "get": {
        "description": "Returns the persisted status, isBinding, lines, totals, discount snapshot, currency, and expiry. Does NOT reprice — a read never mutates the binding total. `expiresAt` (+ `reservationExpiresAt` when a Mode-B hold exists; null under the live Mode A) are the hosted/BYO storefront countdown source. For an ordinary checkout, once `expiresAt` has passed, the read returns the same neutral 404 as an unknown or cross-tenant credential, including when a terminal status is already persisted. A still-active expired session is terminalized lazily when lifecycle readiness permits. The exception is a read that itself reconciles a succeeded payment to terminal state: that read returns the reconciled summary instead of the expiry 404.",
        "operationId": "PublicCheckoutSessionController_getSession",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Opaque checkout credential. For an ordinary checkout session, accepts the original token or one of the eight most recent resume tokens still recognized for the same session and tenant. Older resume tokens outside that retained set are no longer accepted. Session lifecycle requirements still apply. This token does not replace any additional customer-authentication or payment-authorization checks required by the route.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Neutral response for an unknown, no-longer-recognized, cross-tenant or expired checkout credential. For an ordinary checkout, after expiresAt, a persisted terminal status does not make the session readable; a read that itself reconciles a succeeded payment to terminal state instead returns that summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read a checkout session (for client polling / countdown).",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/hosted-checkout/sessions": {
      "post": {
        "description": "Dormant contract: currently returns 503 NOT_ACTIVATED before creating a session or observing the provider. When separately activated, the operation has fixed hosted semantics: tenant, runtime environment, charging account, requested policy and initial method ceiling are frozen atomically before the opaque checkout token is returned. The input cannot supply policy, account, environment or a hosted boolean. The initial ceiling is not payable-generation authority. Generic checkout tokens cannot be converted by calling this operation or navigating to a hosted URL. This operation accepts ordinary carts only. Single-booking, booking-group and subscription sign-up sessions have their own creation adapters, delivered dormant; their restart adapters, subscription recovery and the subscription provider rails remain undelivered and must be completed before those surfaces activate. This operation must not be used to replace an unresolved predecessor checkout: replacement uses the restart operation, which retires the predecessor first. Exact creation retries converge on the original session and frozen policy without replacing either. A receipt found at the initial lookup skips creation repricing and policy observation. Concurrent requests that both miss may already be preparing; a creation failure rechecks once for a committed winner before returning an error. A replay returns a new hash-only resume credential and the current session summary, not an old response snapshot. Changed input under the same key is 409. Expired, terminal, deleted or tombstoned sessions are unavailable; they never create again under that key. Bounded caller retry: after a transport failure with no response, or a refusal whose `details.retry` is `SAME_REQUEST_LATER`, repeat the identical request (same recovery key and body) at most three more times, waiting at least 2, 10 and 30 seconds; then stop and report unavailability. `NOT_RETRYABLE` refusals and every other 4xx except this operation's tenant quota refusal are never retried automatically: they need activation, correction or different input. The tenant quota refusal follows only the rule described next. This operation's tenant quota refusal is a 429 whose readable body has code `RATE_LIMIT_EXCEEDED`, refused before the operation's own work. When its `details.retryAfterSeconds` is an integer JSON number from 1 to 86400, it is never retried automatically and does not count toward those three: send the identical request again only on a new caller decision, and only after that many seconds have passed since the response was received. `Retry-After` repeats the same value; if `Retry-After` is a whole number of seconds from 1 to 86400 and differs, wait for the larger of the two; ignore any other `Retry-After`, including an HTTP-date. A `RATE_LIMIT_EXCEEDED` refusal whose `details.retryAfterSeconds` is missing or is not an integer JSON number from 1 to 86400 is still this quota refusal but has no usable wait, even with a valid `Retry-After`: it is never retried automatically. Any other 429, including one whose body cannot be read, is not this refusal: it is never retried automatically. A quota refusal is not caused by the request's content, but because it precedes body validation the identical request can still be refused for other reasons after any wait. Waiting never extends a checkout's lifetime. Never rotate the key or fall back to another operation. PROVIDER_UNAVAILABLE can also carry a deterministic provider refusal, which the bound stops; identity and configuration faults are reported for correction. Existing hosted issuers remain on their current contracts until coordinated adoption. The dormant gate still precedes key validation. The optional `purchaseProofGrant` (#4870, ADR-055, also dormant) binds a purchase-proof key to this original creation only; it commits with the session or not at all, is covered by the exact-retry comparison, and adds no response field. Restart and generic creation refuse it, and a session created without one never gains one.",
        "operationId": "PublicHostedCheckoutSessionController_create",
        "parameters": [
          {
            "name": "x-hosted-checkout-create-recovery-key",
            "in": "header",
            "description": "Secret retry capability: generate 32 cryptographically random bytes and encode as 64 lowercase hex characters. Keep it private, never log it or place it in a URL. Persist it before submitting and repeat the same key and validated request body after an uncertain response. Scoped to the tenant and runtime environment. Never rotate this key to escape an unknown outcome or to replace an existing checkout.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$",
              "minLength": 64,
              "maxLength": 64
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateHostedCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedCheckoutCreationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "The cart, currency, secret retry-key or purchase-proof grant format is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The organization or permitted checkout identity is unavailable; includes expired, terminal, detached or tombstoned replay targets. No replacement is created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Cart admission failed, or COMMERCE_IDEMPOTENCY_CONFLICT: this key already belongs to different creation input, or another checkout already holds the supplied purchase-proof key or capture correlation. Nothing is created and no field is named.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved. RATE_LIMIT_EXCEEDED: the tenant's daily public API quota is spent. Refusal order: a malformed or oversized JSON body is refused first (400/413); then a capture-header or missing-organization refusal (400); then an unknown or inactive organization (404 `Organization not found`). This refusal comes next, before request-body validation and before this operation's own work: key validation, receipt lookup, provider calls and session writes. The refused request is not added to the quota count. `details.retryAfterSeconds` is the whole seconds until the quota resets at the next UTC midnight (`details.resetsAt`). `Retry-After` repeats the same value; if `Retry-After` is a whole number of seconds from 1 to 86400 and differs, wait for the larger of the two; ignore any other `Retry-After`, including an HTTP-date. Never derive the wait from `details.resetsAt` or compare it with a client clock. When `details.retryAfterSeconds` is an integer JSON number from 1 to 86400, do not retry automatically: the identical request, with the same recovery key and body, may be sent again on a new caller decision once the wait has passed, counted from receipt. It does not count toward the bounded caller retry, and waiting does not extend any checkout's lifetime, so the request may then answer the neutral 404. A `RATE_LIMIT_EXCEEDED` refusal whose `details.retryAfterSeconds` is missing or is not an integer JSON number from 1 to 86400 is still this quota refusal but has no usable wait, even with a valid `Retry-After`: it is never retried automatically. Any other 429, including one whose body cannot be read, is not this refusal: it is never retried automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. HOSTED_CHECKOUT_POLICY_UNAVAILABLE: NOT_ACTIVATED, unavailable provider/binding evidence, invalid snapshot, or exhausted local-source race retry. No credential is returned. `details.retry` is SAME_REQUEST_LATER for PROVIDER_UNAVAILABLE, RATE_LIMITED, EVIDENCE_INCOMPLETE and SOURCE_CHANGED, and NOT_RETRYABLE for every other reason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Create an explicitly hosted ordinary-cart checkout (not yet activated).",
        "tags": [
          "public-hosted-checkout"
        ]
      }
    },
    "/api/v1/public/hosted-checkout/sessions/{token}/restart": {
      "post": {
        "description": "Dormant contract: currently returns 503 NOT_ACTIVATED before credential lookup, provider work or any write. When separately activated, the organization slug and the predecessor's original or recognized resume checkout token identify the checkout being replaced; generic, legacy and hosted ordinary one-time checkouts are accepted. The predecessor must already be unable to pay: expired, abandoned or cancelled, or past its expiry. Before any successor exists, the server fences the predecessor's payment generation, re-reads every PaymentIntent it issued from the provider and proves each one cancelled, cancelling a still-cancellable intent under a deterministic idempotency key. Processing, authorized or succeeded money, an unreadable provider result or an unproven cancellation refuses the restart and leaves the predecessor's own confirmation or refund path in charge. Only then is a lapsed predecessor expired, and the successor created exactly like the explicit creation operation, with its own fresh policy snapshot. The successor and its predecessor link commit together before the new opaque token is returned; the database admits at most one successor per predecessor. The predecessor is never reclassified, reopened or given a copied, reparented or newly keyed PaymentIntent, and its original policy is never rewritten. The request body is the successor cart, repriced by the server. Exact retries with the same key and body converge on the one successor and return a new hash-only resume credential; changed input under the key is 409. A successor recorded under a different key is PREDECESSOR_ALREADY_RESTARTED: recover with the original key. Subscription, setup and booking checkouts cannot be restarted until their adapters exist. Callers must not fall back to generic or explicit creation to replace a refused predecessor. Bounded caller retry: after a transport failure with no response, or a refusal whose `details.retry` is `SAME_REQUEST_LATER`, repeat the identical request (same recovery key and body) at most three more times, waiting at least 2, 10 and 30 seconds; then stop and report unavailability. `NOT_RETRYABLE` refusals and every other 4xx except this operation's tenant quota refusal are never retried automatically: they need activation, correction or different input. The tenant quota refusal follows only the rule described next. This operation's tenant quota refusal is a 429 whose readable body has code `RATE_LIMIT_EXCEEDED`, refused before the operation's own work. When its `details.retryAfterSeconds` is an integer JSON number from 1 to 86400, it is never retried automatically and does not count toward those three: send the identical request again only on a new caller decision, and only after that many seconds have passed since the response was received. `Retry-After` repeats the same value; if `Retry-After` is a whole number of seconds from 1 to 86400 and differs, wait for the larger of the two; ignore any other `Retry-After`, including an HTTP-date. A `RATE_LIMIT_EXCEEDED` refusal whose `details.retryAfterSeconds` is missing or is not an integer JSON number from 1 to 86400 is still this quota refusal but has no usable wait, even with a valid `Retry-After`: it is never retried automatically. Any other 429, including one whose body cannot be read, is not this refusal: it is never retried automatically. A quota refusal is not caused by the request's content, but because it precedes body validation the identical request can still be refused for other reasons after any wait. Waiting never extends a checkout's lifetime. Never rotate the key or fall back to another operation. PROVIDER_UNAVAILABLE can also carry a deterministic provider refusal, which the bound stops; identity and configuration faults are reported for correction.",
        "operationId": "PublicHostedCheckoutSessionController_restart",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-hosted-checkout-create-recovery-key",
            "in": "header",
            "description": "Secret retry capability: generate 32 cryptographically random bytes and encode as 64 lowercase hex characters. Keep it private, never log it or place it in a URL. Persist it before submitting and repeat the same key and validated request body after an uncertain response. Scoped to the tenant and runtime environment. Never rotate this key to escape an unknown outcome or to replace an existing checkout.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$",
              "minLength": 64,
              "maxLength": 64
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostedCheckoutCreationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "The successor cart, currency or secret retry-key format is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Neutral checkout miss: unknown, cross-tenant or unrecognized predecessor credential, or an unavailable replay target. No successor is created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "HOSTED_CHECKOUT_RESTART_REFUSED with `details.reason`: PREDECESSOR_ACTIVE (it can still pay; continue it), PREDECESSOR_COMPLETED (follow its order), PREDECESSOR_PAYMENT_IN_FLIGHT (follow its durable payment status; never restart), PREDECESSOR_RETIREMENT_UNPROVEN (retry later with the same key and body) or PREDECESSOR_ALREADY_RESTARTED (recover with the original key). `details.retry` is SAME_REQUEST_LATER only for PREDECESSOR_RETIREMENT_UNPROVEN. Also cart admission failure, or COMMERCE_IDEMPOTENCY_CONFLICT when this key already belongs to different input or another predecessor. No successor or credential is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved. RATE_LIMIT_EXCEEDED: the tenant's daily public API quota is spent. Refusal order: a malformed or oversized JSON body is refused first (400/413); then a capture-header or missing-organization refusal (400); then an unknown or inactive organization (404 `Organization not found`). This refusal comes next, before request-body validation and before this operation's own work: key validation, receipt lookup, provider calls and session writes. The refused request is not added to the quota count. `details.retryAfterSeconds` is the whole seconds until the quota resets at the next UTC midnight (`details.resetsAt`). `Retry-After` repeats the same value; if `Retry-After` is a whole number of seconds from 1 to 86400 and differs, wait for the larger of the two; ignore any other `Retry-After`, including an HTTP-date. Never derive the wait from `details.resetsAt` or compare it with a client clock. When `details.retryAfterSeconds` is an integer JSON number from 1 to 86400, do not retry automatically: the identical request, with the same recovery key and body, may be sent again on a new caller decision once the wait has passed, counted from receipt. It does not count toward the bounded caller retry, and waiting does not extend any checkout's lifetime, so the request may then answer the neutral 404. A `RATE_LIMIT_EXCEEDED` refusal whose `details.retryAfterSeconds` is missing or is not an integer JSON number from 1 to 86400 is still this quota refusal but has no usable wait, even with a valid `Retry-After`: it is never retried automatically. Any other 429, including one whose body cannot be read, is not this refusal: it is never retried automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. HOSTED_CHECKOUT_POLICY_UNAVAILABLE: NOT_ACTIVATED, RESTART_ADAPTER_NOT_IMPLEMENTED for a subscription or booking predecessor, or unavailable successor policy/provider evidence. No credential is returned. `details.retry` follows the explicit creation operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Replace an unpayable checkout with an explicitly hosted successor (not yet activated).",
        "tags": [
          "public-hosted-checkout"
        ]
      }
    },
    "/api/v1/public/hosted-checkout/sessions/{token}": {
      "get": {
        "description": "Dormant contract: currently returns 503 NOT_ACTIVATED before credential lookup or session work. After separately authorized activation, the organization slug and original or recognized resume checkout token must identify the same session. Before running the existing session reader, require its immutable hosted applicability and usable policy evidence for the current runtime environment and connected account. Generic and legacy tokens receive the same neutral 404 as an unknown token; missing, corrupt or incompatible new-version evidence fails closed. Recheck credential ownership and policy after projection before returning the summary. The owning reader retains its expiry, payment reconciliation and public-field privacy behavior. A successful read establishes hosted applicability only, not permission to pay or use saved cards. A valid policy with no available method remains readable. No policy snapshot, account id, credential, or method-availability contract is added to this response. Effective method availability and payable admission require their own contracts. Callers must not fall back to a generic read or create a replacement to escape refusal. This operation never reclassifies a generic session, creates a successor, or changes its original policy; safe restart and the remaining mode adapters are required before activation.",
        "operationId": "PublicHostedCheckoutEntryController_read",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              },
              "Pragma": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-cache"
                  ]
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Neutral checkout miss: unknown, cross-tenant, unrecognized credential, non-hosted/legacy or owning-lifecycle refusal. No replacement is created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "HOSTED_CHECKOUT_POLICY_UNAVAILABLE: NOT_ACTIVATED or unusable hosted policy evidence (`details.retry` NOT_RETRYABLE for both). Never fall back to a generic read or card recovery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read an explicitly hosted checkout (not yet activated).",
        "tags": [
          "public-hosted-checkout"
        ]
      }
    },
    "/api/v1/public/hosted-checkout/purchase-proof": {
      "get": {
        "description": "Dormant contract (#4870, ADR-055): currently returns 503 NOT_ACTIVATED before the key is read, and it fixes nothing live until hosted creation is separately adopted and activated. When available, it answers for the original hosted root this key was granted at creation, through server-proven restart lineage only: exactly one confirmed ordinary one-time purchase with a linked Order of this tenant, within 32 restart successors, answers 200 with three fields, even after every session in the lineage has expired. Anything else answers the neutral 404. The grant expires at the earlier of the creation's capture deadline and four hours after it, by the database clock; refresh, restart, retry, reload, re-registration and this read never extend it, and there is no guaranteed availability within that window. The read writes nothing, calls no payment provider, reconciles nothing and grants no checkout, order, account or payment access; the request still counts toward the tenant's daily public API quota. A shopper who paid before the Order links reads the neutral 404 until it does. Remove purchased items only when `captureCorrelation` matches and `selections` exactly equals the capture, inside the storefront's locked, generation-aware cart transaction, and settle the attempt only after that commit; replay before it is safe. A root that reads expired, abandoned or cancelled no longer proves nothing was bought: never retire an attempt that holds a key from that read. A failed read consumes nothing; keep the key until settlement or the deadline, then destroy it.",
        "operationId": "PublicHostedCheckoutPurchaseProofController_read",
        "parameters": [
          {
            "name": "x-checkout-purchase-proof-capability",
            "in": "header",
            "description": "The secret purchase-proof key (token family `v`) the storefront supplied as `purchaseProofGrant.capability` at hosted creation. Send it from the storefront server only, exactly once per request: browsers cannot send this header, and it is never logged. A missing, repeated or malformed header answers the neutral 404. The format check establishes neither randomness nor possession, and the key authorizes no other route.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^v[A-Za-z0-9_-]{43}$",
              "minLength": 44,
              "maxLength": 44
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "Exactly one winning purchase. Private, no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutPurchaseProofDto"
                }
              }
            }
          },
          "400": {
            "description": "A missing organization slug or an invalid capture-origin header, decided before the key is read. A configuration fault: keep the capture and remove nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inactive organization (`Organization not found`), decided before the key is read; otherwise the neutral refusal. `RESOURCE_NOT_FOUND` with message `Checkout session not found`, byte-identical for every refusal decided after the key is read: a missing, repeated or malformed key, an unknown key, a key of another tenant or environment, an expired, revoked or purged grant, no linked Order yet (including a paid session not yet linked and a refund without an Order), a lineage past its bound, more than one winner, a vanished Order and any projection failure. Private, no-store. Keep the capture unresolved and remove nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMIT_EXCEEDED: the tenant's daily public API quota is spent, decided after the tenant guards and before the key is read, so known and unknown keys answer alike. Keep the capture and read again on a later return, before the storefront's own capture deadline; waiting never extends the grant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "HOSTED_CHECKOUT_POLICY_UNAVAILABLE with `details.reason` NOT_ACTIVATED: the scope is before its receipt, decided before the key is read. `details.retry` is NOT_RETRYABLE. Keep the capture.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read the purchase proof for a hosted checkout attempt (not yet activated).",
        "tags": [
          "public-hosted-checkout"
        ]
      }
    },
    "/api/v1/public/hosted-checkout/purchase-proof/revoke": {
      "post": {
        "description": "Dormant contract (#4870, ADR-055): currently returns 503 NOT_ACTIVATED before the key is read. When available, a validly formatted key answers 204 alike whether it is known, unknown, already revoked or expired. Revocation is permanent and applies to every read that starts after it commits; a read already past its authorization point may still answer. It cannot recall what a read disclosed, and it changes no purchase, Order, payment or checkout. Request no body.",
        "operationId": "PublicHostedCheckoutPurchaseProofController_revoke",
        "parameters": [
          {
            "name": "x-checkout-purchase-proof-capability",
            "in": "header",
            "description": "The secret purchase-proof key (token family `v`) the storefront supplied as `purchaseProofGrant.capability` at hosted creation. Send it from the storefront server only, exactly once per request: browsers cannot send this header, and it is never logged. A missing, repeated or malformed header answers the neutral 404. The format check establishes neither randomness nor possession, and the key authorizes no other route.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^v[A-Za-z0-9_-]{43}$",
              "minLength": 44,
              "maxLength": 44
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "Revoked, or nothing to revoke: indistinguishable by design."
          },
          "400": {
            "description": "A missing organization slug or an invalid capture-origin header, decided before the key is read. A configuration fault: keep the capture and remove nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inactive organization (`Organization not found`), decided before the key is read, or the neutral `RESOURCE_NOT_FOUND` (`Checkout session not found`), private and no-store, for a missing, repeated or malformed key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMIT_EXCEEDED: the tenant's daily public API quota is spent, decided after the tenant guards and before the key is read, so known and unknown keys answer alike. Keep the capture and read again on a later return, before the storefront's own capture deadline; waiting never extends the grant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "description": "HOSTED_CHECKOUT_POLICY_UNAVAILABLE with `details.reason` NOT_ACTIVATED: the scope is before its receipt, decided before the key is read. `details.retry` is NOT_RETRYABLE. Keep the capture.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Revoke the purchase proof for a hosted checkout attempt (not yet activated).",
        "tags": [
          "public-hosted-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/account-switch/admit": {
      "post": {
        "description": "Only a live verified Account A on the same ordinary one-time PENDING_PAYMENT checkout can admit a switch. The server fences its old payment generation, proves every linked old intent nonchargeable on the exact connected account, and only then returns an admitted unbound epoch. A stalled or ambiguous cancellation remains fenced; do not reuse the old client secret. The client must preserve the original requestId across reloads and retry that same request; a new requestId cannot take over a fenced epoch here. An admitted B branch cannot start another email switch. A 409 with reason PREPARED_PAYMENT_SWITCH_REQUEST_MISMATCH means a fenced switch needs its original requestId, or the recover operation if that value is irretrievably lost, or that an earlier epoch on this checkout already used or superseded this requestId; PREPARED_PAYMENT_SWITCH_ALREADY_ACTIVE means continue the admitted switch; PREPARED_PAYMENT_SWITCH_ALREADY_USED means a second B switch is unavailable.",
        "operationId": "PublicCheckoutAccountSwitchController_admit",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutAccountSwitchAdmitRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAccountSwitchAdmissionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "The checkout account switch is temporarily unavailable; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Safely release Account A payment before changing checkout email.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/account-switch/recover": {
      "post": {
        "description": "Use only after the original admit requestId for this same in-progress checkout is irretrievably lost, so admit answers PREPARED_PAYMENT_SWITCH_REQUEST_MISMATCH. Send a fresh requestId and preserve it across reloads and retries as for admit. A fresh requestId can take over only with the live verified Account A CustomerSession that this ordinary one-time PENDING_PAYMENT checkout is still bound to, and only while its latest switch is still fencing old payment on an unmoved source and old attempt set. Recovery takes two calls. The first omits expectedEpochId: when this request could take over, the server writes nothing and answers 409 with reason PREPARED_PAYMENT_SWITCH_RECOVERY_TARGET and details.epochId, the fencing epoch it would supersede. Repeat the same requestId with that value as expectedEpochId. The takeover then continues exactly that switch as a successor epoch with the same frozen source and old attempts, and the server re-runs the exact old-payment proof. A targeted request whose epoch is no longer the latest fencing epoch is stale and changes nothing. The superseded epoch keeps the lost requestId on record, so that value can never open or recover a switch again. A retry with the new requestId replays like admit. Recovery never starts a new switch, claims a branch, releases a client secret or restores an old one. A 200 returns the admitted successor epoch in the admit response shape; use its epochId from then on. A 409 with reason PREPARED_PAYMENT_SWITCH_RECOVERY_UNAVAILABLE means no fencing switch is left to recover; PREPARED_PAYMENT_SWITCH_REQUEST_MISMATCH means an earlier epoch on this checkout already used or superseded this requestId; PREPARED_PAYMENT_SESSION_MOVED means the fenced checkout or the named epoch moved; PREPARED_PAYMENT_CANCEL_CONTENDED means its old attempts or a concurrent request changed first. PREPARED_PAYMENT_CANCEL_AMBIGUOUS keeps payment paused, and the successor then belongs to this requestId, so retry with the same value. PREPARED_PAYMENT_IN_FLIGHT means a payment for this checkout is already moving: stop and follow payment status instead of retrying. A 409 CHECKOUT_IDENTITY_CHANGED or CHECKOUT_IDENTITY_VERIFICATION_REQUIRED means this request lacks that live Account A authority.",
        "operationId": "PublicCheckoutAccountSwitchController_recover",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutAccountSwitchRecoverRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAccountSwitchAdmissionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "The checkout account switch is temporarily unavailable; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Recover a fenced account switch whose original requestId is lost.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/account-switch/{epochId}/identify": {
      "post": {
        "description": "Claims exactly one durable branch and evaluates its email through the neutral two-action identity contract at the assigned switch version. RETURN_TO_A requires current verified A authority; SWITCH_TO_B requires the frozen A server session to be stale. The response grants no payment, Customer or account-existence authority. Replaying the same branch/email returns the cached action.",
        "operationId": "PublicCheckoutAccountSwitchController_identify",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "epochId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutAccountSwitchBranchRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAccountSwitchBranchResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Claim one Account A or different-email B branch after safe release.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/account-switch/{epochId}/reprice": {
      "post": {
        "description": "Reprices current lines, coupon and delivery inputs for the latest admitted, claimed PENDING_PAYMENT switch epoch. An initial unbound preview grants no charging authority. On a bound switched checkout, this mutation first cancels the current prepared payment, advances the payment generation and returns the checkout unbound; do not reuse that payment client secret. The ordinary reprice route stays OPEN-only; use the dedicated rebind route after the shopper confirms Contact, Delivery and Billing.",
        "operationId": "PublicCheckoutAccountSwitchController_reprice",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "epochId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepriceCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. Checkout or the account switch is temporarily unavailable; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Preview the claimed account-switch branch before rebind.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/account-switch/{epochId}/rebind": {
      "post": {
        "description": "Reprices the shopper-supplied current lines, coupon and addresses through the ordinary server-authoritative bind machinery. This PENDING_PAYMENT exception requires the latest admitted, claimed epoch and a current payment/identity generation at or after that epoch's admitted generation floor. It cannot replay A money or bind another physical checkout. After a successful bind, request a fresh payment session; no old client secret survives.",
        "operationId": "PublicCheckoutAccountSwitchController_rebind",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "epochId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindCheckoutSessionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Shipping or address rejection (`code: BAD_REQUEST` with a scalar `details.reason`) — bind is the commitment, so these reasons fail here and ONLY here. An unresolvable selection silently degrades a reprice to no shipping (`200`, shipping dropped), while address validation rides the successful preview response as guidance. Branch on `details.reason`, never on `message`: `SHIPPING_RATE_NOT_QUOTABLE` (the selected rate cannot be re-quoted — for live carrier rates the quote-scoped `rateId` may simply have rotated past its quote), `SHIPPING_RATE_NOT_APPLICABLE_TO_DESTINATION` (no active zone serves the captured destination), `SHIPPING_RATE_BELOW_SUBTOTAL_MINIMUM` (the cart no longer meets the rate's configured minimum), and `SHIPPING_DELIVERY_PROMISE_UNAVAILABLE` (the selected delivery promise can no longer be presented) all share one recovery: re-quote via reprice, replace the entire option set from `availableShippingOptions`, require the shopper to explicitly reconfirm a delivery method from the fresh set (never auto-restore a prior selection by label and never bind an unconfirmed substitute), then bind again. `SHIPPING_ADDRESS_REQUIRED` means a rate was selected before any shipping/billing address. `SHIPPING_ADDRESS_INVALID` means either the provider rejected the address or its normalized address materially changes the U.S. country, state, or five-digit ZIP, regardless of a non-invalid provider verdict. In either case, use the shopper-safe `violations` and any `details.addressValidation.normalized` suggestion to correct or apply the address before re-quoting. `SHIPPING_ADDRESS_REVIEW_REQUIRED` leaves the session unbound because the provider suggested a non-blocking correction. Show `details.addressValidation.normalized`; the shopper may either reprice with that suggestion and bind normally, or repeat bind with `shippingAddressValidationDecision: KEEP_ENTERED`. The repeat bind revalidates and the decision never overrides an invalid address, a material country/state/five-digit-ZIP correction, or provider failure. A classified live-provider bind failure additionally carries `details.shippingFailure`: `stage: shipping_rate_bind`, a normalized `category`, same-input `retryable`, `paymentAttempted: false`, and an opaque `supportReference` that correlates to a redacted server event. `retryAfterSeconds` is optional and rate-limit-only. The public shape accepts it only as an integer from 1 through 86400. The support reference grammar is `^lrb_[A-Za-z0-9_-]{16}$`. Categories are `invalid_address`, `unknown_provider_rejection`, `configuration_failure`, `authentication_failure`, `rate_limited`, `timeout`, `network_failure`, `provider_outage`, and `no_usable_rates`; retryability is canonical for each category. The diagnostic and correlated log metadata never include provider prose, response bodies, field values, checkout tokens, addresses, customer data, or credentials. `invalid_address` may additionally retain the existing shopper-safe `violations` and `addressValidation` suggestion contract. A classified failure must return the shopper to Delivery; retryable is evidence about a later rate request, not authority for an automatic bind or payment replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                },
                "examples": {
                  "rateNotQuotable": {
                    "summary": "Selected rate can no longer be quoted",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the selected shipping rate is not available",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE"
                      }
                    }
                  },
                  "unknownProviderRejection": {
                    "summary": "Provider rejected the quote without an actionable reason",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "We couldn't confirm a shipping rate, so payment was not attempted. Review the delivery address or try the rates again. If the problem continues, contact support.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "unknown_provider_rejection",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableProviderOutage": {
                    "summary": "Live-rate provider outage before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "Shipping rates are temporarily unavailable, so payment was not attempted. Try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "provider_outage",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableConfigurationFailure": {
                    "summary": "Merchant shipping configuration rejected before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The store's shipping setup couldn't provide a rate, so payment was not attempted. Contact support for help.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "configuration_failure",
                          "retryable": false,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableAuthenticationFailure": {
                    "summary": "Live-rate provider authentication failed before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The store's shipping service needs attention before it can provide rates, so payment was not attempted. Contact support for help.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "authentication_failure",
                          "retryable": false,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableTimeout": {
                    "summary": "Live-rate provider timed out before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The shipping service took too long to confirm a rate, so payment was not attempted. Try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "timeout",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableNetworkFailure": {
                    "summary": "Live-rate provider could not be reached before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "We couldn't reach the shipping service to confirm a rate, so payment was not attempted. Try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "network_failure",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableNoUsableRates": {
                    "summary": "Live-rate provider returned no usable rates before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "No shipping rates are currently available for this delivery, so payment was not attempted. Review the delivery address or try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "no_usable_rates",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        }
                      }
                    }
                  },
                  "rateNotQuotableRateLimited": {
                    "summary": "Live-rate provider asked the caller to retry later",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "Shipping rates are temporarily busy, so payment was not attempted. Wait a moment, then try the rates again.",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "rate_limited",
                          "retryable": true,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL",
                          "retryAfterSeconds": 30
                        }
                      }
                    }
                  },
                  "rateNotQuotableExcludedByPresentation": {
                    "summary": "Every quoted service excluded while a selection was supplied",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "no shipping methods are currently available for this destination — please contact the store",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE"
                      }
                    }
                  },
                  "rateNotQuotableShippingUnconfigured": {
                    "summary": "Shipping zones deactivated while a selection was supplied",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "this order requires shipping, but the store has not set up shipping yet",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_QUOTABLE"
                      }
                    }
                  },
                  "rateNotApplicableToDestination": {
                    "summary": "Selected rate does not serve this destination",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the selected shipping rate is not available for this destination",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_APPLICABLE_TO_DESTINATION"
                      }
                    }
                  },
                  "rateNotApplicableUnservedDestination": {
                    "summary": "No active zone serves the destination while a selection was supplied",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "we do not ship to the selected destination",
                      "details": {
                        "reason": "SHIPPING_RATE_NOT_APPLICABLE_TO_DESTINATION"
                      }
                    }
                  },
                  "rateBelowSubtotalMinimum": {
                    "summary": "Cart fell below the selected rate's minimum",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the selected shipping rate is not available for this order subtotal",
                      "details": {
                        "reason": "SHIPPING_RATE_BELOW_SUBTOTAL_MINIMUM"
                      }
                    }
                  },
                  "deliveryPromiseUnavailable": {
                    "summary": "Selected delivery promise can no longer be presented",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The selected delivery promise is no longer available.",
                      "details": {
                        "reason": "SHIPPING_DELIVERY_PROMISE_UNAVAILABLE"
                      }
                    }
                  },
                  "addressRequired": {
                    "summary": "Rate selected before an address exists",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "a shipping or billing address is required to apply a shipping rate",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_REQUIRED"
                      }
                    }
                  },
                  "addressInvalid": {
                    "summary": "Carrier confirmed the delivery address is invalid before payment",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "The delivery address could not be verified, so payment was not attempted. Check the street address, city, state, and ZIP or postal code, then update the address before continuing.",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_INVALID",
                        "shippingFailure": {
                          "stage": "shipping_rate_bind",
                          "category": "invalid_address",
                          "retryable": false,
                          "paymentAttempted": false,
                          "supportReference": "lrb_AAECAwQFBgcICQoL"
                        },
                        "violations": [
                          "shippingAddress.postalCode was rejected by the fulfillment provider"
                        ],
                        "addressValidation": {
                          "status": "invalid",
                          "messages": [],
                          "normalized": null
                        }
                      }
                    }
                  },
                  "addressMaterialCorrection": {
                    "summary": "Verified suggestion materially changes the U.S. routing locality",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "the delivery address could not be verified — check the city, state, and ZIP or postal code and try again",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_INVALID",
                        "violations": [
                          "shippingAddress.state differs from the provider-suggested address",
                          "shippingAddress.postalCode differs from the provider-suggested address"
                        ],
                        "addressValidation": {
                          "status": "verified",
                          "messages": [
                            "A corrected delivery locality is available."
                          ],
                          "normalized": {
                            "line1": "10 Market St",
                            "line2": null,
                            "city": "San Jose",
                            "state": "CA",
                            "postalCode": "95113-1903",
                            "country": "US"
                          }
                        }
                      }
                    }
                  },
                  "addressReviewRequired": {
                    "summary": "Provider suggested a non-blocking address correction",
                    "value": {
                      "code": "BAD_REQUEST",
                      "message": "review the suggested delivery address before continuing",
                      "details": {
                        "reason": "SHIPPING_ADDRESS_REVIEW_REQUIRED",
                        "addressValidation": {
                          "status": "verified",
                          "messages": [
                            "A more precise delivery address is available."
                          ],
                          "normalized": {
                            "line1": "123 Main St",
                            "line2": null,
                            "city": "Boise",
                            "state": "ID",
                            "postalCode": "83702-1234",
                            "country": "US"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved. Checkout or the account switch is temporarily unavailable; retry after the service becomes ready. A 503 with `HOSTED_CHECKOUT_POLICY_UNAVAILABLE`, `details.reason` `NOT_ACTIVATED` and `details.retry` `NOT_RETRYABLE` means this checkout can no longer hand off a payment: do not repeat the identical request or fall back to another checkout or payment path; show the checkout as unavailable. Nothing was created or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Rebind the claimed account-switch branch on this same checkout.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/account-switch/{epochId}": {
      "get": {
        "description": "Root-locked read of only the latest epoch on this same checkout. A fencing or unsafe old-attempt set reports recoveryRequired and does not issue charging authority.",
        "operationId": "PublicCheckoutAccountSwitchController_status",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "epochId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAccountSwitchStatusResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read the current switch and payment-recovery gate.",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/subscription-checkouts/{token}/handoff": {
      "post": {
        "description": "Resolves the tenant-scoped shared CheckoutSession by its opaque token and safely resumes its existing Billing handoff. PAYMENT refreshes the first-invoice PaymentIntent, SETUP resumes card authorization and can continue Billing creation after setup succeeds, and NONE carries no client confirmation. The request cannot replace checkout input and never confirms fulfillment; invoice.paid plus reconciliation remain authoritative.",
        "operationId": "PublicSubscriptionCheckoutHandoffController_resume",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionCheckoutHandoffResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Checkout token not found in this tenant or not a subscription checkout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The checkout is cancelled, expired, abandoned, awaiting reconciliation, or pinned to a different connected account. Confirmed checkouts return their terminal NONE handoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "Payment processing is unavailable or the subscription handoff cannot be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Resume a hosted subscription checkout handoff.",
        "tags": [
          "public-subscription-checkout"
        ]
      }
    },
    "/api/v1/public/subscription-checkouts": {
      "post": {
        "description": "Creates a recurring-aware shared CheckoutSession and connected-account Stripe Billing flow. A tenant-scoped customer session is required so an email address can never select another customer’s saved/default payment context. The response handoff is PAYMENT, SETUP, or NONE. SETUP must be confirmed and this exact request replayed with the same idempotency key. No client callback confirms fulfillment: invoice.paid plus the reconciliation sweep are authoritative.",
        "operationId": "PublicSubscriptionCheckoutController_start",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable key for the complete start/continuation attempt. A card-upfront SETUP is continued by replaying the same body and key after setup succeeds.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSubscriptionCheckoutDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSubscriptionCheckoutResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "A selected public plan or price is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The idempotency key was already used for different checkout input, or the selected plans cannot share one subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A required live shipping quote is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "CustomerSession": [],
            "OrganizationSlug": []
          }
        ],
        "summary": "Start or safely continue a public subscription checkout.",
        "tags": [
          "public-subscription-checkout"
        ]
      }
    },
    "/api/v1/public/booking-groups/{publicRef}/checkout": {
      "post": {
        "description": "Authorizes with the group proof, atomically converts every held member into its booking-linked Sales projection, binds at most one CheckoutSession, freezes the complete member allocation plan, and returns the authoritative aggregate pricing plus any Stripe handoff. Pay-Later groups remain approval-only and never receive a payment handoff; CheckoutSession and hold capabilities are never exposed.",
        "operationId": "PublicBookingGroupCheckoutController_checkout",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^b[a-z0-9]{25}$"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "booking-group-resume-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^g[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingPriceConfirmationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGroupPaymentSessionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "BOOKING_PRICE_CONFIRMATION_REQUIRED returns the typed two-phase confirmation challenge. Other operation-specific conflicts use the canonical API error envelope. TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/BookingPriceConfirmationRequiredErrorDto"
                    },
                    {
                      "$ref": "#/components/schemas/ApiErrorDto"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "PLATFORM_TAX_UNAVAILABLE when a stored stripe_tax policy requires tax pricing but the connected provider is unavailable or its mode cannot be confirmed. This also blocks free priced commitments. Unpriced draft/request capture, legacy unset policies, and valid audited manual_no_tax retain their existing behavior.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Bind and resume one aggregate booking payment.",
        "tags": [
          "public-booking-groups"
        ]
      }
    },
    "/api/v1/public/orders/token/{token}": {
      "get": {
        "description": "#606 — the read contract behind the hosted cartonium checkout `/order/o.../status` page. The `o`-family token (minted with the order-confirmation email, hashed at rest per ADR-007) is the credential; no customer session is required, but the tenant slug is still required and must match the token tenant. Pure read — the token is never consumed and stays valid until it expires. Unknown, expired, revoked, malformed, and cross-tenant tokens are all the same 404, and the projection carries no customer PII and no database ids. #1656: when the current customer-action config selects a distinct trusted BYO origin, `customerActionRedirectUrl` carries the equivalent token route for hosted cartonium checkout to redirect to; blank, rejected, hosted, or loop-producing config returns `null`.",
        "operationId": "PublicOrderController_getOrderStatusByToken",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Raw `o`-family order-status token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatusResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the order carries package pricing that can no longer be displayed safely. The ORDER IS UNAFFECTED and remains valid; only this presentation of it is withheld. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, so a recoverable staleness is not mistaken for a contract violation — on an order read the generic branch discards the one fact that matters, and a client that loses it is one step from creating a replacement order for an order that is fine.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch the status-safe order projection by opaque `o` token.",
        "tags": [
          "public-orders"
        ]
      }
    },
    "/api/v1/public/orders/by-reference/{orderReference}/confirmation": {
      "get": {
        "description": "The order reference is only a tenant-scoped locator. Authorization comes from the live x-checkout-session-token header, which must belong to this tenant and be bound to the exact final order. The response never looks up or exposes an order-status capability redirect.",
        "operationId": "PublicOrderController_getOrderConfirmationByReference",
        "parameters": [
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$"
            }
          },
          {
            "name": "x-checkout-session-token",
            "required": true,
            "in": "header",
            "description": "The live tenant-bound checkout-session credential whose final order is being confirmed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Tenant and checkout-credential dimensions for this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, x-checkout-session-token"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderConfirmationByReferenceDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Tenant and checkout-credential dimensions for this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, x-checkout-session-token"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Tenant and checkout-credential dimensions for this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, x-checkout-session-token"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the order carries package pricing that can no longer be displayed safely. The ORDER IS UNAFFECTED and remains valid; only this presentation of it is withheld. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, so a recoverable staleness is not mistaken for a contract violation — on an order read the generic branch discards the one fact that matters, and a client that loses it is one step from creating a replacement order for an order that is fine.",
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Tenant and checkout-credential dimensions for this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, x-checkout-session-token"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Tenant and checkout-credential dimensions for this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, x-checkout-session-token"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Tenant and checkout-credential dimensions for this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, x-checkout-session-token"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch the immediate confirmation projection by order reference.",
        "tags": [
          "public-orders"
        ]
      }
    },
    "/api/v1/public/orders/number/{num}": {
      "get": {
        "deprecated": true,
        "description": "Deprecated compatibility lookup retained only through ADR-046 evidence-gated retirement. Order numbers are sequential and therefore guessable, so the number alone is not sufficient: the caller must also supply the customer email used at checkout (case-folded match). A wrong/absent email is indistinguishable from an unknown order number (both 404) so the endpoint cannot be used to enumerate which order numbers exist or to confirm the email on a given order. Returns the confirmation-safe projection only.",
        "operationId": "PublicOrderController_getOrderByNumber",
        "parameters": [
          {
            "name": "num",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the order carries package pricing that can no longer be displayed safely. The ORDER IS UNAFFECTED and remains valid; only this presentation of it is withheld. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, so a recoverable staleness is not mistaken for a contract violation — on an order read the generic branch discards the one fact that matters, and a client that loses it is one step from creating a replacement order for an order that is fine.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch an order by order number + the checkout email.",
        "tags": [
          "public-orders"
        ]
      }
    },
    "/api/v1/public/orders/{id}": {
      "get": {
        "deprecated": true,
        "description": "Deprecated UUID compatibility lookup retained only through ADR-046 evidence-gated retirement. New customer account and return flows use the authenticated by-reference routes. Returns the confirmation-safe projection only.",
        "operationId": "PublicOrderController_getOrderById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the order carries package pricing that can no longer be displayed safely. The ORDER IS UNAFFECTED and remains valid; only this presentation of it is withheld. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, so a recoverable staleness is not mistaken for a contract violation — on an order read the generic branch discards the one fact that matters, and a client that loses it is one step from creating a replacement order for an order that is fine.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch an order by id (opaque, unguessable).",
        "tags": [
          "public-orders"
        ]
      }
    },
    "/api/v1/public/orders": {
      "post": {
        "deprecated": true,
        "description": "Legacy quote-intake path: creates an **unpaid** `PENDING` order for the merchant compatibility queue with `taxInCents: 0`. It does not reserve inventory, create payment or Customer lineage, enter the Sales or fulfillment backbone, or enqueue a customer email. Merchant acceptance is required before the request may become operational. It predates the hosted checkout-session flow and is retained only for the reference storefronts until the hosted-checkout flip (#786/#845) and the BYO/IPG migration (#789). New integrations MUST use the checkout-session flow (`POST …/sessions` → reprice → bind → pay), which is the server-authoritative payment/tax/shipping model — do not treat this as the canonical order-creation endpoint.",
        "operationId": "PublicOrderController_createOrder",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — **partial success. The order WAS created and committed**; only the response projection failed, and this error carries no order id. DO NOT blind-retry: a retry creates a SECOND order. Recover by reading the order back (`GET /public/orders/number/{num}` with the customer email, or the order-status token from the confirmation email) before taking any further action. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, because the generic branch reads as \"nothing happened\" and here something did. This legacy endpoint is deprecated — the checkout-session flow is the supported path and does not have this shape.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Submit a PENDING quote request — LEGACY storefront path.",
        "tags": [
          "public-orders"
        ]
      }
    },
    "/api/v1/merchant/orders": {
      "get": {
        "description": "Returns a bounded page of orders (newest first) plus a `nextCursor` for the following page. Pass `?status=` to filter server-side and `?limit=` (1–200, default 50) to size the page. `#1469` — replaces the former unbounded list that returned every order + line item.",
        "operationId": "MerchantOrderController_getOrders",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of orders to return. Defaults to 50.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating — the `id` of the last order from the previous page (returned as `nextCursor`). Treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter to orders in this status.",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "CONFIRMED",
                "PROCESSING",
                "COMPLETED",
                "CANCELLED"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderListDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List orders for the active org (cursor-paginated).",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/number/{num}": {
      "get": {
        "description": "Returns the order, or a neutral 404 (`RESOURCE_NOT_FOUND`) when no order in the active org matches the number (#1288).",
        "operationId": "MerchantOrderController_getOrderByNumber",
        "parameters": [
          {
            "name": "num",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch an order by order number.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}": {
      "get": {
        "description": "Returns the order, or a neutral 404 (`RESOURCE_NOT_FOUND`) when no order in the active org matches the id (#1288).",
        "operationId": "MerchantOrderController_getOrderById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch an order by id.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}/shipping-destination-corrections": {
      "post": {
        "description": "Requires a verified/converted customer-owned order, a reason, and the current correction revision. The checkout snapshot remains immutable. Country/state/postal changes and orders with prepared fulfillment fail closed.",
        "operationId": "MerchantOrderController_correctShippingDestination",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CorrectOrderShippingDestinationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderShippingDestinationDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Append a protected correction to the order destination used by fulfillment.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}/status": {
      "patch": {
        "description": "State-machine enforced for ordinary Staff-capable progress: PENDING → CONFIRMED → PROCESSING → COMPLETED. PENDING → CONFIRMED acceptance atomically reserves available inventory and creates the durable Sales bridge intent; insufficient inventory leaves the quote PENDING. This lifecycle command remains gated by `orders:operate`; the reservation is its atomic system-side consequence, not a direct `inventory:adjust` operation. Whole-order cancellation is deliberately rejected here and must use the dedicated Owner/Admin cancellation command so fulfillment and paid-label work cannot be stranded.",
        "operationId": "MerchantOrderController_updateOrderStatus",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrderStatusDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Transition an order to the next status.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}/notes": {
      "patch": {
        "description": "Pass `null` to clear the existing note. Customer-visible communication is a separate channel (planned in a later epic).",
        "operationId": "MerchantOrderController_updateOrderNotes",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrderNotesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set or clear the merchant-side notes scratchpad.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}/fulfillment-status": {
      "patch": {
        "deprecated": true,
        "description": "#1962 — retained only for wire compatibility and returns 409 for every existing Order. A missing Sales record is not a safe write boundary: durable bridge delivery or historical backfill can materialize one later. Existing aggregate values remain readable, but physical progress must use explicit Sales line and quantity fulfillment commands.",
        "operationId": "MerchantOrderController_updateOrderFulfillmentStatus",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrderFulfillmentStatusDto"
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retired aggregate fulfillment-status compatibility endpoint.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}/shipment-tracking": {
      "patch": {
        "description": "#1562/#1962 — edits merchant-entered carrier, tracking number/URL, and shipped/delivered timestamps on one existing historical manual aggregate row or the sole existing line-managed fulfillment. It never creates a line-less fulfillment or new allocation, consumes inventory, or originates a shipment notification. It may correct existing shipped/delivered timestamps and advance an existing SHIPPED fulfillment to DELIVERED. A line-managed edit recomputes both order/Sales mirrors from the unchanged exact ledger and may repair stale projections; a historical aggregate edit leaves them untouched. `notify` remains required for wire compatibility; existing SEND/SUPPRESS evidence is immutable, and a pre-evidence historical row catches up conservatively as SUPPRESS. New and mixed/ambiguous orders return 409 and must use the canonical line/package workflow. Existing PLANNED/READY fulfillments must use the canonical idempotent carrier-handoff command instead of this compatibility endpoint. Carrier/service values backed by attached or legacy order-scoped purchased-label evidence cannot be rewritten here; the route may only correct tracking/timestamps on that shipment.",
        "operationId": "MerchantOrderController_updateOrderShipmentTracking",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrderShipmentTrackingDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Edit tracking on one existing fulfillment compatibility record.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/cancel": {
      "post": {
        "description": "Owner/Admin-only, reasoned, idempotent cancellation. Goods already handed to a carrier are rejected and must use Returns. Label-free unshipped fulfillments cancel atomically with the parent order. Paid outbound labels are voided through durable provider compensation first; the order, Sales record, fulfillment allocations, and inventory reservation remain active until every exact label result is authoritative. This command never refunds the customer and never sends an order-cancellation email.",
        "operationId": "MerchantOrderCancellationController_cancelOrder",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable operation key. Matching retries return the same durable parent cancellation; reuse with another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelOrderDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelOrderResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel a whole order and every active unshipped fulfillment safely.",
        "tags": [
          "merchant-orders"
        ]
      }
    },
    "/api/v1/customer/payment-methods": {
      "get": {
        "description": "Also self-heals recent saved-card setups whose setup_intent.succeeded webhook was missed: pending SetupIntents are re-checked against Stripe and, when confirmed, the card is persisted and included in this response (#1387).",
        "operationId": "CustomerPaymentMethodsController_list",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomerPaymentMethodResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the customer’s saved payment methods.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/payment-methods/setup-intent": {
      "post": {
        "description": "Returns a client secret for Stripe Payment Element confirmation. The resulting card is persisted after the setup_intent.succeeded webhook, or by the read-time reconcile on the list endpoint when that delivery is missed (#1387).",
        "operationId": "CustomerPaymentMethodsController_createSetupIntent",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSetupIntentResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Create a Stripe SetupIntent for adding a saved card.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/payment-methods/setup-attempts/{setupHandle}/review": {
      "post": {
        "description": "A digest binds the reviewed snapshot to the opaque setup handle without retaining payer details. A correction starts a new setup; this endpoint does not confirm a card or save an address.",
        "operationId": "CustomerPaymentMethodsController_reviewSetup",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "setupHandle",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewAccountCardSetupDto"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Reviewed snapshot bound to the setup attempt."
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Bind reviewed billing and separate address choices to one account card setup.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/payment-methods/setup-attempts/{setupHandle}": {
      "get": {
        "description": "Correlates the exact attempt and SetupIntent under the authenticated customer, organization and frozen connected account. Setup finality, card projection and address/default outcomes are reported separately.",
        "operationId": "CustomerPaymentMethodsController_setupResult",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "setupHandle",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "setupIntentId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCardSetupResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read server-authoritative status for one submitted account SetupIntent.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/payment-methods/setup-attempts/{setupHandle}/address-save": {
      "post": {
        "description": "Requires proven setup success and still-valid reviewed consent on the same customer session and connected account. The submitted billing copy must match its stored digest; an uncertain write is not automatically repeated.",
        "operationId": "CustomerPaymentMethodsController_saveReviewedAddress",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "setupHandle",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewAccountCardSetupDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCardSetupResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Consume the exact setup review’s address-save choice once.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/payment-methods/{id}/default": {
      "patch": {
        "operationId": "CustomerPaymentMethodsController_setDefault",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerPaymentMethodResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Make a saved payment method the default.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/payment-methods/{id}": {
      "delete": {
        "operationId": "CustomerPaymentMethodsController_remove",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Payment method detached."
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Removal blocked by an active subscription, deposit/preauth, unpaid balance, or future required payment context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Detach a saved payment method when no active dependency blocks it.",
        "tags": [
          "customer-payment-methods"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/return-estimate": {
      "post": {
        "description": "Requires the live CustomerSession and exact existing durable Order ownership. Selection performs no ownership reconciliation, token creation or business/workflow effect. Historical monetary and eligibility evidence may be unavailable; that alone does not reject a valid request. Refresh at review; deliberate submit keeps fresh locked validation. Authentication idle-expiry and source admission are retained; estimates use a separate target budget so selection does not consume submit allowance.",
        "operationId": "CustomerOrderReferenceController_estimateReturn",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerReturnEstimateRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnEstimateResponseDto"
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Estimate a return selection on an owned reference-addressed order.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}": {
      "get": {
        "description": "Requires a live tenant-bound CustomerSession and an existing durable ownership label for the exact referenced Order. Responses are private and non-cacheable.",
        "operationId": "CustomerOrderReferenceController_getOrder",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerOrderByReferenceDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the order carries package pricing that can no longer be displayed safely. The ORDER IS UNAFFECTED and remains valid; only this presentation of it is withheld. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, so a recoverable staleness is not mistaken for a contract violation — on an order read the generic branch discards the one fact that matters, and a client that loses it is one step from creating a replacement order for an order that is fine.",
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get an owned order by its customer-safe reference.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/returns": {
      "get": {
        "description": "Requires the live CustomerSession and exact durable Order ownership. Every return carries the stable parent reference.",
        "operationId": "CustomerOrderReferenceController_listReturns",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnListByReferenceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List returns for an owned reference-addressed order.",
        "tags": [
          "customer-account"
        ]
      },
      "post": {
        "description": "Customer identity comes from the live session and durable ownership; the request deliberately carries no customer email credential.",
        "operationId": "CustomerOrderReferenceController_createReturn",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReturnByReferenceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderReferenceReturnDto"
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Create a return for an owned reference-addressed order.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/returns/{returnId}/cancel": {
      "post": {
        "description": "The Return must belong to the exact tenant and referenced parent Order and remain in a customer-cancellable state.",
        "operationId": "CustomerOrderReferenceController_cancelReturn",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "name": "returnId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderReferenceReturnDto"
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Cancel a return on an owned reference-addressed order.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/returns/facts": {
      "get": {
        "description": "Factual companion of `GET …/by-reference/{orderReference}/returns`: the same live CustomerSession, exact durable Order ownership, budgets and errors. The response leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency.",
        "operationId": "CustomerOrderReferenceController_listReturnFacts",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnFactsListByReferenceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List returns, with factual money, for an owned reference-addressed order.",
        "tags": [
          "customer-account"
        ]
      },
      "post": {
        "description": "Factual companion of `POST …/by-reference/{orderReference}/returns`: the same session/ownership authorization, budgets, validation, command and errors; no customer email credential. The response leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency.",
        "operationId": "CustomerOrderReferenceController_createReturnFacts",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReturnByReferenceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderReferenceReturnFactsDto"
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Create a return for an owned reference-addressed order, with factual money.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/returns/{returnId}/cancel/facts": {
      "post": {
        "description": "Factual companion of `POST …/by-reference/{orderReference}/returns/{returnId}/cancel`: the Return must belong to the exact tenant and referenced parent Order and remain customer-cancellable; same budgets and errors. The response leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency.",
        "operationId": "CustomerOrderReferenceController_cancelReturnFacts",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "name": "returnId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderReferenceReturnFactsDto"
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Cancel a return on an owned reference-addressed order, with factual money.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/return-actions": {
      "post": {
        "description": "Requires exact durable ownership. The issued token retains the existing seven-day tenant, Order, and purpose binding.",
        "operationId": "CustomerOrderReferenceController_issueReturnAction",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueReturnActionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueReturnActionByReferenceResponseDto"
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Issue a purpose-bound return action for an owned order.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/returns/{returnId}/shipping-instructions": {
      "get": {
        "description": "Requires the live CustomerSession, exact durable Order ownership and a return on that Order. `state` says what to do now; the confirmed payer, destination, approved items and the merchant’s customer-safe instructions appear only while they apply. Instructions come only from the merchant’s explicit confirmation, never from an order or store address. The read buys no postage and creates no label, token or notification; merchant identities, confirmation times and internal or intake notes are never included. Document reads use their own per-order budget, separate from return submission.",
        "operationId": "CustomerReturnShippingInstructionsController_getShippingInstructions",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "name": "returnId",
            "required": true,
            "in": "path",
            "description": "A return on that Order, as listed by the owned-order returns read. A return on any other Order or tenant answers the same 404.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnShippingInstructionsDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get the confirmed shipping instructions for a return on an owned order.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/by-reference/{orderReference}/returns/{returnId}/packing-slip": {
      "get": {
        "description": "Same authorization as the shipping-instructions read. The slip lists the approved items and quantities, the return and order references and the confirmed destination; it is not a shipping label or postage. It is AVAILABLE only while the customer is told to ship; otherwise `unavailableReason` names the current shipping state.",
        "operationId": "CustomerReturnShippingInstructionsController_getPackingSlip",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderReference",
            "required": true,
            "in": "path",
            "description": "Stable customer-safe Order address. A reference never grants access by itself.",
            "schema": {
              "type": "string",
              "pattern": "^or1_[0-9a-f]{32}$",
              "maxLength": 128
            }
          },
          {
            "name": "returnId",
            "required": true,
            "in": "path",
            "description": "A return on that Order, as listed by the owned-order returns read. A return on any other Order or tenant answers the same 404.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnPackingSlipDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              },
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "description": "Private response; never store in a browser or intermediary.",
                "schema": {
                  "type": "string",
                  "example": "private, no-store"
                }
              },
              "Pragma": {
                "description": "HTTP/1.0-compatible no-cache directive.",
                "schema": {
                  "type": "string",
                  "example": "no-cache"
                }
              },
              "Vary": {
                "description": "Credential and tenant dimensions used by this response.",
                "schema": {
                  "type": "string",
                  "example": "x-organization-slug, Authorization, Cookie"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get the RMA packing slip for a return on an owned order.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/profile": {
      "get": {
        "description": "Email, name, phone, and email-verification timestamp.",
        "operationId": "CustomerAccountController_getProfile",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerProfileResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get the authenticated customer’s profile.",
        "tags": [
          "customer-account"
        ]
      },
      "patch": {
        "description": "Only `name` and `phone` are editable — email (the identity key) and organization are never mutable here.",
        "operationId": "CustomerAccountController_updateProfile",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProfileDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerProfileResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Update the authenticated customer’s name and/or phone.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/profile-upgrade/candidates": {
      "get": {
        "description": "Requires a live, verified ordinary Customer session in the selected tenant. Only durably owned Orders are examined, newest first with the public order number as a stable tiebreaker. At most 40 Orders are examined; invalid or incomplete historical values and company-bearing addresses that cannot be saved without loss are omitted. Duplicate values retain their newest source, and `truncated` means older Orders exist outside this selection window. Empty arrays mean no eligible values within the window, not that no older history exists. Selection references are not credentials and do not authorize a save.",
        "operationId": "CustomerAccountController_getProfileUpgradeCandidates",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileUpgradeCandidatesResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List bounded, owned-order historical profile-upgrade candidates.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/profile-upgrade": {
      "post": {
        "description": "Requires a live, verified ordinary Customer session in the selected tenant. The server rechecks durable ownership and the bounded current candidate projection for every selection, atomically. One selected name and/or phone updates only those Customer fields; selected historical shipping/billing addresses create or reuse Customer address-book entries without changing default flags. Omitted kinds remain unchanged. A current checkout edit is order-only and cannot reach this endpoint without a separate explicit customer action. Stale and foreign selections both return the same 404 with no partial write.",
        "operationId": "CustomerAccountController_saveProfileUpgrade",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveProfileUpgradeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveProfileUpgradeResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Explicitly save selected historical profile values.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/addresses": {
      "get": {
        "operationId": "CustomerAccountController_listAddresses",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomerAddressResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the customer’s saved addresses (newest first).",
        "tags": [
          "customer-account"
        ]
      },
      "post": {
        "description": "Setting `isDefaultShipping` / `isDefaultBilling` clears the prior default of that kind (at most one default of each per customer). Safe to retry: if the customer already has an entry whose label, recipient, address lines, city, region, postal code, country and phone all equal this request exactly (an omitted optional field matches only `null`), that entry is returned with 201 and no second entry is created. A default flag set to `true` is applied to the returned entry as it would be to a new one; a create never removes a default.",
        "operationId": "CustomerAccountController_createAddress",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAddressDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerAddressResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Add an address to the customer’s address book.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/addresses/{id}": {
      "get": {
        "operationId": "CustomerAccountController_getAddress",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerAddressResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get one of the customer’s addresses by id.",
        "tags": [
          "customer-account"
        ]
      },
      "patch": {
        "description": "Patch any subset of fields. Promoting to a default clears the prior default of that kind.",
        "operationId": "CustomerAccountController_updateAddress",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAddressDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerAddressResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Update one of the customer’s addresses.",
        "tags": [
          "customer-account"
        ]
      },
      "delete": {
        "operationId": "CustomerAccountController_deleteAddress",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Address deleted."
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Delete one of the customer’s addresses.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders": {
      "get": {
        "description": "Scoped to checkout-origin orders carrying durable ownership authorized by a live matching customer session within this tenant. Captured order email alone never grants account-history access.",
        "operationId": "CustomerAccountController_listOrders",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "minimum": 1,
              "default": 1,
              "type": "number"
            }
          },
          {
            "name": "pageSize",
            "required": false,
            "in": "query",
            "description": "Page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 20,
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerOrderListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the customer’s orders (newest first, paginated).",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/{orderNumber}": {
      "get": {
        "description": "Addressed by the public `orderNumber` (never a raw DB id). A foreign order number is a soft 404.",
        "operationId": "CustomerAccountController_getOrder",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderNumber",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerOrderDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the order carries package pricing that can no longer be displayed safely. The ORDER IS UNAFFECTED and remains valid; only this presentation of it is withheld. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch, so a recoverable staleness is not mistaken for a contract violation — on an order read the generic branch discards the one fact that matters, and a client that loses it is one step from creating a replacement order for an order that is fine.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get one of the customer’s orders by its public order number.",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/orders/{orderNumber}/return-estimate": {
      "post": {
        "description": "Requires a live tenant-bound CustomerSession and existing durable Order ownership. Reads historical item/discount/tax and remaining capacity for the exact normalized selection. No business/workflow persistence, provider call or approval. Refresh at review and validate again at submit. Responses are private and non-cacheable; normal session idle expiry may advance.",
        "operationId": "CustomerActionsController_estimateReturn",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderNumber",
            "required": true,
            "in": "path",
            "description": "Public order number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerReturnEstimateRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnEstimateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Estimate a selected return without creating a return or action token.",
        "tags": [
          "customer-actions"
        ]
      }
    },
    "/api/v1/customer/account/orders/{orderNumber}/returns": {
      "get": {
        "description": "The order is addressed by public orderNumber and scoped to the session customer.",
        "operationId": "CustomerActionsController_listReturns",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderNumber",
            "required": true,
            "in": "path",
            "description": "Public order number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List returns for one of the authenticated customer’s orders.",
        "tags": [
          "customer-actions"
        ]
      }
    },
    "/api/v1/customer/account/orders/{orderNumber}/returns/facts": {
      "get": {
        "description": "Factual companion of `GET /customer/account/orders/{orderNumber}/returns`: the same session and durable Order ownership; returns are newest-first. The response leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency. Responses are private and non-cacheable.",
        "operationId": "CustomerActionsController_listReturnFacts",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderNumber",
            "required": true,
            "in": "path",
            "description": "Public order number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnFactsListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List returns, with factual money, for one of the authenticated customer’s orders.",
        "tags": [
          "customer-actions"
        ]
      }
    },
    "/api/v1/customer/account/orders/{orderNumber}/return-actions": {
      "post": {
        "description": "Creates a short-lived action token that can preview and then submit the return request exactly once.",
        "operationId": "CustomerActionsController_issueReturnAction",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "orderNumber",
            "required": true,
            "in": "path",
            "description": "Public order number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueReturnActionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueReturnActionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Issue a scoped return-action token for one customer order.",
        "tags": [
          "customer-actions"
        ]
      }
    },
    "/api/v1/customer/actions/{token}": {
      "get": {
        "description": "The action token itself is the credential. The tenant slug is still required and must match the token tenant.",
        "operationId": "CustomerActionsController_previewAction",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Raw customer action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerReturnActionPreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Preview a scoped customer action token without consuming it.",
        "tags": [
          "customer-actions"
        ]
      },
      "post": {
        "description": "Consumes the token once. Repeating the same consume call returns the original result without performing the action again.",
        "operationId": "CustomerActionsController_consumeAction",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Raw customer action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsumeReturnActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerActionConsumeResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RETURN_REQUESTED_REVIEW_STALE means the reviewed selection or estimate changed without creating a Return. Review again and reuse the same token; other eligibility/source conflicts require correction or order reload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Consume a scoped customer action token.",
        "tags": [
          "customer-actions"
        ]
      }
    },
    "/api/v1/customer/actions/{token}/facts": {
      "post": {
        "description": "Factual companion of `POST /customer/actions/{token}`: the token is the credential, still tenant-scoped by the organization slug, and is consumed once; repeating either operation returns the same return without acting again. On a replay the requested evidence is the original submission, while approval and refund show their current state. The response leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency. Responses are private and non-cacheable.",
        "operationId": "CustomerActionsController_consumeActionFacts",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "token",
            "required": true,
            "in": "path",
            "description": "Raw customer action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsumeReturnActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerActionConsumeFactsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RETURN_REQUESTED_REVIEW_STALE means the reviewed selection or estimate changed without creating a Return. Review again and reuse the same token; other eligibility/source conflicts require correction or order reload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Consume a scoped customer action token, with factual return money.",
        "tags": [
          "customer-actions"
        ]
      }
    },
    "/api/v1/public/orders/{orderId}/returns": {
      "post": {
        "deprecated": true,
        "description": "Caller must supply the customer email used at checkout. Server validates email match and that requested quantities do not exceed the original order line minus any already-claimed returns. This raw Order-id/email compatibility route is a measured retirement target; new clients use the authenticated by-reference route.",
        "operationId": "PublicReturnController_request",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReturnDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicReturnResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Email mismatch is a documented #1475 UX/security exception: the public return flow returns 403 so legitimate customers can correct the email, while org scoping, rate limiting, and no extra order detail bound probing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a return on an order (customer-initiated).",
        "tags": [
          "public-returns"
        ]
      },
      "get": {
        "deprecated": true,
        "description": "Requires the same email that placed the order. Returns are newest-first. This raw Order-id/email compatibility route is a measured retirement target.",
        "operationId": "PublicReturnController_list",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicReturnResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Email mismatch is a documented #1475 UX/security exception: the public return flow returns 403 so legitimate customers can correct the email, while org scoping, rate limiting, and no extra order detail bound probing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List the calling customer's returns on this order.",
        "tags": [
          "public-returns"
        ]
      }
    },
    "/api/v1/public/orders/{orderId}/returns/{returnId}/cancel": {
      "post": {
        "deprecated": true,
        "description": "Customer-side cancellation. After the package is in transit, cancellation routes through the merchant's status endpoint. This raw Order-id/email compatibility route is a measured retirement target.",
        "operationId": "PublicReturnController_cancel",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "returnId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelReturnDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicReturnResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Email mismatch is a documented #1475 UX/security exception: the public return flow returns 403 so legitimate customers can correct the email, while org scoping, rate limiting, and no extra order detail bound probing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Cancel a return while still REQUESTED or APPROVED.",
        "tags": [
          "public-returns"
        ]
      }
    },
    "/api/v1/public/orders/{orderId}/returns/facts": {
      "post": {
        "deprecated": true,
        "description": "Factual companion of `POST /public/orders/{orderId}/returns`: the same email check, quantity validation and errors. Leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency. Like the route it accompanies, this email-gated operation is a measured retirement target; new clients use the authenticated by-reference `/facts` operations.",
        "operationId": "PublicReturnController_requestWithFacts",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReturnDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicReturnFactsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Email mismatch is a documented #1475 UX/security exception: the public return flow returns 403 so legitimate customers can correct the email, while org scoping, rate limiting, and no extra order detail bound probing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "Return money facts are unavailable. The request is refused before the order or any return is read or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a return and read its factual money (customer-initiated).",
        "tags": [
          "public-returns"
        ]
      },
      "get": {
        "deprecated": true,
        "description": "Factual companion of `GET /public/orders/{orderId}/returns`: requires the same email that placed the order; returns are newest-first. Leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency. Like the route it accompanies, this email-gated operation is a measured retirement target; new clients use the authenticated by-reference `/facts` operations.",
        "operationId": "PublicReturnController_listWithFacts",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicReturnFactsDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Email mismatch is a documented #1475 UX/security exception: the public return flow returns 403 so legitimate customers can correct the email, while org scoping, rate limiting, and no extra order detail bound probing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "Return money facts are unavailable. The request is refused before the order or any return is read or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List the calling customer's returns on this order, with factual money.",
        "tags": [
          "public-returns"
        ]
      }
    },
    "/api/v1/public/orders/{orderId}/returns/{returnId}/cancel/facts": {
      "post": {
        "deprecated": true,
        "description": "Factual companion of `POST /public/orders/{orderId}/returns/{returnId}/cancel`: the same customer-side cancellation rules and errors. Leaves out the private refund draft (`refundAmountInCents`, `refundState`, `amountOwedInCents`, `refundCurrency`): `money` reports what the customer requested, what the merchant published once the return is approved, and the refund this return actually issued — each with its own availability and historical currency. Like the route it accompanies, this email-gated operation is a measured retirement target; new clients use the authenticated by-reference `/facts` operations.",
        "operationId": "PublicReturnController_cancelWithFacts",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "returnId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelReturnDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicReturnFactsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Email mismatch is a documented #1475 UX/security exception: the public return flow returns 403 so legitimate customers can correct the email, while org scoping, rate limiting, and no extra order detail bound probing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "Return money facts are unavailable. The request is refused before the order or any return is read or changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Cancel a return while still REQUESTED or APPROVED, and read its factual money.",
        "tags": [
          "public-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/non-stripe-completion": {
      "get": {
        "description": "Requires current merchant tenant returns:operate authority. A candidate is a necessary versioned snapshot; execution requalifies under owner locks. Only genuine zero has authoritative nonterminal Return evidence today. Positive manual/credit/exchange labels or drafts grant no settlement proof. Receipt is original safe history; absent data never implies zero or receipt.",
        "operationId": "MerchantReturnController_getNonStripeCompletion",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnNonStripeCompletionPreparationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the deliberate non-Stripe completion candidate and original receipt.",
        "tags": [
          "merchant-returns"
        ]
      },
      "post": {
        "description": "Requires current tenant merchant returns:operate authority and the reviewed candidate, refund intent, generation and reason. Atomically commits immutable receipt, status/completedAt and actor audit. All-waived Approved/InTransit/Received retains actual physical history; required-back goods need exact real receipt coverage. No settlement engine, ledger movement, provider call, physical receipt/stock or completion email. Same key and semantic payload replays the original result under current authority; changed payload or fresh terminal key conflicts.",
        "operationId": "MerchantReturnController_completeNonStripeReturn",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteReturnNonStripeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnNonStripeCompletionReceiptDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Deliberately complete a qualified genuine-zero Return.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/receipt": {
      "post": {
        "description": "Confirms the current physical-required subset at InTransit. Commits receipt, conditions, eligible once-only inventory, audit and existing receipt notification together. Same key/payload replays original receipt after later lifecycle changes; changed keys/basis conflict. No refund or provider call.",
        "operationId": "MerchantReturnController_recordExactReceipt",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordReturnExactReceiptDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnExactReceiptResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Confirm one exact ordinary physical receipt.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/protected-arrival": {
      "post": {
        "description": "Requires current tenant returns:operate permission, exact retained keep lineage and mapped whole-line quantities with real shipped-before-waiver/arrival/inspection evidence. Admits Approved, InTransit, Received, qualified Completed and legal Cancelled; status alone grants nothing. Preserves status, money, shipping and immutable original results. Same key/payload replays under current access; changed payload/basis or a fresh key conflicts. No status/refund/repair email or provider call. Required-back receipt uses the separate ordinary receipt command.",
        "operationId": "MerchantReturnController_recordProtectedArrival",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordReturnProtectedArrivalDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnProtectedArrivalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record the actual arrival of a protected waived parcel.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns": {
      "get": {
        "description": "Optional `status` filter narrows by lifecycle state. Newest-first by `requestedAt`.",
        "operationId": "MerchantReturnController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "REQUESTED",
                "APPROVED",
                "IN_TRANSIT",
                "RECEIVED",
                "COMPLETED",
                "REJECTED",
                "CANCELLED"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantReturnListItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List returns for the active org.",
        "tags": [
          "merchant-returns"
        ]
      },
      "post": {
        "description": "A team member starts a return on the customer’s behalf. It runs the same command as a customer request: the order must belong to the active organization, each quantity must fit within the units handed off on that line minus units on active returns, and a cancelled order or one being cancelled is refused (409). The return is REQUESTED and is recorded as started by the calling team member; the customer’s email and name come from the order. Starting a return does not approve it, set or issue a refund, restock inventory, confirm shipping instructions or buy a label, and the customer’s existing cancel rules apply. The customer receives the return-requested email, which says store staff created the request. 503 `RETURN_STAFF_CREATION_UNAVAILABLE` with `details.reason` `NOT_MIGRATED` while the provenance migrations are not yet applied; nothing is read or written, and the same request and key may be retried later. If the installed provenance writer is disabled, a committed key still replays its original return; a key not found returns 503 with `details.reason` `WRITER_DISABLED`. That refusal cannot settle an earlier attempt’s outcome: keep the same request and key for retry.",
        "operationId": "MerchantReturnController_create",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable command key. Retrying the same order, lines and reason with the same key returns the original return without creating another; reusing it for anything else returns 409 with `details.reason` `RETURN_STAFF_CREATION_IDEMPOTENCY_KEY_REUSED`.",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMerchantReturnDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Start a return on an order for the customer (#4077).",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/orders/{orderId}": {
      "get": {
        "description": "Every return on the order, customer- and staff-created alike, newest first and each with its `origin`, plus each order line’s remaining return eligibility for starting a new one. Read-only.",
        "operationId": "MerchantReturnController_listForOrder",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrderReturnsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List one order’s returns with remaining return eligibility (#4077).",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/order-evidence/{orderId}": {
      "get": {
        "description": "Reports whether authoritative line-level handoff evidence is already rebuildable, can be normalized from a versioned machine-owned import manifest, or remains insufficient. Aggregate fulfilled status, tracking, and ordered quantity never make an item returnable.",
        "operationId": "MerchantReturnController_classifyOrderEvidence",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnEvidenceDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Classify exact return-eligibility evidence for an imported order.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/order-evidence/{orderId}/reconcile": {
      "post": {
        "description": "Owner/Admin only. Requires explicit confirmation, the current evidence fingerprint, and an idempotency key. The command writes exact canonical fulfillment-line evidence plus an immutable before/after audit record. It does not create a Return, issue/refund money, mutate inventory or rollups, call a provider, or notify a customer.",
        "operationId": "MerchantReturnController_reconcileOrderEvidence",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable command key. Matching retries replay; reuse with another order or evidence fingerprint returns 409.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileMerchantReturnEvidenceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnEvidenceDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Normalize exact imported handoff evidence for physical returns.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}": {
      "get": {
        "operationId": "MerchantReturnController_getById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a return by id with full details.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/status": {
      "patch": {
        "description": "State-machine enforced. First approval uses POST :id/first-approval; this status-only route rejects APPROVED with RETURN_FIRST_APPROVAL_COMMAND_REQUIRED. REQUESTED → {REJECTED, CANCELLED}; APPROVED → {IN_TRANSIT, CANCELLED}; IN_TRANSIT → {RECEIVED, CANCELLED}; RECEIVED → COMPLETED. COMPLETED, REJECTED, CANCELLED are terminal. For a positive cash refund, HTTP 200 acknowledges the command but the canonical Return may remain RECEIVED; consume `status` and the redacted `refundWorkflow` rather than inferring completion from the HTTP status. A COMPLETED request may carry `refundIntent`, the refund amount and mode the merchant reviewed; if the saved or frozen refund no longer matches it, the request returns 409 with `details.reason` `RETURN_REFUND_INTENT_STALE` and changes nothing, so reload the return and review it again.",
        "operationId": "MerchantReturnController_updateStatus",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-return-refund-prior-generation",
            "in": "header",
            "description": "Required with a fresh idempotency key when retrying a deterministic no-money rejection. Pins the command to the exact failed generation.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Optional for the first refund command; required to explicitly authorize a new provider generation after a deterministic no-money rejection. Reusing a key replays only the generation it originally authorized.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReturnStatusDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Transition a return to the next status.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/intake": {
      "patch": {
        "description": "Records terminal RESELLABLE, DAMAGED, or WRITE_OFF outcomes and optional merchant notes while the return is APPROVED or IN_TRANSIT. PENDING → terminal is forward-only; changing one terminal outcome to another or editing a received return is rejected with 409. To apply outcomes and receive atomically, send the same item shape with PATCH /merchant/returns/{id}/status and status RECEIVED.",
        "operationId": "MerchantReturnController_updateIntake",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReturnIntakeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record return-item intake outcomes before receipt.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/refund-allocation-preparation": {
      "get": {
        "description": "Returns the exact cents each return item can absorb, so an operator can author `allocations` for PATCH :id/refund-amount. That endpoint requires allocations for any positive refund and never derives the split server-side. A zero-amount refund still sends `allocations: []`.",
        "operationId": "MerchantReturnController_getRefundAllocationPreparation",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnRefundAllocationPreparationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read per-item refundable cents for a return (#3057).",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/refund-amount": {
      "patch": {
        "description": "Records the refund (in cents) to issue when the return reaches COMPLETED. Validated <= the refundable cap (each returned line’s frozen checkout components, tax included, less earlier allocations, clamped to the order balance after sibling returns); free entry below the cap is allowed (e.g. a restocking-fee deduction), and 0 records that no cash refund will be issued when the return is later completed. When the detail’s `refundableCapAvailability` is UNAVAILABLE, 0 can still be saved and a positive amount is refused with 409 and execution’s retryable reason. Settable only while the return is active — a COMPLETED, REJECTED, or CANCELLED return is rejected with 409. The Stripe refund is issued on the COMPLETED transition, not by this endpoint.",
        "operationId": "MerchantReturnController_setRefundAmount",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReturnRefundAmountDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set the intended cash refund amount for a return.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/approval-publication": {
      "get": {
        "description": "Returns the current customer-visible approval (or `null`), every published revision newest first, and the customer’s requested money evidence — explicitly UNAVAILABLE with reason NOT_CAPTURED when none was captured. The private refund draft and the APPROVED lifecycle status never appear here as approved money. `currentRevisionNumber` is the `expectedCurrentRevision` for the next publication.",
        "operationId": "MerchantReturnController_getApprovalPublication",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnApprovalPublicationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the published customer approval and requested evidence.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/approval-publication/revisions": {
      "post": {
        "deprecated": true,
        "description": "Retains the version 1 aggregate publication contract during the bounded API lifecycle transition. Appends immutable history and advances its head with the existing expected-version, idempotency, requested-line, whole-return cap and explanation checks. The whole-return cap is the merchant detail’s `refundableCapInCents`, what refund execution can pay from the frozen line components; a positive amount above it is refused with 400 `RETURN_APPROVAL_EXCEEDS_REFUNDABLE_CAP`. Where the detail’s `refundableCapAvailability` is UNAVAILABLE, a positive amount is refused with 409 `APPROVED_SELECTION_UNSUPPORTED`, the complete route’s evidence refusal, and zero stays allowed. It never changes status, sends a notification, or reserves or issues money. Version 1 cannot authorize first approval. Adopt /complete-approval-publication/revisions for complete version 2 item decisions; removal follows the published API lifecycle policy and consumer adoption evidence.",
        "operationId": "MerchantReturnController_publishApprovalRevision",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable command key. Retrying the identical intent with the same key replays (`outcome: REPLAYED`) without writing; reusing it for a different intent or another return returns 409 `RETURN_APPROVAL_IDEMPOTENCY_KEY_REUSED`.",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishReturnApprovalRevisionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnApprovalPublishResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Publish a legacy aggregate customer-facing approval.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/complete-approval-publication/revisions": {
      "post": {
        "description": "Appends one immutable approval revision naming the current one as its predecessor and makes it current atomically; every predecessor is kept. Requires `expectedCurrentRevision` to equal the current revision number (409 `RETURN_APPROVAL_REVISION_STALE` otherwise), complete `itemOutcomes` for every originally requested line, and matching approved `items`. Each selected line and the total must fit the exact historical source and remaining refundable capacity in its currency. A first publication that differs from the customer’s known requested evidence, and every replacement, requires `customerExplanation`. Publishing does not change the refund draft or lifecycle status, and never reserves, issues or schedules money or sends a notification. Not available once the return is COMPLETED, REJECTED or CANCELLED.",
        "operationId": "MerchantReturnController_publishCompleteApprovalRevision",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable command key. Retrying the identical intent with the same key replays (`outcome: REPLAYED`) without writing; reusing it for a different intent or another return returns 409 `RETURN_APPROVAL_IDEMPOTENCY_KEY_REUSED`.",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishCompleteReturnApprovalRevisionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnApprovalPublishResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Complete approval schema migration is not ready. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Deliberately publish the customer-facing approval of a return.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/first-approval": {
      "post": {
        "description": "Commits the selected complete publication, REQUESTED → APPROVED, exactly one attributed existing return notification intent, and an immutable command receipt in one transaction. Rechecks exact source ownership and selected-item plus whole-return capacity under locks. A matching key and intent replays the historical success after current authorization, even after later revision or cancellation; other intent or Return under the key conflicts. Does not issue or reserve money or confirm shipping instructions.",
        "operationId": "MerchantReturnController_firstApproveReturn",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable command key. Reuse only for the identical first-approval intent.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FirstReturnApprovalDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FirstReturnApprovalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Complete approval schema migration is not ready. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Publish or deliberately reuse complete decisions and first approve a return.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/shipping-instructions": {
      "get": {
        "description": "Returns the current confirmed instructions (or `null`), every revision newest first, the current published approval a confirmation would bind (`currentApprovalRevisionNumber` and its `approvedLines`), and what the customer is told now (`customerState`, with `pendingReason` while pending). `currentRevisionNumber` is the `expectedCurrentRevision` for the next confirmation. No label, quote or carrier data exists here.",
        "operationId": "MerchantReturnController_getShippingInstructions",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnShippingInstructionsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the confirmed shipping instructions of a return.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/shipping-instructions/revisions": {
      "post": {
        "description": "Appends one immutable instruction revision naming the current one as its predecessor and makes it current atomically; every predecessor is kept. Requires `expectedCurrentRevision` to equal the current revision (409 `RETURN_SHIPPING_INSTRUCTIONS_REVISION_STALE` otherwise) and `expectedApprovalRevision` to equal the current published approval (409 `RETURN_SHIPPING_INSTRUCTIONS_APPROVAL_STALE`; 409 `RETURN_SHIPPING_INSTRUCTIONS_APPROVAL_REQUIRED` when none is published). The revision copies that approval’s approved order lines and quantities for versions 1/2, or only the exact positive physical-required subset for version 3, excluding waived/refused units. An empty version-3 subset returns 409 `RETURN_SHIPPING_INSTRUCTIONS_NOT_REQUIRED`. Version-3 actor checks, including replay, return 403 `RETURN_SHIPPING_INSTRUCTIONS_PERMISSION_REQUIRED` without current return operation permission. The revision records the explicit payer, the complete destination and optional customer-safe instructions; the destination is never filled in from an organization, origin or delivery address. Confirming identical instructions again returns 409 `RETURN_SHIPPING_INSTRUCTIONS_UNCHANGED`. Confirmation does not change the return’s status or approval, never buys, quotes or voids a label, moves money, or sends a notification. Available while the return is REQUESTED, APPROVED or IN_TRANSIT (409 `RETURN_SHIPPING_INSTRUCTIONS_CLOSED` otherwise); customers see instructions only once the return is approved.",
        "operationId": "MerchantReturnController_confirmShippingInstructions",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable command key. Retrying the identical intent with the same key replays (`outcome: REPLAYED`) without writing; reusing it for a different intent or another return returns 409 `RETURN_SHIPPING_INSTRUCTIONS_IDEMPOTENCY_KEY_REUSED`.",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmReturnShippingInstructionsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnShippingInstructionsConfirmResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Deliberately confirm the shipping instructions of a return.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/refund-exception/claim": {
      "post": {
        "description": "Assigns the case to the current operator. Claiming changes no ledger, Return, customer notification, provider, tax, shipping, fulfillment, or inventory state.",
        "operationId": "MerchantReturnController_claimRefundException",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Claim a post-success refund exception for remediation.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/refund-exception/reimbursements": {
      "post": {
        "description": "High-risk, idempotent operator attestation. Appends an ordinary Sales REFUND and reserves its Stripe Tax reversal intent, but performs no provider call and cannot issue customer money. Full coverage advances notification resolution; partial coverage leaves the balance owed visible.",
        "operationId": "MerchantReturnController_recordRefundReimbursement",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable operation key. Exact retries replay; reuse with different reimbursement facts returns 409.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordReturnRefundRemediationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record alternative reimbursement already made to the customer.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/returns/{id}/notes": {
      "patch": {
        "description": "Pass `null` to clear; pass a string up to 4000 chars to set. Customer-visible communication is a separate channel. Returns the full return detail (items joined to their order lines, the order context, and `refundableCapInCents`) — the same shape as the status and refund-amount writes and the by-id read.",
        "operationId": "MerchantReturnController_updateNotes",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReturnNotesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantReturnDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set or clear the merchant-only internal notes.",
        "tags": [
          "merchant-returns"
        ]
      }
    },
    "/api/v1/merchant/coupons": {
      "get": {
        "description": "Optional `status` filter narrows by lifecycle state. Newest first by `createdAt`. Reads are open to any org member.",
        "operationId": "MerchantCouponController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "ACTIVE",
                "DISABLED",
                "EXPIRED"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CouponResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List coupons for the active org.",
        "tags": [
          "merchant-coupons"
        ]
      },
      "post": {
        "description": "Codes are trimmed + upper-cased before write. PERCENTAGE.value is basis points (1-10000); FIXED_AMOUNT.value is cents off subtotal (>=0); FREE_SHIPPING.value is ignored. A Buy X, Get Y coupon (`buyGet` set) must be PERCENTAGE and takes no value: omit it or send 0, and set the reward in `buyGet.rewardPercentOffBasisPoints`. `expiresAt` must be strictly after `startsAt` when both are set. A `usesPerCustomer` limit is refused with 409 where this store cannot count it yet (see the field).",
        "operationId": "MerchantCouponController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCouponDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a coupon (permission required).",
        "tags": [
          "merchant-coupons"
        ]
      }
    },
    "/api/v1/merchant/coupons/{id}": {
      "get": {
        "operationId": "MerchantCouponController_getById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a coupon by id.",
        "tags": [
          "merchant-coupons"
        ]
      },
      "patch": {
        "description": "Patch-style: provided fields overwrite, omitted fields are left alone. Nullable fields (`startsAt`, `expiresAt`, `maxUses`, `usesPerCustomer`, `internalNotes`) accept explicit `null` to clear. The resulting lifecycle window + (type, value) pair are re-validated. Setting `usesPerCustomer` is refused with 409 `RESOURCE_CONFLICT` where this store cannot count it yet (see the field); clearing it is always accepted.",
        "operationId": "MerchantCouponController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCouponDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a coupon (permission required).",
        "tags": [
          "merchant-coupons"
        ]
      },
      "delete": {
        "description": "Sets `status = DISABLED`. The row stays in the DB so audit history is preserved and the storefront apply (slice 2C) can cleanly reject attempts to use the code. Requires a reason for the high-risk audit record. Idempotent — already-DISABLED rows are returned unchanged.",
        "operationId": "MerchantCouponController_softDisable",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Soft-disable a coupon (permission required).",
        "tags": [
          "merchant-coupons"
        ]
      }
    },
    "/api/v1/merchant/auto-discounts": {
      "get": {
        "description": "Optional `status` filter narrows by lifecycle state. Newest first by `createdAt`. Reads are open to any org member.",
        "operationId": "MerchantAutoDiscountController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "ACTIVE",
                "DISABLED",
                "EXPIRED"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoDiscountResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List auto-discounts for the active org.",
        "tags": [
          "merchant-auto-discounts"
        ]
      },
      "post": {
        "description": "PERCENTAGE.value is basis points (1-10000); FIXED_AMOUNT.value is cents off subtotal (>=0); FREE_SHIPPING.value is ignored. scope=ITEMS_BY_COLLECTION requires scopeCollectionId; ALL_ITEMS / ORDER_TOTAL require it to be null. `expiresAt` must be strictly after `startsAt` when both are set.",
        "operationId": "MerchantAutoDiscountController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAutoDiscountDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoDiscountResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create an auto-discount (permission required).",
        "tags": [
          "merchant-auto-discounts"
        ]
      }
    },
    "/api/v1/merchant/auto-discounts/{id}": {
      "get": {
        "operationId": "MerchantAutoDiscountController_getById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoDiscountResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch an auto-discount by id.",
        "tags": [
          "merchant-auto-discounts"
        ]
      },
      "patch": {
        "description": "Patch-style: provided fields overwrite, omitted fields are left alone. Nullable fields (`scopeCollectionId`, `startsAt`, `expiresAt`, `internalNotes`) accept explicit `null` to clear. The resulting (scope, scopeCollectionId), (type, value), and (startsAt, expiresAt) pairs are re-validated. If another write changes `scope` or `scopeCollectionId` while this one is checked, this one is checked again against the newer row; 409 RESOURCE_CONFLICT if they keep changing.",
        "operationId": "MerchantAutoDiscountController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutoDiscountDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoDiscountResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update an auto-discount (permission required).",
        "tags": [
          "merchant-auto-discounts"
        ]
      },
      "delete": {
        "description": "Sets `status = DISABLED`. The row stays in the DB so audit history is preserved and the storefront apply (slice 3B) skips it cleanly. Requires a reason for the high-risk audit record. Idempotent — already-DISABLED rows are returned unchanged. 409 RESOURCE_CONFLICT if another write keeps changing `scope` or `scopeCollectionId` while this one runs.",
        "operationId": "MerchantAutoDiscountController_softDisable",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoDiscountResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Soft-disable an auto-discount (permission required).",
        "tags": [
          "merchant-auto-discounts"
        ]
      }
    },
    "/api/v1/merchant/bundles": {
      "get": {
        "description": "Optional `status` filter narrows by lifecycle state (ACTIVE / DISABLED / EXPIRED). Newest first by `createdAt`. Reads are open to any org member. Each row includes its component items so the admin list never needs a secondary round-trip.",
        "operationId": "MerchantBundleController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "ACTIVE",
                "DISABLED",
                "EXPIRED"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BundleResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List bundles for the active org (with items).",
        "tags": [
          "merchant-bundles"
        ]
      },
      "post": {
        "description": "PERCENTAGE.value is basis points (1-10000); FIXED_AMOUNT.value is cents off subtotal (>=0); FREE_SHIPPING.value is ignored. Requires at least 2 component items — a \"bundle\" of one item isn't a bundle. Each item must belong to the active org; variant slots (when set) must reference a variant of the supplied item. `expiresAt` must be strictly after `startsAt` when both are set.",
        "operationId": "MerchantBundleController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBundleDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a bundle (permission required).",
        "tags": [
          "merchant-bundles"
        ]
      }
    },
    "/api/v1/merchant/bundles/{id}": {
      "get": {
        "operationId": "MerchantBundleController_getById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundleResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a bundle by id (with items).",
        "tags": [
          "merchant-bundles"
        ]
      },
      "patch": {
        "description": "Patch-style: provided fields overwrite, omitted fields are left alone. Nullable fields (`startsAt`, `expiresAt`) accept explicit `null` to clear. When `items` is supplied, it REPLACES the bundle's composition wholesale (still subject to the 2-item minimum). The resulting (type, value) and (startsAt, expiresAt) pairs are re-validated against the merged row state.",
        "operationId": "MerchantBundleController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBundleDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a bundle (permission required).",
        "tags": [
          "merchant-bundles"
        ]
      },
      "delete": {
        "description": "Sets `status = DISABLED`. The row stays in the DB so audit history is preserved and the storefront apply (slice 5B) skips it cleanly. Requires a reason for the high-risk audit record. Idempotent — already-DISABLED rows are returned unchanged.",
        "operationId": "MerchantBundleController_softDisable",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Soft-disable a bundle (permission required).",
        "tags": [
          "merchant-bundles"
        ]
      }
    },
    "/api/v1/public/cart/check-bundles": {
      "post": {
        "description": "Returns one entry per matching bundle with the per-bundle saving in cents. Bundles match when every component slot is satisfied: the cart has at least `minQuantity` of the slot's (itemId, variantId) tuple. Item-only slots (variantId NULL) accept any variant of the item; variant-specific slots require an exact match. Stacked additively when multiple bundles match — matches the coupon + auto-discount stacking convention. Pure detection — no persistence, no usage counter.",
        "operationId": "PublicBundleController_checkBundles",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckBundlesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckBundlesResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Detect every ACTIVE bundle the supplied cart satisfies.",
        "tags": [
          "public-bundles"
        ]
      }
    },
    "/api/v1/public/items/{slug}/bundles": {
      "get": {
        "description": "Proactive merchandising read keyed by item slug. Returns every ACTIVE bundle (lifecycle-window-gated, tenant-scoped) whose composition includes the item, with the full slot list (each slot's itemId / variantId / minQuantity plus the slot item's slug / name / price, and variant name / options / price when the slot is variant-narrowed) and `discountInCents` — the MINIMUM qualifying saving at current catalog prices times minQuantity. Actual cart savings (which scale with quantity) come from POST /public/cart/check-bundles. Bundles referencing draft / archived catalog rows are omitted. Unknown / unpublished slug → 404. Each bundle's `id` is resolvable on its own with GET /api/v1/public/bundles/{id} (#3402), which is how a surface holding only a bundle id addresses it — a bundle belongs to many items and has no canonical parent item, so this slug route is an entry point rather than a bundle's address. Each bundle and each slot also carries `availability` (#3648) — the stock-eligibility verdict an upsell needs so it stops recommending a set whose component cannot be bought. Presentation eligibility only: checkout revalidates and stays authoritative, and stock never omits a bundle from this list.",
        "operationId": "PublicItemBundleController_getBundlesForItem",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemBundlesResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List ACTIVE bundles that contain an item (public).",
        "tags": [
          "public-bundles"
        ]
      }
    },
    "/api/v1/public/bundles/{id}": {
      "get": {
        "description": "Resolves the `id` published by `GET /api/v1/public/items/{slug}/bundles` and by `POST /api/v1/public/cart/check-bundles`. Returns the same `ItemBundleDto` shape a caller already parses from the slug read — name, discount type and value, the minimum qualifying `discountInCents`, and the full component slot list. Use this when a surface holds only a bundle id: a bundle belongs to MANY items, so it has no canonical parent item and cannot be addressed through any one item's slug. Actual cart savings still come from `POST /api/v1/public/cart/check-bundles`, since they scale with quantity. Gating is identical to the slug read: tenant-scoped to `x-organization-slug`, `ACTIVE` only, inside the lifecycle window only, and omitted entirely when any component slot references a draft or archived catalog row — so an unlaunched or expired promotion is never published. Every failure THIS ROUTE handles returns ONE identical 404: unknown, another tenant's, not ACTIVE, outside its window, composition-gated, or an id shaped so it could not be queried at all are deliberately indistinguishable.\n\nThat promise is bounded to a DECODED path parameter, which is the honest limit rather than a caveat. A path the HTTP layer cannot turn into a parameter never reaches this route: an undecodable percent-escape (`/bundles/%`, `/bundles/%ZZ`) returns a `400` with `Failed to decode param`, and a missing segment (`/bundles/`) returns a `404` reading `Cannot GET …` rather than `Bundle not found`. Both happen before routing selects this handler, both are uniform across every route on the platform, and neither depends on whether any bundle exists — so they disclose nothing the identical-404 rule exists to hide. A percent-encoded NUL (`%00`) DOES decode and reach this route, and is rejected here with the ordinary 404.\n\nA published id is NOT permanently resolvable, and a bundle page must not assume otherwise. Archiving any single component item removes the bundle from this read AND from the slug read, because a partially archived composition would misrepresent what unlocks the saving. So this route gives a bundle a stable public ADDRESS; it does not give it a stable lifetime. Treat 404 as an ordinary outcome.\n\n#3648 — stock eligibility (`availability`, per slot and on the bundle) is computed by the same shared projection as the slug read, so the two surfaces agree. Stock never changes WHETHER a bundle resolves: an out-of-stock bundle still returns 200 and is labelled, because a 404 would be indistinguishable from the gated states above.",
        "operationId": "PublicBundleByIdController_getBundleById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemBundleDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch one ACTIVE bundle by its published id (public).",
        "tags": [
          "public-bundles"
        ]
      }
    },
    "/api/v1/public/shipping/zones": {
      "get": {
        "description": "Returns zones where `archivedAt IS NULL`, each with its non-archived rates inlined. Ordered by `sortOrder ASC, name ASC` at both levels. This response describes CONFIGURATION and zone-level ELIGIBILITY, NOT current checkout availability.\n\n#3272 — read `rates` and `liveRatesEnabled` together. Empty `rates` establishes only that the zone has no active flat rate. The boolean then distinguishes whether live-rate eligibility is paused or enabled; it does not promise a carrier option. A non-empty `rates` array publishes active flat-rate configuration, with each rate still subject to its own `minimumSubtotalInCents` floor. Both flat and live eligibility apply only to destinations matched by `countries`; an empty `countries` array matches no destination.\n\nFor an ordinary checkout, resolve the current option set with `POST /api/v1/public/checkout/sessions/{token}/reprice` and read `availableShippingOptions`. Physical subscription checkout has no public equivalent for resolving its current shipping options. Do not derive a checkout outcome from this configuration read.\n\nAn EMPTY top-level array means the tenant has no ACTIVE zones — including when every zone is archived — so shipping is unconfigured, not unrestricted. That is a configuration statement, not a checkout outcome.",
        "operationId": "PublicShippingController_listZones",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active zones (each with its active rates inlined), ordered by `sortOrder ASC, name ASC` at both levels. Empty when the tenant has no ACTIVE zones — which includes a tenant whose zones are all archived, not only one that never configured any. Either way shipping is unconfigured rather than unrestricted; this read does not state a checkout outcome (#3272).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicShippingZoneDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List active shipping zones with their active rates.",
        "tags": [
          "public-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/zones": {
      "get": {
        "description": "Returns zones with their rates inlined. Includes archived rows by default; pass `?archived=false` to hide soft-deleted zones.",
        "operationId": "MerchantShippingController_listZones",
        "parameters": [
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "description": "When `false`, only zones where `archivedAt IS NULL` are returned. Omitting the param includes archived rows.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ShippingZoneResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List shipping zones for the active org.",
        "tags": [
          "merchant-shipping"
        ]
      },
      "post": {
        "operationId": "MerchantShippingController_createZone",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertShippingZoneDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingZoneResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a shipping zone (permission required).",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/zones/{id}": {
      "get": {
        "operationId": "MerchantShippingController_getZone",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingZoneResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a single shipping zone with its rates.",
        "tags": [
          "merchant-shipping"
        ]
      },
      "patch": {
        "operationId": "MerchantShippingController_updateZone",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateShippingZoneDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingZoneResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The zone revision is stale while replacing delivery-promise rules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a shipping zone (permission required).",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/zones/{id}/archive": {
      "post": {
        "description": "Sets `archivedAt = now()`. Idempotent — archiving an already-archived zone returns the same row. The zone disappears from the public read while remaining visible to the merchant.",
        "operationId": "MerchantShippingController_archiveZone",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingZoneResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive (soft-delete) a shipping zone.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/zones/{id}/restore": {
      "post": {
        "description": "Clears `archivedAt`. Idempotent on an active zone.",
        "operationId": "MerchantShippingController_restoreZone",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingZoneResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a soft-deleted shipping zone.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/zones/{zoneId}/rates": {
      "post": {
        "operationId": "MerchantShippingController_createRate",
        "parameters": [
          {
            "name": "zoneId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertShippingRateDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingRateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a shipping rate on a zone (permission required).",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/rates/{rateId}": {
      "patch": {
        "operationId": "MerchantShippingController_updateRate",
        "parameters": [
          {
            "name": "rateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateShippingRateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingRateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a shipping rate (permission required).",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/rates/{rateId}/archive": {
      "post": {
        "operationId": "MerchantShippingController_archiveRate",
        "parameters": [
          {
            "name": "rateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingRateResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a shipping rate.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/rates/{rateId}/restore": {
      "post": {
        "operationId": "MerchantShippingController_restoreRate",
        "parameters": [
          {
            "name": "rateId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingRateResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a soft-deleted shipping rate.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets": {
      "get": {
        "description": "Includes active and inactive presets in deterministic merchant preference order.",
        "operationId": "MerchantShippingBoxPresetController_list",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List current shipping package presets for the active org.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      },
      "post": {
        "description": "Creates revision 1. This saves reusable configuration only and does not choose a box for any order.",
        "operationId": "MerchantShippingBoxPresetController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShippingBoxPresetDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create an active shipping package preset.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets/{presetId}": {
      "get": {
        "operationId": "MerchantShippingBoxPresetController_get",
        "parameters": [
          {
            "name": "presetId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one current shipping package preset.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      },
      "put": {
        "description": "Supersedes the observed revision and writes a complete immutable successor snapshot.",
        "operationId": "MerchantShippingBoxPresetController_replace",
        "parameters": [
          {
            "name": "presetId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceShippingBoxPresetDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace the authored fields of a package preset.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets/order": {
      "put": {
        "description": "Requires every current preset and its observed revision. Changed positions create new revisions atomically.",
        "operationId": "MerchantShippingBoxPresetController_reorder",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReorderShippingBoxPresetsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace the deterministic package-preset preference order.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets/{presetId}/activate": {
      "post": {
        "operationId": "MerchantShippingBoxPresetController_activate",
        "parameters": [
          {
            "name": "presetId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShippingBoxPresetRevisionCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Activate an inactive package preset.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets/{presetId}/deactivate": {
      "post": {
        "operationId": "MerchantShippingBoxPresetController_deactivate",
        "parameters": [
          {
            "name": "presetId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShippingBoxPresetRevisionCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Deactivate a package preset without deleting its history.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets/{presetId}/default": {
      "post": {
        "description": "Revisions the previous default off before revisioning this preset on. Default is a merchant preference, not an automatic recommendation.",
        "operationId": "MerchantShippingBoxPresetController_setDefault",
        "parameters": [
          {
            "name": "presetId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShippingBoxPresetRevisionCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Make one active package preset the organization default.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping/box-presets/{presetId}/default/clear": {
      "post": {
        "description": "Creates a new non-default revision. The active package preset remains available.",
        "operationId": "MerchantShippingBoxPresetController_clearDefault",
        "parameters": [
          {
            "name": "presetId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShippingBoxPresetRevisionCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingBoxPresetResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Clear the organization default without deactivating the preset.",
        "tags": [
          "merchant-shipping-box-presets"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider": {
      "get": {
        "description": "Returns the connection read-model: connected/disabled flags, sandbox flag, masked key fingerprint, connect/verify timestamps, the cached carrier snapshot, and whether credential encryption is configured on this environment. The API key is write-only and never returned — reads carry a masked fingerprint only.",
        "operationId": "MerchantShippingProviderController_getStatus",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingProviderStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active org's shipping-provider connection status.",
        "tags": [
          "merchant-shipping-provider"
        ]
      },
      "put": {
        "description": "High-risk, reasoned action. Validates the key with a live carrier listing against the provider, then stores it ENCRYPTED at rest along with the carrier snapshot. Idempotent per org: a second connect replaces the stored key and re-arms a disabled connection. The key is write-only — it is never returned by any read; responses carry only a masked fingerprint. Returns 400 when the key is malformed, missing a `reason`, or rejected by the provider; 502 when the provider is unreachable/misbehaving; 503 when credential encryption is not configured on this environment. Returns 409 while any label purchase for the organization is still in flight; wait for it to finish or reconcile its outcome before replacing the connection.",
        "operationId": "MerchantShippingProviderController_connect",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectShippingProviderDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingProviderStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Connect (or replace) the org's ShipEngine API key.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider/services": {
      "get": {
        "description": "#1863 — the connected carriers' rateable services (real `service_code`s with carrier + domestic/international flags), so admins pick services from a catalog instead of typing slugs (live-rate curation) and can buy labels without knowing carrier codes (#1872). Attempts a bounded live refresh, then returns a usable stored snapshot with explicit source/freshness metadata when the provider fails. A successful live empty response stays authoritative. 400 when no/disabled connection, 502 when the provider fails and no usable snapshot exists, 503 when credential encryption is unconfigured, the stored credential can no longer be decrypted (reconnect required), or an authoritative live-empty result cannot durably invalidate an older snapshot.",
        "operationId": "MerchantShippingProviderController_listServices",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingProviderServicesDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List the tenant's carrier-catalog services for the admin pickers.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider/test": {
      "post": {
        "description": "Runs a live provider check with the stored (decrypted in-memory) key. Always 200: provider or cipher failures are reported in the body (`ok: false` + code/message), never thrown. A passing check refreshes the cached carrier snapshot and `lastVerifiedAt`. The key itself is never returned. Returns 400 when no provider is connected.",
        "operationId": "MerchantShippingProviderController_testConnection",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestShippingProviderConnectionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Re-check the stored provider key with a live carrier listing.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider/disconnect": {
      "post": {
        "description": "High-risk, reasoned action. Hard-deletes the connection row so the encrypted credential leaves the database entirely; live rate quoting stops immediately and checkout falls back to flat rates. Reconnect by submitting a key again. Returns 400 when a `reason` is missing or no provider is connected. Returns 409 while any label purchase for the organization is still in flight; wait for it to finish or reconcile its outcome before disconnecting. Also returns 409 until carrier delivery updates are Disabled: request Disable and wait for owned webhook cleanup before retrying disconnect. An Owner/Admin may instead explicitly set acknowledgeUnremovedWebhooks=true to erase the local credential and revoke carrier admission while remote webhooks may remain. Hash-only history is retained and provider cleanup is not claimed. The label-purchase fence still applies.",
        "operationId": "MerchantShippingProviderController_disconnect",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisconnectShippingProviderDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingProviderStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Disconnect the org's shipping provider.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider/carrier-delivery": {
      "get": {
        "description": "Local registration evidence only. No provider lookup, raw token, callback URL, or encrypted key is returned. A replaced connection requires explicit re-registration.",
        "operationId": "MerchantCarrierDeliveryController_get",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CarrierDeliverySettingsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read carrier delivery opt-in state for the active organization.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider/carrier-delivery/enable": {
      "post": {
        "description": "Owner/Admin only. Commits a pending intent and secret-free durable job. The worker lists before creation, issues the callback token at registration time, and stores only its hash. A foreign track slot is never modified. Repeated enable preserves an active registration or pending retry.",
        "operationId": "MerchantCarrierDeliveryController_enable",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CarrierDeliverySettingsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Opt in to carrier delivery updates.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/shipping-provider/carrier-delivery/disable": {
      "post": {
        "description": "Stops admission immediately and durably requests deletion of only the locally recorded webhook id under the same credential generation. DISABLED is reported after deletion succeeds. An uncertain registration remains pending reconciliation.",
        "operationId": "MerchantCarrierDeliveryController_disable",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CarrierDeliverySettingsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Opt out of carrier delivery updates.",
        "tags": [
          "merchant-shipping-provider"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/delivery-promise-recommendations": {
      "post": {
        "description": "Read-only Owner/Admin comparison. The API tenant-validates the selected order lines and merchant-confirmed loaded package, then rates the immutable order destination and current authoritative origin against one server-derived ship date. The original quote service is re-rated as the reference; cheaper candidates are classified as same-or-faster or, separately, meets-promise. Missing ETA/reference evidence, stale settings or zone rules, incompatible currency/route/capabilities, and unsupported international customs fail closed. This operation never buys or selects a label, allocates inventory, mutates fulfillment/order state, creates a notification intent, or implies carrier handoff.",
        "operationId": "MerchantDeliveryPromiseRecommendationController_recommend",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryPromiseRecommendationRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryPromiseRecommendationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fresh-rate safe fulfillment alternatives for a delivery-promise order.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/rates": {
      "post": {
        "description": "Read-only full-rate comparison for the immutable destination, confirmed parcel and one planned ship date, signature and carrier-insurance basis. Returns eligible merchant-paid postage with provider-authored estimated dates; partial and unknown results stay explicit. A separate exact quote is required before the reasoned high-risk label purchase command. Requires BearerAuth, OrganizationSlug tenant scope, and Owner/Admin membership.",
        "operationId": "MerchantShippingLabelController_shopRates",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShopShippingRatesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShopShippingRatesResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Shop connected carrier rates for one confirmed order parcel.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-package/recommendation": {
      "post": {
        "description": "Read-only ADR-029 package planning. Uses immutable order-line parcel evidence and current active box presets, or reuses the frozen checkout plan for the exact full-order selection. A recommendation includes a bounded placement witness; uncertainty returns an explicit no-recommendation reason and never guesses.",
        "operationId": "MerchantShippingLabelController_recommendPackage",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PackageRecommendationRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PackageRecommendationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Recommend the smallest proven-fit active package preset.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/fulfillments/{fulfillmentId}/cancel-prepared-shipment": {
      "post": {
        "description": "High-risk, reasoned package-local cancellation. Label-free PLANNED/READY work cancels immediately through the canonical fulfillment-cancellation primitive. When the READY shipment carries current paid OUTBOUND postage, the command durably records one cancellation intent and queues the exact provider void before returning. The fulfillment stays READY and carrier handoff remains blocked until authoritative void evidence retires the postage; only then does the stored intent complete cancellation. Provider void approval never promises a customer refund or carrier-account credit. After a mixed whole-order cancellation denial, the same command may release one exact parent-aborted READY allocation only for Owner/Admin, only after re-proving the terminal denied parent and immutable void proof, and without another provider call or changing the parent, siblings, payment, or notification state.",
        "operationId": "MerchantShippingLabelController_cancelPreparedShipment",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable operation key. Matching retries return the same durable cancellation intent; reuse for another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelPreparedShipmentDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelPreparedShipmentResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel one prepared shipment, safely voiding paid outbound postage first.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/fulfillments/{fulfillmentId}/cancel-prepared-shipment/retry-carrier-check": {
      "post": {
        "description": "Owner/Admin-only, reasoned #2126 recovery. The server reuses the frozen label and provider credential generation from the original cancellation, records an attributable request, and performs exactly one provider GET. It never sends another void request, buys postage, resets provider-attempt history, or accepts operator evidence as provider proof. A provider-confirmed void completes the prepared-shipment cancellation; a provider-confirmed active label leaves the READY shipment usable; ambiguous results remain blocked. A different recovery key receives 409 while another check has a live 15-minute claim. If that claim never records a result, the next request may supersede it after the lease while preserving the abandoned request as immutable evidence.",
        "operationId": "MerchantShippingLabelController_retryPreparedShipmentCancellationCarrierCheck",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable recovery key. Matching retries resume or replay the attributed check. Keep the key through transient 409 responses; reuse for another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetryPreparedShipmentCancellationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelPreparedShipmentResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retry one exact carrier-label check after cancellation recovery is exhausted.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/{purchaseId}/reconciliation-status": {
      "get": {
        "description": "Returns a reload-safe, server-derived action mode and the latest immutable safe event. Credentials, generation identifiers, lookup hashes, request payloads, raw bodies, and artifact URLs are never included; bounded non-secret evidence such as label and request identifiers plus tracking presence may be returned.",
        "operationId": "MerchantShippingLabelController_getReconciliationStatus",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShippingLabelReconciliationStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read safe reconciliation certainty and currently allowed action.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/quote": {
      "post": {
        "description": "Read-only #2447 confirmation step. Recomputes the delivery-promise recommendation evidence when applicable, classifies the merchant-selected service, and performs one exact non-funded provider preflight. Returns the exact cost plus an opaque fingerprint; it allocates no lines, buys no label, and changes no fulfillment, inventory, order, or notification state.",
        "operationId": "MerchantShippingLabelController_quoteLabelSelection",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteShippingLabelSelectionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteShippingLabelSelectionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Quote and classify one exact carrier service before buying postage.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/external-shipping-label": {
      "post": {
        "description": "#4204 provider-money-free preparation. Allocates the exact selected original-order line quantities to one immutable physical package and records merchant-supplied carrier, service, tracking, source, actor, and destination-snapshot evidence before moving only that fulfillment to READY. The tracking number is required; untracked shipments are rejected clearly. This command never requests rates, reads provider credentials, funds an account, buys or voids postage, creates a ShippingLabelPurchase row, records carrier handoff, consumes inventory, changes handed-off rollups, or enqueues a shipment email. Carrier handoff and its notification decision remain a separate explicit action. The label remains merchant-managed, and later cancellation requires the existing external-label retirement acknowledgement.",
        "operationId": "MerchantShippingLabelController_prepareExternalLabel",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable operation key. Matching line, package, carrier, service, and tracking retries replay the same READY fulfillment; reuse for different evidence returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareExternalShippingLabelDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrepareExternalShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Prepare selected order lines with merchant-acquired external postage.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label": {
      "post": {
        "description": "High-risk, reasoned preparation action. It allocates the selected original-order line quantities to one server-owned physical package. Every funded request must carry the opaque fingerprint returned by the matching reviewed read-only exact selection quote for the same lines, loaded parcel, destination, carrier, service, settings, zone, and provider connection. The server freshly recomputes and exactly preflights that selected carrier/service before the durable spend claim; stale or mismatched evidence fails before funding. A captured carrier service remains the ordinary fallback. Manual/free methods and orders with no captured carrier service instead require an explicit actual-postage confirmation and `overrideReason`, recorded as OVERRIDE without any recommendation, equivalence, savings, or promise claim. A non-recommended captured-service choice requires a distinct explicit acknowledgement and `overrideReason`; both reasons remain separate from the high-risk spend reason. If that contract requires or rejects a recipient phone, `recipientPhone` provides an explicit correction for this label only and never mutates the order snapshot. It then buys through the tenant ShipEngine key. On success the label, tracking, exact rating evidence, and package binding are durable and the fulfillment becomes READY. Buying, printing, or reprinting the label never marks carrier handoff, consumes inventory, adds handed-off quantity, or enqueues a shipped notification. READY contributes zero handed-off quantity; its shared recompute may repair pre-existing projection drift from an otherwise exact ledger. Physical handoff effects belong only to the later explicit handoff action. Never auto-funds — funding is operator-driven (#1802). Sandbox (`TEST_`) keys produce a free test label. Returns 400 for a missing method/address/weight or a fixable provider rejection; 409 when a timeout, network interruption, provider 5xx, or opaque/malformed response leaves label creation uncertain and requires ShipEngine reconciliation before retry; 502 for an authoritative upstream refusal such as rate limiting; and 503 when credentials or another authoritative provider gate reject the request. Authoritative no-label failures are durably retryable after correction and fresh selection review.",
        "operationId": "MerchantShippingLabelController_buyLabel",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "#1809/#1904 — required operation key. A retry carrying the same key and canonical line/package payload replays the existing package-bound label; reusing the key with a different payload is rejected before provider spend.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BuyShippingLabelDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuyShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Prepare selected order lines and buy a native ShipEngine label (spends tenant money).",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/reconcile": {
      "post": {
        "description": "For an exact package-bound PURCHASING attempt older than the DB-clock safety window, first parks only that unchanged claim as reconciliation-required. It then performs a non-funded ShipEngine GET using the exact provider identity and credential generation persisted before the original spend. A matching completed outbound label is adopted and moves only the prepared fulfillment to READY. A first 404 remains blocked; release to FAILED requires a second explicit lookup after both the 30-minute claim grace and a five-minute separated-not-found window. Provider errors, evidence mismatches, credential changes, cancellation, and legacy rows remain blocked. Every outcome is idempotent and append-only.",
        "operationId": "MerchantShippingLabelController_reconcileLabel",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required operation key. Replays the exact prior reconciliation event; reuse with different reason or action is rejected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileShippingLabelDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconcileShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Safely reconcile an ambiguous package-bound label purchase.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/accept-actual-cost": {
      "post": {
        "description": "#3956 — for a package-bound attempt parked because the provider completed the label at a cost other than the merchant-approved fresh quote, re-verifies the exact label at ShipEngine with a non-funded GET under the same locks as reconciliation, then adopts the existing purchase at its actual cost and moves only the prepared fulfillment to READY. Price-only: tenant/order/package/fulfillment/provider-generation binding, exact label identity, outbound and non-voided status, the approved carrier/service, a valid amount in the approved currency, and a printable completed artifact remain required; missing or invalid amounts, currency differences, and identity or artifact conflicts stay blocked. The approved quote is preserved beside the actual cost and their signed difference. It never buys another label, records carrier handoff, consumes inventory, or sends a shipped notification. Idempotent and append-only.",
        "operationId": "MerchantShippingLabelController_acceptActualCost",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required operation key. Replays the exact prior acceptance event; reuse with a different reason or action is rejected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptShippingLabelActualCostDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconcileShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Accept a parked completed label at its actual provider cost.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/fulfillments/{fulfillmentId}/retire-postage": {
      "post": {
        "description": "#4050 / PC-13 — for a handoff recorded by mistake while the parcel is still with the merchant. This is NOT cancel-prepared-shipment with a relaxed guard: that command cancels the fulfillment and releases its allocation on success, which must never happen after goods leave. Eligibility is server-derived and narrow: a line-managed handed-off shipment (SHIPPED or DELIVERED) with an exact physical package whose named, current outbound ShipEngine purchase is PURCHASED with an exact label and provider connection generation, on a non-terminal parent, with no void already requested for that label. The named purchase must be the current postage; a newer replacement label is never substituted. The command durably records one idempotent intent and append-only attempt evidence before any provider I/O, then queues the exact provider void outside the database transaction. On authoritative carrier approval the exact purchase is retired and NOTHING else changes: no unship, no fulfillment or order cancellation, no allocation release, no restock, no payment or return change, no customer refund, and no new customer email. Denial leaves the postage live and usable. An ambiguous result reconciles through bounded exact-label lookups rather than blind retries. Provider acceptance never promises a carrier-account credit, and retired postage is never evidence about whether the goods were delivered. A DELIVERED shipment is eligible on purpose: a merchant may print a label here and then ship by another route — hand delivery, customer pickup, a different courier — so a delivered order can still carry entirely unused postage. Only the carrier knows whether a given label was scanned, so the request is recorded and the provider adjudicates rather than the platform guessing from its own fulfillment status.",
        "operationId": "MerchantShippingLabelController_retirePostHandoffPostage",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable operation key. Matching retries return the same durable retirement intent; reuse for another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetirePostHandoffPostageDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetirePostHandoffPostageResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Ask the carrier to retire the postage on an already handed-off shipment, without cancelling it.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/fulfillments/{fulfillmentId}/retire-postage/retry-carrier-check": {
      "post": {
        "description": "#4050 — Owner/Admin-only, reasoned #2126-style recovery for a post-handoff postage retirement. The server reuses the frozen label and provider credential generation from the original request, records an attributable request, and performs exactly one provider GET. It never sends another void request, buys postage, resets provider-attempt history, or accepts operator evidence as provider proof. A provider-confirmed void retires the postage and leaves the shipment exactly as it is; a provider-confirmed active label leaves the postage live and usable; ambiguous results remain unresolved rather than being relabelled as denial.",
        "operationId": "MerchantShippingLabelController_retryPostHandoffPostageRetirementCarrierCheck",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable recovery key. Matching retries resume or replay the attributed check. Keep the key through transient 409 responses; reuse for another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetryPostHandoffPostageRetirementCheckDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetirePostHandoffPostageResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retry one exact carrier-label check after a postage retirement exhausted recovery.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/void-parked-label": {
      "post": {
        "description": "#3956 — the refusal alternative to accept-actual-cost. For a package-bound attempt parked because ShipEngine completed the label at a cost other than the merchant-approved fresh quote, durably records one void intent and queues the exact provider void before returning, exactly as a prepared-shipment cancellation does for paid postage (#1803). Eligibility is server-derived and narrow: a PLANNED line-managed package whose current outbound ShipEngine purchase is RECONCILIATION_REQUIRED with the cost-mismatch diagnostic, a completed printable label whose valid same-currency cost differs from the approved quote, a provider generation and exact label identity, and no void of that label already requested. No READY transition is manufactured: a confirmed void retires the purchase as VOIDED and then cancels the planned package through the same #1933 kernel a prepared-shipment cancellation uses, releasing its items for a fresh preparation with a new quote; a denial leaves the label parked and acceptable at its actual cost; an ambiguous result reconciles through bounded exact-label lookups. Acceptance is excluded while a void of the label exists. Provider void approval never promises carrier-account credit.",
        "operationId": "MerchantShippingLabelController_voidParkedLabel",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable operation key. Matching retries return the same durable void intent; reuse for another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoidParkedShippingLabelDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoidParkedShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Void a parked completed label at the provider instead of accepting its actual cost.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/void-parked-label/retry-carrier-check": {
      "post": {
        "description": "#3956 — Owner/Admin-only, reasoned #2126-style recovery for a parked-label void. The server reuses the frozen label and provider credential generation from the original void, records an attributable request, and performs exactly one provider GET. It never sends another void request, buys postage, resets provider-attempt history, or accepts operator evidence as provider proof. A provider-confirmed void retires the label and cancels the planned package, releasing its items; a provider-confirmed active label leaves it parked and acceptable at its actual cost; ambiguous results remain blocked.",
        "operationId": "MerchantShippingLabelController_retryParkedLabelVoidCarrierCheck",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable recovery key. Matching retries resume or replay the attributed check. Keep the key through transient 409 responses; reuse for another payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetryParkedShippingLabelVoidCheckDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoidParkedShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retry one exact carrier-label check after a parked-label void exhausted recovery.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/orders/{orderId}/shipping-label/legacy-disposition": {
      "post": {
        "description": "Records the operator reason, bounded evidence note, and conclusion in immutable history. It never calls the provider, never changes fulfillment state, and never grants automatic retry permission. Current package-bound attempts with safe lookup identity must use the reconcile endpoint instead.",
        "operationId": "MerchantShippingLabelController_recordLegacyDisposition",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required operation key. Reuse with a different disposition, reason, or evidence is rejected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordLegacyShippingLabelDispositionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconcileShippingLabelResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record an attributable disposition for a legacy ambiguous label.",
        "tags": [
          "merchant-shipping-label"
        ]
      }
    },
    "/api/v1/merchant/shipping/warehouse-outputs": {
      "get": {
        "description": "Returns one tenant-scoped physical fulfillment row per shipment, with packing-slip lines/address and server-derived label eligibility. Defaults to READY rows. A label is eligible only when the latest package-bound OUTBOUND purchase is durably PURCHASED, completed, and has a safe PDF artifact.",
        "operationId": "MerchantWarehouseOutputController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum fulfillment rows to return. Defaults to 50.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque next-page cursor returned by the previous response. Treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Shipment lifecycle to show. Defaults to READY.",
            "schema": {
              "type": "string",
              "enum": [
                "PLANNED",
                "READY",
                "SHIPPED",
                "DELIVERED"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarehouseOutputListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List bounded shipment fulfillments for warehouse output.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/warehouse-outputs/csv": {
      "post": {
        "description": "Exports exactly 1–50 selected, tenant-owned shipment fulfillments in the request order. The bounded read does not buy postage or change any fulfillment/handoff state. Spreadsheet-formula prefixes are neutralized.",
        "operationId": "MerchantWarehouseOutputController_exportCsv",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseOutputSelectionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "CSV attachment containing the selected rows.",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "413": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Export selected fulfillment/shipment rows as CSV.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/merchant/shipping/warehouse-outputs/labels": {
      "post": {
        "description": "Downloads and locally merges the already-purchased PDF artifact for each selected fulfillment, in request order. This makes no authenticated ShipEngine API call, sends no label-purchase request, buys no postage, and performs no fulfillment or handoff mutation. Downloads use bounded concurrency and a batch deadline, and the final PDF stays below a 4 MiB deployment-safe response ceiling. Any stale, voided, missing, invalid, oversized, slow, or unavailable artifact fails the whole request rather than silently omitting a label.",
        "operationId": "MerchantWarehouseOutputController_combineLabels",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseOutputSelectionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One combined PDF containing every selected label page.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Combine existing purchased labels into one printable PDF.",
        "tags": [
          "merchant-shipping"
        ]
      }
    },
    "/api/v1/public/subscription-plans": {
      "get": {
        "description": "Returns cursor-paginated ACTIVE CUSTOMER plans published to PUBLIC_STOREFRONT with at least one ACTIVE recurring price synced to the tenant's current VERIFIED connected Stripe account. Draft, archived, API-only, merchant-created-only, stale-account, unsynced, and catalog-ineligible plans are omitted. Stripe ids, tenant ids, metadata, and entitlement internals are never exposed.",
        "operationId": "PublicSubscriptionPlanController_list",
        "parameters": [
          {
            "name": "priceLimit",
            "required": false,
            "in": "query",
            "description": "Maximum recurring prices to include per returned plan.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 20,
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum public plans to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 24,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque plan cursor from a previous response (`nextCursor`). Treat it as opaque and pass it back unchanged.",
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSubscriptionPlanListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List purchasable public subscription plans.",
        "tags": [
          "public-subscriptions"
        ]
      }
    },
    "/api/v1/public/subscription-plans/{slug}": {
      "get": {
        "description": "Resolves PUBLIC_STOREFRONT and API_BYO_ONLY plans. API_BYO_ONLY slugs are intentionally non-enumerable but are not bearer secrets. Every unpublished, merchant-only, stale-account, unsynced, cross-tenant, or catalog-ineligible state is masked as the same neutral 404.",
        "operationId": "PublicSubscriptionPlanController_getBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priceLimit",
            "required": false,
            "in": "query",
            "description": "Maximum recurring prices to include per returned plan.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 20,
              "type": "integer"
            }
          },
          {
            "name": "priceCursor",
            "required": false,
            "in": "query",
            "description": "Opaque price cursor from a prior plan response (`nextPriceCursor`). Treat it as opaque and pass it back unchanged.",
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSubscriptionPlanDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No purchasable public/BYO subscription plan matches the slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch a purchasable subscription plan by known slug.",
        "tags": [
          "public-subscriptions"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans": {
      "get": {
        "description": "Optional `status` filter narrows by lifecycle state. Newest first.",
        "operationId": "MerchantSubscriptionPlanController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "DRAFT",
                "ACTIVE",
                "ARCHIVED"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionPlanResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List subscription plans for the active org.",
        "tags": [
          "merchant-subscription-plans"
        ]
      },
      "post": {
        "description": "Plans are born DRAFT. `channelVisibility` defaults to MERCHANT_CREATED_ONLY (orthogonal to status). Add a price, then publish.",
        "operationId": "MerchantSubscriptionPlanController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSubscriptionPlanDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPlanResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a subscription plan (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans/{planId}": {
      "get": {
        "operationId": "MerchantSubscriptionPlanController_getById",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPlanDetailResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a plan with its prices and entitlement rules.",
        "tags": [
          "merchant-subscription-plans"
        ]
      },
      "patch": {
        "description": "Patch-style: provided fields overwrite, omitted are left alone, explicit null clears nullable fields. Lifecycle status is changed via publish/archive, not here.",
        "operationId": "MerchantSubscriptionPlanController_update",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSubscriptionPlanDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPlanResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a subscription plan (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      },
      "delete": {
        "description": "Soft-archive: sets status ARCHIVED + archivedAt. The plan and its prices stay (existing subscriptions keep referencing them). Idempotent.",
        "operationId": "MerchantSubscriptionPlanController_archive",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPlanResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a plan (elevated permission + reason required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans/{planId}/publish": {
      "post": {
        "description": "Requires at least one ACTIVE price synced to a connected Stripe account. Idempotent-ish: an already-ACTIVE plan re-publishes cleanly.",
        "operationId": "MerchantSubscriptionPlanController_publish",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPlanResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Publish a plan → ACTIVE (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans/{planId}/prices": {
      "post": {
        "description": "Mints a backing Stripe Product (once per plan) + Price on the tenant connected account. If the org has no verified account the price is stored unsynced (Stripe ids null) and the plan cannot be published yet.",
        "operationId": "MerchantSubscriptionPriceController_create",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSubscriptionPriceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPriceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Add a recurring price to a plan (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans/{planId}/prices/{priceId}": {
      "patch": {
        "description": "Only `isDefault` and `metadata` are patchable — Stripe Prices are immutable, so amount/currency/interval cannot change here.",
        "operationId": "MerchantSubscriptionPriceController_update",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSubscriptionPriceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPriceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a price’s local fields (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      },
      "delete": {
        "description": "Flips local status to ARCHIVED and archives the backing Stripe Price (active:false). Existing subscriptions keep it (grandfathering). Idempotent.",
        "operationId": "MerchantSubscriptionPriceController_archive",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPriceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a price (elevated permission + reason required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans/{planId}/entitlements": {
      "post": {
        "description": "Unique per (plan, key). All five entitlement types are accepted; the `value` payload shape is validated by the projection consumer (#631).",
        "operationId": "MerchantSubscriptionEntitlementController_create",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSubscriptionEntitlementDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionEntitlementResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Define an entitlement rule on a plan (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/merchant/subscription-plans/{planId}/entitlements/{entitlementId}": {
      "patch": {
        "description": "`key` and `entitlementType` are identity and not patchable — delete + recreate to change them.",
        "operationId": "MerchantSubscriptionEntitlementController_update",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entitlementId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSubscriptionEntitlementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionEntitlementResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update an entitlement rule’s value/metadata (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      },
      "delete": {
        "description": "Hard delete of the rule DEFINITION. (No customer grants exist yet — grant projection is #631.)",
        "operationId": "MerchantSubscriptionEntitlementController_remove",
        "parameters": [
          {
            "name": "planId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entitlementId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete an entitlement rule (permission required).",
        "tags": [
          "merchant-subscription-plans"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/analytics-consent": {
      "post": {
        "description": "Records the storefront-collected choice against this checkout. You supply the `updateCapability` secret that authorizes later updates; the platform stores only its hash and never returns it, so persist it BEFORE sending this request. The response reports when that capability stops authorizing new updates. The grant ceiling is frozen from the checkout at acceptance and is never extended by activity, retry or update, and runs on a separate clock from the capability. Unavailable consent never blocks commerce: a failure here leaves checkout working. A client abort, timeout or disconnect does not prove database cancellation: it may commit later. No hard completion deadline is promised; a local timer, lease expiry or released client lock is not proof of remote completion. Recover an ambiguous delivery with the original checkout reference, capability, operation, idempotency key and body, including the genuine choice time; do not remint a capability or invent a new assertedAt to recover a lost reply. Server-to-server callers may omit Origin and use the same reference/capability contract; CORS is not server authentication. The API derives tenant scope from the original reference and the consent plane from its own runtime. Source admission precedes reference resolution and shares one per-source bucket with every public analytics-consent route on that instance, including the state, cleanup and hosted-cleanup reads: per warm instance, a fixed 60-second window admits at most 300 requests per source, 2048 tracked sources and 20000 requests total. Backend callers sharing an egress address share that bucket. A 429 includes Retry-After; honour it before retrying. Cold starts reset this local bound and multiple instances multiply it; it is not a tenant-wide budget or throughput guarantee. Source identity uses Express req.ip with one trusted proxy hop, then the socket address. Arbitrary tenant-supplied forwarding headers are not a supported shopper-IP delegation contract; proxy sanitization/topology needs separate deployment verification. The platform stores capability hashes and receipts, not a recoverable copy of the caller secret or the caller's current intent. No tenant database product is prescribed, and these routes alone do not qualify browser-only recovery after lost caller custody.",
        "operationId": "PublicCheckoutAnalyticsConsentController_handoff",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Caller-generated key for this handoff. Retrying with the same key and an identical body is a safe no-op that reports the acceptance already recorded; nothing is re-issued, because you generated the capability yourself and still hold it. Retrying with the same key and a DIFFERENT `updateCapability` is a different request and is refused `409`. **That replay window is seven days**, the retry-receipt lifetime: after it expires the same-key retry no longer finds its receipt and is refused `400` as a second handoff for a checkout that already has one. A lost response is therefore recoverable within seven days, not indefinitely. Identical overlapping handoffs serialize behind the scoped database transaction lock. Commit stores authority and receipt together; rollback stores neither, allowing the retry to decide against the remaining authority. A pending twin is not a distinct in-flight 409 protocol: the documented 409 is reuse of a key for a different request. Admission, infrastructure or transaction timeout failures can still occur.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentHandoffDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentHandoffResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing idempotency key, malformed body, or an assertion the accepted contract refuses — for example a grant asserted at or after the checkout ceiling, or `inheritedDenial` on a non-denied state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "One neutral response for unknown, malformed, cross-tenant and ineligible checkout references alike.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "This idempotency key was already used for a different handoff — most often a retry carrying a different `updateCapability`. Nothing was changed. Retry with the secret you originally persisted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this source. Admission is decided BEFORE the checkout token is resolved and is keyed on the request source alone, so a 429 here says nothing about whether the token is valid — a recognised and an unrecognised token are throttled identically. The tenant daily budget is still accounted for these routes but no longer denies them, precisely so the response cannot depend on resolution.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "summary": "Hand off a shopper analytics-consent choice to hosted checkout",
        "tags": [
          "public-checkout"
        ]
      },
      "get": {
        "description": "Side-effect-free. This call never reconciles payment, reprices, resumes or terminalizes the checkout, and never renews a grant. A stored grant reports `unknown` once the frozen ceiling has passed, evaluated at `readAt`. **That is not by itself enough to stop on time:** the answer is evaluated server-side, so a response delayed in transit or held by a client can still carry `granted` after `originalCutoffAt`. Honour `originalCutoffAt` yourself regardless of response timing, and base any freshness window on `readAt` rather than local arrival time. This GET does not debit the commerce `public_api_daily` budget. Its independent consent-read reservation seam is currently inert: no runtime backend or numerical read limits are configured. A configured reservation refusal or failure returns the same neutral projection as an unresolved reference.",
        "operationId": "PublicCheckoutAnalyticsConsentController_readState",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Always 200 once admitted — including for unknown or ineligible references and configured consent-read reservation refusals or failures, which return the same empty projection as a checkout with no recorded consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentStateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this source. Admission is decided BEFORE the checkout token is resolved and is keyed on the request source alone, so a 429 here says nothing about whether the token is valid — a recognised and an unrecognised token are throttled identically. Source admission is unchanged; this GET never debits the commerce `public_api_daily` budget. A consent-read reservation refusal or failure returns a neutral 200, not this source-admission response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "summary": "Read the current analytics-consent state for a checkout",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/analytics-consent/updates": {
      "post": {
        "description": "Applies a newer choice under the purpose-bound capability. Ordering is enforced server-side: an assertion that is not strictly newer than the accepted choice is refused, a delayed grant can never rebase over a later withdrawal, and a grant assertion must have assertedAt before the frozen ceiling. HTTP 200 alone is not acceptance: inspect outcome, and count a withdrawal as acknowledged only for its exact accepted request. A timeout, abort or closed tab proves neither commit nor rollback; there is no bounded-completion guarantee. Preserve the original request identity when retrying an ambiguous delivery. Receipt and capability expiry are evaluated using the attempt clock captured before reference resolution and transaction lock waits, not at commit. The response reprojects cutoff/lifecycle state after the transaction but does not re-read a later writer. It carries neither an evaluation timestamp nor the cutoff: use the timestamped state GET for current enforcement, honour its originalCutoffAt, and fence delayed replies against newer local intent. A replayed acceptance never authorizes restoring an older grant over a newer Deny. A client abort, timeout or disconnect does not prove database cancellation: it may commit later. No hard completion deadline is promised; a local timer, lease expiry or released client lock is not proof of remote completion. Recover an ambiguous delivery with the original checkout reference, capability, operation, idempotency key and body, including the genuine choice time; do not remint a capability or invent a new assertedAt to recover a lost reply. Server-to-server callers may omit Origin and use the same reference/capability contract; CORS is not server authentication. The API derives tenant scope from the original reference and the consent plane from its own runtime. Source admission precedes reference resolution and shares one per-source bucket with every public analytics-consent route on that instance, including the state, cleanup and hosted-cleanup reads: per warm instance, a fixed 60-second window admits at most 300 requests per source, 2048 tracked sources and 20000 requests total. Backend callers sharing an egress address share that bucket. A 429 includes Retry-After; honour it before retrying. Cold starts reset this local bound and multiple instances multiply it; it is not a tenant-wide budget or throughput guarantee. Source identity uses Express req.ip with one trusted proxy hop, then the socket address. Arbitrary tenant-supplied forwarding headers are not a supported shopper-IP delegation contract; proxy sanitization/topology needs separate deployment verification. The platform stores capability hashes and receipts, not a recoverable copy of the caller secret or the caller's current intent. No tenant database product is prescribed, and these routes alone do not qualify browser-only recovery after lost caller custody.",
        "operationId": "PublicCheckoutAnalyticsConsentController_update",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Caller-generated key for this update. An exact retry preserves this key, checkout, capability, state, assertedAt and expectedRevision. Overlapping attempts serialize: if the first transaction commits, an unexpired receipt replays its decision without another transition; if it rolls back, the retry is evaluated against the authority that remains. Receipts expire seven days after the deciding attempt's captured entry clock, without renewal on replay. Expiry of the capability does not prevent reading its own unexpired receipt, but retirement does. Missing or expired receipts provide no historical acknowledgement or reset of authority.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "x-consent-update-capability",
            "in": "header",
            "description": "The capability YOU supplied on the handoff for THIS checkout — the platform never returned it and cannot. Never place it in a URL, log or analytics payload.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentUpdateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentUpdateResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing capability or idempotency header, or a malformed body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The same neutral response the handoff uses for an unresolved reference. This is not an acknowledgement and does not prove that an earlier ambiguous attempt rolled back.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The idempotency key was already used for a DIFFERENT request on this checkout. Nothing was applied. Retry the new request with a fresh key — this is never an acknowledgement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this source. Admission is decided BEFORE the checkout token is resolved and is keyed on the request source alone, so a 429 here says nothing about whether the token is valid — a recognised and an unrecognised token are throttled identically. The tenant daily budget is still accounted for these routes but no longer denies them, precisely so the response cannot depend on resolution.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "summary": "Update the analytics-consent choice for a checkout",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/analytics-consent/cleanup": {
      "get": {
        "description": "The minimum cleanup-only projection. Deliberately independent of commerce availability: a shopper returning to a long-expired checkout still learns that an accepted withdrawal left cleanup outstanding. Carries no customer, order, payment or token detail, and a lapse to `unknown` never creates an obligation. This GET does not debit the commerce `public_api_daily` budget. Its independent consent-read reservation seam is currently inert: no runtime backend or numerical read limits are configured. A configured reservation refusal or failure returns the neutral cleanup projection.",
        "operationId": "PublicCheckoutAnalyticsConsentController_readCleanup",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Always 200 once admitted. A 429 here is the per-source admission gate described above; this GET does not debit the commerce budget. Missing, deleted, out-of-scope, purged and never-withdrawn authorities, and configured consent-read reservation refusals or failures, all answer `cleanupRequired: false, cleanupRequiredAt: null`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentCleanupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this source. Admission is decided BEFORE the checkout token is resolved and is keyed on the request source alone, so a 429 here says nothing about whether the token is valid — a recognised and an unrecognised token are throttled identically. Source admission is unchanged; this GET never debits the commerce `public_api_daily` budget. A consent-read reservation refusal or failure returns a neutral 200, not this source-admission response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "summary": "Read any outstanding owned-cookie cleanup obligation",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/analytics-consent/hosted-read": {
      "get": {
        "description": "Ordinary hosted refresh uses one host-bound original-reference resolution, one consent-read reservation and one authority-row snapshot for both required projections. An original or still-authorized resume token must belong to the independently host-resolved tenant and API deployment plane. Source admission precedes tenant/token lookup. Cleanup takes precedence: an outstanding instruction suppresses state without reading configuration. Otherwise the current configuration is read afresh, and state/readAt are narrowed after awaited reads against the immutable original cutoff. No commerce GET, payment reconciliation, create/reprice/resume, grant renewal, cutoff extension or cleanup-completion write occurs. Unavailable hosted pages retain the separate minimal hosted-cleanup route without normal state/configuration reads. Existing token-only BYO routes are unchanged. This GET never debits the commerce public_api_daily budget. The independent reservation seam remains inert; no backend or numerical limits are installed. The unchanged ten-second recurring cadence targets six API reads per active minute instead of twelve paired reads; this is not runtime or billing proof.",
        "operationId": "PublicHostedCheckoutAnalyticsConsentController_readHosted",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-checkout-environment",
            "in": "header",
            "description": "Hosted deployment plane; must equal the API deployment plane. It cannot select another plane. Invalid or mismatched scope returns a neutral read.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "development",
                "preview",
                "production"
              ]
            }
          },
          {
            "name": "x-organization-slug",
            "in": "header",
            "description": "Tenant slug independently resolved by the hosted server from the request host before token use. Never derive it from the token, query or a browser override. The API binds resolution to that ACTIVE organization.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private, no-store. Required state and cleanup fields only. Missing/invalid scope, wrong tenant/plane, unknown/malformed/excluded/revoked references, absent/ended authority, backend failure or reservation refusal/failure yield neutral unknown state with null authority/configuration fields and false/null cleanup. Neutral cleanup never proves successful cleanup. A configuration failure suppresses state; cleanup facts still come from the same row. No identity, lookup reason, capability or commerce data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentHostedReadResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Private, no-store source admission refusal before tenant/token lookup. Recognized and unknown references are refused identically. Reservation refusal/failure instead returns neutral 200. No commerce allowance debit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "summary": "Read hosted consent state and cleanup from one authority snapshot",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/public/checkout/sessions/{token}/analytics-consent/hosted-cleanup": {
      "get": {
        "description": "Side-effect-free hosted cleanup on ordinary and unavailable original checkout entry. Supply host-resolved tenant and deployment scope on every request. The existing primary token or already recognized, still-authorized resume token must resolve to that same tenant and original session; consent is read only in the API deployment plane. Ordinary commerce expiry, including a ten-day original return, does not cancel accepted-withdrawal cleanup while this binding remains authorized. No commerce GET, payment reconciliation, create/reprice/resume, grant renewal, cutoff extension or shared cleanup-completion write occurs. No new URL credential or reference mapping is created. BYO handoff, update and token-only reads retain their existing contract. This GET does not debit the commerce `public_api_daily` budget. Its independent consent-read reservation seam is currently inert: no runtime backend or numerical read limits are configured. A configured reservation refusal or failure returns the neutral cleanup projection.",
        "operationId": "PublicHostedCheckoutAnalyticsConsentController_readCleanup",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-checkout-environment",
            "in": "header",
            "description": "The hosted caller deployment plane. It must equal the API deployment plane; it cannot select another plane. Missing, invalid or mismatched values yield the neutral cleanup projection.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "development",
                "preview",
                "production"
              ]
            }
          },
          {
            "name": "x-organization-slug",
            "in": "header",
            "description": "Expected tenant slug, independently resolved by the hosted server from the current request host, never from the checkout token, URL query or browser-supplied tenant override. The API resolves the ACTIVE organization and constrains the original/resume-token lookup to its id. This header alone grants no authority; matching configuration markers prove no identity.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private, no-store. Once admitted, missing/invalid scope, wrong tenant or environment, unknown/malformed, revoked/retired/deleted/excluded or otherwise unusable authority, backend read failures and configured consent-read reservation refusals or failures all return `cleanupRequired: false, cleanupRequiredAt: null`, indistinguishable from no withdrawal. False does not establish successful cleanup or a usable checkout. Unknown/lapse alone creates no cleanup instruction. No identity, lookup reason, configuration or commerce data is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentCleanupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Private, no-store source admission refusal, before tenant/token lookup. Recognized and unknown tokens are refused identically. Source admission is unchanged; this GET never debits the commerce `public_api_daily` budget. A consent-read reservation refusal or failure returns a neutral 200, not this source-admission response. An error may leave cleanup unfulfilled; it is not a completed attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "summary": "Read cleanup bound to the independently resolved hosted tenant",
        "tags": [
          "public-checkout"
        ]
      }
    },
    "/api/v1/merchant/checkout-analytics-consent": {
      "get": {
        "description": "Authenticated, tenant- and environment-scoped diagnostics for the consent-driven hosted analytics integration on THIS deployment: which policy governs, whether the adopted configuration permits analytics, the reason as a safe category, where the answer came from and when it was evaluated, and coarse daily counts for at most 30 days. Describes platform decisions only — never a shopper, a session, an order or any claim that Google received data. Open to any member of the organization.",
        "operationId": "MerchantCheckoutAnalyticsConsentController_read",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionDiagnosticsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read hosted-checkout analytics adoption status and trends.",
        "tags": [
          "merchant-checkout-analytics-consent"
        ]
      }
    },
    "/api/v1/merchant/checkout-analytics-consent/enable": {
      "post": {
        "deprecated": true,
        "description": "Owners and Admins enroll or renew GA4 through PATCH /merchant/settings.",
        "operationId": "MerchantCheckoutAnalyticsConsentController_enable",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableCheckoutAnalyticsAdoptionDto"
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not an Owner or Admin of this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "CHECKOUT_ANALYTICS_ADOPTION_REJECTED with details.reason REPLACEMENT_ACKNOWLEDGEMENT_REQUIRED. Use PATCH /merchant/settings to acknowledge the measurement ID, consent mode and regions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retired GA4 acknowledgement endpoint.",
        "tags": [
          "merchant-checkout-analytics-consent"
        ]
      }
    },
    "/api/v1/merchant/checkout-analytics-consent/disable": {
      "post": {
        "description": "Requires `settings:manage` (Owner/Admin or delegated Staff), the same boundary that may clear the measurement ID. Analytics stops on active hosted pages at their next configuration read and stays off; the environment remains adopted and NEVER returns to the legacy notice-based defaults. Works whether or not adoption is currently available on this deployment. An environment already disabled answers `applied: false` and writes nothing.",
        "operationId": "MerchantCheckoutAnalyticsConsentController_disable",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionControlResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`CHECKOUT_ANALYTICS_ADOPTION_REJECTED` with `details.reason` `NOT_ADOPTED`: this store has never enrolled in this environment. There is nothing to disable. Nothing was written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Disable the adopted analytics integration on this environment.",
        "tags": [
          "merchant-checkout-analytics-consent"
        ]
      }
    },
    "/api/v1/merchant/checkout-analytics-consent/control-evidence": {
      "get": {
        "description": "Owner or Admin only — the existing audit-reader roles. Each applied enable, re-enable, acknowledgement renewal or disable, newest first, retained at most 365 days from the event. Existing settings audit history is separate and unchanged.",
        "operationId": "MerchantCheckoutAnalyticsConsentController_listEvidence",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size, 1–100.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque `nextCursor` from the previous page. Omit for the newest page.",
            "schema": {
              "maxLength": 256,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionEvidencePageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List adoption control evidence for this environment.",
        "tags": [
          "merchant-checkout-analytics-consent"
        ]
      }
    },
    "/api/v1/storefront/analytics-consent/configuration": {
      "get": {
        "description": "One ordinary metered configuration check for the server-side storefront integration. Requires a storefront:read key and a verified origin. Use only on an owed configuration check. An inactive or unavailable answer keeps analytics off and does not cancel any owed consent operation.",
        "operationId": "StorefrontGa4ConsentConfigurationController_read",
        "parameters": [
          {
            "name": "x-storefront-visitor-country",
            "in": "header",
            "description": "Assigned ISO 3166-1 alpha-2 country or territory determined by the authenticated storefront server from the current shopper request. Omit if the host cannot verify the region.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-storefront-origin",
            "in": "header",
            "description": "Origin of the storefront request. Must match the tenant key and the verified storefront domain and commerce environment.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ga4ConsentConfigurationDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Read the effective storefront GA4 configuration",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/analytics-consent/checkout-handoff": {
      "post": {
        "description": "Server-to-server with a storefront:consent key and its verified storefront origin; a request carrying a browser Origin is refused. Send the input of the maintained adapter `acceptMerchantPolicyHandoff` seam unchanged as the JSON body, and return this status, body and any Retry-After to the adapter. Records the checkout as `unknown` with its update capability and the configuration marker the storefront qualified against. It records no shopper choice or shopper time and grants nothing: hosted checkout separately requires its own trusted request region, the current acknowledged configuration, the validated opt-out address and an acknowledged eligibility write before any collection. A later Decline withdraws this checkout with the same capability and addressed update as after a shopper handoff. Uses ordinary tenant API accounting. Unavailable consent never blocks commerce: a failure here leaves checkout working with analytics off.",
        "operationId": "StorefrontCheckoutMerchantPolicyHandoffController_handoff",
        "parameters": [
          {
            "name": "x-storefront-origin",
            "in": "header",
            "description": "Origin of the storefront this server integration is installed for. Must match the tenant key, the verified storefront domain and the commerce environment.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentMerchantPolicyHandoffDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Accepted, or an exact retry of an accepted handoff. A first acceptance reports `state` `unknown`, `revision` `1` and `grantGeneration` `0`. An exact retry writes nothing and reports the checkout authority as it is now, not a copy of the first reply: after an accepted Allow it reports `granted`, and after an accepted Decline `denied`, each with its later `revision` and `grantGeneration`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutAnalyticsConsentHandoffResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body, a scope field that does not match this request, or an opt-out address the contract does not accept. Nothing was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Browser origin, key scope, storefront origin or its verification refused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "One neutral response for unknown, malformed, cross-tenant and ineligible checkout references alike.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "No merchant basis was recorded: the configuration marker is not the current acknowledged active collect-unless-opted-out configuration, the commerce environment is not eligible, this checkout already has a consent authority, or the idempotency key was already used for a different request. The cases are not distinguished. Hosted checkout stays off for this checkout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Source admission or ordinary API quota refused. Honor Retry-After.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                },
                "description": "Whole seconds before another attempt."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Hand off a merchant-policy checkout to hosted checkout",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/merchant/limits": {
      "get": {
        "description": "Returns `{ plan, limits, usage, hostedApiApplicable }` for the active org. `limits` contains the effective caps from the exact accepted Custom terms for a managed plan, or the standard tier table for a legacy plan. A null limit means that dimension is unlimited under that policy. Unavailable or inconsistent managed terms return 503 rather than unlimited limits. `usage` has matching keys with the org's current counts. The admin Plan & Usage page renders progress bars off these. Hosted API calls are included in the total API count and both daily allowances reset at UTC midnight. `hostedApiApplicable` is a presentation flag derived from the effective checkout mode; false means BYO, not that previously recorded hosted usage is zero.\n\nOpen to any authenticated member of the org.",
        "operationId": "LimitsController_getLimits",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantLimitsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the active org's plan, effective limits, and current usage.",
        "tags": [
          "merchant-limits"
        ]
      }
    },
    "/api/v1/merchant/limits/alerts": {
      "get": {
        "description": "Available to any tenant member. Uses the shared tenant settings and Live daily allowances even when the admin Sandbox view is selected. Reads do not send alerts.",
        "operationId": "UsageAlertSettingsController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAlertSettingsDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Alert settings are unavailable until their schema is installed; no settings were saved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read daily usage email alert thresholds.",
        "tags": [
          "merchant-limits"
        ]
      },
      "put": {
        "description": "Owner/Admin only. Replaces the three percentages as one ordered set. Applies to future admitted API requests and never sends an email merely because settings were saved.",
        "operationId": "UsageAlertSettingsController_update",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UsageAlertSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAlertSettingsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Alert settings are unavailable until their schema is installed; no settings were saved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set all three daily usage email alert thresholds.",
        "tags": [
          "merchant-limits"
        ]
      }
    },
    "/api/v1/public/pages": {
      "get": {
        "description": "Always filters to `status = PUBLISHED` and excludes archived rows. DRAFT and archived pages are never visible to public storefront callers regardless of query params.",
        "operationId": "PublicPageController_getPages",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicPageSummaryDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List PUBLISHED pages for the tenant (public).",
        "tags": [
          "public-pages"
        ]
      }
    },
    "/api/v1/public/pages/{slug}": {
      "get": {
        "description": "DRAFT or archived pages are masked as 404 so storefronts cannot probe for unpublished slugs.",
        "operationId": "PublicPageController_getPageBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The PUBLISHED page matching the slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPageSummaryDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No PUBLISHED page matches the slug (unknown, DRAFT, or archived) — neutral `RESOURCE_NOT_FOUND` (#1221).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch a PUBLISHED page by slug (public).",
        "tags": [
          "public-pages"
        ]
      }
    },
    "/api/v1/merchant/pages": {
      "get": {
        "description": "Returns PUBLISHED + DRAFT pages by default in createdAt-desc order. Pass `?archived=true` to include archived rows, optionally with `?status=ARCHIVED` to see only archived. Pass `?search=...` for substring search across title + content.",
        "operationId": "MerchantPageController_listPages",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by page status. On the public route this is forced to PUBLISHED. On the merchant route the default is \"any non-archived\".",
            "schema": {
              "type": "string",
              "enum": [
                "PUBLISHED",
                "DRAFT",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over title and content.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "description": "Merchant-only. When true, soft-deleted (`archivedAt != null`) pages are included. Public reads ignore this. Accepts `true`/`1`/`yes` (case-insensitive) for true, `false`/`0`/`no` for false. Any other value is rejected as 400.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantPageDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List pages for the active org.",
        "tags": [
          "merchant-pages"
        ]
      },
      "post": {
        "operationId": "MerchantPageController_createPage",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePageDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a page (permission required).",
        "tags": [
          "merchant-pages"
        ]
      }
    },
    "/api/v1/merchant/pages/by-slug/{slug}": {
      "get": {
        "operationId": "MerchantPageController_getPageBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPageDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a page by slug (merchant — includes DRAFT + archived).",
        "tags": [
          "merchant-pages"
        ]
      }
    },
    "/api/v1/merchant/pages/{id}": {
      "get": {
        "operationId": "MerchantPageController_getPageById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPageDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch a page by id (merchant — includes DRAFT + archived).",
        "tags": [
          "merchant-pages"
        ]
      },
      "patch": {
        "operationId": "MerchantPageController_updatePage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePageDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a page (permission required).",
        "tags": [
          "merchant-pages"
        ]
      }
    },
    "/api/v1/merchant/pages/{id}/archive": {
      "post": {
        "description": "Sets `archivedAt = now()` and `status = ARCHIVED`. Idempotent — archiving an already-archived page returns the same row.",
        "operationId": "MerchantPageController_archivePage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive (soft-delete) a page.",
        "tags": [
          "merchant-pages"
        ]
      }
    },
    "/api/v1/merchant/pages/{id}/restore": {
      "post": {
        "description": "Clears `archivedAt` and sets `status = DRAFT` (conservative — merchant must republish to make it visible). Idempotent.",
        "operationId": "MerchantPageController_restorePage",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a soft-deleted page.",
        "tags": [
          "merchant-pages"
        ]
      }
    },
    "/api/v1/public/storefront/site-config": {
      "get": {
        "description": "Server-driven storefront configuration derived from the org record (ADR-003). `storefrontOrigin` resolves the canonical domain in the selected Production or Sandbox commerce schema, independently of API deployment. Browser Origin or server `x-storefront-origin` must identify a verified Domains entry; its tenant and commerce mode are authoritative, with no missing-source Production fallback. `null` when no origin is configured for that commerce mode. Storefronts should prefer this over a per-deploy site-URL or commerce-mode env var. `commerceEnvironment` and `hostedCheckoutUrl` report the API-selected commerce mode and hosted checkout origin. The response also exposes only customer-facing support contact, the three http(s)-guarded policy URLs, the default-off ordinary-cart checkout phone requirement, a recipient-free confirmation-email guidance capability, and derived trust proof: the verified/attested storefront origin and the effective origins selected by the API checkout, customer-action, and newsletter resolvers; raw organization settings are never returned. `orderProcessing` (#3275) carries the tenant-wide order-processing timing a shipping-policy page needs — effective processing business days, the effective local order cutoff, and the timezone both are evaluated in — resolved from the same inputs that produce `shipByDate` on a checkout session. That timezone is usually an IANA name but is NOT guaranteed to be one: the gate is what `Intl.DateTimeFormat` accepts, so a tenant storing a fixed offset such as `+05:00` has it published verbatim. Do not reject the response or attempt an IANA lookup on that basis — see the field description for the full contract. Read `mode` first: `description` means the two timing values are not configured rather than zero. Per-rate transit windows and the free-text per-rate estimate remain on `GET /api/v1/public/shipping/zones`. This response is no-store; refresh it rather than retaining email-guidance capability across configuration changes.",
        "operationId": "PublicStorefrontSiteConfigController_getSiteConfig",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorefrontSiteConfigDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Fetch the tenant's storefront site config and destination trust proof.",
        "tags": [
          "public-site-config"
        ]
      }
    },
    "/api/v1/merchant/organization": {
      "get": {
        "description": "Requires merchant authentication and membership for x-organization-slug. Returns the same customer-safe organization projection as the public snapshot from the merchant-selected commerce mode. No storefront origin is required; member authority selects the tenant. No raw settings, credentials, or domain proof fields are returned.",
        "operationId": "MerchantOrganizationController_getOrganization",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The selected organization’s customer-safe snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantOrganizationSnapshotDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the authenticated merchant organization snapshot.",
        "tags": [
          "merchant-settings"
        ]
      }
    },
    "/api/v1/merchant/organization/catalog-price-currency": {
      "get": {
        "description": "Requires merchant authentication and membership for x-organization-slug; member authority selects the tenant. Returns the currency that the stored catalog price minor units are denominated in. It comes from the organization’s Canadian signup initialization record, never from the editable store profile currency: CAD only for an organization created through the Canadian signup admission, including after its eligibility is withdrawn, and USD for every other organization. Both commerce modes return the Live organization’s answer.",
        "operationId": "MerchantOrganizationController_getCatalogPriceCurrency",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The selected organization’s catalog price currency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCatalogPriceCurrencyDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the currency of the merchant organization’s catalog prices.",
        "tags": [
          "merchant-settings"
        ]
      }
    },
    "/api/v1/merchant/domain-verification": {
      "get": {
        "description": "Returns both tenant-owned storefronts, independent of Admin mode or API deployment. The production slot is the live store; the legacy staging slot is Sandbox. sandboxEnabled=false means Sandbox has not been provisioned; its slot is empty.",
        "operationId": "DomainVerificationController_getStatus",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Production and Sandbox storefront-domain verification for the active org.",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/domain": {
      "delete": {
        "description": "Clears the canonical domain and its trust for Production or Sandbox, and invalidates pending and verified ownership proofs atomically. Releases the hostname without changing the other commerce mode. The expectedHost must match the current configuration; a changed host returns 409. Never falls back to a retired preview URL.",
        "operationId": "DomainVerificationController_disconnect",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisconnectDomainDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Disconnect the selected storefront domain.",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/proposal": {
      "post": {
        "description": "Requires CUSTOM hosting mode. Supersedes the pending challenge for this environment without changing the active host or trust. A proposed domain is not reserved or used for routing until verification activates it.",
        "operationId": "DomainVerificationController_proposeDomain",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProposeDomainDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Propose a storefront domain and issue its DNS-TXT proof.",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/proposal/verify": {
      "post": {
        "description": "A matching DNS-TXT proof atomically activates the proposed host as VERIFIED. A DNS miss returns verified:false and preserves the active domain. Expired, cancelled, superseded, or configuration-stale proofs cannot activate. A domain already assigned in this environment returns 409 without changing either tenant.",
        "operationId": "DomainVerificationController_verifyDomainProposal",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainProposalChallengeDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Verify and activate the exact pending storefront-domain proposal.",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/proposal/cancel": {
      "post": {
        "description": "Fails only the specified pending DOMAIN_CHANGE challenge for the active organization and environment. The active host and its verification status are unchanged. A stale challenge id returns 404; refresh status before retrying.",
        "operationId": "DomainVerificationController_cancelDomainProposal",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainProposalChallengeDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel the exact pending domain proposal.",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/challenge": {
      "post": {
        "description": "Returns the TXT record the tenant must publish. Supersedes any prior pending challenge for this environment. A host that is already trusted stays trusted while re-verification runs.",
        "operationId": "DomainVerificationController_createChallenge",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Issue a DNS-TXT ownership challenge (permission required).",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/verify": {
      "post": {
        "description": "Resolves the TXT record; on a match flips the per-env status to VERIFIED. A DNS miss returns `verified: false` (not an error) so the tenant can retry while DNS propagates.",
        "operationId": "DomainVerificationController_verifyChallenge",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Check the active DNS-TXT challenge (permission required).",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/domain-verification/{environment}/revoke": {
      "post": {
        "description": "Resets the per-env status to UNVERIFIED (fail closed) and fails any active challenge. Use when a domain changes hands or a later check fails.",
        "operationId": "DomainVerificationController_revoke",
        "parameters": [
          {
            "name": "environment",
            "required": true,
            "in": "path",
            "description": "Tenant commerce mode: production is the live store; staging is the legacy wire name for Sandbox, not the API deployment.",
            "schema": {
              "enum": [
                "production",
                "staging"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainVerificationStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Domain verification schema update is not installed yet; retry shortly. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revoke verification for an environment (permission required).",
        "tags": [
          "merchant-domain-verification"
        ]
      }
    },
    "/api/v1/merchant/email-sending-domain": {
      "get": {
        "description": "Returns the configured domain, its provider verification status, the DNS records that must be published, the candidate sender address, and the current closed-default sender-policy selection for new tenant-authored production deliveries. A stable VERIFIED domain may be selected only when the independent sender-resolution switch and production admission configuration are ready. Platform-authored mail retains the platform sender, and retries retain the exact sender pinned on first admission. Any authenticated member can read this surface.",
        "operationId": "MerchantEmailSendingDomainController_get",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSendingDomainDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read this organization’s sending-domain configuration.",
        "tags": [
          "merchant-email-sending-domain"
        ]
      },
      "post": {
        "description": "Durably queues provider registration before any provider call. The response may be CONFIGURING while the reconciliation drain obtains the SPF/DKIM records; later reads return the canonical lifecycle. Configuring a domain never starts sending on it. Verification establishes eligibility; only the separately gated sender policy may select it for future tenant-authored production deliveries, while existing retries retain their admission-time sender. When a different domain is already configured this returns 409; remove it first so the swap is explicit and separately audited. Re-posting the same domain with a new `fromLocalPart` updates the sender name without disturbing verification.",
        "operationId": "MerchantEmailSendingDomainController_configure",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfigureEmailSendingDomainDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSendingDomainDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Configure the sending domain for this organization.",
        "tags": [
          "merchant-email-sending-domain"
        ]
      },
      "delete": {
        "description": "Durably records removal and fences sender eligibility before provider I/O. The response may be REMOVING until the exact provider object and local projection converge. New tenant-authored admissions select the platform default immediately; existing retries retain their immutable sender pin. Removing when nothing is configured is a no-op and still returns 200.",
        "operationId": "MerchantEmailSendingDomainController_remove",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSendingDomainDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove the configured sending domain.",
        "tags": [
          "merchant-email-sending-domain"
        ]
      }
    },
    "/api/v1/merchant/email-sending-domain/verify": {
      "post": {
        "description": "Records a verification intent, fences sender eligibility immediately, and returns the canonical lifecycle, which may be VERIFYING while the provider performs its asynchronous check. The durable drain polls until the provider reports a terminal status. Rate limited per organization — DNS propagation takes minutes, and the provider account is shared across tenants. If the domain no longer exists at the provider, the drain clears the exact bound local configuration and a later read reports it as unconfigured.",
        "operationId": "MerchantEmailSendingDomainController_verify",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSendingDomainDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Re-check verification for the configured sending domain.",
        "tags": [
          "merchant-email-sending-domain"
        ]
      }
    },
    "/api/v1/merchant/api-keys": {
      "get": {
        "description": "By default returns only non-revoked keys. Pass `?includeRevoked=true` to include revoked rows for audit review.",
        "operationId": "ApiKeysController_list",
        "parameters": [
          {
            "name": "includeRevoked",
            "required": false,
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List API keys for the active org.",
        "tags": [
          "merchant-api-keys"
        ]
      },
      "post": {
        "description": "The returned `secret` is shown ONCE. There is no way to retrieve it again — only revoke + recreate. Surface a \"copy now\" affordance in the admin UI before navigating away from the post-create state.",
        "operationId": "ApiKeysController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyWithSecretDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a new API key (permission required).",
        "tags": [
          "merchant-api-keys"
        ]
      }
    },
    "/api/v1/merchant/api-keys/{id}/revoke": {
      "post": {
        "description": "Idempotent: revoking an already-revoked key is a no-op. The row is retained for audit history — we never delete API key rows.",
        "operationId": "ApiKeysController_revoke",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revoke an API key (permission required).",
        "tags": [
          "merchant-api-keys"
        ]
      }
    },
    "/api/v1/merchant/audit-logs": {
      "get": {
        "description": "Returns the most recent audit events for this tenant in `createdAt DESC` order. Supports filtering by action substring, targetType, targetId, actorUserId, and a time range (`since` / `until`). Cursor pagination via the returned `nextCursor`. Requires an OWNER or ADMIN membership; any other role receives 403.",
        "operationId": "MerchantAuditController_list",
        "parameters": [
          {
            "name": "action",
            "required": false,
            "in": "query",
            "description": "Action namespace prefix or full action string. e.g. `item.` matches `item.created`, `item.updated`; `collection.archived` matches exactly. Substring match on the action column.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetType",
            "required": false,
            "in": "query",
            "description": "Filter by target entity type — `item`, `variant`, `collection`, `page`, etc. Exact match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetId",
            "required": false,
            "in": "query",
            "description": "Filter to a specific target id (combine with `targetType` for best results — different entities can share an id space in theory). Accepts canonical UUIDs, historical/imported text identities and logical keys: `targetType=commerce_number_config` with `ORDER`, `QUOTE`, `INVOICE`, `CONTRACT` or `invalid-kind` lists every saved or refused numbering change for that kind.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "actorUserId",
            "required": false,
            "in": "query",
            "description": "Filter to actions performed by a specific user.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "required": false,
            "in": "query",
            "description": "ISO-8601 timestamp; only audit events created at or after this instant are returned. Useful for \"since I last checked\" polling.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until",
            "required": false,
            "in": "query",
            "description": "ISO-8601 timestamp; only audit events created strictly before this instant are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (the `nextCursor` field). Currently a stringified row id; treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantAuditLogPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List audit log entries for the active org.",
        "tags": [
          "merchant-audit"
        ]
      }
    },
    "/api/v1/merchant/audit-logs/export": {
      "get": {
        "description": "Streams the FULL set of audit events matching the given filters (`action`, `targetType`, `targetId`, `actorUserId`, `since`, `until` — the same filters as the list endpoint) as `text/csv`, in the same `createdAt DESC` order, with NO pagination or row cap. Columns: timestamp (ISO), actorUserId, actorEmail, action, targetType, targetId, metadata (JSON-encoded). Served as an attachment download; an empty result still returns a header-only CSV. Same auth/tenancy as the list — OWNER or ADMIN only, org-scoped.",
        "operationId": "MerchantAuditController_export",
        "parameters": [
          {
            "name": "action",
            "required": false,
            "in": "query",
            "description": "Action namespace prefix or full action string. e.g. `item.` matches `item.created`, `item.updated`; `collection.archived` matches exactly. Substring match on the action column.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetType",
            "required": false,
            "in": "query",
            "description": "Filter by target entity type — `item`, `variant`, `collection`, `page`, etc. Exact match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetId",
            "required": false,
            "in": "query",
            "description": "Filter to a specific target id (combine with `targetType` for best results — different entities can share an id space in theory). Accepts canonical UUIDs, historical/imported text identities and logical keys: `targetType=commerce_number_config` with `ORDER`, `QUOTE`, `INVOICE`, `CONTRACT` or `invalid-kind` lists every saved or refused numbering change for that kind.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "actorUserId",
            "required": false,
            "in": "query",
            "description": "Filter to actions performed by a specific user.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "required": false,
            "in": "query",
            "description": "ISO-8601 timestamp; only audit events created at or after this instant are returned. Useful for \"since I last checked\" polling.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until",
            "required": false,
            "in": "query",
            "description": "ISO-8601 timestamp; only audit events created strictly before this instant are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV stream of the matching audit events (attachment).",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Export audit log entries as CSV.",
        "tags": [
          "merchant-audit"
        ]
      }
    },
    "/api/v1/merchant/settings/connection-details": {
      "get": {
        "description": "Read-only connection details for any authenticated member of the organization resolved by x-organization-slug. Returns only the guarded organization ID and current slug, serving environment, and hosted customer-account URL. Does not load or create settings, access API keys, or return credentials. Environment and hostedAccountUrl are null when runtime identity cannot be safely matched.",
        "operationId": "MerchantSettingsController_getConnectionDetails",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionDetailsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the active organization's connection details.",
        "tags": [
          "merchant-settings"
        ]
      }
    },
    "/api/v1/merchant/settings": {
      "get": {
        "description": "Returns the full `organization_settings` row for the org bound to the request (resolved by `x-organization-slug`). On first call, the service materializes an empty row with all category JSONB columns set to `{}` so the client never has to handle a 404.\n\nOpen to any authenticated member of the org.",
        "operationId": "MerchantSettingsController_getSettings",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Settings row plus the active organization timezone used by tenant-local settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationSettingsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the active org's settings.",
        "tags": [
          "merchant-settings"
        ]
      },
      "patch": {
        "description": "Partial update. Each category in the body — `businessProfile`, `checkoutSettings`, `apiSettings`, `notifications`, `shippingSettings` — is SHALLOW-MERGED into the existing JSONB column at the top level only. Omitted categories are left alone. To clear a nullable key inside a category, set it to `null` in the payload (the spread preserves explicit null).\n\nEmits `settings.updated` to the audit log; metadata records only the category names that were touched, never the values themselves.",
        "operationId": "MerchantSettingsController_updateSettings",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated settings row plus the active organization timezone used by tenant-local settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationSettingsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The delivery-promise catalog revision is stale; refresh before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "The GA4 acknowledgment is temporarily unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update the active org's settings (permission required).",
        "tags": [
          "merchant-settings"
        ]
      }
    },
    "/api/v1/merchant/settings/tax-readiness": {
      "get": {
        "description": "Read-only, server-derived status for the active organization resolved by x-organization-slug. Requires settings:manage (Owner/Admin or delegated Staff). Returns only safe states and mode; never account identifiers, settings values or provider errors. Does not configure Stripe or establish legal tax obligations.",
        "operationId": "MerchantTaxReadinessController_getReadiness",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxReadinessDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Check connected Stripe Tax readiness.",
        "tags": [
          "merchant-settings"
        ]
      }
    },
    "/api/v1/merchant/settings/canadian-operating-profile": {
      "get": {
        "operationId": "CanadianOperatingProfileController_getProfile",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "enum": [
                        1
                      ],
                      "example": 1
                    },
                    "currentRevisionId": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$",
                      "format": "uuid",
                      "nullable": true,
                      "description": "Null only when no revision exists."
                    },
                    "revisionNumber": {
                      "type": "integer",
                      "minimum": 1,
                      "nullable": true
                    },
                    "facts": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "residency": {
                          "type": "string",
                          "enum": [
                            "DECLARED_CA_RESIDENT",
                            "DECLARED_NON_RESIDENT",
                            "UNKNOWN"
                          ]
                        },
                        "entityKind": {
                          "type": "string",
                          "enum": [
                            "INCORPORATED",
                            "SOLE_PROPRIETOR",
                            "PARTNERSHIP",
                            "OTHER",
                            "UNKNOWN"
                          ]
                        },
                        "incorporation": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN",
                                    "NOT_APPLICABLE"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "registeredOffice": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN",
                                    "NOT_APPLICABLE"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision",
                                    "city",
                                    "line1",
                                    "postalCode"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "headquarters": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN",
                                    "NOT_APPLICABLE"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision",
                                    "city",
                                    "line1",
                                    "postalCode"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "principalBusinessLocation": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision",
                                    "city",
                                    "line1",
                                    "postalCode"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "materialQuebecPresence": {
                          "type": "string",
                          "enum": [
                            "UNKNOWN",
                            "PRESENT",
                            "DECLARED_NONE"
                          ]
                        },
                        "warehouse": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 20,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[cC][aA]$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "phone": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "city",
                                    "line1",
                                    "postalCode",
                                    "country",
                                    "state",
                                    "name",
                                    "phone"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "designatedReturnFacility": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "CONFIRMED",
                                    "UNCONFIRMED"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 20,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[cC][aA]$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "phone": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "city",
                                    "line1",
                                    "postalCode",
                                    "country",
                                    "state",
                                    "name",
                                    "phone"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "preferences": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "timezone": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "pattern": "^[^\\u0000-\\u001F\\u007F]+$",
                              "nullable": true,
                              "description": "Declared IANA time zone. Null means unset and leaves the declaration incomplete."
                            },
                            "weightUnit": {
                              "type": "string",
                              "enum": [
                                "OZ",
                                "LB",
                                "G",
                                "KG",
                                null
                              ],
                              "nullable": true,
                              "description": "Declared weight unit. Null means unset and leaves the declaration incomplete."
                            },
                            "dimensionUnit": {
                              "type": "string",
                              "enum": [
                                "IN",
                                "CM",
                                null
                              ],
                              "nullable": true,
                              "description": "Declared dimensions unit. Null means unset and leaves the declaration incomplete."
                            }
                          },
                          "required": [
                            "timezone",
                            "weightUnit",
                            "dimensionUnit"
                          ]
                        }
                      },
                      "required": [
                        "residency",
                        "entityKind",
                        "incorporation",
                        "registeredOffice",
                        "headquarters",
                        "principalBusinessLocation",
                        "materialQuebecPresence",
                        "warehouse",
                        "designatedReturnFacility",
                        "preferences"
                      ],
                      "nullable": true,
                      "description": "Null only when no revision exists."
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "currentRevisionId",
                    "revisionNumber",
                    "facts"
                  ],
                  "description": "Current private declaration. An absent profile has null currentRevisionId, revisionNumber and facts."
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Canadian setup is unavailable in this scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Profile source unavailable (PROFILE_SOURCE_UNAVAILABLE). It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the current private Canadian operating declaration.",
        "tags": [
          "merchant-settings"
        ]
      },
      "put": {
        "operationId": "CanadianOperatingProfileController_saveProfile",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "expectedRevisionId": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$",
                    "format": "uuid",
                    "nullable": true,
                    "description": "Send explicit null for the first save."
                  },
                  "facts": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "residency": {
                        "type": "string",
                        "enum": [
                          "DECLARED_CA_RESIDENT",
                          "DECLARED_NON_RESIDENT",
                          "UNKNOWN"
                        ]
                      },
                      "entityKind": {
                        "type": "string",
                        "enum": [
                          "INCORPORATED",
                          "SOLE_PROPRIETOR",
                          "PARTNERSHIP",
                          "OTHER",
                          "UNKNOWN"
                        ]
                      },
                      "incorporation": {
                        "type": "object",
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNKNOWN",
                                  "NOT_APPLICABLE"
                                ]
                              }
                            },
                            "required": [
                              "state"
                            ]
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "PRESENT"
                                ]
                              },
                              "value": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "country": {
                                    "type": "string",
                                    "pattern": "^[a-zA-Z]{2}$"
                                  },
                                  "subdivision": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  }
                                },
                                "required": [
                                  "country",
                                  "subdivision"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "value"
                            ]
                          }
                        ]
                      },
                      "registeredOffice": {
                        "type": "object",
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNKNOWN",
                                  "NOT_APPLICABLE"
                                ]
                              }
                            },
                            "required": [
                              "state"
                            ]
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "PRESENT"
                                ]
                              },
                              "value": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "country": {
                                    "type": "string",
                                    "pattern": "^[a-zA-Z]{2}$"
                                  },
                                  "subdivision": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "city": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line1": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line2": {
                                    "type": "string",
                                    "minLength": 0,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                  },
                                  "postalCode": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 32,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  }
                                },
                                "required": [
                                  "country",
                                  "subdivision",
                                  "city",
                                  "line1",
                                  "postalCode"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "value"
                            ]
                          }
                        ]
                      },
                      "headquarters": {
                        "type": "object",
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNKNOWN",
                                  "NOT_APPLICABLE"
                                ]
                              }
                            },
                            "required": [
                              "state"
                            ]
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "PRESENT"
                                ]
                              },
                              "value": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "country": {
                                    "type": "string",
                                    "pattern": "^[a-zA-Z]{2}$"
                                  },
                                  "subdivision": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "city": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line1": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line2": {
                                    "type": "string",
                                    "minLength": 0,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                  },
                                  "postalCode": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 32,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  }
                                },
                                "required": [
                                  "country",
                                  "subdivision",
                                  "city",
                                  "line1",
                                  "postalCode"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "value"
                            ]
                          }
                        ]
                      },
                      "principalBusinessLocation": {
                        "type": "object",
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNKNOWN"
                                ]
                              }
                            },
                            "required": [
                              "state"
                            ]
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "PRESENT"
                                ]
                              },
                              "value": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "country": {
                                    "type": "string",
                                    "pattern": "^[a-zA-Z]{2}$"
                                  },
                                  "subdivision": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "city": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line1": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line2": {
                                    "type": "string",
                                    "minLength": 0,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                  },
                                  "postalCode": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 32,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  }
                                },
                                "required": [
                                  "country",
                                  "subdivision",
                                  "city",
                                  "line1",
                                  "postalCode"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "value"
                            ]
                          }
                        ]
                      },
                      "materialQuebecPresence": {
                        "type": "string",
                        "enum": [
                          "UNKNOWN",
                          "PRESENT",
                          "DECLARED_NONE"
                        ]
                      },
                      "warehouse": {
                        "type": "object",
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNKNOWN"
                                ]
                              }
                            },
                            "required": [
                              "state"
                            ]
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "PRESENT"
                                ]
                              },
                              "value": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "city": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line1": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line2": {
                                    "type": "string",
                                    "minLength": 0,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                  },
                                  "postalCode": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "country": {
                                    "type": "string",
                                    "pattern": "^[cC][aA]$"
                                  },
                                  "state": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "phone": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 40,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  }
                                },
                                "required": [
                                  "city",
                                  "line1",
                                  "postalCode",
                                  "country",
                                  "state",
                                  "name",
                                  "phone"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "value"
                            ]
                          }
                        ]
                      },
                      "designatedReturnFacility": {
                        "type": "object",
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNKNOWN"
                                ]
                              }
                            },
                            "required": [
                              "state"
                            ]
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "CONFIRMED",
                                  "UNCONFIRMED"
                                ]
                              },
                              "value": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "city": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line1": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "line2": {
                                    "type": "string",
                                    "minLength": 0,
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                  },
                                  "postalCode": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "country": {
                                    "type": "string",
                                    "pattern": "^[cC][aA]$"
                                  },
                                  "state": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  },
                                  "phone": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 40,
                                    "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                  }
                                },
                                "required": [
                                  "city",
                                  "line1",
                                  "postalCode",
                                  "country",
                                  "state",
                                  "name",
                                  "phone"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "value"
                            ]
                          }
                        ]
                      },
                      "preferences": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "timezone": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "pattern": "^[^\\u0000-\\u001F\\u007F]+$",
                            "nullable": true,
                            "description": "Declared IANA time zone. Null means unset and leaves the declaration incomplete."
                          },
                          "weightUnit": {
                            "type": "string",
                            "enum": [
                              "OZ",
                              "LB",
                              "G",
                              "KG",
                              null
                            ],
                            "nullable": true,
                            "description": "Declared weight unit. Null means unset and leaves the declaration incomplete."
                          },
                          "dimensionUnit": {
                            "type": "string",
                            "enum": [
                              "IN",
                              "CM",
                              null
                            ],
                            "nullable": true,
                            "description": "Declared dimensions unit. Null means unset and leaves the declaration incomplete."
                          }
                        },
                        "required": [
                          "timezone",
                          "weightUnit",
                          "dimensionUnit"
                        ]
                      }
                    },
                    "required": [
                      "residency",
                      "entityKind",
                      "incorporation",
                      "registeredOffice",
                      "headquarters",
                      "principalBusinessLocation",
                      "materialQuebecPresence",
                      "warehouse",
                      "designatedReturnFacility",
                      "preferences"
                    ]
                  }
                },
                "required": [
                  "expectedRevisionId",
                  "facts"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "enum": [
                        1
                      ],
                      "example": 1
                    },
                    "currentRevisionId": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$",
                      "format": "uuid",
                      "nullable": true,
                      "description": "Null only when no revision exists."
                    },
                    "revisionNumber": {
                      "type": "integer",
                      "minimum": 1,
                      "nullable": true
                    },
                    "facts": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "residency": {
                          "type": "string",
                          "enum": [
                            "DECLARED_CA_RESIDENT",
                            "DECLARED_NON_RESIDENT",
                            "UNKNOWN"
                          ]
                        },
                        "entityKind": {
                          "type": "string",
                          "enum": [
                            "INCORPORATED",
                            "SOLE_PROPRIETOR",
                            "PARTNERSHIP",
                            "OTHER",
                            "UNKNOWN"
                          ]
                        },
                        "incorporation": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN",
                                    "NOT_APPLICABLE"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "registeredOffice": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN",
                                    "NOT_APPLICABLE"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision",
                                    "city",
                                    "line1",
                                    "postalCode"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "headquarters": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN",
                                    "NOT_APPLICABLE"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision",
                                    "city",
                                    "line1",
                                    "postalCode"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "principalBusinessLocation": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[a-zA-Z]{2}$"
                                    },
                                    "subdivision": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "country",
                                    "subdivision",
                                    "city",
                                    "line1",
                                    "postalCode"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "materialQuebecPresence": {
                          "type": "string",
                          "enum": [
                            "UNKNOWN",
                            "PRESENT",
                            "DECLARED_NONE"
                          ]
                        },
                        "warehouse": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "PRESENT"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 20,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[cC][aA]$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "phone": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "city",
                                    "line1",
                                    "postalCode",
                                    "country",
                                    "state",
                                    "name",
                                    "phone"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "designatedReturnFacility": {
                          "type": "object",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNKNOWN"
                                  ]
                                }
                              },
                              "required": [
                                "state"
                              ]
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "CONFIRMED",
                                    "UNCONFIRMED"
                                  ]
                                },
                                "value": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "properties": {
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "line2": {
                                      "type": "string",
                                      "minLength": 0,
                                      "maxLength": 200,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]*$"
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 20,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "country": {
                                      "type": "string",
                                      "pattern": "^[cC][aA]$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    },
                                    "phone": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40,
                                      "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                                    }
                                  },
                                  "required": [
                                    "city",
                                    "line1",
                                    "postalCode",
                                    "country",
                                    "state",
                                    "name",
                                    "phone"
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "value"
                              ]
                            }
                          ]
                        },
                        "preferences": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "timezone": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100,
                              "pattern": "^[^\\u0000-\\u001F\\u007F]+$",
                              "nullable": true,
                              "description": "Declared IANA time zone. Null means unset and leaves the declaration incomplete."
                            },
                            "weightUnit": {
                              "type": "string",
                              "enum": [
                                "OZ",
                                "LB",
                                "G",
                                "KG",
                                null
                              ],
                              "nullable": true,
                              "description": "Declared weight unit. Null means unset and leaves the declaration incomplete."
                            },
                            "dimensionUnit": {
                              "type": "string",
                              "enum": [
                                "IN",
                                "CM",
                                null
                              ],
                              "nullable": true,
                              "description": "Declared dimensions unit. Null means unset and leaves the declaration incomplete."
                            }
                          },
                          "required": [
                            "timezone",
                            "weightUnit",
                            "dimensionUnit"
                          ]
                        }
                      },
                      "required": [
                        "residency",
                        "entityKind",
                        "incorporation",
                        "registeredOffice",
                        "headquarters",
                        "principalBusinessLocation",
                        "materialQuebecPresence",
                        "warehouse",
                        "designatedReturnFacility",
                        "preferences"
                      ],
                      "nullable": true,
                      "description": "Null only when no revision exists."
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "currentRevisionId",
                    "revisionNumber",
                    "facts"
                  ],
                  "description": "Current private declaration. An absent profile has null currentRevisionId, revisionNumber and facts."
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Canadian setup is unavailable in this scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "PROFILE_REVISION_MISMATCH or ORIGIN_BINDING_MISMATCH. Reread the current facts before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Profile source unavailable (PROFILE_SOURCE_UNAVAILABLE). It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Save a version-checked Canadian operating declaration.",
        "tags": [
          "merchant-settings"
        ]
      }
    },
    "/api/v1/merchant/onboarding/canadian-readiness": {
      "get": {
        "description": "saasAdmission reports current E7 eligibility. A merchant may enter setup before its first operating profile. Payment account, tax, currency, fulfillment and checkout each have additional requirements.",
        "operationId": "CanadianReadinessController_getReadiness",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "enum": [
                        1
                      ],
                      "example": 1
                    },
                    "checkedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "commerceEnvironment": {
                      "type": "string",
                      "enum": [
                        "production"
                      ]
                    },
                    "profileRevisionId": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$",
                      "format": "uuid",
                      "nullable": true
                    },
                    "concerns": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "declaration": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "merchantFootprint": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "originBinding": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "designatedReturnFacility": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "saasAdmission": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "connect": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "merchantTax": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "retailCad": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "carrierServices": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "canadaDomestic": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "canadaToUs": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "domesticReturns": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        },
                        "usToCanadaReturns": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "INCOMPLETE",
                                "REVIEW_REQUIRED",
                                "BLOCKED",
                                "SATISFIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "reasonCode": {
                              "type": "string",
                              "enum": [
                                "PROFILE_ABSENT",
                                "DECLARATION_INCOMPLETE",
                                "DECLARATION_RECORDED",
                                "MERCHANT_LOCATION_EXCLUDED",
                                "RESIDENCY_OUTSIDE_COHORT",
                                "APPLICABILITY_REVIEW_REQUIRED",
                                "ORIGIN_UNSET",
                                "ORIGIN_BINDING_STALE",
                                "ORIGIN_BINDING_CURRENT",
                                "RETURN_FACILITY_UNCONFIRMED",
                                "QUALIFICATION_REQUIRED",
                                "SOURCE_PENDING"
                              ]
                            },
                            "sourceVersion": {
                              "type": "string",
                              "nullable": true,
                              "description": "Opaque observed source version, or null if unavailable."
                            }
                          },
                          "required": [
                            "state",
                            "reasonCode",
                            "sourceVersion"
                          ]
                        }
                      },
                      "required": [
                        "declaration",
                        "merchantFootprint",
                        "originBinding",
                        "designatedReturnFacility",
                        "saasAdmission",
                        "connect",
                        "merchantTax",
                        "retailCad",
                        "carrierServices",
                        "canadaDomestic",
                        "canadaToUs",
                        "domesticReturns",
                        "usToCanadaReturns"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "checkedAt",
                    "commerceEnvironment",
                    "profileRevisionId",
                    "concerns"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Canadian setup is unavailable in this scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Profile source unavailable (PROFILE_SOURCE_UNAVAILABLE). It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read current Canadian setup concerns for the active organization.",
        "tags": [
          "merchant-onboarding"
        ]
      }
    },
    "/api/v1/merchant/uploads/signed-url": {
      "post": {
        "description": "Validates the caller's org owns the target item/collection and returns a short-lived signed PUT URL plus the eventual public URL and bucket-relative storage path. The admin app uploads the bytes directly to the signed URL, then POSTs to the matching `/merchant/items/:id/images` or `/merchant/collections/:id/images` endpoint to write the metadata row.",
        "operationId": "MerchantUploadsController_signUploadUrl",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignUploadUrlDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedUploadResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Mint a signed upload URL for a catalog image.",
        "tags": [
          "merchant-uploads"
        ]
      }
    },
    "/api/v1/merchant/uploads/checkout-logo/signed-url": {
      "post": {
        "description": "Records and mints an immutable path under the current tenant branding namespace. Static JPEG, PNG, WebP, and AVIF are accepted up to 5 MiB; SVG and animation are rejected. Replacements are checked against storage limits using the full candidate byte count while the prior immutable logo remains retained.",
        "operationId": "MerchantUploadsController_signCheckoutLogoUpload",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignCheckoutLogoUploadDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignedUploadResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Mint a tenant-scoped signed upload URL for the checkout logo.",
        "tags": [
          "merchant-uploads"
        ]
      }
    },
    "/api/v1/merchant/uploads/checkout-logo/confirm": {
      "post": {
        "description": "Downloads and fully decodes the object server-side, verifies its exact tenant-owned mint intent, MIME, byte size, and dimensions, then atomically sets the server-derived environment-matched media reference. The authoritative storage-limit check charges the full candidate bytes while any prior immutable logo remains retained for non-destructive reconciliation.",
        "operationId": "MerchantUploadsController_confirmCheckoutLogo",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmCheckoutLogoUploadDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutLogoAssetDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Validate and attach an uploaded checkout logo.",
        "tags": [
          "merchant-uploads"
        ]
      }
    },
    "/api/v1/merchant/uploads/checkout-logo": {
      "delete": {
        "description": "Clears both the active upload-backed asset and any retained legacy external URL. When media quarantine is enabled, detached Storage objects enter its bounded, exact-path, non-destructive flow.",
        "operationId": "MerchantUploadsController_removeCheckoutLogo",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutLogoRemovalResultDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove the current or legacy checkout logo setting.",
        "tags": [
          "merchant-uploads"
        ]
      }
    },
    "/api/v1/merchant/email-suppression/status": {
      "get": {
        "description": "Authenticated organization membership is required. This status contains no recipient identity, provider account, internal attempt, or cross-tenant data. It cannot activate enforcement, authorize recovery, or send email.",
        "operationId": "MerchantEmailSuppressionStatusController_get",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSuppressionStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read this organization’s redacted transactional-email suppression signal.",
        "tags": [
          "merchant-email-suppression"
        ]
      }
    },
    "/api/v1/merchant/email-history": {
      "get": {
        "description": "Requires settings management permission. Source ownership is immutable and tenant-stapled. Platform-authored/unknown sources are excluded. Independent domain restrictions still apply to staff. This read cannot send, recover, release a deny, or activate capture.",
        "operationId": "MerchantEmailDeliveryHistoryController_tenant",
        "parameters": [
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation lower bound, default 30 days ago. A window may span at most 400 days. This selects triggers/attempts, not provider event timestamps.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation upper bound, default now; cannot be future. Facts are observed at the current watermark, not reconstructed as of this filter.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum recent authorized records; coverage.collection reports a bounded/truncated read. No internal identifiers or identity-bearing cursors are returned.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailHistoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read redacted tenant email history.",
        "tags": [
          "merchant-email-history"
        ]
      }
    },
    "/api/v1/merchant/customers/{id}/email-history": {
      "get": {
        "description": "Requires customer support permission and an existing Customer in the active organization. No email-address or payload match is used; a missing Customer association remains unavailable. Independent owning-domain restrictions apply to staff.",
        "operationId": "MerchantEmailDeliveryHistoryController_customer",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation lower bound, default 30 days ago. A window may span at most 400 days. This selects triggers/attempts, not provider event timestamps.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation upper bound, default now; cannot be future. Facts are observed at the current watermark, not reconstructed as of this filter.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum recent authorized records; coverage.collection reports a bounded/truncated read. No internal identifiers or identity-bearing cursors are returned.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailHistoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read structurally linked Customer email history.",
        "tags": [
          "merchant-email-history"
        ]
      }
    },
    "/api/v1/merchant/orders/{id}/email-history": {
      "get": {
        "description": "Requires active organization membership and a native Order belonging to that organization. Distinct from the commerce ORDER projection. Domain restrictions still apply to staff; unknown/deleted associations cannot be reconstructed.",
        "operationId": "MerchantEmailDeliveryHistoryController_order",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation lower bound, default 30 days ago. A window may span at most 400 days. This selects triggers/attempts, not provider event timestamps.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation upper bound, default now; cannot be future. Facts are observed at the current watermark, not reconstructed as of this filter.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum recent authorized records; coverage.collection reports a bounded/truncated read. No internal identifiers or identity-bearing cursors are returned.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailHistoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read structurally linked native Order email history.",
        "tags": [
          "merchant-email-history"
        ]
      }
    },
    "/api/v1/merchant/commerce-records/{id}/email-history": {
      "get": {
        "description": "Requires active organization membership and an exact commerce ORDER in that organization. Quotes/invoices and native Order IDs are not interchangeable. Domain restrictions still apply to staff.",
        "operationId": "MerchantEmailDeliveryHistoryController_commerceOrder",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation lower bound, default 30 days ago. A window may span at most 400 days. This selects triggers/attempts, not provider event timestamps.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Inclusive local record-creation upper bound, default now; cannot be future. Facts are observed at the current watermark, not reconstructed as of this filter.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum recent authorized records; coverage.collection reports a bounded/truncated read. No internal identifiers or identity-bearing cursors are returned.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailHistoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read structurally linked commerce ORDER email history.",
        "tags": [
          "merchant-email-history"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom": {
      "get": {
        "description": "Returns an identifier-free tenant projection of surface eligibility, connection, capability, resource, cleanup, and action availability. Routine tenant/runtime/global-switch ineligibility returns HTTP 200 with surfaceAvailable false; 5xx responses are reserved for genuine faults. It never returns provider workspace/resource identifiers, token or credential identifiers, canonical provider configuration, secret material, or operator-only controls.",
        "operationId": "MerchantIntercomConnectionController_getStatus",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomMerchantLifecycleStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the masked Intercom connection lifecycle.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/workspace-identity": {
      "get": {
        "description": "A separate, live GET /me inspection for the active tenant/runtime connection. Returns only the app/workspace ID, display name, verified region, and observation time after matching the provider read to the saved owner and active credential. Names are not unique, and this read does not certify a connector, Fin, or Messenger. The routine lifecycle response remains identifier-free. No admin identity or secret material is returned.",
        "operationId": "MerchantIntercomConnectionController_getWorkspaceIdentity",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomMerchantWorkspaceIdentityDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Verify the connected Intercom workspace identity.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/connect": {
      "post": {
        "description": "Available only to a database-enrolled tenant in its matching canonical runtime when the support plane and Intercom OAuth switch are enabled. Requires customers:support plus a human reason. The same route performs an initial connect or a same-owner reconnect after cleanup completes. The client may propose only US, EU, or AU; it cannot supply a hostname, workspace, runtime, tenant, or return URL. The callback revalidates enrollment and runtime binding and persists no authority until hard-allowlisted GET /me attests the same region and exact workspace. Connection does not enable Fin or Messenger.",
        "operationId": "MerchantIntercomConnectionController_start",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartIntercomConnectionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartIntercomConnectionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Begin or reconnect a tenant Intercom OAuth connection.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/disconnect": {
      "post": {
        "description": "Immediately disables cartonium authority, tombstones customer subjects, and starts provider-credential retirement. The response is the same identifier-free lifecycle projection as GET status. Reconnect remains unavailable until cleanup is complete, and operator-only recovery stays outside this tenant route.",
        "operationId": "MerchantIntercomConnectionController_disconnect",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisconnectIntercomConnectionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomMerchantLifecycleStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Disconnect the tenant Intercom connection.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/continue-cleanup": {
      "post": {
        "description": "Requires current customers:support permission, enrollment, a human reason, requestId, and the opaque operation precondition from status. Schedules only existing credential revocation after the response; exhausted expired work is finalized locally as Needs support without a provider call. Exact replay, an active lease, or a future retry returns safe progress without another attempt. Never resets attempts, re-arms failed work, releases ownership, or creates credentials or connectors. Unavailable in Production. GET and reload never dispatch cleanup.",
        "operationId": "MerchantIntercomConnectionController_continueCleanup",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContinueIntercomCleanupDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomMerchantLifecycleStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Continue due Intercom cleanup in canonical Preview.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog": {
      "get": {
        "description": "Separate safe catalog projection; the existing identifier-free connection route is unchanged. Staff can read masked progress but cannot issue or manage catalog credentials. Read-only reload never prepares, tests, publishes or dispatches cleanup.",
        "operationId": "MerchantIntercomCatalogController_status",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read guided public catalog setup status.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/prepare": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_prepare",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareIntercomCatalogDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Prepare first-time or eligible retained public catalog setup.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/issue": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_issue",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntercomCatalogCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Issue one pending catalog credential for a private show-once handoff.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/bind": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_bind",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntercomCatalogCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Bind the pending credential to the server-derived Text-token artifact.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/verify": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_verify",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntercomCatalogCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Admit the exact pending generation no-data verification.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/publish": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_publish",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntercomCatalogCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Publish and verify the exact current public catalog draft.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/activate": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_activate",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntercomCatalogCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Activate the pending generation after current LIVE and single-use test gates pass.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/support-provider-connections/intercom/catalog/revoke": {
      "post": {
        "description": "Requires current enrolled Owner/Admin membership and explicit merchant management eligibility. The server derives tenant/runtime/workspace/connection, current public profile and generation/configuration fences. Exact UUID replay returns masked progress only. No resource/generation selectors, private capability, recovery/repin or token automation are accepted.",
        "operationId": "MerchantIntercomCatalogController_revoke",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntercomCatalogCommandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntercomCatalogCommandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Discard the exact pending catalog credential before a fresh issuance.",
        "tags": [
          "merchant-support-provider-connections"
        ]
      }
    },
    "/api/v1/merchant/notices": {
      "get": {
        "description": "Returns every currently active published notice that has not been dismissed by the active organization, newest first.",
        "operationId": "MerchantNoticesController_list",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantNoticeDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List active, non-dismissed platform notices for the active org.",
        "tags": [
          "merchant-notices"
        ]
      }
    },
    "/api/v1/merchant/notices/read": {
      "patch": {
        "description": "Marks up to 1000 active notices read for the active organization while preserving each notice first-read timestamp.",
        "operationId": "MerchantNoticesController_markReadBatch",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarkMerchantNoticesReadDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrganizationNoticeStateDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Mark a bounded batch of platform notices read.",
        "tags": [
          "merchant-notices"
        ]
      }
    },
    "/api/v1/merchant/notices/{id}/read": {
      "patch": {
        "operationId": "MerchantNoticesController_markRead",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationNoticeStateDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Mark a platform notice read for the active organization.",
        "tags": [
          "merchant-notices"
        ]
      }
    },
    "/api/v1/merchant/notices/{id}/dismiss": {
      "patch": {
        "operationId": "MerchantNoticesController_dismiss",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationNoticeStateDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Dismiss a platform notice for the whole organization (Owner/Admin).",
        "tags": [
          "merchant-notices"
        ]
      }
    },
    "/api/v1/public/contact": {
      "post": {
        "description": "Public-facing capture for a storefront contact form. Persists the message for the merchant to read and triage in admin; nothing is emailed. Carries a honeypot field (`website`) that real submitters never see. The response is constant — `{ ok: true }` regardless of whether the message was stored or discarded as spam — so it cannot be used as a delivery or storage oracle.",
        "operationId": "PublicContactController_submit",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitContactMessageDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSubmitResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Submit a contact-form message to a tenant.",
        "tags": [
          "public-contact"
        ]
      }
    },
    "/api/v1/merchant/contact/messages": {
      "get": {
        "description": "Newest first. Filter by triage state: `all` (default), `unread`, `read`, or `archived`. Cursor-paginated via `limit` (default 50, max 200) plus the returned `nextCursor`. Rows carry a truncated `preview` rather than the full body — fetch a single message for that. Requires the `customers:support` permission group (Owner and Admin always pass).",
        "operationId": "MerchantContactController_list",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over name, email, subject, and body.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "required": false,
            "in": "query",
            "description": "Triage filter: `all` (default — the whole inbox), `unread`, `read`, or `archived`.",
            "schema": {
              "type": "string",
              "enum": [
                "unread",
                "read",
                "archived",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of messages to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (the `nextCursor` field). Currently a stringified message id; treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantContactMessagePageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List contact-form messages for the active org.",
        "tags": [
          "merchant-contact"
        ]
      }
    },
    "/api/v1/merchant/contact/messages/{id}": {
      "get": {
        "description": "Scoped to the active org: an id belonging to another tenant 404s exactly like one that does not exist. Reading does NOT mark the message read — that is an explicit PATCH, so opening a message to check it cannot silently clear a colleague's unread queue. Requires the `customers:support` permission group (Owner and Admin always pass).",
        "operationId": "MerchantContactController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantContactMessageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a single contact-form message, including the full body.",
        "tags": [
          "merchant-contact"
        ]
      },
      "patch": {
        "description": "Moves the message between `UNREAD`, `READ`, and `ARCHIVED`. `readAt` and `archivedAt` are stamped the first time the message enters each state and are retained afterwards, so marking a message unread again restores the queue without rewriting the history. Returns the updated message with its full body, so it carries the same `customers:support` requirement as the reads (Owner and Admin always pass).",
        "operationId": "MerchantContactController_updateStatus",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactMessageStatusDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantContactMessageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a contact message's triage state.",
        "tags": [
          "merchant-contact"
        ]
      }
    },
    "/api/v1/public/cart/apply-coupon": {
      "post": {
        "description": "Customer-entered code lookup with all storefront-apply validation gates: ACTIVE status, lifecycle window, minimum subtotal, max uses. Send the cart in exactly one of two shapes. **`lines` is the authoritative shape**: catalog references and quantities, priced by the server through the same pricing the checkout session runs, so real prices, sale state and other active promotions decide the result, including the eligible base of a coupon that excludes items already on sale. The minimum-subtotal gate counts the whole cart. **`subtotalInCents` is the original client-priced shape, unchanged and preview-only**: the server trusts the number for this preview, cannot see which items are on sale, and so can over-promise a coupon that excludes them. Returns either a structured discount or a `valid: false` result with neutral public rejection copy. Neither shape reserves or redeems a use; usage is counted when an order is placed, and the checkout session re-evaluates the code whenever it prices or binds the cart.",
        "operationId": "PublicCouponController_apply",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCouponDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returned after validation and admission. The body carries the apply result discriminated by `valid: true | false`. With `lines`, it is the coupon allocation the checkout session would bind for those lines now, except that no shipping rate is selected yet: a Buy X, Get Y code can still be skipped at checkout once the selected rate has a charge that an automatic discount or a bundle waives. With `subtotalInCents`, it is a preview of the client-asserted number only and is not checkout eligibility.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyCouponResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Only with `lines`, from the same pricing the checkout session runs. `COMPOSITION_REVISION_STALE`: a package line's `expectedCompositionRevision` is missing or no longer current, or a line sends one for an item that is no longer a package (`details.reason` says which). Re-read the item from the public catalog and retry with its current revision, or without one when it is no longer a package. `RESOURCE_CONFLICT`: a line cannot be priced as sent, because the item is sold through booking availability or a package has booking capacity or a component that is unavailable or no longer resolves (`details.itemId` names the line). Remove or replace that line. The client-priced shape never returns 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "COUPON_ATTEMPT_LIMITED means a fresh coupon lookup must wait. Retry-After is a positive number of whole seconds. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "COUPON_ATTEMPT_UNAVAILABLE means the fresh coupon lookup could not be admitted. Retry later. The existing checkout is preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Preview a coupon code against the current cart.",
        "tags": [
          "public-coupons"
        ]
      }
    },
    "/api/v1/public/auto-discounts/calculate": {
      "post": {
        "description": "Returns every ACTIVE auto-discount that matches the supplied cart (by scope, lifecycle window, and minimum-subtotal gate), with the per-discount saving and the post-discount cart total. Send the cart in exactly one of two shapes. **`lines` is the authoritative shape**: catalog references and quantities, priced by the server through the same pricing the checkout session runs, so real prices, sale state and collection membership decide which discounts match and what each may discount, including a discount that excludes items already on sale. The minimum-subtotal gate counts the whole cart. **`items` + `subtotalInCents` is the original client-priced shape, unchanged and preview-only**: the server trusts the prices and collection memberships it is sent and cannot see sale state. Pure calculation — no persistence, no usageCount increment. The storefront cart + PDP both consume this endpoint.",
        "operationId": "PublicAutoDiscountController_calculate",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalculateAutoDiscountsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "With `lines`, each saving is the allocation the checkout session would bind for those lines now without a coupon. With `items` + `subtotalInCents`, the result previews the client-asserted numbers only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalculateAutoDiscountsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Only with `lines`, from the same pricing the checkout session runs. `COMPOSITION_REVISION_STALE`: a package line's `expectedCompositionRevision` is missing or no longer current, or a line sends one for an item that is no longer a package (`details.reason` says which). Re-read the item from the public catalog and retry with its current revision, or without one when it is no longer a package. `RESOURCE_CONFLICT`: a line cannot be priced as sent, because the item is sold through booking availability or a package has booking capacity or a component that is unavailable or no longer resolves (`details.itemId` names the line). Remove or replace that line. The client-priced shape never returns 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Calculate auto-discounts applicable to a cart snapshot.",
        "tags": [
          "public-auto-discounts"
        ]
      }
    },
    "/api/v1/merchant/commerce/contracts": {
      "post": {
        "operationId": "MerchantCommerceContractController_createContract",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContractPacketDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantContractPacketDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a DRAFT contract/signature packet on a commerce record.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "get": {
        "operationId": "MerchantCommerceContractController_listContracts",
        "parameters": [
          {
            "name": "recordId",
            "required": false,
            "in": "query",
            "description": "Filter to packets on a single commerce record.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by packet status.",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SENT",
                "SIGNED",
                "DECLINED",
                "EXPIRED",
                "VOIDED"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor — the `id` of the last packet from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContractPacketListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List contract/signature packets (newest-first, cursor-paginated).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/contracts/{id}/send": {
      "post": {
        "operationId": "MerchantCommerceContractController_sendContract",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendContractPacketDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendContractResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Send a DRAFT packet — allocate the C- number, mint the customer signature link, DRAFT→SENT.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/contracts/{id}/countersign": {
      "post": {
        "operationId": "MerchantCommerceContractController_countersignContract",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendContractPacketDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantContractPacketDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Countersign a SENT packet (merchant/first-party) — completes to SIGNED once every signature is signed.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/contracts/{id}/void": {
      "post": {
        "operationId": "MerchantCommerceContractController_voidContract",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendContractPacketDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantContractPacketDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Void a SENT contract packet — SENT→VOIDED; withdraws the signature request.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/payment-term-presets": {
      "get": {
        "description": "The read surface behind the Sales header payment-term picker. Returns the active (non-archived) presets for the org, default-first then by name, so the UI can offer `paymentTermPresetId` choices for a DRAFT. Tenant-scoped; unpaginated (the per-org preset set is small and bounded).",
        "operationId": "MerchantCommercePaymentTermsController_list",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentTermPresetListDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List the org's reusable payment-term presets (#1418).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce": {
      "get": {
        "description": "Cursor-paginated, newest-first. Each item projects a type-aware primary status: linked orders use the Order processing lifecycle while quotes, invoices, and unlinked orders use the commercial lifecycle. Filter by that primary status or the independent commercial/payment/fulfillment axes, plus type, source, customer, external id, and created-date range; `search` matches display number, customer name/email, and company name.",
        "operationId": "MerchantCommerceController_list",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over display number, customer name/email, and company name, plus a prefix match on the record id (matches the `Draft · <id-prefix>` tag — the first 8 characters of the record id — shown for un-issued drafts, as well as a full record id).",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of records to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating large lists — the `id` of the last record from the previous page (returned as `nextCursor`). Treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Filter by document type.",
            "schema": {
              "type": "string",
              "enum": [
                "QUOTE",
                "INVOICE",
                "ORDER"
              ]
            }
          },
          {
            "name": "source",
            "required": false,
            "in": "query",
            "description": "Filter by source/origin.",
            "schema": {
              "type": "string",
              "enum": [
                "ONLINE",
                "MANUAL",
                "POS",
                "WHOLESALE",
                "BOOKING",
                "SUBSCRIPTION",
                "RENEWAL"
              ]
            }
          },
          {
            "name": "commercialStatus",
            "required": false,
            "in": "query",
            "description": "Filter by commercial status.",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SENT",
                "ACCEPTED",
                "DECLINED",
                "EXPIRED",
                "CANCELLED",
                "VOIDED",
                "CONVERTED"
              ]
            }
          },
          {
            "name": "excludeDrafts",
            "required": false,
            "in": "query",
            "description": "When true, leave out records whose commercialStatus is DRAFT. Applied as its own AND term, so it never replaces `commercialStatus` or `primaryStatus`; both filters apply. `commercialStatus=DRAFT` or `primaryStatus=DRAFT` together with `excludeDrafts=true` therefore returns an empty page. Cancelled, voided, expired and every other non-draft record stay in the list under their own status. When false or omitted, the list is unchanged. Accepts `true`/`1`/`yes` (case-insensitive) for true and `false`/`0`/`no` for false; any other value is rejected as 400.",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "toFulfill",
            "required": false,
            "in": "query",
            "description": "When true, return only orders waiting to ship: ORDER records whose commercialStatus is ACCEPTED and fulfillmentStatus is UNFULFILLED or PARTIALLY_FULFILLED, other than POS and BOOKING sources, whose outbound fulfillment mode is unset or SHIPMENT. Cancelled and voided orders are left out by their commercial status. Applied as its own AND term, so every other filter still applies: with `fulfillmentStatus` or `source`, the page holds only records that match both, and `fulfillmentStatus=FULFILLED` together with `toFulfill=true` returns an empty page. When false or omitted, the list is unchanged. Accepts `true`/`1`/`yes` (case-insensitive) for true and `false`/`0`/`no` for false; any other value is rejected as 400.",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "primaryStatus",
            "required": false,
            "in": "query",
            "description": "Filter by the same type-aware lifecycle projected as primaryStatus. A tenant-owned linked ORDER matches its Order processing status; quotes, invoices, and unlinked orders match commercialStatus. CANCELLED can match either lifecycle. Composes with type and cursor pagination.",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SENT",
                "ACCEPTED",
                "DECLINED",
                "EXPIRED",
                "CANCELLED",
                "VOIDED",
                "CONVERTED",
                "PENDING",
                "CONFIRMED",
                "PROCESSING",
                "COMPLETED"
              ]
            }
          },
          {
            "name": "paymentStatus",
            "required": false,
            "in": "query",
            "description": "Filter by payment status.",
            "schema": {
              "type": "string",
              "enum": [
                "NOT_REQUIRED",
                "UNPAID",
                "PARTIALLY_PAID",
                "PAID",
                "PARTIALLY_REFUNDED",
                "REFUNDED",
                "FAILED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "fulfillmentStatus",
            "required": false,
            "in": "query",
            "description": "Filter by fulfillment status.",
            "schema": {
              "type": "string",
              "enum": [
                "NOT_REQUIRED",
                "UNFULFILLED",
                "PARTIALLY_FULFILLED",
                "FULFILLED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "description": "Filter to a single customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerEmail",
            "required": false,
            "in": "query",
            "description": "Filter to records for a customer email. Matched on the normalized (`lower(trim(...))`) form against the index-backed `customerEmailNormalized` column, so casing/whitespace do not matter. Independent of `customerId` (a record may carry an email without a linked customer account).",
            "schema": {
              "maxLength": 320,
              "type": "string"
            }
          },
          {
            "name": "externalSource",
            "required": false,
            "in": "query",
            "description": "Filter by the external source system (with `externalId`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalId",
            "required": false,
            "in": "query",
            "description": "Filter by external id (scoped to `externalSource`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "createdFrom",
            "required": false,
            "in": "query",
            "description": "Only records created at or after this ISO-8601 timestamp.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "createdTo",
            "required": false,
            "in": "query",
            "description": "Only records created at or before this ISO-8601 timestamp.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "totalMin",
            "required": false,
            "in": "query",
            "description": "Only records with total ≥ this (cents).",
            "schema": {
              "minimum": 0,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "totalMax",
            "required": false,
            "in": "query",
            "description": "Only records with total ≤ this (cents).",
            "schema": {
              "minimum": 0,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "balanceDueMin",
            "required": false,
            "in": "query",
            "description": "Only records with balance due ≥ this (cents).",
            "schema": {
              "minimum": 0,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "balanceDueMax",
            "required": false,
            "in": "query",
            "description": "Only records with balance due ≤ this (cents).",
            "schema": {
              "minimum": 0,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "sort",
            "required": false,
            "in": "query",
            "description": "Sort axis. Each is index-backed; defaults to newest-first by creation.",
            "schema": {
              "default": "createdAt",
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "total",
                "balanceDue"
              ]
            }
          },
          {
            "name": "order",
            "required": false,
            "in": "query",
            "description": "Sort direction.",
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Master Sales list/search across commerce documents.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/payment-transactions": {
      "get": {
        "description": "Read-only active-organization ledger ordered by transaction business timestamp then id, both descending. Supports direction, status, method, payable record type, and full ISO-8601 occurrence bounds. Each row includes safe linked Sales-record/customer display context; processor and idempotency internals are not exposed.",
        "operationId": "MerchantCommerceController_listPaymentTransactionsAcrossRecords",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque `(occurredAt,id)` seek cursor returned by the previous cross-record ledger page.",
            "schema": {
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "direction",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PAYMENT",
                "REFUND",
                "REFUND_REVERSAL"
              ]
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "COMPLETED",
                "FAILED",
                "VOIDED"
              ]
            }
          },
          {
            "name": "method",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "CASH",
                "CHECK",
                "BANK_TRANSFER",
                "STORE_CREDIT",
                "CARD",
                "OTHER"
              ]
            }
          },
          {
            "name": "recordType",
            "required": false,
            "in": "query",
            "description": "Filter to invoice or order transactions.",
            "schema": {
              "type": "string",
              "enum": [
                "INVOICE",
                "ORDER"
              ]
            }
          },
          {
            "name": "occurredFrom",
            "required": false,
            "in": "query",
            "description": "Inclusive lower bound on the transaction business timestamp. Must be a full ISO-8601 timestamp.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "occurredTo",
            "required": false,
            "in": "query",
            "description": "Inclusive upper bound on the transaction business timestamp. Must be a full ISO-8601 timestamp.",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentLedgerListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List commerce payment/refund transactions across Sales records.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/customers": {
      "get": {
        "description": "Tenant-scoped customer search over the org `customers`. A blank `search` returns the most-recent customers as a default list; otherwise matches name or (normalized) email case-insensitively. Capped, newest-first, unpaginated — feeds a filter-bar picker that resolves a chosen customer to its `customerId`. Default purpose=filter retains historical identities. Use purpose=create to omit identities the commerce lifecycle guard cannot link to a new document and blank-email options before the usable-result limit. An empty list means no matching selectable identities, not that the organization has no Customers. Eligibility may change after search; create rechecks it and can return a neutral 400.",
        "operationId": "MerchantCommerceController_searchCustomers",
        "parameters": [
          {
            "name": "purpose",
            "required": false,
            "in": "query",
            "description": "filter (default) retains historical Customer identities. create excludes identities that the existing commerce lifecycle guard cannot link to a new document. Results are a point-in-time selection aid; creation rechecks eligibility and may return 400.",
            "schema": {
              "default": "filter",
              "type": "string",
              "enum": [
                "filter",
                "create"
              ]
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Typeahead term — matches customer name or email (case-insensitive).",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum matches to return.",
            "schema": {
              "minimum": 1,
              "maximum": 25,
              "format": "int32",
              "default": 10,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceCustomerOptionListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Customer typeahead for Sales filtering or new-document selection.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}": {
      "get": {
        "operationId": "MerchantCommerceController_getQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCommerceRecordReadDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a quote record by id (with revisions + lines).",
        "tags": [
          "merchant-commerce"
        ]
      },
      "patch": {
        "operationId": "MerchantCommerceWriteController_updateQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update editable fields on a DRAFT quote.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}": {
      "get": {
        "operationId": "MerchantCommerceController_getInvoice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCommerceRecordReadDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read an invoice record by id (with revisions + lines).",
        "tags": [
          "merchant-commerce"
        ]
      },
      "patch": {
        "description": "A linked invoice (E11 #4841) keeps its Order's Customer and currency: changing `customerId` or `currency` returns 409 `LINKED_SALE_IDENTITY_FIXED`.",
        "operationId": "MerchantCommerceWriteController_updateInvoice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A linked invoice while linked invoices are not activated: `COMMERCE_LINKED_INVOICE_UNAVAILABLE`. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update editable fields on a DRAFT invoice.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}": {
      "get": {
        "operationId": "MerchantCommerceController_getOrder",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCommerceRecordReadDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read an order record by id (with revisions + lines).",
        "tags": [
          "merchant-commerce"
        ]
      },
      "patch": {
        "operationId": "MerchantCommerceWriteController_updateOrder",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update editable fields on a DRAFT manual order.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/contracts/{id}": {
      "get": {
        "operationId": "MerchantCommerceController_getContract",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceContractPacketDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a contract/signature packet by id (with signature requests).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/payments": {
      "get": {
        "operationId": "MerchantCommerceController_listInvoicePayments",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor — the `id` of the last entry from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentTransactionListDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read an invoice's payment/refund ledger entries (#1336), newest-first.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "post": {
        "operationId": "MerchantCommercePaymentController_recordInvoicePayment",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Optional idempotency key for safe retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordCommercePaymentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record a manual/offline payment against an issued invoice (SENT/ACCEPTED).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/payments": {
      "get": {
        "operationId": "MerchantCommerceController_listOrderPayments",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor — the `id` of the last entry from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePaymentTransactionListDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read an order's payment/refund ledger entries (#1336), newest-first.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "post": {
        "operationId": "MerchantCommercePaymentController_recordOrderPayment",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Optional idempotency key for safe retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordCommercePaymentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record a manual/offline payment against an issued order (SENT/ACCEPTED).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/activity": {
      "get": {
        "description": "Cursor-paginated `commerce_activity_events` for the record — the customer-visible / money-moving / status-changing / permission-sensitive axes, actor, status transition, reason, and diagnostic metadata. Type-agnostic; a cross-tenant id returns a neutral 404.",
        "operationId": "MerchantCommerceController_listActivity",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor — the `id` of the last event from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceActivityEventListDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read a record's activity timeline (#598), newest-first.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}": {
      "get": {
        "description": "Type-agnostic detail read. Returns a neutral 404 (`RESOURCE_NOT_FOUND`) when no record in the active org matches the id.",
        "operationId": "MerchantCommerceController_getRecord",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCommerceRecordReadDetailDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read any commerce record by id (with revisions + lines).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes": {
      "post": {
        "description": "Requires minimum context: at least one of `customerId`, `customerName`, `customerEmail`, `customerPhone`, `companyName`, or `externalId` must be a non-blank string — a fully blank create is rejected with 400 `VALIDATION_FAILED` (#1463). New creation also rechecks `customerId` against the existing commerce lifecycle guard. Missing, cross-tenant, tombstoned and frozen selections return the same neutral 400 `VALIDATION_FAILED` with `details.field=customerId`; clear or change the selection before retrying. Search results do not guarantee future eligibility. A completed matching idempotent replay still returns the existing document.",
        "operationId": "MerchantCommerceWriteController_createQuote",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Optional idempotency key for safe retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a DRAFT quote.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices": {
      "post": {
        "description": "Requires minimum context: at least one of `customerId`, `customerName`, `customerEmail`, `customerPhone`, `companyName`, or `externalId` must be a non-blank string — a fully blank create is rejected with 400 `VALIDATION_FAILED` (#1463). New creation also rechecks `customerId` against the existing commerce lifecycle guard. Missing, cross-tenant, tombstoned and frozen selections return the same neutral 400 `VALIDATION_FAILED` with `details.field=customerId`; clear or change the selection before retrying. Search results do not guarantee future eligibility. A completed matching idempotent replay still returns the existing document. Linked invoices (E11 #4841), once activated: a MANUAL invoice is `STANDALONE` by default, creating its unnumbered DRAFT Order anchor in the same transaction (an `x-idempotency-key` is then required; 400 `IDEMPOTENCY_KEY_REQUIRED`), or `EXISTING_ORDER`, consuming an allocated base of an eligible MANUAL Order (`orderRecordId`, optional `commitmentBase`) and inheriting its Customer and currency. Ineligible Orders return 409 `COMMERCE_INVOICE_ORDER_INELIGIBLE` with `details.reason`. The new draft is priced as an exact projection of its base, so it bills the frozen accepted amounts.",
        "operationId": "MerchantCommerceWriteController_createInvoice",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A create naming `invoiceMode`, `orderRecordId` or `commitmentBase` while linked invoices are not activated: `COMMERCE_LINKED_INVOICE_UNAVAILABLE`. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a DRAFT invoice.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders": {
      "post": {
        "description": "Manual order creation is secondary to quote/invoice flows; gated on `orders:operate` pending a dedicated shared-commerce orders permission. Requires minimum context: at least one of `customerId`, `customerName`, `customerEmail`, `customerPhone`, `companyName`, or `externalId` must be a non-blank string — a fully blank create is rejected with 400 `VALIDATION_FAILED` (#1463). New creation also rechecks `customerId` against the existing commerce lifecycle guard. Missing, cross-tenant, tombstoned and frozen selections return the same neutral 400 `VALIDATION_FAILED` with `details.field=customerId`; clear or change the selection before retrying. Search results do not guarantee future eligibility. A completed matching idempotent replay still returns the existing document.",
        "operationId": "MerchantCommerceWriteController_createOrder",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a DRAFT manual order.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{recordId}/fulfillment-rollup/rebuild": {
      "post": {
        "description": "Recomputes the tenant-scoped Commerce and linked legacy Order projections from exact PRODUCT-line quantities on SHIPPED and DELIVERED fulfillments. PLANNED, READY, and CANCELLED work contributes zero handed-off quantity. Safe materialized drift is corrected atomically; historical line-less or otherwise ambiguous evidence fails closed with 409 and requires explicit reconciliation. A cross-tenant or missing ORDER record returns 404.",
        "operationId": "MerchantCommerceFulfillmentController_rebuildRollup",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Rebuild one order fulfillment rollup from its line ledger.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{recordId}/fulfillments/{fulfillmentId}/cancel": {
      "post": {
        "description": "Moves one PLANNED or READY fulfillment to CANCELLED while retaining its line history and the active order stock reservation. Matching retries are read-only. SHIPPED or DELIVERED work must use returns, and any active or ambiguous postage fails closed until its label is reconciled or voided.",
        "operationId": "MerchantCommerceFulfillmentController_cancel",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel one unshipped fulfillment with no active or ambiguous postage.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{recordId}/fulfillments/{fulfillmentId}/acknowledge-external-label-retirement": {
      "post": {
        "description": "Owner/Admin-only, reasoned package-local acknowledgement for exact external tracking or legacy already-retired label evidence. The merchant explicitly accepts responsibility for any external carrier void and carrier-account refund. The server snapshots the retained evidence and then invokes canonical fulfillment cancellation in one transaction. This is not provider proof, never rewrites label history as provider-confirmed retirement, and cannot bypass current or ambiguous native postage. It does not refund the customer, promise carrier credit, consume inventory, or send customer email.",
        "operationId": "MerchantCommerceFulfillmentController_acknowledgeExternalLabelRetirement",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Required stable acknowledgement key. Matching retries replay the recorded cancellation; reuse for another actor, reason, or target returns 409.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcknowledgeExternalLabelRetirementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AcknowledgeExternalLabelRetirementResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Acknowledge externally managed label retirement and cancel one prepared shipment.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{recordId}/fulfillments/{fulfillmentId}/handoff": {
      "post": {
        "description": "Moves exactly one READY shipment to SHIPPED after the merchant confirms physical carrier custody. The command consumes only that fulfillment's line reservations, recomputes fulfillment rollups from SHIPPED/DELIVERED evidence, and durably records whether the customer shipment notification was sent or suppressed. Requires a stable `x-idempotency-key` for safe retries.",
        "operationId": "MerchantCommerceFulfillmentController_handoff",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Required stable handoff key. Matching retries replay; reuse with a different fulfillment, notification decision, or tracking number returns 409.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HandoffCommerceFulfillmentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record carrier handoff for one prepared shipment.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{recordId}/fulfillments/{fulfillmentId}/deliver": {
      "post": {
        "description": "Moves exactly one SHIPPED shipment to DELIVERED on the merchant's own assertion that the recipient received it. A carrier pickup scan is not required; a valid recorded handoff is. The command durably stores the authenticated actor, a required reason, the asserted delivery time, the server-recorded time, and an explicit MERCHANT_CONFIRMED provenance that must never be presented as carrier confirmation. It moves no inventory, changes no fulfillment rollup (SHIPPED and DELIVERED are the same rollup class), and creates no email, return, refund, or label effect. Requires a stable `x-idempotency-key` for safe retries.",
        "operationId": "MerchantCommerceFulfillmentController_deliver",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fulfillmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Required stable delivery key. Matching retries replay read-only; reuse with a different fulfillment, asserted time, or reason returns 409.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliverCommerceFulfillmentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record merchant-confirmed delivery for one exact shipment.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/fulfillments": {
      "post": {
        "description": "Creates one outbound CommerceFulfillment in SHIPPED status with explicit positive PRODUCT line quantities. SERVICE, CUSTOM, FEE, DEPOSIT, and ADJUSTMENT lines are not shipment-eligible. The command serializes concurrent writes, prevents cumulative over-fulfillment, consumes linked inventory reservations exactly once, and derives both shared-commerce and linked legacy Order rollups. Explicit REPLACEMENT_GOODS commands require matching ReturnItem and original handed-off allocation links, consume replacement stock separately, and never inflate the original order rollup. Optional tracking fields use the same fulfillment row. The mode defaults to SHIPMENT. The required `notify` field durably records SEND or SUPPRESS; non-shipment modes require suppression. Requires a stable `x-idempotency-key` for safe retries.",
        "operationId": "MerchantCommerceFulfillmentController_create",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required stable key. Matching retries replay; reuse with a different record, line quantity, notification decision, or tracking payload returns 409.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceFulfillmentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fulfill explicit line quantities on an ORDER commerce record.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/composed-products": {
      "post": {
        "description": "Revision-guarded, atomic expansion into one typed PACKAGE/KIT group and its ordered component lines. Current Catalog, Inventory, and BookingService authorities are validated before any write; fixed-price component money uses commercial quantity one while frozen effectiveQuantity remains operational truth.",
        "operationId": "MerchantCommerceLinesController_selectComposedProduct",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SelectComposedProductDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Select one catalog package/kit into an editable DRAFT record.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/composed-products/{groupId}": {
      "delete": {
        "description": "Deletes the generated group and all of its component lines atomically, then reprices the remaining bespoke and composed Sales content.",
        "operationId": "MerchantCommerceLinesController_removeComposedProduct",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove one generated package/kit selection from an editable DRAFT.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/lines": {
      "post": {
        "operationId": "MerchantCommerceLinesController_addLine",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceLineDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Add a line to a DRAFT record.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/lines/{lineId}": {
      "patch": {
        "operationId": "MerchantCommerceLinesController_updateLine",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommerceLineDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a line on a DRAFT record.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "delete": {
        "operationId": "MerchantCommerceLinesController_removeLine",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove a line from a DRAFT record.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/groups": {
      "post": {
        "operationId": "MerchantCommerceLinesController_addGroup",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceLineGroupDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Add a line group to a DRAFT record.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/groups/{groupId}": {
      "patch": {
        "operationId": "MerchantCommerceLinesController_updateGroup",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommerceLineGroupDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a line group on a DRAFT record.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "delete": {
        "operationId": "MerchantCommerceLinesController_removeGroup",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove a line group from a DRAFT record (ungroups its lines).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/reprice": {
      "post": {
        "description": "Builds a pricing context from the persisted lines and freezes a priced snapshot via the shared pricing engine, then syncs the record + line rollups. Persisted manual overrides (#1349 price/discount/tax) are re-applied as reasoned engine inputs on every reprice. An action on an existing record (200), not a creation. Document-level shipping inputs are a follow-up.",
        "operationId": "MerchantCommerceLinesController_reprice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reprice a DRAFT record from its current lines.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/lines/{lineId}/price-override": {
      "put": {
        "operationId": "MerchantCommerceOverridesController_setLinePriceOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetLinePriceOverrideDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set a reasoned manual unit-price override on a line of a DRAFT record and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "delete": {
        "operationId": "MerchantCommerceOverridesController_clearLinePriceOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceOverrideActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Clear the line price override (restores the pre-override unit price) and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/lines/{lineId}/discount-override": {
      "put": {
        "operationId": "MerchantCommerceOverridesController_setLineDiscountOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetDiscountOverrideDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set a reasoned manual discount (fixed cents or percent) on a line of a DRAFT record and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "delete": {
        "operationId": "MerchantCommerceOverridesController_clearLineDiscountOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceOverrideActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove the manual line discount and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/discount-override": {
      "put": {
        "operationId": "MerchantCommerceOverridesController_setDocumentDiscountOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetDiscountOverrideDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set a reasoned manual document-level discount (allocated across lines) on a DRAFT record and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "delete": {
        "operationId": "MerchantCommerceOverridesController_clearDocumentDiscountOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceOverrideActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove the manual document-level discount and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/tax-override": {
      "put": {
        "operationId": "MerchantCommerceOverridesController_setTaxOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetTaxOverrideDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set a reasoned document tax-treatment override on a DRAFT record and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      },
      "delete": {
        "operationId": "MerchantCommerceOverridesController_clearTaxOverride",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceOverrideActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Clear the tax override (restores the pre-override tax treatment) and reprice.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/terminal-generation/reconcile": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_reconcilePosTerminalGeneration",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcilePosTerminalGenerationRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalGenerationRecoveryResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reconcile the original POS invoice Terminal generation without starting a new payment.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}/send": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_sendQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCommerceResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Send a DRAFT quote — freeze the revision, allocate the display number, DRAFT→SENT.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/send": {
      "post": {
        "description": "A linked invoice (E11 #4841) issues through its own plan once linked invoices are activated: it freezes `paymentTermsSnapshot` with any derived `dueDate` on the revision, retains its consumption row, and on a standalone first send promotes its Order anchor, allocating the Order number and then the Invoice number in one transaction. A revision that bills a commercial difference against its base requires a `reason` (409 `COMMERCIAL_DIFFERENCE_REASON_REQUIRED`). Terms that cannot derive their due date are refused (409 `DUE_DATE_NOT_DERIVABLE` / `DUE_DATE_UNREPRESENTABLE`); none is fabricated. An invoice that would bring its sale's live issued invoices above 2,147,483,647 cents in total, the most its Order's payment totals can record, is refused before it is issued (409 `LINKED_ORDER_POSITION_OUT_OF_RANGE`).",
        "operationId": "MerchantCommerceLifecycleController_sendInvoice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Linked invoices only, once activated: the same key and body replay the committed send (`customerAction` null, because the link is issued only once); a different body returns 409 `COMMERCE_IDEMPOTENCY_CONFLICT`. Not read for any other send.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendCommerceRecordDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCommerceResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A linked invoice (E11 #4841) while linked invoices are not activated: `COMMERCE_LINKED_INVOICE_UNAVAILABLE`, `details.reason: NOT_ACTIVATED`. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Send a DRAFT invoice / payment request — freeze, allocate the display number, DRAFT→SENT.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}/accept": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_acceptQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Accept a SENT quote on behalf of the customer — SENT→ACCEPTED.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}/void": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_voidQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Void an issued quote — SENT|ACCEPTED→VOIDED.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/void": {
      "post": {
        "description": "A linked invoice (E11 #4841) passes the payment-authority fence: 409 `COMMERCE_LIFECYCLE_INVALID` with `details.reason: PAYMENT_AUTHORITY_UNRESOLVED` while any payment attempt is reusable, in progress, unknown or captured without a ledger row, even when the capture is held as a reconciliation exception, and with `details.reason: LINKED_INVOICE_HAS_PAYMENTS` once it has taken a payment. Once voided, its base is reserved for a successor, the Order stays committed, and a later provider success is recorded as a reconciliation exception, never as a payment.",
        "operationId": "MerchantCommerceLifecycleController_voidInvoice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A linked invoice (E11 #4841) while linked invoices are not activated: `COMMERCE_LINKED_INVOICE_UNAVAILABLE`, `details.reason: NOT_ACTIVATED`. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Void an issued invoice — SENT|ACCEPTED→VOIDED.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}/cancel": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_cancelQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel a quote not yet accepted — DRAFT|SENT→CANCELLED.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/cancel": {
      "post": {
        "description": "Linked invoices (E11 #4841): a never-sent draft releases its drafted base; a standalone draft cancels its Order anchor with it; a successor draft ends its claim and the base stays reserved. A previously issued linked invoice (SENT, or revised back to DRAFT with its number kept) passes the payment-authority fence: 409 `COMMERCE_LIFECYCLE_INVALID` with `details.reason: PAYMENT_AUTHORITY_UNRESOLVED` while any payment attempt is reusable, in progress, unknown or captured without a ledger row, even when the capture is held as a reconciliation exception, and with `details.reason: LINKED_INVOICE_HAS_PAYMENTS` once it has taken a payment. Once cancelled, its base is reserved for a successor and the Order stays committed.",
        "operationId": "MerchantCommerceLifecycleController_cancelInvoice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A linked invoice (E11 #4841) while linked invoices are not activated: `COMMERCE_LINKED_INVOICE_UNAVAILABLE`, `details.reason: NOT_ACTIVATED`. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel an invoice not yet accepted — DRAFT|SENT→CANCELLED.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}/revise": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_reviseQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revise a SENT|ACCEPTED quote — supersede the customer-visible revision and open a new DRAFT clone, record→DRAFT.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/revise": {
      "post": {
        "description": "A linked invoice (E11 #4841) is revisable only while unpaid (409 `details.reason: LINKED_INVOICE_HAS_PAYMENTS`) and behind the payment-authority fence (409 `details.reason: PAYMENT_AUTHORITY_UNRESOLVED`, which a capture held as a reconciliation exception does not satisfy). Its base and number stay as they are; the next send measures the new revision's commercial difference against that base.",
        "operationId": "MerchantCommerceLifecycleController_reviseInvoice",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "A linked invoice (E11 #4841) while linked invoices are not activated: `COMMERCE_LINKED_INVOICE_UNAVAILABLE`, `details.reason: NOT_ACTIVATED`. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revise a SENT|ACCEPTED invoice — supersede the customer-visible revision and open a new DRAFT clone, record→DRAFT.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/quotes/{id}/convert": {
      "post": {
        "operationId": "MerchantCommerceLifecycleController_convertQuote",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Once linked invoices (E11 #4841) are activated: the same key and body replay the winning Order exactly; a different body returns 409 `COMMERCE_IDEMPOTENCY_CONFLICT`. Not read while dormant, when a repeated convert still returns the existing Order.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommerceActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Convert an ACCEPTED quote into a committed order — spawns the order (carrying the accepted snapshot), quote→CONVERTED.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/invoice-capacity": {
      "get": {
        "description": "E11 #4841. The commitment vector read from the Order's frozen accepted snapshot (one component per priced line, then shipping), each component's remaining capacity, and every consumption row: drafted, retained, reserved and released. An existing-Order invoice draft may take at most the remaining capacity. Missing, cross-tenant, non-ORDER and unpromoted-anchor ids return the same neutral 404. Dormant: 503 `COMMERCE_LINKED_INVOICE_UNAVAILABLE` until linked invoices are activated.",
        "operationId": "MerchantCommerceLinkedInvoiceController_getInvoiceCapacity",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceInvoiceCapacityDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Not activated. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read an Order's commitment and remaining invoice capacity.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/terminal/connection-token": {
      "post": {
        "operationId": "MerchantCommercePaymentController_createInvoiceTerminalConnectionToken",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceTerminalRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceTerminalConnectionTokenDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "COMMERCE_PAYMENT_INVALID with details.reason BELOW_PROVIDER_MINIMUM_BALANCE: the balance due is positive but below the minimum a card payment can collect (details.balanceDueInCents, details.currency, details.minimumChargeInCents), so no token is returned and the balance remains due. A balance that falls below the minimum while the token is being created is refused the same way after the provider call. Other existing payment conflicts also return 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a Stripe Terminal connection token for collecting an invoice balance in person.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/terminal/payment-intent": {
      "post": {
        "operationId": "MerchantCommercePaymentController_createInvoiceTerminalPaymentIntent",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required idempotency key for safe Terminal retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceTerminalRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceTerminalPaymentIntentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "COMMERCE_PAYMENT_INVALID: an unresolved capture case, evidence conflict (including closed cases), unreconciled missing signed amount, unreconciled refund evidence before a capture case, or open signed-currency payment exception blocks Terminal creation, replacement and reusable credential handoff with details.reason CAPTURE_RECONCILIATION_REQUIRED. Reconcile the payment before further collection; another operation key does not bypass the hold. details.reason BELOW_PROVIDER_MINIMUM_BALANCE: the balance due is positive but below the minimum a card payment can collect (details.balanceDueInCents, details.currency, details.minimumChargeInCents). The balance remains due. The refusal describes this request only and does not show whether an earlier payment attempt exists. Other existing payment conflicts also return 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Terminal collection is temporarily unavailable, including when capture schema readiness cannot be confirmed. Retry with the same idempotency key after availability recovers; do not start a replacement payment. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a Stripe Terminal card-present PaymentIntent for the invoice's balance due.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/terminal/connection-token": {
      "post": {
        "operationId": "MerchantCommercePaymentController_createOrderTerminalConnectionToken",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceTerminalRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceTerminalConnectionTokenDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "COMMERCE_PAYMENT_INVALID with details.reason BELOW_PROVIDER_MINIMUM_BALANCE: the balance due is positive but below the minimum a card payment can collect (details.balanceDueInCents, details.currency, details.minimumChargeInCents), so no token is returned and the balance remains due. A balance that falls below the minimum while the token is being created is refused the same way after the provider call. Other existing payment conflicts also return 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a Stripe Terminal connection token for collecting an order balance in person.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/terminal/payment-intent": {
      "post": {
        "operationId": "MerchantCommercePaymentController_createOrderTerminalPaymentIntent",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required idempotency key for safe Terminal retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommerceTerminalRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceTerminalPaymentIntentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "COMMERCE_PAYMENT_INVALID: an unresolved capture case, evidence conflict (including closed cases), unreconciled missing signed amount, unreconciled refund evidence before a capture case, or open signed-currency payment exception blocks Terminal creation, replacement and reusable credential handoff with details.reason CAPTURE_RECONCILIATION_REQUIRED. Reconcile the payment before further collection; another operation key does not bypass the hold. details.reason BELOW_PROVIDER_MINIMUM_BALANCE: the balance due is positive but below the minimum a card payment can collect (details.balanceDueInCents, details.currency, details.minimumChargeInCents). The balance remains due. The refusal describes this request only and does not show whether an earlier payment attempt exists. Other existing payment conflicts also return 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Terminal collection is temporarily unavailable, including when capture schema readiness cannot be confirmed. Retry with the same idempotency key after availability recovers; do not start a replacement payment. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a Stripe Terminal card-present PaymentIntent for the order's balance due.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/refunds": {
      "post": {
        "operationId": "MerchantCommercePaymentController_recordInvoiceRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Optional idempotency key for safe retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordCommercePaymentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record a manual/offline refund against an invoice — cannot exceed net paid.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/refunds/cash/preparation": {
      "get": {
        "description": "Reads advisory gross/component capacity for the selected original CASH payment; reserves nothing. Valid before forward tax filing and independent of current sale configuration. Requires Invoice write access as well as the manual-payments permission.",
        "operationId": "MerchantCommercePaymentController_prepareInvoiceCashRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentTransactionId",
            "required": true,
            "in": "query",
            "description": "The original completed CASH payment on this Invoice.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCashRefundPreparationDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Prepare full or partial cash refund allocations from the original frozen POS sale.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/refunds/cash": {
      "post": {
        "description": "Commits one immutable original-payment command, CASH refund ledger, financial audit, Invoice/Order rollups and automatic-tax reversal intent. It does not issue a Stripe payment refund. Exact retries return the same identifiers/amount/time, even after capacity is exhausted; retain the original key and normalized body, including omitted/null occurredAt. REVERSAL_INTENT is pending tax bookkeeping, not provider success. Known rolled-back contention is COMMERCE_PAYMENT_INVALID / POS_CASH_REFUND_CONCURRENT_UPDATE with details.retryable=true; retry only the same request/key. Changed-body replay is COMMERCE_IDEMPOTENCY_CONFLICT / POS_CASH_REFUND_REQUEST_MISMATCH. Other frozen-basis/capacity/reconciliation conflicts are not automatic retry authority.",
        "operationId": "MerchantCommercePaymentController_recordInvoiceCashRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Original operation key, trimmed 1..200 characters. Preserve it across lost replies and recovery.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosCashRefundDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCashRefundResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record cash returned for a full or partial POS refund with exact frozen allocations.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/refunds/stripe": {
      "post": {
        "operationId": "MerchantCommercePaymentController_issueInvoiceStripeRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required idempotency key for safe refund retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueCommerceStripeRefundDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Issue a Stripe refund to the original card for an online invoice payment (#1630).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/invoices/{id}/refunds/stripe/preparation": {
      "get": {
        "description": "Returns the exact LINE/SHIPPING components an operator may allocate a Stripe refund across. Author `allocations` from this projection: the issue endpoint requires it and never derives the split server-side.",
        "operationId": "MerchantCommercePaymentController_prepareInvoiceStripeRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundAllocationPreparationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the refundable components and remaining cents for an invoice card refund (#3056).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/refunds/stripe/preparation": {
      "get": {
        "description": "Returns the exact LINE/SHIPPING components an operator may allocate a Stripe refund across. Author `allocations` from this projection: the issue endpoint requires it and never derives the split server-side.",
        "operationId": "MerchantCommercePaymentController_prepareOrderStripeRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundAllocationPreparationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the refundable components and remaining cents for an order card refund (#3056).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/refunds/stripe": {
      "post": {
        "operationId": "MerchantCommercePaymentController_issueOrderStripeRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Required idempotency key for safe refund retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueCommerceStripeRefundDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Issue a Stripe refund to the original card for an online order payment (#1630).",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/orders/{id}/refunds": {
      "post": {
        "operationId": "MerchantCommercePaymentController_recordOrderRefund",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Optional idempotency key for safe retries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordCommercePaymentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRecordDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Record a manual/offline refund against an order — cannot exceed net paid.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/capture-cases": {
      "get": {
        "description": "Same tenant-qualified membership read boundary as Sales record payment detail. Whitelisted evidence only; no raw webhook or provider-account identities.",
        "operationId": "MerchantCommerceCaptureController_list",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque nextCursor from this record’s preceding page. Omit for the newest page. On acceptance, controls only the returned page; it grants no action authority.",
            "schema": {
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceCaptureCaseListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Capture reconciliation is temporarily unavailable while required schema readiness cannot be confirmed. No new money is created; retry the same read after readiness recovers. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read prospective capture reconciliation cases.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/merchant/commerce/{id}/capture-cases/{caseId}/accept": {
      "post": {
        "description": "Evidence-only, idempotent on the capture. Requires manual-payment and record-type permissions plus high-risk reason. Posts the full signed amount once only after current currency, identity, status, cap and zero-successful-refund checks. A durable refusal returns the still-open case with its structured reason. Performs no provider operation.",
        "operationId": "MerchantCommerceCaptureController_accept",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "caseId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque nextCursor from this record’s preceding page. Omit for the newest page. On acceptance, controls only the returned page; it grants no action authority.",
            "schema": {
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptCommerceCaptureDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceCaptureCaseListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Retryable conflict: COMMERCE_PAYMENT_INVALID/CONCURRENT_UPDATE or an in-progress idempotency operation. Reload the case and retry the same evidence-bound acceptance; never start a replacement payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Capture reconciliation is temporarily unavailable while required schema readiness cannot be confirmed. Reload the case and retry the same evidence-bound acceptance after readiness recovers; never start a replacement payment. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Accept the exact captured payment into the ledger.",
        "tags": [
          "merchant-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/quotes/{tokenOrId}": {
      "get": {
        "operationId": "CustomerCommerceController_getQuote",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family quote action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCommerceDocumentDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The addressed revision was superseded by a newer version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read a customer-scoped quote revision by action token. Pure read — never consumes the token.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/invoices/{tokenOrId}": {
      "get": {
        "operationId": "CustomerCommerceController_getInvoice",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family invoice action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCommerceDocumentDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The addressed revision was superseded by a newer version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read a customer-scoped invoice / payment request by action token. Pure read.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/invoices/{tokenOrId}/pay": {
      "post": {
        "operationId": "CustomerCommerceController_payInvoice",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family invoice action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerInvoicePaymentDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The invoice is not payable (already paid, not open, or superseded).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "502": {
            "description": "Payments are not available for this document (merchant account not ready).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Start an online card payment for an invoice balance — returns the Stripe PaymentIntent client secret.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/quotes/{tokenOrId}/accept": {
      "post": {
        "operationId": "CustomerCommerceController_acceptQuote",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family quote action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCommerceDocumentDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The quote is no longer open (already accepted/declined/voided) or was superseded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Accept a quote by action token (SENT→ACCEPTED). Single-use; idempotent on replay.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/quotes/{tokenOrId}/decline": {
      "post": {
        "operationId": "CustomerCommerceController_declineQuote",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family quote action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclineCommerceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCommerceDocumentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The quote is no longer open, expired, or was superseded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Decline a quote by action token (SENT→DECLINED, record-only). Single-use; idempotent on replay.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/contracts/{tokenOrId}": {
      "get": {
        "operationId": "CustomerCommerceController_getContract",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family contract action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerContractPacketDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read a customer-scoped contract/signature packet by action token. Pure read.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/commerce/contracts/{tokenOrId}/sign": {
      "post": {
        "operationId": "CustomerCommerceController_signContract",
        "parameters": [
          {
            "name": "tokenOrId",
            "required": true,
            "in": "path",
            "description": "Raw `a`-family contract action token.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignContractDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerContractPacketDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The contract is not open for signature (signed/declined/voided/expired).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "First-party sign a contract by action token. Single-use; idempotent on replay. Captures signer IP/UA.",
        "tags": [
          "customer-commerce"
        ]
      }
    },
    "/api/v1/customer/account/commerce": {
      "get": {
        "description": "Documents the merchant has SENT to this buyer (drafts never appear), newest-first, offset-paginated, projected from the latest customer-visible revision. A document being revised shows `stale: true` until the updated version is sent. Empty when the tenant has disabled the account commerce surface.",
        "operationId": "CustomerCommerceAccountController_list",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Filter to one document type; both when omitted.",
            "schema": {
              "type": "string",
              "enum": [
                "QUOTE",
                "INVOICE"
              ]
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "format": "int32",
              "default": 1,
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "format": "int32",
              "default": 20,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCommerceListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the signed-in customer's quotes and invoices (#598).",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/customer/account/commerce/{displayNumber}": {
      "get": {
        "description": "Detail of the latest customer-visible revision (summary + lines). Neutral 404 for anything that isn’t this buyer’s sent document.",
        "operationId": "CustomerCommerceAccountController_detail",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "displayNumber",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCommerceDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`COMPOSITION_REVISION_STALE` — the quote/invoice carries package pricing that can no longer be displayed safely. THE DOCUMENT IS UNAFFECTED and remains valid; only this presentation of it is withheld, and no order is involved. Clients that fail closed on an undocumented `409` should match this code BEFORE that generic branch. Do not treat it as a document defect, do not re-issue or duplicate the document, and do not apply order-recovery behaviour — re-read once the composition is republished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read one of the customer’s documents by its public number (#598).",
        "tags": [
          "customer-account"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/creation-review": {
      "post": {
        "description": "Owner/Admin, scoped by x-organization-slug. Returns normalized entered content and current tax disclosure, with a review version bound to this tenant's current account/tax/default context. Saves nothing and calls no provider. A changed address or context requires a fresh review before explicit confirmation. Reader/card readiness is irrelevant to this local-only setup.",
        "operationId": "MerchantPosPhysicalLocationController_review",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewPosPhysicalLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationReviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "PAYMENT_ACCOUNT_CONFIGURATION_UNSUPPORTED: a current Stripe connection in CONNECTED, RESTRICTED or VERIFIED state is required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review a new local physical selling address.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations": {
      "post": {
        "description": "Owner/Admin with a reason. Rechecks the exact reviewed address/context and saves immutable version-1 evidence and safe audit atomically. Always creates a non-default local identity; never enrolls or mutates a Terminal binding, changes a default, or enables payment. An exact retry returns the original receipt even after account/default/address changes, without republishing old state. Current location details are a separate read.",
        "operationId": "MerchantPosPhysicalLocationController_create",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable key for this exact reviewed creation. Retain both key and original body after an unknown outcome; changing the body conflicts.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePosPhysicalLocationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationCreatedDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason is IDEMPOTENCY_CONFLICT, PHYSICAL_LOCATION_REVIEW_CHANGED (fresh review required), or PAYMENT_ACCOUNT_CONFIGURATION_UNSUPPORTED. Only qualified immutable different-request evidence includes details.rejection for CREATE. Qualified rejection also includes details.organizationId from API authentication; require an exact match to the frozen tenant identity. Missing or inconsistent version-1 confirmation evidence has no marker; retain the original key/body and hold the uncertain outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationCommandConflictDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Save and confirm a local physical POS location (high risk).",
        "tags": [
          "merchant-pos"
        ]
      },
      "get": {
        "description": "Owner/Admin tenant-scoped keyset page including retired and unconfirmed identities. Local records survive provider binding removal and account relink. These are selling/tax locations, not inventory origins or proof of payment readiness.",
        "operationId": "MerchantPosPhysicalLocationController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Pass the previous nextCursor unchanged; locations are ordered by id.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List local physical POS locations.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}": {
      "get": {
        "description": "Owner/Admin tenant-scoped read. Confirmation is only for the current immutable version and never means Terminal enrollment or cash readiness. Unknown and cross-tenant ids return the same 404.",
        "operationId": "MerchantPosPhysicalLocationController_get",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the current local physical POS address and confirmation.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/selling-context": {
      "get": {
        "description": "Uses only the authenticated POS session's selected organization/installation and current sale plus either-tender permissions. Default unavailable until separately qualified server schema/binary evidence exists. A positively verified never-explicit installation may observe a confirmed tenant default; invalid explicit identity never falls back. NOT_EVALUATED authorizes no change, payment or journal release. No provider/private operation/address read or new-sale/frozen-sale authority is supplied.",
        "operationId": "MerchantPosSellingContextController_observe",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PosSellingContextObservedHttpDto"
                    },
                    {
                      "$ref": "#/components/schemas/PosSellingContextUnavailableHttpDto"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Observe this phone's local selling context.",
        "tags": [
          "merchant-pos"
        ]
      },
      "post": {
        "description": "Same guarded selected organization/installation and either-tender policy as the reads. Retain the exact original x-idempotency-key and closed body; replay returns the immutable original result before mutable current readiness. Qualified server source remains unavailable by default. Every error preserves original-request recovery; no HTTP failure or current GET supplies definitive rejection, default fallback, a replacement key or money authority.",
        "operationId": "MerchantPosSellingContextController_select",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "One exact original nonempty header, with no surrounding whitespace. Duplicate occurrences are refused; its value is never trimmed, regenerated or replaced for retry or outcome lookup.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "expectedGeneration",
                  "locationId",
                  "expectedAddressVersion"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.selling-context-select/v1"
                    ]
                  },
                  "expectedGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483645
                  },
                  "locationId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^(?:\\S|\\S[\\s\\S]*\\S)$",
                    "description": "Original untrimmed local text expectation; no UUID or authority conversion."
                  },
                  "expectedAddressVersion": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Only a validated positive immutable receipt correlated to the original request, plus independent current observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSellingContextCommandResultHttpDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED / SELLING_CONTEXT_REQUEST_INVALID before service entry. Retain any earlier transmitted original.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY / SELLING_CONTEXT_OUTCOME_UNPROVEN. No definitive original rejection or permission to replace the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR. Service or result assembly could not be verified; retain the exact original.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY / SELLING_CONTEXT_UNAVAILABLE. No qualified source or caller association; no original outcome is proved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Select or exactly replay this phone's local selling choice.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/selling-locations": {
      "get": {
        "description": "Same authenticated POS selected-tenant/installation and either-tender policy as selling-context. Returns a bounded keyset page and current count from one SQL snapshot. Other pages or concurrent changes can contain the selected/default place; an empty page or false marker never proves never-explicit/removal/default inheritance. GET selling-context resolves retained selection independently. No selection/enrollment/money action or private eligibility is supplied; default unavailable until separately qualified server schema/binary evidence exists.",
        "operationId": "MerchantPosSellingContextController_listOptions",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque seek cursor from this list, bound to current authenticated tenant/installation and the same limit. Omission starts page one; an empty/invalid cursor is refused. It is a consistency value, never authentication, permission, a frozen choice or a snapshot across pages.",
            "schema": {
              "minLength": 1,
              "maxLength": 2048,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PosSellingLocationOptionsObservedHttpDto"
                    },
                    {
                      "$ref": "#/components/schemas/PosSellingContextUnavailableHttpDto"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED for an invalid/unknown page query or a cursor inconsistent with authenticated scope/limit. No submitted cursor or private query failure is reflected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Observe a page of active confirmed local selling places.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/selling-context/outcome": {
      "post": {
        "description": "POST lookup using the SAME original x-idempotency-key and unchanged select body, with no query or status wrapper. Hash identity remains original POST /api/v1/merchant/pos/selling-context, never this outcome route. Read mode never publishes a choice/receipt/audit. Only a matching positive receipt returns 200; absence, current reads and every error keep the original unconfirmed. Current observation is separate and may be unavailable. Existing guard housekeeping and server qualification gates remain unchanged.",
        "operationId": "MerchantPosSellingContextController_readOutcome",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "The exact original command key, once, without trimming or replacement.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "expectedGeneration",
                  "locationId",
                  "expectedAddressVersion"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.selling-context-select/v1"
                    ]
                  },
                  "expectedGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483645
                  },
                  "locationId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^(?:\\S|\\S[\\s\\S]*\\S)$",
                    "description": "Original untrimmed local text expectation; no UUID or authority conversion."
                  },
                  "expectedAddressVersion": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSellingContextCommandResultHttpDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED / SELLING_CONTEXT_REQUEST_INVALID before service entry; earlier original outcome remains unproven.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY / SELLING_CONTEXT_OUTCOME_UNPROVEN, including no matched original. This is not a negative receipt or safe-to-clear proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR. Keep the original; a post-service contract fault is not invalid-input proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY / SELLING_CONTEXT_UNAVAILABLE. Keep the exact original. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read the exact original local-choice outcome.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/terminal-enrollments/setup": {
      "get": {
        "description": "Owner/Admin merchant configuration, scoped by the authenticated organization. Minimized local/current-association observation only; NONE is not absence of provider objects or pending effects. No payment, provider identity, action capability or Native source-precondition header is supplied. Unavailable source stays unavailable.",
        "operationId": "MerchantPosTerminalEnrollmentController_setup",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalEnrollmentSetupHttpDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED / TERMINAL_ENROLLMENT_REQUEST_INVALID. An earlier original remains unconfirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Existing merchant membership, lifecycle or role refusal. Retain any original request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_OUTCOME_UNPROVEN. No definitive rejection or replacement authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected pre-service/application failure, including INTERNAL_ERROR. Source-observation failures retain their declared unavailable response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_UNAVAILABLE. Qualification is unavailable by default; no original outcome or legacy classification is proved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Observe a local place’s enrollment association.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/terminal-enrollments/review": {
      "post": {
        "description": "Owner/Admin, ADOPT only. The explicit mapping candidate is not authority. Re-resolves the confirmed local version, account/link, mapping and predecessor under the separately qualified source. No provider-location creation, backfill, default rewrite or Native source-precondition header. The review digest is correlation, not permission.",
        "operationId": "MerchantPosTerminalEnrollmentController_review",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "action",
                  "location",
                  "expectedPredecessor",
                  "candidateMappingReference"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.terminal-enrollment.review-request/v1"
                    ]
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "ADOPT"
                    ]
                  },
                  "location": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "locationId",
                      "addressVersion",
                      "confirmedAt"
                    ],
                    "properties": {
                      "locationId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "addressVersion": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "confirmedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
                      }
                    }
                  },
                  "expectedPredecessor": {
                    "type": "object",
                    "nullable": true,
                    "additionalProperties": false,
                    "enum": [
                      null
                    ],
                    "description": "ADOPT requires a null predecessor expectation. Null is not server-proved absence or replacement authority."
                  },
                  "candidateMappingReference": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Existing local mapping UUID, never a provider identifier or capability."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalEnrollmentAdoptReviewHttpDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED / TERMINAL_ENROLLMENT_REQUEST_INVALID. An earlier original remains unconfirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Existing merchant membership, lifecycle or role refusal. Retain any original request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_OUTCOME_UNPROVEN. No definitive rejection or replacement authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected pre-service/application failure, including INTERNAL_ERROR. Source-observation failures retain their declared unavailable response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_UNAVAILABLE. Qualification is unavailable by default; no original outcome or legacy classification is proved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review adoption of an existing merchant Terminal mapping.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/terminal-enrollments": {
      "post": {
        "description": "Owner/Admin with original reason and explicit confirmation. Preserve the literal original key/body/canonical POST route. The existing service resolves an authorized exact original before current NEW review/provider eligibility and again after serialization. Source remains unavailable by default; no Native source-precondition header is consumed. Status does not authorize replacement, rekeying or payment.",
        "operationId": "MerchantPosTerminalEnrollmentController_admit",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "One literal original key, without surrounding whitespace. Retain the same key and original admission body for retry and outcome lookup; duplicate occurrences are refused.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "action",
                  "location",
                  "expectedPredecessor",
                  "candidateMappingReference",
                  "reviewVersion",
                  "reason",
                  "confirmed"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.terminal-enrollment.admission-request/v1"
                    ]
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "ADOPT"
                    ]
                  },
                  "location": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "locationId",
                      "addressVersion",
                      "confirmedAt"
                    ],
                    "properties": {
                      "locationId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "addressVersion": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "confirmedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
                      }
                    }
                  },
                  "expectedPredecessor": {
                    "type": "object",
                    "nullable": true,
                    "additionalProperties": false,
                    "enum": [
                      null
                    ],
                    "description": "ADOPT requires a null predecessor expectation. Null is not server-proved absence or replacement authority."
                  },
                  "candidateMappingReference": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Existing local mapping UUID, never a provider identifier or capability."
                  },
                  "reviewVersion": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$",
                    "description": "Original reviewed-context digest; not authorization or a source precondition."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Exact original confirmed reason; retain unchanged for retries and outcome lookup."
                  },
                  "confirmed": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosEnrollmentOriginalOperationHttpDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED / TERMINAL_ENROLLMENT_REQUEST_INVALID. An earlier original remains unconfirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Existing merchant membership, lifecycle or role refusal. Retain any original request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_OUTCOME_UNPROVEN. No definitive rejection or replacement authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected pre-service/application failure, including INTERNAL_ERROR. Source-observation failures retain their declared unavailable response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_UNAVAILABLE. Qualification is unavailable by default; no original outcome or legacy classification is proved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Admit or exactly retry a reviewed ADOPT operation.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/terminal-enrollments/outcome": {
      "post": {
        "description": "Owner/Admin lookup using the same original key and unchanged admission body inside originalRequest. Identity remains canonical POST admission, never this outcome route. No Native source-precondition header or current NEW eligibility is required for original identity. Authentication and safe access qualification still apply. UNPROVEN is HOLD; failed current setup does not erase a known original. No guessed operation ID, replacement authority or reload-safe storage is provided.",
        "operationId": "MerchantPosTerminalEnrollmentController_outcome",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "One literal original key, without surrounding whitespace. Retain the same key and original admission body for retry and outcome lookup; duplicate occurrences are refused.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "originalRequest"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.terminal-enrollment.status-request/v1"
                    ]
                  },
                  "originalRequest": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "contract",
                      "action",
                      "location",
                      "expectedPredecessor",
                      "candidateMappingReference",
                      "reviewVersion",
                      "reason",
                      "confirmed"
                    ],
                    "properties": {
                      "contract": {
                        "type": "string",
                        "enum": [
                          "pos.terminal-enrollment.admission-request/v1"
                        ]
                      },
                      "action": {
                        "type": "string",
                        "enum": [
                          "ADOPT"
                        ]
                      },
                      "location": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "locationId",
                          "addressVersion",
                          "confirmedAt"
                        ],
                        "properties": {
                          "locationId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "addressVersion": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "confirmedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$"
                          }
                        }
                      },
                      "expectedPredecessor": {
                        "type": "object",
                        "nullable": true,
                        "additionalProperties": false,
                        "enum": [
                          null
                        ],
                        "description": "ADOPT requires a null predecessor expectation. Null is not server-proved absence or replacement authority."
                      },
                      "candidateMappingReference": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Existing local mapping UUID, never a provider identifier or capability."
                      },
                      "reviewVersion": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$",
                        "description": "Original reviewed-context digest; not authorization or a source precondition."
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "description": "Exact original confirmed reason; retain unchanged for retries and outcome lookup."
                      },
                      "confirmed": {
                        "type": "boolean",
                        "enum": [
                          true
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalEnrollmentAdoptStatusHttpDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED / TERMINAL_ENROLLMENT_REQUEST_INVALID. An earlier original remains unconfirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Existing merchant membership, lifecycle or role refusal. Retain any original request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_OUTCOME_UNPROVEN. No definitive rejection or replacement authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected pre-service/application failure, including INTERNAL_ERROR. Source-observation failures retain their declared unavailable response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY / TERMINAL_ENROLLMENT_UNAVAILABLE. Qualification is unavailable by default; no original outcome or legacy classification is proved. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Look up the exact original ADOPT outcome.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/address-review": {
      "post": {
        "description": "Owner/Admin, scoped by x-organization-slug. Returns the current and proposed normalized address, tax disclosure and a digest binding the expected version and tenant configuration. No write or provider call. Existing card setup remains pre-enrollment.",
        "operationId": "MerchantPosPhysicalLocationLifecycleController_reviewAddress",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewPosPhysicalAddressDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLifecycleReviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and cross-tenant locations return the same neutral response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason: PHYSICAL_LOCATION_REVIEW_CHANGED, PHYSICAL_LOCATION_RETIRED, PHYSICAL_LOCATION_UNCONFIRMED, or PAYMENT_ACCOUNT_CONFIGURATION_UNSUPPORTED. Changed review context requires fresh review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "The lifecycle migration is not yet applied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review a local physical address revision.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/address": {
      "put": {
        "description": "Owner/Admin with a reason. Atomically appends the next immutable address version, its explicit confirmation, permanent command receipt and safe audit. Even unchanged address content creates a new confirmation version. Old evidence and sales remain unchanged. Default identity is retained. Exact retry returns original outcome facts without appending or republishing. Does not enroll a Terminal binding, call a provider or activate cash.",
        "operationId": "MerchantPosPhysicalLocationLifecycleController_revise",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable key shared across local lifecycle commands. Reuse only with the exact original action, location and body.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisePosPhysicalAddressDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLifecycleResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and cross-tenant locations return the same neutral response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason: PHYSICAL_LOCATION_REVIEW_CHANGED, PHYSICAL_LOCATION_RETIRED, PHYSICAL_LOCATION_UNCONFIRMED, PAYMENT_ACCOUNT_CONFIGURATION_UNSUPPORTED, or IDEMPOTENCY_CONFLICT. Only qualified immutable different-request evidence includes details.rejection for ADDRESS. Qualified rejection also includes details.organizationId from API authentication; require an exact match to the frozen tenant identity. Without that marker, retain the original key/body and hold an uncertain outcome. Changed review context requires fresh review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationCommandConflictDto"
                }
              }
            }
          },
          "503": {
            "description": "The lifecycle migration is not yet applied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Revise and explicitly reconfirm a local physical address (high risk).",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/default-review": {
      "post": {
        "description": "Owner/Admin, tenant scoped. Requires an active location with explicit confirmation of its current address. Returns the reviewed address and the current local default. This is separate from the Terminal default and does not prove payment readiness.",
        "operationId": "MerchantPosPhysicalLocationLifecycleController_reviewDefault",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewPosPhysicalDefaultDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLifecycleReviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and cross-tenant locations return the same neutral response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason: PHYSICAL_LOCATION_REVIEW_CHANGED, PHYSICAL_LOCATION_RETIRED, PHYSICAL_LOCATION_UNCONFIRMED, or PAYMENT_ACCOUNT_CONFIGURATION_UNSUPPORTED. Changed review context requires fresh review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "The lifecycle migration is not yet applied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review selecting the local physical default.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/physical-locations/{locationId}/default": {
      "put": {
        "description": "Owner/Admin with a reason and explicit confirmation. Rechecks the reviewed address and tenant/account/tax/default context under the organization lock, clears the previous local default and selects this active confirmed location atomically. A current-default selection records UNCHANGED. Exact replay returns original receipt facts and cannot restore an obsolete default. No provider, Terminal selection, enrollment, sale or payment mutation.",
        "operationId": "MerchantPosPhysicalLocationLifecycleController_setDefault",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable key shared across local lifecycle commands; keep the original key/body after an unknown outcome.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPosPhysicalDefaultDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLifecycleResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and cross-tenant locations return the same neutral response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "details.reason: PHYSICAL_LOCATION_REVIEW_CHANGED, PHYSICAL_LOCATION_RETIRED, PHYSICAL_LOCATION_UNCONFIRMED, PAYMENT_ACCOUNT_CONFIGURATION_UNSUPPORTED, or IDEMPOTENCY_CONFLICT. Only qualified immutable different-request evidence includes details.rejection for SET_DEFAULT. Qualified rejection also includes details.organizationId from API authentication; require an exact match to the frozen tenant identity. Without that marker, retain the original key/body and hold an uncertain outcome. Changed review context requires fresh review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPhysicalLocationCommandConflictDto"
                }
              }
            }
          },
          "503": {
            "description": "The lifecycle migration is not yet applied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Select the confirmed local physical default (high risk).",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/session": {
      "post": {
        "operationId": "MerchantPosSessionController_register",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterPosSessionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSessionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Register or resume a revocable cartonium POS session.",
        "tags": [
          "merchant-pos"
        ]
      },
      "delete": {
        "operationId": "MerchantPosSessionController_revoke",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSessionRevocationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Revoke the current cartonium POS session.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/session/organization": {
      "put": {
        "operationId": "MerchantPosSessionController_selectOrganization",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SelectPosOrganizationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSessionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Select an authorized organization for this POS session.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/customers": {
      "post": {
        "description": "Requires a live POS session and customers:support. This deliberate steward action writes name, normalized email, and phone to the reusable main Customer profile. The server-selected POS organization scopes identity. A duplicate email returns EXISTING_MATCH without editing or restoring the matched profile, and this route never marks email verified or creates a provider Customer.",
        "operationId": "MerchantPosCustomerController_create",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable key for one explicit Customer create intent. An exact retry returns the original CREATED or EXISTING_MATCH result while the identity receipt remains replayable. After verified identity cleanup erases the contact-derived fingerprint, replay fails closed with HTTP 409, top-level code=RESOURCE_CONFLICT, and details.reason=CUSTOMER_IDENTITY_UNAVAILABLE.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePosCustomerDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCustomerCreateResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create one reusable tenant Customer for cartonium POS.",
        "tags": [
          "merchant-pos"
        ]
      },
      "get": {
        "description": "Requires a live POS session. The server-owned POS session selects the active organization; an x-organization-slug header, when supplied, must match it and cannot switch tenants. Searches canonical Customer name and normalized email only. Results use fixed createdAt/id descending keyset order and exclude archived Customers by default.",
        "operationId": "MerchantPosCustomerController_list",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Case-insensitive substring search over canonical Customer name and normalized email only.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum customers to return, newest first.",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "format": "int32",
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque server-owned cursor returned by the previous page. Bound to this route, tenant, search value, fixed ordering, and caller capability set.",
            "schema": {
              "maxLength": 500,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCustomerListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List tenant Customers for selection in cartonium POS.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/customers/{customerId}": {
      "get": {
        "description": "Requires a live POS session. The server-owned POS session selects the active organization; an x-organization-slug header, when supplied, must match it and cannot switch tenants. Archived Customers remain addressable. Unknown and cross-tenant ids return the same neutral 404.",
        "operationId": "MerchantPosCustomerController_detail",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCustomerIdentityDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read one tenant Customer identity profile for cartonium POS.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/customers/{customerId}/sales": {
      "get": {
        "description": "Requires merchant auth, a live POS session/membership and both customers:support and orders:operate (Owner/Admin retain broad access). The active POS session selects the organization; a supplied organization header must match it. Reads issued, non-DRAFT canonical Orders with an assigned display number across all sources by tenant-qualified customerId only, never email equality. Archived Customers remain addressable; unknown, foreign and tombstoned Customers share a neutral 404. Pages use createdAt/id descending order. Read failures are errors, never successful empty pages. Historical unnumbered bridge Orders are outside this issued-sales population and are neither renumbered nor given a substitute number. Malformed issued projections fail with HTTP 500, code=INTERNAL_ERROR and details.reason=CUSTOMER_COMMERCE_PROJECTION_INCONSISTENT. This bounded history grants no Sales mutation or payment authority.",
        "operationId": "MerchantPosCustomerController_sales",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size; defaults to 10 and cannot exceed 25.",
            "schema": {
              "minimum": 1,
              "maximum": 25,
              "format": "int32",
              "default": 10,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque createdAt/id descending bookmark bound to organization, Customer, route and capability set. Cross-context replay is rejected with 400. Omit for the first page.",
            "schema": {
              "maxLength": 500,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCustomerSalePageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Projection or read failed; no successful page is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read recent sales linked to one POS Customer.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/customers/{customerId}/open-balances": {
      "get": {
        "description": "Requires merchant auth, a live POS session/membership and both customers:support and shared-commerce:invoices (Owner/Admin retain broad access). The active POS session selects the organization; a supplied organization header must match it. Resolves tenant-qualified customerId only, never email equality. Archived Customers remain addressable; unknown, foreign and tombstoned Customers share a neutral 404. Pages use createdAt/id descending order. SENT/ACCEPTED Invoices with positive stored balance qualify regardless of payment-status label. Balance uses gross payments; refunds do not reopen a paid receivable. Inconsistent rollups fail with HTTP 500, code=INTERNAL_ERROR and details.reason=CUSTOMER_COMMERCE_PROJECTION_INCONSISTENT. Read failures are errors, never empty pages or zero balances. This read does not authorize or guarantee payment collection.",
        "operationId": "MerchantPosCustomerController_openBalances",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size; defaults to 10 and cannot exceed 25.",
            "schema": {
              "minimum": 1,
              "maximum": 25,
              "format": "int32",
              "default": 10,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque createdAt/id descending bookmark bound to organization, Customer, route and capability set. Cross-context replay is rejected with 400. Omit for the first page.",
            "schema": {
              "maxLength": 500,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCustomerOpenBalancePageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Projection or read failed; no successful page is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read authoritative open Invoice balances linked to one POS Customer.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/customers/{customerId}/invoices/{invoiceId}": {
      "get": {
        "description": "Read only. Requires merchant auth, a live POS session/membership, customers:support and shared-commerce:invoices (Owner/Admin retain broad access). The active POS session selects the tenant; any supplied organization header must match. Resolves the exact invoice id and durable Customer association, across all sources; never email matching, first/latest invoice selection, or an Order pair. Archived Customers remain addressable. Unknown, foreign, tombstoned, unlinked, wrong-Customer, DRAFT or unnumbered targets share a neutral 404. Paid/closed issued invoices remain readable if a balance changed after list loading. Stored invoice financial rollups and lines are returned; current catalog is not repriced. Inconsistent rollups fail closed. Up to 200 stored lines are returned with explicit linesTruncated. No provider credentials, metadata, audit payload, new collection eligibility or payment authority is exposed.",
        "operationId": "MerchantPosCustomerController_invoice",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCustomerInvoiceDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Projection or read failed; no successful empty invoice is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read one exact issued Invoice linked to a POS Customer.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/catalog/items": {
      "get": {
        "operationId": "MerchantPosController_listCatalog",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Case-insensitive product search over name and description.",
            "schema": {
              "maxLength": 120,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum products to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCatalogPageDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List active sellable catalog items for cartonium POS.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/preflight": {
      "get": {
        "description": "Requires a current merchant POS session and selected-tenant membership with orders:operate and shared-commerce:invoices, plus card (shared-commerce:manual-payments) or cash (shared-commerce:cash-payments) collection; Owner and Admin may collect both. Card and cash capabilities are evaluated independently. Card readiness, with its provider calls, runs only for a member who may collect card, and its failure returns the same refusal as before unless cash is active. A member who may collect only cash gets no Terminal or provider call and receives the cash refusal when cash is not active, including 409 POS_NOT_READY CASH_TENDER_NOT_AVAILABLE while cash is not available.",
        "operationId": "MerchantPosController_preflight",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPreflightResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Verify that the tenant can create and collect a POS sale.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales": {
      "post": {
        "operationId": "MerchantPosController_createSale",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable key for one sale intent. A matching retry returns the original order/invoice pair.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePosSaleDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSaleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Atomically create a server-priced POS order and issued invoice.",
        "tags": [
          "merchant-pos"
        ]
      },
      "get": {
        "description": "Requires a current merchant POS session, selected-tenant membership, orders:operate and shared-commerce:invoices. Optional exact number, invoice payment status, customer ID/email and ORDER created dates combine with AND before pagination. Date bounds are optional, including status-only searches; supplied dates must be paired and ordered, with no maximum range length. A supplied timeZone interprets inclusive calendar dates in that IANA zone; omitting it retains legacy UTC-day semantics. dateFilterCapability advertises optional dates and unrestricted range length. Filtered cursors bind the tenant and normalized filters; changing filters requires page one. Missing/excluded numbers return a neutral empty page. Short or empty pages can have a next cursor when corrupt rows are omitted. No cross-page snapshot is promised. Existing unfiltered clients and cursors remain compatible. Filtered statements have a 5-second limit; proven read timeouts return 503 POS_SALE_FILTER_READ_UNAVAILABLE with smaller-date-range guidance. Retry starts from page one.",
        "operationId": "MerchantPosController_listSales",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum sales to return, newest first.",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 25,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor returned as nextCursor by the previous page. Server-owned; never constructed by the client.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "number",
            "required": false,
            "in": "query",
            "description": "Exact tenant POS order or issued invoice display number. URL-decoded once, edge-trimmed only; case, punctuation, Unicode and internal spaces are literal. Blank means absent. Maximum 200 Unicode code points.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "paymentStatus",
            "required": false,
            "in": "query",
            "description": "Stored linked invoice payment status. Date bounds are optional, including without an exact number. Commercially closed sales retain their actual payment status and cannot be resumed.",
            "schema": {
              "type": "string",
              "enum": [
                "NOT_REQUIRED",
                "UNPAID",
                "PARTIALLY_PAID",
                "PAID",
                "PARTIALLY_REFUNDED",
                "REFUNDED",
                "FAILED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "dateFrom",
            "required": false,
            "in": "query",
            "description": "First included ORDER created calendar date, YYYY-MM-DD, 1970-01-01 through 9999-12-30. UTC by default; uses the supplied timeZone when present. Optional; supply with dateTo. No maximum range length; server pagination and read timeouts still apply.",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "name": "dateTo",
            "required": false,
            "in": "query",
            "description": "Last included ORDER created calendar date. Its following midnight in timeZone (UTC when omitted) is excluded. Every supplied number, status, date and customer filter combines with AND.",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "name": "timeZone",
            "required": false,
            "in": "query",
            "description": "IANA device time zone for paired dateFrom/dateTo calendar days. Omit to retain legacy UTC-day behavior. Includes local midnight through the next midnight after dateTo, accounting for daylight-saving changes.",
            "schema": {
              "maxLength": 100,
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "description": "Exact current Customer association on the POS order, chosen using the separately authorized customer directory. Combined with other filters using AND; unknown or another tenant Customer yields an empty page.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "customerEmail",
            "required": false,
            "in": "query",
            "description": "Exact stored order customer email, edge-trimmed and lowercased, matched against customerEmailNormalized. Finds recorded contact data without requiring a currently linked Customer. AND with customerId when both are supplied.",
            "schema": {
              "maxLength": 320,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSaleListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_SALE_FILTER_READ_UNAVAILABLE: filtered Sales statement (5 seconds), transaction, or pool-acquisition timeout. Suggest a smaller date range; retry starts at page one. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List this tenant POS sales history, newest first, anchored on the order.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/receipts/availability": {
      "get": {
        "description": "Requires the current authenticated selected-tenant POS session and both orders:operate and shared-commerce:invoices permissions. Read-only advisory preflight for NEW preparation and NEW SEND/RESEND, with independent completed and declined modes. Without deliveryVersion, both modes are false before any receipt source is read, so a client that does not send the v2 marker cannot initiate. With deliveryVersion=commerce.pos.receipt-delivery/v2, missing, unknown or unqualified sources still return both false. The marker selects the protocol only; it is not authority or client attestation. This is not authorization, sale eligibility, admission/nonadmission or delivery proof. Existing per-request checks and current-auth original status/exact-key retry remain mandatory and separate. No order, recipient or payment selector is accepted or probed.",
        "operationId": "MerchantPosController_receiptAvailability",
        "parameters": [
          {
            "name": "deliveryVersion",
            "required": false,
            "in": "query",
            "description": "Optional exact C2 protocol marker. Absent keeps both modes false. An empty, repeated, wrong-case or other value returns 400 VALIDATION_FAILED before any receipt source call.",
            "schema": {
              "enum": [
                "commerce.pos.receipt-delivery/v2"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosReceiptAvailabilityDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED: deliveryVersion was empty, repeated or not exactly commerce.pos.receipt-delivery/v2.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read current receipt initiation availability.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/receipt/preparation": {
      "post": {
        "description": "Requires the current selected-tenant merchant POS session and compound sale permissions. Returns optimistic original proof/control data after transaction commit. It neither sends email nor changes payment, inventory or fulfillment. Without deliveryVersion=commerce.pos.receipt-delivery/v2 it returns 503 before any epoch, preparation source or timing read, and creates no command or epoch. Missing original controls, expired history, unknown invocation or unavailable receipt authority remain unavailable; completed sales stay valid.",
        "operationId": "MerchantPosController_prepareReceipt",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deliveryVersion",
            "required": false,
            "in": "query",
            "description": "C2 protocol marker; required for a preparation. Absent returns 503 POS_NOT_READY and issues nothing. An empty, repeated, wrong-case or other value returns 400 VALIDATION_FAILED before any receipt source call.",
            "schema": {
              "enum": [
                "commerce.pos.receipt-delivery/v2"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosReceiptPreparationRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "headers": {
              "X-Receipt-Preparation-Remaining-Ms": {
                "description": "Non-negative integer milliseconds remaining in the original epoch, measured using the database clock after preparation. Advisory only; zero means expired. Clients subtract the full elapsed preparation request using a monotonic clock and never renew this deadline by re-parsing or caching. A missing or invalid header (including an older API) cannot support new preparation in the native client. It neither extends expiresAt nor proves admission or non-admission.",
                "schema": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$"
                }
              }
            },
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosReceiptPreparationDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Receipt preparation is unavailable, including a request without the v2 marker; no command, epoch, send or payment retry was created. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Prepare an email receipt from authoritative server proof.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/receipt/status": {
      "get": {
        "description": "Current authenticated selected-tenant status read only. Never sends, recreates an operation or clears payment recovery. Qualified absence is not sending eligibility; unavailable/unknown history stays HOLD. No recipient or original command body is returned. Without receiptKind the call and response are unchanged. With exactly one receiptKind, the response echoes it and reports the active operation of either kind, else that kind's retained terminal receipt, else a qualified absence of that kind; unavailable history still returns an error.",
        "operationId": "MerchantPosController_receiptStatus",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "receiptKind",
            "required": false,
            "in": "query",
            "description": "Optional receipt kind selector (completed or declined). An empty, repeated, wrong-case or other value returns 400 VALIDATION_FAILED before any receipt source call.",
            "schema": {
              "enum": [
                "completed",
                "declined"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosReceiptStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED: receiptKind was empty, repeated or not exactly completed or declined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read the retained original receipt status for this sale.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/receipt/send": {
      "post": {
        "description": "Reuses the existing durable email pipeline. The opaque preparation and random key confer no authority: current session, membership, compound permissions, original proof/root/source/epoch and recipient confirmation are checked in the owning transaction. Retry the exact key/body after uncertainty. Only a commerce.pos.receipt-delivery/v2 body can be admitted: the first receipt of each kind is SEND, and RESEND requires that kind's proved terminal predecessor. A well-formed v1 body stays unavailable (503). The result is an operation state, never payment success or inbox delivery.",
        "operationId": "MerchantPosController_sendReceipt",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Original commandKey from preparation, retained unchanged with the exact request across uncertainty.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosReceiptDeliveryRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosReceiptDeliveryResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Current receipt admission is unavailable. Preserve uncertainty and original command identity. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Send or explicitly resend the prepared email receipt.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/receipt/resolution": {
      "post": {
        "description": "Command-bound resolution of the original key and exact body after an uncertain send. It never admits, sends, prepares or issues an epoch. Current session, membership, compound permissions, the original root and qualified history are checked in one transaction. ADMITTED reports the original operation's own retained state, even after later receipts of the same kind. PENDING keeps the original while its window is open. Without resolutionVersion, an ended window without admission returns 503. Opting into v2 may close an already-expired admission window. Only an acknowledged NOT_ADMITTED_FINAL proves permanent non-admission of this exact original. A lost or unavailable response keeps the original in HOLD. Only completed commerce.pos.receipt-delivery/v2 originals can resolve.",
        "operationId": "MerchantPosController_resolveReceipt",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Original commandKey from preparation, retained unchanged with the exact request across uncertainty.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resolutionVersion",
            "required": false,
            "in": "query",
            "description": "Omit for v1. Only this exact single value selects v2. An empty, repeated or unrecognized value returns 400 VALIDATION_FAILED.",
            "schema": {
              "enum": [
                "commerce.pos.receipt-resolution/v2"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosReceiptDeliveryRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PosReceiptResolutionDto"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/PosReceiptResolutionV2Dto"
                        }
                      ],
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "version": {},
                        "outcome": {},
                        "operation": {}
                      },
                      "oneOf": [
                        {
                          "properties": {
                            "outcome": {
                              "enum": [
                                "ADMITTED"
                              ]
                            },
                            "operation": {
                              "$ref": "#/components/schemas/PosReceiptDeliveryResultDto"
                            }
                          }
                        },
                        {
                          "properties": {
                            "outcome": {
                              "enum": [
                                "PENDING",
                                "NOT_ADMITTED_FINAL"
                              ]
                            },
                            "operation": {
                              "type": "object",
                              "nullable": true,
                              "enum": [
                                null
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "The original request cannot be resolved now. Preserve uncertainty and original command identity. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Resolve the exact retained original receipt request.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/payment-proof": {
      "get": {
        "description": "Authenticated merchant POS session with orders:operate and shared-commerce:invoices in the selected tenant. Uses one RepeatableRead snapshot of the issued order/invoice, frozen prices and completed ledger. No customer, provider reference, credential or delivery operation is returned or created. Historical tip and location absence are explicit. A refund preserves the original amounts, paid time and zero collection balance.",
        "operationId": "MerchantPosController_getPaymentProof",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPaymentProofDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "RESOURCE_NOT_FOUND: neutral missing or cross-tenant sale.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_PAYMENT_PROOF_NOT_SETTLED: no proven full original payment. POS_PAYMENT_PROOF_UNAVAILABLE: incomplete or contradictory persisted evidence. Neither refusal changes payment, inventory or fulfillment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read persisted POS payment proof and current refund status.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}": {
      "get": {
        "description": "#5227 (DR-5227-04): when `x-idempotency-key` carries the operation key of the sale's retained original card payment, the response also returns that operation's `terminalOperation` state, read from persisted facts in the same snapshot. It makes no provider call and no write. Without the header the response is unchanged.",
        "operationId": "MerchantPosController_getSale",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": false,
            "in": "header",
            "description": "Optional retained original card operation key whose attempt state to return.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSaleReadResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read the authoritative POS order and linked invoice state.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/invoices/{invoiceId}/abandon": {
      "post": {
        "description": "Requires a current POS session and selected-tenant membership with orders:operate and shared-commerce:invoices. The reason is audited. A 204 means the linked order and invoice were safely abandoned; an uncertain or paid payment returns a refusal and keeps recovery state.",
        "operationId": "MerchantPosController_abandonSale",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Unpaid POS sale safely abandoned."
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Abandon an uncollected POS sale after proving its payment is cancelled.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/invoices/{invoiceId}/terminal/connection-token": {
      "post": {
        "operationId": "MerchantPosController_createInvoiceTerminalConnectionToken",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosTerminalCollectionRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalConnectionTokenDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "COMMERCE_PAYMENT_INVALID with details.reason BELOW_PROVIDER_MINIMUM_BALANCE: the balance due is positive but below the minimum a card payment can collect (details.balanceDueInCents, details.currency, details.minimumChargeInCents), so no token is returned and the balance remains due. It is checked before Terminal readiness. A balance that falls below the minimum while the token is being created is refused the same way after the provider call. Other existing payment conflicts also return 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create a connected-account Terminal token for cartonium POS Tap to Pay.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/preparation-connection-token": {
      "post": {
        "description": "Apple Case 21203371: the app prepares the Tap to Pay reader at launch and when it returns to the foreground, so the first payment does not wait for configuration. The same authority as invoice collection applies: a current POS session and a member who may collect card (Owner, Admin, or Staff with shared-commerce:manual-payments). Routine and reasonless. The token is scoped to the tenant connected account and this installation's effective Terminal Location, re-proved after the provider call. It carries no sale, and it cannot accept Apple's Tap to Pay terms: the app connects with terms acceptance off.",
        "operationId": "MerchantPosController_createReaderPreparationToken",
        "parameters": [],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalReaderConnectionTokenDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "ROLE_INSUFFICIENT: the member may not collect card payments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY: the tenant payment account or this installation's Terminal Location is not ready, or changed while the token was created. details.reason names the readiness refusal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "POS_NOT_READY with details.reason STRIPE_TERMINAL_REQUEST_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY with details.reason STRIPE_NOT_CONFIGURED. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create a Terminal token that prepares Tap to Pay on this iPhone before a sale.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/terms-connection-token": {
      "post": {
        "description": "Apple Case 21203371: Apple's terms for Tap to Pay on iPhone may be accepted only by the merchant's administrator. This route keeps the authority of the Admin Apple Account setup handoff: Owner or Admin, the reasoned settings.destructive_change action, and a secret-free audit event naming the actor, the masked connected account, the Terminal Location and this POS installation. The token is bound to the active tenant's exact VERIFIED connected account and this installation's effective Terminal Location, re-proved after the provider call. The app uses it only for an explicit setup outside checkout, after the operator confirms the business. Payment-time and background connections never accept terms. cartonium never receives the Apple Account and does not record whether the terms were accepted.",
        "operationId": "MerchantPosController_createTermsConnectionToken",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalReaderConnectionTokenDto"
                }
              }
            }
          },
          "400": {
            "description": "HIGH_RISK_REASON_REQUIRED: a nonblank reason is required. VALIDATION_FAILED: the reason is too long or the body has another field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "ROLE_INSUFFICIENT: only an Owner or Admin may accept the terms.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY: the tenant payment account or this installation's Terminal Location is not ready, or changed while the token was created. details.reason names the readiness refusal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "POS_NOT_READY with details.reason STRIPE_TERMINAL_REQUEST_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY with details.reason STRIPE_NOT_CONFIGURED. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create the Terminal token an Owner or Admin uses to accept Apple's Tap to Pay on iPhone terms in the app.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/invoices/{invoiceId}/terminal/payment-intent": {
      "post": {
        "operationId": "MerchantPosController_createInvoiceTerminalPaymentIntent",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable operation key for safe Tap to Pay retries.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosTerminalPaymentIntentRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalPaymentIntentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "COMMERCE_PAYMENT_INVALID with details.reason CAPTURE_RECONCILIATION_REQUIRED blocks Terminal creation, replacement and reusable credential handoff while the invoice has unresolved capture evidence, including closed-case conflicts, unreconciled missing signed amounts, unreconciled refund evidence before a capture case, or an open signed-currency payment exception. Reconcile the payment before further collection; another operation key does not bypass the hold. POS_NOT_READY with details.reason POS_TERMINAL_LOCATION_CHANGED means the sale was created at another Terminal Location than this phone now uses (details.saleTerminalLocationId and details.currentTerminalLocationId); details.paymentAttemptActive says whether, when this request was refused, its x-idempotency-key held a Terminal payment attempt for this invoice that can still move money. It describes that moment only: an earlier request with the same key that has not answered can still reserve afterwards, for example once the location changes back. When it is true, keep the key, because another one is refused while that attempt is active. Discard the key only when it is false and this refused request was the key's first and only one. COMMERCE_PAYMENT_INVALID with details.reason BELOW_PROVIDER_MINIMUM_BALANCE: the balance due is positive but below the minimum a card payment can collect (details.balanceDueInCents, details.currency, details.minimumChargeInCents). It is checked before Terminal readiness, and the balance remains due. It carries no details.paymentAttemptActive, so it does not show whether this key holds an earlier attempt: keep the key. Other existing payment conflicts also return 409.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create a card-present PaymentIntent for a POS invoice's full balance.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/invoices/{invoiceId}/cash-tender": {
      "post": {
        "description": "Requires a current merchant POS session and selected-tenant membership with shared-commerce:cash-payments; Owner and Admin keep their bypass. No built-in preset grants it. Reasonless: the server records structured provenance, and the request accepts no reason. Authorization runs before any receipt lookup, so an exact replay also requires current authorization; it returns the original result and writes nothing. One transaction records the completed CASH payment, the receipt and its audit, or nothing. Full tender only. While cash is not available every new collection is refused with 409 POS_NOT_READY CASH_TENDER_NOT_AVAILABLE.",
        "operationId": "MerchantPosController_collectCash",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "required": true,
            "in": "header",
            "description": "Stable key for one cash collection (DR-2536-04). The server trims leading and trailing whitespace, and the trimmed key must be 1 to 200 characters; surrounding whitespace does not count toward the limit. A missing, blank or longer key is refused with 400 VALIDATION_FAILED (details.field Idempotency-Key) before any transaction. An exact retry with the same key and request replays the original result. This route reads only Idempotency-Key, not the x-idempotency-key header other POS commands use.",
            "schema": {
              "type": "string",
              "pattern": "^\\s*\\S(?:[\\s\\S]{0,198}\\S)?\\s*$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosCashTenderRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosCashTenderResultDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED: a missing, blank or over-200-character Idempotency-Key after trimming (details.field Idempotency-Key), or an invalid amount or currency.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "ROLE_INSUFFICIENT: the member may not collect cash. Checked before any receipt lookup.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "RESOURCE_NOT_FOUND: neutral missing, foreign or non-POS invoice.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY with details.reason CASH_TENDER_NOT_AVAILABLE (cash is not available), CASH_SALE_EVIDENCE_INVALID or CASH_SALE_CONTEXT_CHANGED (start a new sale). COMMERCE_PAYMENT_INVALID with details.reason CASH_UNDERPAYMENT or CASH_TENDER_CURRENCY_MISMATCH. RESOURCE_CONFLICT with details.reason IDEMPOTENCY_PAYLOAD_MISMATCH when the key was already used for a different cash payment. COMMERCE_LIFECYCLE_INVALID when the sale can no longer be collected. Nothing is written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY: cash storage or configuration is not ready. Retry the same request later. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Collect a POS invoice's full balance in cash.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/customer": {
      "put": {
        "description": "Requires a live POS session and customers:support, orders:operate and shared-commerce:invoices (Owner/Admin retain broad access). The active POS session selects the organization. Writes the same current customerId to the POS Order and its one linked Invoice, or neither, only when both still carry expectedCustomerId. Null to a Customer id attaches; a Customer id to null removes it; a direct change from one Customer to another is refused. The sale keeps its prices, revisions, payments, contact snapshot and immutable customerMode creation provenance: read customerId for the current association. Archived Customers may be attached by exact id. Attaching makes no profile edit and creates or attaches no provider Customer. Unknown and cross-tenant sale ids return the same neutral 404.",
        "operationId": "MerchantPosSaleCustomerController_setSaleCustomer",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "x-idempotency-key",
            "required": true,
            "in": "header",
            "description": "Stable key for one association change. An exact retry with the same body returns the original frozen result, even if the sale later changed again; the same key with a different body returns HTTP 409 with details.reason=IDEMPOTENCY_PAYLOAD_MISMATCH.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPosSaleCustomerDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosSaleCustomerChangeResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, no change requested (details.reason=POS_SALE_CUSTOMER_UNCHANGED), a direct rebind (details.reason=POS_SALE_CUSTOMER_REBIND_FORBIDDEN), or a Customer this organization cannot use (details.reason=CUSTOMER_NOT_FOUND_IN_TENANT).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Nothing was written. details.reason is POS_SALE_CUSTOMER_ASSOCIATION_STALE when the sale no longer carries expectedCustomerId (refresh, then retry with a new key), CUSTOMER_LIFECYCLE_UNAVAILABLE when the Customer cannot take a new use, CUSTOMER_LIFECYCLE_RECONCILIATION_REQUIRED or POS_SALE_CUSTOMER_ASSOCIATION_DIVERGENT when stored state needs reconciliation, POS_ORDER_INVOICE_PAIR_INCOMPLETE for an unissued or malformed pair, or IDEMPOTENCY_PAYLOAD_MISMATCH.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable before any write, including code=POS_SALE_CUSTOMER_CHANGE_UNAVAILABLE while a database migration completes. Retry the same change with the same key. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Attach or remove the Customer on an issued POS sale.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/pricing/preview": {
      "post": {
        "description": "Requires a current merchant POS session and selected-tenant membership with orders:operate and shared-commerce:invoices. \"Prices include tax\" ON also needs Owner/Admin or Staff delegated pricing:write, and a manual discount needs its existing authority. The server reads prices, genuine discounts, tax settings, the connected account and the Terminal Location tax address from current server state, then calculates tax on the tenant's connected account: added on top when OFF, carved out of the fixed post-discount gross when ON. Product lines only: tips, fees and shipping are not included. This is not authorization, a confirmation or collection authority. Nothing is created, recorded or audited; a retry is a fresh read and may price differently. Collection reprices and needs the cashier's explicit confirmation. Failed, skipped or malformed automatic tax refuses; it never becomes zero tax. Only the default Terminal context is priced.",
        "operationId": "MerchantPosPricingPreviewController_previewPricing",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosPricingPreviewRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosPricingPreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED: an invalid body, line, draft or manual discount (including one without a valid reason, details.field discount.reason); details.reason CATALOG_SELECTION_INVALID with details.itemId for a rental or service item, which a POS sale refuses the same way; pricing details.reason INCLUSIVE_PRICING_MALFORMED, INCLUSIVE_PRICING_REASON_REQUIRED or PRICING_PREVIEW_CONFIRMATION_NOT_ACCEPTED; or details.reason NON_POSITIVE_PAYABLE_TOTAL when nothing is left to pay after discounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "ROLE_INSUFFICIENT: missing the POS sale groups, pricing:write for ON, or the manual-discount authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY: a readiness refusal, or details.reason TAX_PROVIDER_UNAVAILABLE, MANUAL_TAX_ACKNOWLEDGEMENT_REQUIRED, TERMINAL_LOCATION_ADDRESS_INCOMPLETE, TAX_PROVIDER_PROVENANCE_INVALID, INCLUSIVE_PRICING_REQUIRES_AUTOMATIC_TAX or INCLUSIVE_PRICING_UNSUPPORTED_CART. TENANT_TAX_NOT_CONFIGURED: Stripe Tax settings are not active. Nothing is created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "POS_NOT_READY with details.reason STRIPE_READINESS_CHECK_FAILED or TAX_PROVIDER_FAILED: a failed, malformed or unreconcilable provider result. Never zero tax.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY with details.reason STRIPE_NOT_CONFIGURED, or PLATFORM_TAX_UNAVAILABLE: the provider is not configured or skipped the calculation. Never zero tax. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Preview server pricing for the current POS draft, without creating a sale.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal-locations": {
      "get": {
        "description": "Returns the Admin-configured active locations for the tenant's current connected Stripe account, the business default, and this POS installation's saved choice (#2386). A Terminal Location is Stripe's operational grouping for card payments, not the device's live geolocation. Preflight reports the effective location actually used.",
        "operationId": "MerchantPosTerminalLocationController_listTerminalLocations",
        "parameters": [
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from `nextCursor` of the previous page. Pass it back unchanged; omit it for the first page.",
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalLocationOptionsDto"
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION_FAILED when `cursor` is not one this endpoint returned. Request the first page again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY. `details.reason` names the failed precondition: ORGANIZATION_NOT_ACTIVE, CURRENCY_NOT_CONFIGURED or PAYMENT_ACCOUNT_NOT_VERIFIED for the tenant; TERMINAL_LOCATION_ACCOUNT_MISMATCH, TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_SELECTION_UNAVAILABLE, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH or CARD_PAYMENTS_NOT_ACTIVE for the chosen location; ORGANIZATION_PAYMENT_CONTEXT_CHANGED or TERMINAL_LOCATION_CHANGED when configuration changed while choosing (refresh and retry).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY with TERMINAL_LOCATION_SELECTION_UNAVAILABLE while the selection store is not yet deployed, or TERMINAL_LOCATION_SELECTION_UNVERIFIED when its readiness could not be read. The phone keeps using the business default. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List Terminal Locations this phone may use, with its saved choice.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal-location-selection": {
      "put": {
        "description": "Saves one listed location as this POS installation's choice for the selected tenant. It never changes the business default or another phone's choice. The server revalidates tenant, connected account, active state, Stripe availability, country and currency now, and again before every sale, connection token and PaymentIntent. The choice lasts until POS sign-out ends this installation. Choosing the location already saved is a no-op. Audited as pos.terminal_location.selected.",
        "operationId": "MerchantPosTerminalLocationController_selectTerminalLocation",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SelectPosTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PosTerminalLocationOptionsDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "RESOURCE_NOT_FOUND when the id is not a Terminal Location configured for this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_NOT_READY. `details.reason` names the failed precondition: ORGANIZATION_NOT_ACTIVE, CURRENCY_NOT_CONFIGURED or PAYMENT_ACCOUNT_NOT_VERIFIED for the tenant; TERMINAL_LOCATION_ACCOUNT_MISMATCH, TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_SELECTION_UNAVAILABLE, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH or CARD_PAYMENTS_NOT_ACTIVE for the chosen location; ORGANIZATION_PAYMENT_CONTEXT_CHANGED or TERMINAL_LOCATION_CHANGED when configuration changed while choosing (refresh and retry).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY when the selection store is not yet deployed or Stripe verification is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Choose the Terminal Location this phone uses for card payments.",
        "tags": [
          "merchant-pos"
        ]
      },
      "delete": {
        "description": "Removes this POS installation's saved Terminal Location choice for the selected tenant, including a stale one, so the phone uses the business default. Succeeds with 204 when nothing was saved. Audited as pos.terminal_location.selection_cleared when a choice existed.",
        "operationId": "MerchantPosTerminalLocationController_clearTerminalLocationSelection",
        "parameters": [],
        "responses": {
          "204": {
            "description": "The phone now has no saved choice."
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "POS_NOT_READY when the selection store is not yet deployed or its readiness could not be read. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Clear this phone's choice so it uses the business default.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/outcomes/{recordId}/report": {
      "post": {
        "description": "Native 6500 is a merchant-device assertion, not issuer/processor proof or receipt authority. Identical replay returns the original custody hash/time; changed evidence returns 409. The original session, installation, user, organization and current collection permissions must still match.",
        "operationId": "MerchantPosTerminalOutcomeController_report",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportTerminalOutcomeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalOutcomeCustodyAckDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or outcome identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Authentication or POS session is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Current selected membership or collection permission is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inaccessible outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The report conflicts with the immutable original collection or evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Outcome history or notification registration is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Complete an original merchant-device outcome exactly once.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/outcomes": {
      "get": {
        "description": "Preparation alone is excluded. History is cursor-paged, not capped or dependent on push delivery. Unknown/foreign cursors return a neutral 400.",
        "operationId": "MerchantPosTerminalOutcomeController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque nextCursor from the prior page, validated against the original owner and current filters.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "paymentAttemptId",
            "required": false,
            "in": "query",
            "description": "Filter by the original server payment attempt.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "view",
            "required": false,
            "in": "query",
            "description": "Pagination limits each response, never retained history or payment eligibility.",
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "ALL",
                "UNSEEN"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalOutcomePageDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or outcome identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Authentication or POS session is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Current selected membership or collection permission is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Outcome history or notification registration is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read completed historical outcomes for this original authorized session.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/outcomes/{recordId}": {
      "get": {
        "description": "No payment, receipt or active-basket mutation. An unavailable current proof never establishes nonpayment. Unknown and foreign outcomes share a neutral 404.",
        "operationId": "MerchantPosTerminalOutcomeController_detail",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalOutcomeDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or outcome identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Authentication or POS session is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Current selected membership or collection permission is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inaccessible outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Outcome history or notification registration is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read one historical fact and fresh proof for its original sale.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/outcomes/{recordId}/acknowledge": {
      "post": {
        "description": "Monotonic and replay-safe. Upload custody, push acceptance and OS callbacks are not acknowledgement.",
        "operationId": "MerchantPosTerminalOutcomeController_acknowledge",
        "parameters": [
          {
            "name": "recordId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalOutcomeAcknowledgementDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or outcome identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Authentication or POS session is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Current selected membership or collection permission is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inaccessible outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Outcome history or notification registration is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Acknowledge the exact outcome rendered in the authorized app.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/terminal/notification-registration": {
      "put": {
        "description": "The original authenticated session and installation select the owner; topic is fixed by the server. Permission denial does not prevent payments. Tokens and token-derived routing data are never returned.",
        "operationId": "MerchantPosTerminalOutcomeController_register",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterTerminalNotificationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalNotificationRegistrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or outcome identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Authentication or POS session is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Current selected membership or collection permission is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Outcome history or notification registration is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Register optional merchant notifications after native OS authorization.",
        "tags": [
          "merchant-pos"
        ]
      },
      "delete": {
        "description": "Retains historical outcomes and payment eligibility; does not clear another registration.",
        "operationId": "MerchantPosTerminalOutcomeController_revoke",
        "parameters": [],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokeTerminalNotificationDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or outcome identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Authentication or POS session is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Current selected membership or collection permission is unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Outcome history or notification registration is unavailable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Clear notification routing for this session and installation.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/pos/sales/{orderId}/inclusive-payment-proof": {
      "get": {
        "description": "Requires an authenticated merchant POS session and both sale permission groups (orders:operate and shared-commerce:invoices) for Staff. Owner and Admin keep their existing group bypass. The selected session determines the tenant. If supplied, the legacy organization slug header must match. The read uses one RepeatableRead snapshot for the original positive-payable CARD sale, its paired original Order and Invoice revisions, and their completed-ledger evidence. A verified original remains historical evidence after quote expiry. This proof confers no authority to collect, refund or issue a receipt.",
        "operationId": "MerchantPosInclusivePaymentProofController_getProof",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "description": "Original POS Order UUID (version 4).",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verified original amounts and completed-ledger status for the selected tenant.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proofVersion",
                    "orderId",
                    "invoiceId",
                    "currency",
                    "original",
                    "ledger"
                  ],
                  "properties": {
                    "proofVersion": {
                      "type": "string",
                      "enum": [
                        "pos.inclusive-payment-proof/v1"
                      ]
                    },
                    "orderId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Issued POS order ID used to address this read."
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Correlates the one verified invoice linked to this order."
                    },
                    "currency": {
                      "type": "string",
                      "description": "Original currency. Amounts use its minor units."
                    },
                    "original": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "revisionNumber",
                        "netInCents",
                        "includedTaxInCents",
                        "grossInCents",
                        "tipInCents"
                      ],
                      "properties": {
                        "revisionNumber": {
                          "type": "integer",
                          "enum": [
                            1
                          ],
                          "description": "Original revision number for both the verified Order and Invoice."
                        },
                        "netInCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Original net including ancillary amounts and the verified tip."
                        },
                        "includedTaxInCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Tax already included in the original gross. Zero means verified zero tax."
                        },
                        "grossInCents": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991,
                          "description": "Original net plus included tax. Paid amounts and refunds do not change this value."
                        },
                        "tipInCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Verified original tip already counted in net and gross. Zero means no tip or verified explicit zero."
                        }
                      }
                    },
                    "ledger": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "grossPaidInCents",
                        "effectiveRefundedInCents",
                        "balanceDueInCents",
                        "paymentStatus",
                        "tender",
                        "paidAt"
                      ],
                      "properties": {
                        "grossPaidInCents": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991,
                          "description": "Gross completed payments before refunds."
                        },
                        "effectiveRefundedInCents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Completed refunds less completed refund reversals. Zero means no completed refunds or a full reversal of their effect."
                        },
                        "balanceDueInCents": {
                          "type": "integer",
                          "enum": [
                            0
                          ],
                          "description": "Original collection balance remains zero after refunds."
                        },
                        "paymentStatus": {
                          "type": "string",
                          "enum": [
                            "PAID",
                            "PARTIALLY_REFUNDED",
                            "REFUNDED"
                          ],
                          "description": "Payment and refund status from the same completed-ledger snapshot as the original proof."
                        },
                        "tender": {
                          "type": "string",
                          "enum": [
                            "CARD"
                          ],
                          "description": "Method of the completed payments."
                        },
                        "paidAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Latest completed PAYMENT occurrence in UTC."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid commerce environment header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Merchant authentication or a current POS session is required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Selected POS membership or sale permissions are unavailable, or Sandbox was requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "RESOURCE_NOT_FOUND for a malformed, missing, foreign-tenant or non-POS order identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "POS_PAYMENT_PROOF_NOT_SETTLED: a coherent pair and ledger did not establish a fully paid positive original. POS_PAYMENT_PROOF_UNAVAILABLE: unsupported cohort, incomplete evidence, or contradictory evidence. Both refusals leave payment history undetermined for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "The read failed before a proof could be returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Read the original inclusive POS payment proof and current refund status.",
        "tags": [
          "merchant-pos"
        ]
      }
    },
    "/api/v1/merchant/customers": {
      "get": {
        "description": "Charter §3 fixed operational directory: name and normalized-email search, stable keyset pagination, three fixed sorts, and the verification / date / domain-presence / archive filters. The `DR-3032-20-A` account-status facet replaces the former Unlinked-purchasers queue — there is no separate queue surface. Archived customers are hidden unless explicitly requested. Excluded by charter: customizable views, saved segments, scoring, first-time/returning classification, arbitrary exports, phone search, and \"needs attention\" logic. API `displayName` is `name ?? \"Guest\"`: only `null` selects the fallback; empty and whitespace-only names pass through unchanged. For presentation, preserve the API value for a nonblank canonical name, regardless of account status. Otherwise, `REGISTERED` rows display `Unnamed customer`; `GUEST` rows keep a nonblank API display value or use `Unnamed customer` if it is blank. Use `name` to identify the fallback; a stored name of `Guest` is preserved. An unverified Customer may still carry canonical name/phone. Name search uses the canonical name, never an order-only name. ADR-047 adds only a permission-aware accepted-order PRESENCE result: an authorized `false` supports “No accepted orders yet.” and never implies a failed payment, purchaser status, spend, LTV, AOV, conversion, verification, consent, or marketing membership. Tombstoned Customers are not active directory identities and are never returned.",
        "operationId": "MerchantCustomerDirectoryController_list",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Search over canonical name and normalized email. Case-insensitive substring match, regardless of account status. An unverified Customer is searchable by its stored canonical name. Order-only names are not searched (`DR-3032-24-A`); rows with null or blank names remain searchable by normalized email. Phone search is excluded by charter §3.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of customers to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque keyset cursor from the previous page `nextCursor`. Treat it as opaque: its encoding is not part of this contract and changes with the sort. A cursor is bound to the sort, the organization, the caller's capability set and the filter set it was issued under; replaying it under a different one is rejected with `VALIDATION_FAILED` rather than silently returning a wrong page. Re-request the first page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "required": false,
            "in": "query",
            "description": "Sort order. Charter §3 fixes these three. `NAME` compares stored canonical names A–Z with `null` names last; empty and whitespace-only names participate as stored.",
            "schema": {
              "default": "CREATED",
              "type": "string",
              "enum": [
                "CREATED",
                "NAME",
                "LAST_ACTIVITY"
              ]
            }
          },
          {
            "name": "accountStatus",
            "required": false,
            "in": "query",
            "description": "Account-status facet (`DR-3032-20-A`), which replaces the Unlinked-purchasers queue. Also serves as charter §3 verification filter: under `DR-3032-22-A` verification promotes the same row in place, so the two are one predicate. Account status does not determine whether canonical name/phone are present.",
            "schema": {
              "type": "string",
              "enum": [
                "GUEST",
                "REGISTERED"
              ]
            }
          },
          {
            "name": "archived",
            "required": false,
            "in": "query",
            "description": "Archive posture. Defaults to `ACTIVE`: archived customers are hidden from the default result set and surfaced only when explicitly asked for. They remain addressable by id at all times.",
            "schema": {
              "default": "ACTIVE",
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED",
                "ALL"
              ]
            }
          },
          {
            "name": "domainPresence",
            "required": false,
            "in": "query",
            "description": "Restrict to customers with at least one authoritative record in this domain. Presence comes from a tenant-qualified link only — generalized email equality is never relationship authority (charter §8).",
            "schema": {
              "type": "string",
              "enum": [
                "COMMERCE",
                "BOOKING",
                "SUBSCRIPTION"
              ]
            }
          },
          {
            "name": "createdAfter",
            "required": false,
            "in": "query",
            "description": "Only customers created at or after this instant (ISO 8601).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "createdBefore",
            "required": false,
            "in": "query",
            "description": "Only customers created at or before this instant (ISO 8601).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lastActivityAfter",
            "required": false,
            "in": "query",
            "description": "Only customers whose last authoritative activity is at or after this instant (ISO 8601). Customers with NO authoritative activity are excluded by this filter — absence is not a date, and treating it as one would silently rewrite \"unknown\" into \"old\".",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lastActivityBefore",
            "required": false,
            "in": "query",
            "description": "Only customers whose last authoritative activity is at or before this instant (ISO 8601). Customers with NO authoritative activity are excluded, for the same reason as `lastActivityAfter`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDirectoryListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Customer directory for the active org (cursor-paginated).",
        "tags": [
          "merchant-customer-directory"
        ]
      }
    },
    "/api/v1/merchant/customers/{id}": {
      "get": {
        "description": "`DR-3032-08-A` hybrid model: the list is a projection, this detail is read live. API `displayName` is `name ?? \"Guest\"`: only `null` selects the fallback; empty and whitespace-only names pass through unchanged. For presentation, preserve the API value for a nonblank canonical name, regardless of account status. Otherwise, `REGISTERED` rows display `Unnamed customer`; `GUEST` rows keep a nonblank API display value or use `Unnamed customer` if it is blank. Use `name` to identify the fallback; a stored name of `Guest` is preserved. An unverified Customer may still carry canonical name/phone. Carries every distinct order-derived name / phone / address variant for the customer (`DR-3032-24-A`), reached ONLY through the accepted `CommerceRecord` association from #3233 and its owning order — never by email equality, which charter §8 forbids as relationship authority. Snapshots are read, never rewritten. #3519 also carries a per-currency payment reconciliation sourced from completed cartonium commerce-ledger rows on those tenant-qualified links. It explicitly marks Stripe Customer Insights as non-authoritative for money truth; it is not a net-sales or LTV summary. The accepted-order presence object follows the commerce capability; a restricted or unavailable result is unknown, never “no orders.” #4061 adds the reusable address book without copying order snapshots into it. It also adds masked persisted saved-method metadata only when the caller holds the independently resolved payment-summary capability (Staff need reports:view in addition to this route's customers:support gate). That projection is bound to the exact tenant, Customer, and current charging account; excludes detached and foreign-account rows; and reports bounded metadata completeness plus NOT_PROVIDER_VERIFIED freshness. It never calls the side-effecting customer-owned list, a provider, reconciliation, or any write. Last four is support context, not identity proof or authority for profile/financial actions. Addressable regardless of archive posture. Returns a neutral 404 for an unknown id and for an id belonging to another tenant, so the route cannot be used to probe for cross-tenant existence.",
        "operationId": "MerchantCustomerDirectoryController_detail",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDirectoryDetailDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one customer profile, addresses, masked saved methods, and history.",
        "tags": [
          "merchant-customer-directory"
        ]
      }
    },
    "/api/v1/public/items/{itemId}/reviews": {
      "post": {
        "description": "Public-facing capture for a storefront product-review form. Creates a PENDING review and returns immediately — the review is NOT visible on the storefront until a merchant approves it. Anyone can submit; reviews from an email matching a paid order for this item carry a verified-purchase badge (it never gates submission). Idempotent + enumeration-safe: the same author submitting twice for the same item gets the same response shape rather than a duplicate or an error revealing the prior review.",
        "operationId": "PublicProductReviewController_submit",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitReviewDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Review accepted for moderation. Returns a constant `{ ok: true }` — no review state or verified-purchase signal is echoed to the public caller (those surface only on approved reviews + the merchant queue).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitReviewResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Submit a product review (created PENDING; moderated).",
        "tags": [
          "public-product-reviews"
        ]
      },
      "get": {
        "description": "Returns only approved (PUBLISHED) reviews, newest first, with the display name only — an author email is NEVER returned. Includes the denormalized rating aggregate (`ratingAverage`, null when there are no reviews, + `ratingCount`). Cursor paginated via `nextCursor`. An unknown item id returns an empty list + a zero aggregate (same as \"no reviews yet\").",
        "operationId": "PublicProductReviewController_list",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of reviews to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating. Pass back the `nextCursor` value returned by the previous page. Currently a stringified review id; treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicItemReviewsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "List PUBLISHED reviews + the rating aggregate for an item.",
        "tags": [
          "public-product-reviews"
        ]
      }
    },
    "/api/v1/merchant/reviews": {
      "get": {
        "description": "Newest first. Filter by status: `pending` (default — the moderation queue), `published` (approved + visible), `hidden` (approved but merchant-hidden), `rejected` (declined), `all` (every row). Includes the author email (a merchant surface — moderators need it to judge a review).",
        "operationId": "MerchantProductReviewController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "pending",
                "published",
                "hidden",
                "rejected",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MerchantReviewModerationItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List product reviews for moderation.",
        "tags": [
          "merchant-product-reviews"
        ]
      }
    },
    "/api/v1/merchant/reviews/{id}/approve": {
      "post": {
        "description": "Publishes the review (makes it visible on the storefront) and adds its rating into the item aggregate, transactionally. Only valid from PENDING — an already-published or rejected review is a 409.",
        "operationId": "MerchantProductReviewController_approve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantProductReviewDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Approve a PENDING review → PUBLISHED.",
        "tags": [
          "merchant-product-reviews"
        ]
      }
    },
    "/api/v1/merchant/reviews/{id}/reject": {
      "post": {
        "description": "Valid from PENDING (decline an un-moderated review) or PUBLISHED (true post-approval moderation rejection). When the review was PUBLISHED + visible, its rating is subtracted back out of the item aggregate transactionally. Use hide/show for non-punitive storefront visibility changes.",
        "operationId": "MerchantProductReviewController_reject",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantProductReviewDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Reject a review → REJECTED.",
        "tags": [
          "merchant-product-reviews"
        ]
      }
    },
    "/api/v1/merchant/reviews/{id}/hide": {
      "post": {
        "description": "Valid only from PUBLISHED + visible. The moderation status remains PUBLISHED, visibility flips to HIDDEN, and the rating is removed from the public item aggregate transactionally.",
        "operationId": "MerchantProductReviewController_hide",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantProductReviewDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Hide an approved review without rejecting it.",
        "tags": [
          "merchant-product-reviews"
        ]
      }
    },
    "/api/v1/merchant/reviews/{id}/show": {
      "post": {
        "description": "Valid only from PUBLISHED + hidden. The moderation status remains PUBLISHED, visibility flips to VISIBLE, and the rating is restored to the public item aggregate transactionally.",
        "operationId": "MerchantProductReviewController_show",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantProductReviewDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Show a hidden approved review.",
        "tags": [
          "merchant-product-reviews"
        ]
      }
    },
    "/api/v1/merchant/payment-account": {
      "get": {
        "description": "Returns status, masked connected-account id, provider, connectedAt, and a nullable safe Stripe connected-account identity/requirements summary when available. Live charges require `status = VERIFIED`; everything else fails closed at the charge boundary (#930). The account id is masked and no Stripe secret/token, external account, person/company object, or submitted requirement value is ever returned.",
        "operationId": "MerchantPaymentAccountController_getStatus",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentAccountStatusDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active org's Stripe payment-account status.",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/connect": {
      "post": {
        "description": "Mints a single-use, hashed-at-rest CSRF state bound to this org and returns the Stripe authorize URL to redirect the merchant to. After the merchant authorizes, Stripe redirects to the public callback which links the connected account in the selected commerce environment. Sandbox uses a distinct single-use state table, test-only credentials, and the /connect/stripe/sandbox/callback redirect. Returns 503 when Connect is not configured — missing `STRIPE_CONNECT_CLIENT_ID` / redirect URI, OR a missing `STRIPE_SECRET_KEY` (the callback code exchange needs it, so the start fails fast before minting state).",
        "operationId": "MerchantPaymentAccountController_startConnect",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartConnectResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Begin Stripe Connect (Standard) OAuth onboarding.",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/refresh": {
      "post": {
        "description": "Interim manual re-check (until the durable `account.updated` webhook in #934): re-retrieves the connected account and re-derives `paymentAccountStatus`. Returns 400 when no account is linked, 503 when Stripe is not configured.",
        "operationId": "MerchantPaymentAccountController_refresh",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentAccountStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Re-check the connected account's status from Stripe.",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations": {
      "get": {
        "description": "Returns one bounded page from the active tenant connected account, the current provider-verified default, and a nullable organization-address prefill suggestion. The suggestion is never applied implicitly. Fails closed unless the connected account is VERIFIED with card_payments active.",
        "operationId": "MerchantPaymentAccountController_listTerminalLocations",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "format": "int32",
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque Stripe page cursor from `nextCursor`. Pass it back unchanged.",
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationSetupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List Stripe Terminal Locations and POS setup status.",
        "tags": [
          "merchant-payment-account"
        ]
      },
      "post": {
        "description": "Reasoned high-risk action that creates a location from the explicit merchant-supplied physical address on the active tenant connected account, re-retrieves it in that exact account, and atomically makes it the sole active default. Replacing an existing default follows the same high-risk controls and audit semantics as selecting an existing location. Organization and Stripe account identifiers are server-owned and cannot be supplied.",
        "operationId": "MerchantPaymentAccountController_createTerminalLocation",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetDefaultTerminalLocationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Conflict reasons are machine-readable in details.reason. Correct PAYMENT_ACCOUNT_NOT_VERIFIED or CARD_PAYMENTS_NOT_ACTIVE before retrying. Retry CREATION_IN_PROGRESS after waiting, and PAYMENT_ACCOUNT_CHANGED or TERMINAL_LOCATION_MAPPING_CHANGED after refreshing. TERMINAL_LOCATION_UNAVAILABLE is not retryable for this organization and requires operator intervention. TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create and select a Stripe Terminal Location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/tap-to-pay/apple-account-link": {
      "post": {
        "description": "Reasoned high-risk action for the active tenant only. The server uses the tenant's exact connected Stripe account as `on_behalf_of`, uses the organization name as the merchant display name, and always enables Apple Account relinking. The short-lived HTTPS onboarding URL is returned once and is never persisted or included in audit metadata.",
        "operationId": "MerchantPaymentAccountController_createTapToPayAppleAccountLink",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapToPayAppleAccountLinkResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Tap to Pay setup is not ready. `details.reason` is `PAYMENT_ACCOUNT_NOT_VERIFIED`, `CARD_PAYMENTS_NOT_ACTIVE`, or `PAYMENT_ACCOUNT_CHANGED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a Stripe-generated Tap to Pay Apple Account setup or relink URL.",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/default": {
      "put": {
        "description": "Reasoned high-risk adoption/switch. Re-retrieves the supplied location under the exact active tenant connected account before atomically making it the sole active default. Never accepts a Stripe account or organization id.",
        "operationId": "MerchantPaymentAccountController_adoptTerminalLocation",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdoptTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetDefaultTerminalLocationResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Conflict reasons are machine-readable in details.reason. Correct PAYMENT_ACCOUNT_NOT_VERIFIED or CARD_PAYMENTS_NOT_ACTIVE before retrying. Retry PAYMENT_ACCOUNT_CHANGED or TERMINAL_LOCATION_MAPPING_CHANGED after refreshing. TERMINAL_LOCATION_UNAVAILABLE is not retryable for this organization and requires operator intervention. TERMINAL_LOCATION_COUNTRY_MISMATCH means the location is outside the account country. TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Verify and select an existing Stripe Terminal Location.",
        "tags": [
          "merchant-payment-account"
        ]
      },
      "delete": {
        "description": "Leaves no default. Phones with a saved choice keep it; phones without one cannot take card payments until a default is set or they choose a location. No Stripe change. A no-op when there is no default.",
        "operationId": "MerchantTerminalLocationLifecycleController_clearDefault",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Clear the business default (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/disconnect": {
      "post": {
        "description": "High-risk, reasoned action (#1445). Fails closed FIRST: clears the account linkage and sets `paymentAccountStatus = NONE` locally, so card payments and payment links stop immediately, THEN attempts best-effort Stripe OAuth deauthorization (outcome reported in the response and audit event; a Stripe-side failure never leaves the local state connected). `paymentAccountConnectedAt` is retained as historical first-connected metadata. Reconnect via the existing connect flow. Returns 400 when a `reason` is missing or no account is linked. Returns 409 when the linked Stripe account changes while disconnecting.",
        "operationId": "MerchantPaymentAccountController_disconnect",
        "parameters": [
          {
            "name": "x-commerce-environment",
            "in": "header",
            "description": "Selects the tenant commerce environment; defaults to production. Sandbox uses separate payment-account state and test-only Stripe credentials.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisconnectPaymentAccountResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The linked Stripe account changed while disconnecting. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Disconnect the active Stripe payment account.",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured": {
      "get": {
        "description": "One complete list with the business default in place, including retired and previous-account locations and how many POS phones saved each as their choice. Read from cartonium only. A Terminal Location is Stripe's operational grouping for card payments, not a phone's live geolocation.",
        "operationId": "MerchantTerminalLocationLifecycleController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfiguredTerminalLocationListDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List every Terminal Location this tenant configured.",
        "tags": [
          "merchant-payment-account"
        ]
      },
      "post": {
        "description": "Creates the location in the connected Stripe account from the reviewed physical address, verifies it there, and adds it for POS. `makeDefault` also makes it the business default; otherwise it is an extra location phones can choose. The address must be in the connected account's country. The response reports the Stripe effect separately from the cartonium change.",
        "operationId": "MerchantTerminalLocationLifecycleController_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConfiguredTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a Stripe Terminal Location and add it (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/adopt": {
      "post": {
        "description": "Verifies the location in the connected Stripe account and adds it for POS, optionally as the business default. Adding a location already configured is a no-op; a retired one must be restored instead.",
        "operationId": "MerchantTerminalLocationLifecycleController_adopt",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdoptConfiguredTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Add an existing Stripe Terminal Location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}/default": {
      "put": {
        "description": "Re-verifies the location at Stripe and makes it the default phones use when they have no saved choice. It never changes a phone's saved choice. Setting the current default again is a no-op.",
        "operationId": "MerchantTerminalLocationLifecycleController_setDefault",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Make a configured location the business default (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}": {
      "patch": {
        "description": "Renames the Stripe Terminal Location first, then cartonium. The address and country are unchanged; a location on a previously connected account cannot be renamed.",
        "operationId": "MerchantTerminalLocationLifecycleController_rename",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameConfiguredTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Rename a configured location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      },
      "delete": {
        "description": "Refused with TERMINAL_LOCATION_IN_USE when cartonium holds sales or payments for it; retire it instead. Otherwise the cartonium mapping is removed under the same locks POS sales take, leaving any saved phone choice stale. The Stripe location is always kept, and `providerEffect` reports `KEPT`.",
        "operationId": "MerchantTerminalLocationLifecycleController_remove",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Remove an unused configured location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}/address": {
      "get": {
        "description": "Reads the address from Stripe on the current connected account, with the `addressVersion` an edit must quote. cartonium does not store it. Only an active location on the current account can be reviewed for an edit.",
        "operationId": "MerchantTerminalLocationLifecycleController_addressReview",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationAddressReviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED (restore the location first), TERMINAL_LOCATION_PREVIOUS_ACCOUNT, or TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER (Stripe no longer has the location). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review the address Stripe holds for a configured location.",
        "tags": [
          "merchant-payment-account"
        ]
      },
      "put": {
        "description": "Changes the address at Stripe only while the location still matches the reviewed `addressVersion`, which covers both Stripe's address and the location's record here and is good only for the location it was read for. Otherwise TERMINAL_LOCATION_ADDRESS_CHANGED asks for a fresh review, so two edits made from one review can't both apply. Stripe cannot change the country (400 TERMINAL_LOCATION_COUNTRY_UNCHANGEABLE), and a location outside the connected account's country is refused with TERMINAL_LOCATION_COUNTRY_MISMATCH: replace it instead. Until a confirmed physical location is enrolled (#2536), new card sales here are taxed with this address. Existing sales keep the tax they were created with, and a sale already being priced when the change is saved may keep the previous address's tax. A retirement that lands while Stripe applies the change is refused with TERMINAL_LOCATION_RETIRED, and Stripe may already show the new address. Stripe's address is read again right before the update, so a change made there after the review is refused rather than overwritten. Stripe has no conditional update, though, so a change landing between that last read and the update can still be overwritten. An unchanged address makes no Stripe call. Audit records which fields changed, never their values.",
        "operationId": "MerchantTerminalLocationLifecycleController_updateAddress",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateConfiguredTerminalLocationAddressDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal. These change nothing at Stripe: TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH (replace the location instead), TERMINAL_LOCATION_ADDRESS_CHANGED (review the address again), TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER (Stripe no longer has the location), PAYMENT_ACCOUNT_NOT_VERIFIED, CARD_PAYMENTS_NOT_ACTIVE, and TERMINAL_LOCATION_RETIRED when the location was already retired. PAYMENT_ACCOUNT_CHANGED, TERMINAL_LOCATION_RETIRED and TERMINAL_LOCATION_MAPPING_CHANGED can also arrive after Stripe accepted the change, when a relink, a retirement or a removal lands meanwhile. Their messages then say that Stripe may already show the new address: check the location there before trying again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Change the address Stripe holds for a configured location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}/replace": {
      "post": {
        "description": "Stripe can't change a location's country, and POS takes card payments only at a location in the connected account's country. This creates a new location in that country at Stripe, then retires the old one here, keeping its Stripe location and sales history, and moves the business default to the new one when the old one held it. POS phones that chose the old location must choose again. A location already in the account country is refused with TERMINAL_LOCATION_COUNTRY_MATCHES: change its address instead. The request quotes the `addressVersion` of the address review it was made from, which is claimed before Stripe is called: a second replacement made from the same review is refused with TERMINAL_LOCATION_ADDRESS_CHANGED instead of creating a second location. If a replacement fails after Stripe may have created the new location, review the location again and repeat it with the same name and address: for 24 hours, Stripe returns the location it already made, and it is bound without a duplicate.",
        "operationId": "MerchantTerminalLocationLifecycleController_replace",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceConfiguredTerminalLocationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal. These create nothing at Stripe: TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_RETIRED (add a new location instead), TERMINAL_LOCATION_COUNTRY_MATCHES (the location is already in the account country: change its address instead), TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER (Stripe no longer has the location being replaced), TERMINAL_LOCATION_ADDRESS_CHANGED (review the location again: it changed since the review, or another replacement has started), CREATION_IN_PROGRESS (the same creation is still running at Stripe: retry shortly), PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE (the connected account is not ready), and the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED. PAYMENT_ACCOUNT_CHANGED and TERMINAL_LOCATION_MAPPING_CHANGED can also arrive after Stripe created the new location, when a relink, a retirement, a removal or another replacement lands meanwhile. Their messages then say that Stripe may already hold the new location: check the connected account's locations before trying again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Replace a location outside the connected account's country (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}/retire": {
      "post": {
        "description": "Keeps its sale and payment history but stops new use, and clears the default when it was the default. Phones that saved it cannot take card payments until they choose again, unless it is restored first; restoring makes their saved choice apply again. No Stripe change. Retiring a retired location is a no-op.",
        "operationId": "MerchantTerminalLocationLifecycleController_retire",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retire a configured location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}/restore": {
      "post": {
        "description": "Re-verifies the location at Stripe on the current connected account and makes it usable again, not as the default. Phones whose saved choice is this location use it again.",
        "operationId": "MerchantTerminalLocationLifecycleController_restore",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HighRiskReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationLifecycleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "RESOURCE_CONFLICT or POS_NOT_READY; `details.reason` names the refusal: TERMINAL_LOCATION_RETIRED, TERMINAL_LOCATION_PREVIOUS_ACCOUNT, TERMINAL_LOCATION_COUNTRY_MISMATCH, TERMINAL_LOCATION_UNAVAILABLE, TERMINAL_LOCATION_UNAVAILABLE_AT_PROVIDER, TERMINAL_LOCATION_IN_USE, CREATION_IN_PROGRESS, or, after a concurrent change, TERMINAL_LOCATION_MAPPING_CHANGED / PAYMENT_ACCOUNT_CHANGED (refresh and retry). PAYMENT_ACCOUNT_NOT_VERIFIED and CARD_PAYMENTS_NOT_ACTIVE mean the connected account is not ready. Creating, adding, restoring or making a location the default also applies the Tap to Pay rules POS readiness applies to every sale: TERMINAL_COUNTRY_UNSUPPORTED, TERMINAL_CURRENCY_MISMATCH and CURRENCY_NOT_CONFIGURED mean cartonium POS cannot take Tap to Pay payments for the account country in the organization currency; retrying does not help until that changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore a retired location (high risk).",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}/removal-preview": {
      "get": {
        "description": "Reports whether cartonium holds sales or payments for it (then it must be retired instead), whether it is the default, and how many saved phone choices would go stale. Removal never changes the Stripe location.",
        "operationId": "MerchantTerminalLocationLifecycleController_removalPreview",
        "parameters": [
          {
            "name": "terminalLocationMappingId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminalLocationRemovalPreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preview removing a configured location.",
        "tags": [
          "merchant-payment-account"
        ]
      }
    },
    "/api/v1/merchant/payment-policy": {
      "get": {
        "description": "Owner or Admin only. Returns the environment this deployment manages, the versioned method catalog with honest controls (`editable`, the activation gate and its reason) and the current requested policy with its revision, the compare-and-set value a save must echo. Reads saved intent only: no provider call and no effective result — see `GET /merchant/payment-policy/effective-preview`.",
        "operationId": "MerchantPaymentPolicySettingsController_read",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentPolicySettingsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not an Owner or Admin of this organization. Staff are refused even with `settings:manage`: payment policy has its own dedicated permission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "`PAYMENT_POLICY_SETTINGS_UNAVAILABLE` with `details.reason: NOT_ACTIVATED`: payment-method settings have not been activated on this deployment. Nothing was read, written or observed; retrying does not help until a separately authorized rollout activates them. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read this environment's payment-method catalog and requested policy.",
        "tags": [
          "merchant-payment-policy"
        ]
      },
      "put": {
        "description": "Owner or Admin only. Appends the complete proposed policy as a new immutable revision, advancing the current revision by compare-and-set and recording the durable audit fact in the same transaction. It changes only this environment, never copies to another, affects only hosted-checkout sessions created afterwards, and never calls the provider. A valid policy requesting no method is saved as-is (nonpayable); Cards is never added.",
        "operationId": "MerchantPaymentPolicySettingsController_save",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SavePaymentPolicyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavePaymentPolicyResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: the body is not a complete schema-1 policy save.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not an Owner or Admin of this organization. Staff are refused even with `settings:manage`: payment policy has its own dedicated permission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`PAYMENT_POLICY_REVISION_CONFLICT`: `expectedRevision` is not the current revision (`details.expectedRevision`, `details.currentRevision`). Nothing was written. Read again, reconcile the change, and save explicitly against the current revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "`PAYMENT_POLICY_SAVE_REJECTED`; nothing was written. `details.reason` is `ENVIRONMENT_MISMATCH` (`details.environment` names this deployment's environment), `CONTROL_NOT_EDITABLE` (`details.entries` lists the locked entries the save would change), `CURRENT_POLICY_UNSUPPORTED_VERSION` (the current policy was saved by a newer version and is preserved) or `DOCUMENT_INVALID`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "`PAYMENT_POLICY_SETTINGS_UNAVAILABLE` with `details.reason: NOT_ACTIVATED`: payment-method settings have not been activated on this deployment. Nothing was read, written or observed; retrying does not help until a separately authorized rollout activates them. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Explicitly save this environment's requested payment policy.",
        "tags": [
          "merchant-payment-policy"
        ]
      }
    },
    "/api/v1/merchant/payment-policy/effective-preview": {
      "get": {
        "description": "Owner or Admin only. Derives, from the current requested policy and freshly observed Stripe constraints for the tenant's connected account, what a NEW ordinary hosted-checkout session created now would freeze: each method and wallet with its status, reasons, unresolved predicates and provider drift. It is not any existing session's snapshot and not payable-generation admission. Each call makes fresh read-only Stripe requests and writes nothing; provider unavailability is reported as `outcome: UNAVAILABLE`, never as a Cards fallback.",
        "operationId": "MerchantPaymentPolicySettingsController_preview",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentPolicyEffectivePreviewResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not an Owner or Admin of this organization. Staff are refused even with `settings:manage`: payment policy has its own dedicated permission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "`PAYMENT_POLICY_SETTINGS_UNAVAILABLE` with `details.reason: NOT_ACTIVATED`: payment-method settings have not been activated on this deployment. Nothing was read, written or observed; retrying does not help until a separately authorized rollout activates them. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preview what a new hosted-checkout session would be offered now.",
        "tags": [
          "merchant-payment-policy"
        ]
      }
    },
    "/api/v1/merchant/payment-policy/history": {
      "get": {
        "description": "Owner or Admin only. Every saved or copied revision, newest first, with its durable audit fact: actor, reason code, the revision it replaced, copy provenance, and the prior and new requested values.",
        "operationId": "MerchantPaymentPolicySettingsController_history",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size.",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 20,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "`nextCursor` from the previous page, passed back unchanged. Omit it for the newest revisions. It is a revision number, so any value from 1 to 2147483647 is a valid cursor.",
            "schema": {
              "pattern": "^[1-9][0-9]{0,9}$",
              "example": "12",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentPolicyHistoryPageDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not an Owner or Admin of this organization. Staff are refused even with `settings:manage`: payment policy has its own dedicated permission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "`PAYMENT_POLICY_SETTINGS_UNAVAILABLE` with `details.reason: NOT_ACTIVATED`: payment-method settings have not been activated on this deployment. Nothing was read, written or observed; retrying does not help until a separately authorized rollout activates them. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List this environment's requested-policy revisions.",
        "tags": [
          "merchant-payment-policy"
        ]
      }
    },
    "/api/v1/merchant/settings/numbering": {
      "get": {
        "description": "Returns the four kinds with their effective format (the stored configuration, or the default the first issue would store), whether `sequenceStartsAt` can still change, and any prefix conflicts that already exist. `formatLockedReason` marks a kind whose format cannot change on this deployment, such as ORDER while Orders keep their protected-base numbers. `writesEnabled` says whether saves are activated on this deployment. Reads only; it never provisions a configuration.",
        "operationId": "MerchantCommerceNumberSettingsController_read",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNumberSettingsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted: Owner and Admin always may; Staff need the `settings:manage` permission group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the numbering configuration for Orders, Quotes, Invoices and Agreements.",
        "tags": [
          "merchant-settings-numbering"
        ]
      }
    },
    "/api/v1/merchant/settings/numbering/{kind}/preview": {
      "get": {
        "description": "Advisory and read-only: the number the next issue would receive if nothing else issues first. It never reserves that number, and a concurrent issue can take it before a save. Query parameters override the effective format; with none, the effective format is previewed. While `sequenceStartsAtEditable` is false, a `sequenceStartsAt` override is not applied, because a save of a different start is refused with `SEQUENCE_START_LOCKED`; the preview uses the start in force. For ORDER while `formatLockedReason` is `ORDER_AUTHORITY_INACTIVE`, the preview is the protected-base number the Order path issues next, and any override is refused. It takes no lock and never writes, so an open Settings page cannot slow issuance.",
        "operationId": "MerchantCommerceNumberSettingsController_preview",
        "parameters": [
          {
            "name": "kind",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "enum": [
                "QUOTE",
                "INVOICE",
                "ORDER",
                "CONTRACT"
              ]
            }
          },
          {
            "name": "prefixPattern",
            "required": false,
            "in": "query",
            "description": "Proposed prefix pattern; empty for none.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prefixSeparator",
            "required": false,
            "in": "query",
            "description": "Proposed prefix separator; empty for none.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mainPattern",
            "required": false,
            "in": "query",
            "description": "Proposed main pattern.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "suffixSeparator",
            "required": false,
            "in": "query",
            "description": "Proposed suffix separator; empty for none.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "suffixPattern",
            "required": false,
            "in": "query",
            "description": "Proposed suffix pattern; empty for none.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "padding",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 0,
              "maximum": 8,
              "type": "number"
            }
          },
          {
            "name": "sequenceStartsAt",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 999999999,
              "type": "number"
            }
          },
          {
            "name": "resetScope",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "NEVER",
                "YEAR",
                "MONTH",
                "DAY"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceNumberPreviewResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: an unknown kind, an unknown parameter, or a parameter of the wrong type or range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted: Owner and Admin always may; Staff need the `settings:manage` permission group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`NUMBERING_FORMAT_LOCKED`: the query supplies a format override, even one equal to the current value, for a kind whose format cannot change on this deployment. `details.kind` and `details.reason` (from `COMMERCE_NUMBER_FORMAT_LOCKED_REASONS`) match the kind's `formatLockedReason`; nothing was previewed or written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "`NUMBERING_FORMAT_INVALID`: the proposed format breaks the published grammar. `details.fields[]` carries `{ field, reason }` from `COMMERCE_NUMBER_FORMAT_REASONS`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preview the next number for a kind, optionally with unsaved changes.",
        "tags": [
          "merchant-settings-numbering"
        ]
      }
    },
    "/api/v1/merchant/settings/numbering/{kind}": {
      "put": {
        "description": "Saves the complete format for future numbers of this kind; issued numbers never change and no configuration is ever deleted. Prefixes compare against every other kind (case-insensitive for literal text, at most one kind without a prefix). `sequenceStartsAt` can change only while the format's counter scope has no counter, or has a switch-provisioned counter that provably never issued, which the save then moves to the new start (see `sequenceStartsAtEditable`). An issued counter is never reseeded. Every attempt, saved or refused, is recorded in the audit log under target type `commerce_number_config` and target id the kind (or `invalid-kind`).",
        "operationId": "MerchantCommerceNumberSettingsController_save",
        "parameters": [
          {
            "name": "kind",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "QUOTE",
                "INVOICE",
                "ORDER",
                "CONTRACT"
              ],
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCommerceNumberSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveCommerceNumberSettingsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted: Owner and Admin always may; Staff need the `settings:manage` permission group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "`NUMBERING_SAVE_REJECTED`; nothing was saved. `details.reasonCodes` and `details.fields[]` (`{ field, reason, conflictingKind? }`) come from `COMMERCE_NUMBER_SAVE_REASONS`: request shape (`KIND_INVALID`, `BODY_NOT_OBJECT`, `FIELD_UNKNOWN`, `FIELD_MISSING`, `FIELD_TYPE_INVALID`), the published grammar and bounds, `PREFIX_CONFLICT` naming the conflicting kind, `SEQUENCE_START_LOCKED`, and `ORDER_AUTHORITY_INACTIVE` or `CONFIGURATION_RECONCILIATION_REQUIRED` for an ORDER configuration this database cannot accept from the editor. `details.requestId` matches the audit row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "`NUMBERING_WRITES_UNAVAILABLE` with `details.reason: NOT_ACTIVATED`: saving is not activated on this deployment; the attempt was audited and nothing else changed. Or `NUMBERING_AUDIT_UNAVAILABLE`: the attempt could not be recorded, so nothing changed; retryable. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Save one kind's numbering format.",
        "tags": [
          "merchant-settings-numbering"
        ]
      }
    },
    "/api/v1/public/csp-report": {
      "post": {
        "description": "Sink for the `report-uri` directive emitted by every cartonium app-class CSP (and the API’s own policies). Accepts the legacy `application/csp-report` body and the Reporting API `application/reports+json` batch. Anonymous and fire-and-forget: the browser dispatches reports without tenant headers or credentials and ignores the response, so this endpoint always returns 204 — malformed or unrecognized payloads are absorbed, not rejected. `?app=` self-identifies the reporting app class; unknown values are recorded as `unknown`. Not an integrator surface — there is nothing to read back.",
        "operationId": "CspReportController_report",
        "parameters": [
          {
            "name": "app",
            "required": false,
            "in": "query",
            "description": "App-class hint baked into each policy’s `report-uri` (an internal security-headers preset, or `api`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Report accepted (or absorbed)."
          }
        },
        "summary": "Collect a browser CSP violation report.",
        "tags": [
          "public-csp-report"
        ]
      }
    },
    "/api/v1/storefront/context": {
      "get": {
        "description": "The canonical \"verify my key + which tenant am I\" call for an external storefront backend. Requires the `storefront:read` scope. Returns the tenant org (id/slug/name/status/currency/timezone) plus the granted scopes. Authenticate with `x-api-key: <publicKey>.<secret>` — server-side only.",
        "operationId": "StorefrontController_getContext",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorefrontContextResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks the required scope, or org is suspended/archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Resolve the authenticated tenant storefront context.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/items": {
      "get": {
        "description": "Server-to-server catalog read for SSR/server caches. Requires `storefront:read` via `x-api-key` (server-side only). The tenant is resolved from the key, not from `x-organization-slug`. Reuses the browser-safe `PublicItemDto` projection and forces ACTIVE, non-archived items with the same bounded keyset pagination as `/public/items`.",
        "operationId": "StorefrontCatalogController_listItems",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Substring search over name, description, tags.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of items to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for paginating large lists — the `id` of the last item from the previous page. The merchant paginated list returns this value as `nextCursor`; the public list endpoint returns a flat array, so use the `id` of the last item you received. Treat it as opaque.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Filter by item type.",
            "schema": {
              "type": "string",
              "enum": [
                "RENTAL",
                "SALE",
                "SERVICE"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `storefront:read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "List ACTIVE items for an external storefront backend.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/items/search": {
      "get": {
        "description": "Server-to-server item search for SSR/server caches. Requires `storefront:read` via `x-api-key` (server-side only). Results are tenant-scoped by the authenticated key, bounded server-side, and reuse the browser-safe `PublicItemDto` projection.",
        "operationId": "StorefrontCatalogController_searchItems",
        "parameters": [
          {
            "name": "q",
            "required": true,
            "in": "query",
            "description": "Search active public catalog items. Literal matches are preserved; short multi-word queries can also match terms across public product name, slug, descriptions, tags, and live variant names. Results remain bounded and merchant-ordered, not relevance-ranked.",
            "schema": {
              "minLength": 1,
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of search results to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `storefront:read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Search ACTIVE items for an external storefront backend.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/items/{slug}": {
      "get": {
        "description": "Server-to-server PDP read. Requires `storefront:read` via `x-api-key` (server-side only). Missing, DRAFT, or archived slugs are masked as 404. The response reuses `PublicItemDto`, including public media, variants, prices, ratings, collection ids, and merchandising fields.",
        "operationId": "StorefrontCatalogController_getItemBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicItemDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `storefront:read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No ACTIVE item matches the slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Fetch one ACTIVE item by slug for an external storefront backend.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/collections": {
      "get": {
        "description": "Server-to-server navigation/collection-card read. Requires `storefront:read` via `x-api-key` (server-side only). The tenant is resolved from the key and the response reuses the browser-safe `PublicCollectionDto` projection.",
        "operationId": "StorefrontCatalogController_getCollections",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicCollectionDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `storefront:read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "List ACTIVE collections for an external storefront backend.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/collections/{slug}/items": {
      "get": {
        "description": "Server-to-server collection-page read. Requires `storefront:read` via `x-api-key` (server-side only). DRAFT/archived parent collections return an empty array, matching `/public/collections/:slug/items`; DRAFT or archived items are hidden. Reuses `PublicItemDto`.",
        "operationId": "StorefrontCatalogController_getCollectionItems",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicItemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `storefront:read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "List ACTIVE items in an ACTIVE collection for an external storefront backend.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/collections/{slug}": {
      "get": {
        "description": "Server-to-server collection read. Requires `storefront:read` via `x-api-key` (server-side only). Missing, DRAFT, or archived slugs are masked as 404. The response reuses `PublicCollectionDto`.",
        "operationId": "StorefrontCatalogController_getCollectionBySlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCollectionDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `storefront:read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No ACTIVE collection matches the slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Fetch one ACTIVE collection by slug for an external storefront backend.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/analytics-consent/resolve": {
      "post": {
        "description": "Server-to-server with a storefront:consent key and its verified storefront origin. May reconcile bindings, save a carried Decline or issue a handle. Uses ordinary tenant API accounting. The storefront handles browser cookie custody and same-origin checks.",
        "operationId": "StorefrontConsentController_resolve",
        "parameters": [
          {
            "name": "x-storefront-visitor-country",
            "in": "header",
            "description": "Country determined by the authenticated storefront server for this request. Used only for the composed configuration projection.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorefrontConsentResolveDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorefrontConsentResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Malformed bounded request or origin context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing server API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Origin, environment, key scope or tenant lifecycle refused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Storefront consent authority unavailable for this scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Source admission or ordinary API quota refused. Honor Retry-After.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                },
                "description": "Whole seconds before another attempt."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Authority temporarily unavailable. No save is confirmed by this response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Resolve the current storefront consent binding.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/storefront/analytics-consent/save": {
      "post": {
        "description": "Server-to-server with a storefront:consent key and its verified storefront origin. A live handle is required. Saved is reported after commit and only an exact receipt settles the operation. Resolve again before using an Allow.",
        "operationId": "StorefrontConsentController_save",
        "parameters": [
          {
            "name": "x-storefront-visitor-country",
            "in": "header",
            "description": "Country determined by the authenticated storefront server for this request. Used only for the composed configuration projection.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StorefrontConsentSaveDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorefrontConsentResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Malformed bounded request or origin context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing server API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Origin, environment, key scope or tenant lifecycle refused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Storefront consent authority unavailable for this scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Source admission or ordinary API quota refused. Honor Retry-After.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                },
                "description": "Whole seconds before another attempt."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Authority temporarily unavailable. No save is confirmed by this response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Save one named storefront consent choice.",
        "tags": [
          "storefront"
        ]
      }
    },
    "/api/v1/import/catalog": {
      "post": {
        "description": "Server-to-server catalog import. Requires `import:catalog` via `x-api-key` (server-side only). Batch-first: one authenticated request carries many rows, each one of five target shapes discriminated by `target` (`product` when omitted, `collection`, `variant`, `membership`, `composition`). Rows process in submitted order, so one batch can carry products/collections first and the variant/membership rows that reference them by external id after (an unresolved reference is a typed per-row `IMPORT_ROW_UNRESOLVED_REFERENCE` error). Product, collection, and variant rows are idempotent on the `(sourceSystem, externalId)` triple; membership rows use the resolved collection+item pair, and composition rows use the resolved parent Item plus `expectedRevision` (their `externalId` is job-row lineage only). Thus re-running an identical batch is a no-op-equivalent (never duplicates). Per-row continue-on-error: a bad row fails that row and the job proceeds; the terminal job may be `PARTIALLY_SUCCEEDED`. Set `dryRun: true` to validate a mapping without writing anything. Validation is the SAME as the merchant catalog write paths. A batch within the sync row ceiling returns 201 with the terminal job + per-row results; a larger batch (up to the async cap) returns 202 with a `QUEUED` job processed out-of-band — poll `GET /import/jobs/:id` (+ `/rows`) for progress and per-row results. Per-row errors live on the rows, not the audit log.",
        "operationId": "ImportController_importCatalogBatch",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportCatalogBatchDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sync fast-path: the terminal job + per-row results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJobResultDto"
                }
              }
            }
          },
          "202": {
            "description": "Async path (batch over the sync row ceiling): the job was accepted as `QUEUED` with `rows: []`; the cron runner processes it out-of-band. Poll `GET /import/jobs/:id`. Also returned when `idempotencyKey` matches an existing not-yet-terminal job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJobResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Malformed batch / over the row cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `import:catalog`, or the org is suspended/archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key import rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Idempotent batch upsert of catalog products, collections, variants, collection membership, and Item compositions.",
        "tags": [
          "import"
        ]
      }
    },
    "/api/v1/import/content": {
      "post": {
        "description": "Server-to-server content import. Requires `import:content` via `x-api-key` (server-side only). Batch-first: one authenticated request carries many page rows (`target: \"page\"`, or omitted — the only content target today). Rows are idempotent on the `(sourceSystem, externalId)` triple, so re-running an identical batch is a no-op-equivalent (never duplicates a page). Per-row continue-on-error: a bad row fails that row and the job proceeds; the terminal job may be `PARTIALLY_SUCCEEDED`. Set `dryRun: true` to validate a mapping without writing anything. Validation is the SAME as the merchant page write path — including that `status` accepts only `PUBLISHED`/`DRAFT` (`ARCHIVED` stays reserved for the merchant archive endpoint) and that an already-archived page cannot be written until it is restored. Optional fields are omit-preserves on update; send `excerpt: null` to clear it. A batch within the sync row ceiling returns 201 with the terminal job + per-row results; a larger batch (up to the async cap) returns 202 with a `QUEUED` job processed out-of-band — poll `GET /import/jobs/:id` (+ `/rows`). Per-row errors live on the rows, not the audit log. NOTE: the 2 MB request-body cap is enforced by the JSON parser before any of this runs, so for pages — whose bodies may reach 1 MB each — it is usually the binding limit rather than the row cap, and an oversized submission returns a bare `413`. Chunk by bytes, not by row count; see the `rows` field description for the size/row tradeoff.",
        "operationId": "ImportController_importContentBatch",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportContentBatchDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sync fast-path: the terminal job + per-row results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJobResultDto"
                }
              }
            }
          },
          "202": {
            "description": "Async path (batch over the sync row ceiling): the job was accepted as `QUEUED` with `rows: []`; the cron runner processes it out-of-band. Poll `GET /import/jobs/:id`. Also returned when `idempotencyKey` matches an existing not-yet-terminal job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJobResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Malformed batch / over the row cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks `import:content`, or the org is suspended/archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key import rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Idempotent batch upsert of CMS pages.",
        "tags": [
          "import"
        ]
      }
    },
    "/api/v1/import/jobs/{id}": {
      "get": {
        "description": "Fetch an import job by id, scoped to the authenticated tenant. Requires the `import:*` scope matching the job's own family — a job is only readable by a key that could have written it. Missing / cross-tenant / wrong-family ids are all masked as 404.",
        "operationId": "ImportController_getJob",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportJobResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key holds no live `import:*` scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No such job readable by this key in this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Read an import job (with its per-row results).",
        "tags": [
          "import"
        ]
      }
    },
    "/api/v1/import/jobs/{id}/rows": {
      "get": {
        "description": "The per-row reconciliation surface for a job (source lineage, terminal per-row status, target entity, typed per-row errors). Requires the `import:*` scope matching the job's own family. Missing / cross-tenant / wrong-family ids are all masked as 404.",
        "operationId": "ImportController_getJobRows",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ImportJobRowResultDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Key holds no live `import:*` scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No such job readable by this key in this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Per-key rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Read just the per-row results of an import job.",
        "tags": [
          "import"
        ]
      }
    },
    "/api/v1/merchant/booking-services": {
      "get": {
        "operationId": "MerchantBookingServicesController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List bookable services for the active organization.",
        "tags": [
          "merchant-booking-services"
        ]
      },
      "post": {
        "description": "Configures the service period, duration or fixed slots, buffers, pricing posture, payment/security-deposit posture, approval, and booking window. PRICING_STRUCTURE is reserved for M4-18.",
        "operationId": "MerchantBookingServicesController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingServiceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "A BookingService conflict, including uniqueness, active Item linkage, or concurrent configuration conflicts. An item-linked ACTIVE service with unmapped source pricing returns PRICING_POLICY_INCOMPATIBLE with details.reason = STRUCTURE_EVIDENCE_UNMAPPED; that refusal writes no BookingService row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a bookable service (booking operations permission required).",
        "tags": [
          "merchant-booking-services"
        ]
      }
    },
    "/api/v1/merchant/booking-services/{id}": {
      "get": {
        "operationId": "MerchantBookingServicesController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one bookable service.",
        "tags": [
          "merchant-booking-services"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingServicesController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingServiceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "A BookingService conflict, including uniqueness, active Item linkage, or concurrent configuration conflicts. An item-linked ACTIVE service with unmapped source pricing returns PRICING_POLICY_INCOMPATIBLE with details.reason = STRUCTURE_EVIDENCE_UNMAPPED; that refusal writes no BookingService row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a bookable service (booking operations permission required).",
        "tags": [
          "merchant-booking-services"
        ]
      }
    },
    "/api/v1/merchant/booking-services/{id}/archive": {
      "post": {
        "operationId": "MerchantBookingServicesController_archive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a bookable service. Idempotent.",
        "tags": [
          "merchant-booking-services"
        ]
      }
    },
    "/api/v1/merchant/booking-services/{id}/restore": {
      "post": {
        "operationId": "MerchantBookingServicesController_restore",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore an archived service to DRAFT. Idempotent.",
        "tags": [
          "merchant-booking-services"
        ]
      }
    },
    "/api/v1/merchant/booking-resources": {
      "get": {
        "operationId": "MerchantBookingResourcesController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "resourceType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "STAFF",
                "EQUIPMENT",
                "ROOM",
                "LOCATION",
                "VEHICLE",
                "POOL"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List booking resources and staff pools.",
        "tags": [
          "merchant-booking-resources"
        ]
      },
      "post": {
        "operationId": "MerchantBookingResourcesController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingResourceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a resource or staff pool.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{id}": {
      "get": {
        "operationId": "MerchantBookingResourcesController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one booking resource.",
        "tags": [
          "merchant-booking-resources"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingResourcesController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingResourceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a booking resource.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{id}/archive": {
      "post": {
        "operationId": "MerchantBookingResourcesController_archive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a booking resource. Idempotent.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{id}/restore": {
      "post": {
        "operationId": "MerchantBookingResourcesController_restore",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore an archived resource. Idempotent.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{resourceId}/units": {
      "get": {
        "operationId": "MerchantBookingResourcesController_listUnits",
        "parameters": [
          {
            "name": "resourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "MAINTENANCE",
                "LOST",
                "RETIRED"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceUnitListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List exact units for a booking resource.",
        "tags": [
          "merchant-booking-resources"
        ]
      },
      "post": {
        "operationId": "MerchantBookingResourcesController_createUnit",
        "parameters": [
          {
            "name": "resourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingResourceUnitDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceUnitResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create an exact unit under a booking resource.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{resourceId}/units/{unitId}": {
      "get": {
        "operationId": "MerchantBookingResourcesController_getUnit",
        "parameters": [
          {
            "name": "resourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unitId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceUnitResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one exact booking resource unit.",
        "tags": [
          "merchant-booking-resources"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingResourcesController_updateUnit",
        "parameters": [
          {
            "name": "resourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unitId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingResourceUnitDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceUnitResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update an exact booking resource unit.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{resourceId}/units/{unitId}/archive": {
      "post": {
        "operationId": "MerchantBookingResourcesController_archiveUnit",
        "parameters": [
          {
            "name": "resourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unitId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceUnitResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive an exact booking resource unit. Idempotent.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resources/{resourceId}/units/{unitId}/restore": {
      "post": {
        "operationId": "MerchantBookingResourcesController_restoreUnit",
        "parameters": [
          {
            "name": "resourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unitId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceUnitResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore an archived exact booking resource unit. Idempotent.",
        "tags": [
          "merchant-booking-resources"
        ]
      }
    },
    "/api/v1/merchant/booking-resource-requirements": {
      "get": {
        "operationId": "MerchantBookingResourceRequirementsController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceRequirementListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List service resource requirements.",
        "tags": [
          "merchant-booking-resource-requirements"
        ]
      },
      "post": {
        "operationId": "MerchantBookingResourceRequirementsController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingResourceRequirementDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceRequirementResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a service resource requirement.",
        "tags": [
          "merchant-booking-resource-requirements"
        ]
      }
    },
    "/api/v1/merchant/booking-resource-requirements/{id}": {
      "get": {
        "operationId": "MerchantBookingResourceRequirementsController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceRequirementResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one service resource requirement.",
        "tags": [
          "merchant-booking-resource-requirements"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingResourceRequirementsController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingResourceRequirementDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceRequirementResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a service resource requirement.",
        "tags": [
          "merchant-booking-resource-requirements"
        ]
      },
      "delete": {
        "operationId": "MerchantBookingResourceRequirementsController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResourceRequirementResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete a service resource requirement.",
        "tags": [
          "merchant-booking-resource-requirements"
        ]
      }
    },
    "/api/v1/merchant/booking-availability-rules": {
      "get": {
        "operationId": "MerchantBookingAvailabilityRulesController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "targetType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "SERVICE",
                "RESOURCE"
              ]
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingAvailabilityRuleListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List recurring booking availability rules.",
        "tags": [
          "merchant-booking-availability-rules"
        ]
      },
      "post": {
        "operationId": "MerchantBookingAvailabilityRulesController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingAvailabilityRuleDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingAvailabilityRuleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a recurring availability rule.",
        "tags": [
          "merchant-booking-availability-rules"
        ]
      }
    },
    "/api/v1/merchant/booking-availability-rules/{id}": {
      "get": {
        "operationId": "MerchantBookingAvailabilityRulesController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingAvailabilityRuleResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one recurring availability rule.",
        "tags": [
          "merchant-booking-availability-rules"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingAvailabilityRulesController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingAvailabilityRuleDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingAvailabilityRuleResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a recurring availability rule.",
        "tags": [
          "merchant-booking-availability-rules"
        ]
      },
      "delete": {
        "operationId": "MerchantBookingAvailabilityRulesController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingAvailabilityRuleResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete a recurring availability rule.",
        "tags": [
          "merchant-booking-availability-rules"
        ]
      }
    },
    "/api/v1/merchant/booking-blackouts": {
      "get": {
        "operationId": "MerchantBookingBlackoutsController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "targetType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ORGANIZATION",
                "SERVICE",
                "RESOURCE"
              ]
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingBlackoutListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List organization, service, or resource blackouts.",
        "tags": [
          "merchant-booking-blackouts"
        ]
      },
      "post": {
        "description": "Instant fields require RFC 3339 offsets. Recurrence supports a bounded RRULE subset: FREQ (DAILY/WEEKLY/MONTHLY/YEARLY), INTERVAL, BYDAY, and COUNT.",
        "operationId": "MerchantBookingBlackoutsController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingBlackoutDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingBlackoutResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a booking blackout.",
        "tags": [
          "merchant-booking-blackouts"
        ]
      }
    },
    "/api/v1/merchant/booking-blackouts/{id}": {
      "get": {
        "operationId": "MerchantBookingBlackoutsController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingBlackoutResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one booking blackout.",
        "tags": [
          "merchant-booking-blackouts"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingBlackoutsController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingBlackoutDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingBlackoutResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a booking blackout.",
        "tags": [
          "merchant-booking-blackouts"
        ]
      },
      "delete": {
        "operationId": "MerchantBookingBlackoutsController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingBlackoutResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete a booking blackout.",
        "tags": [
          "merchant-booking-blackouts"
        ]
      }
    },
    "/api/v1/merchant/booking-policies": {
      "get": {
        "operationId": "MerchantBookingPoliciesController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "required": false,
            "in": "query",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPolicyListResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List reusable or service-scoped booking policies.",
        "tags": [
          "merchant-booking-policies"
        ]
      },
      "post": {
        "operationId": "MerchantBookingPoliciesController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingPolicyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPolicyResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a booking policy.",
        "tags": [
          "merchant-booking-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-policies/{id}": {
      "get": {
        "operationId": "MerchantBookingPoliciesController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPolicyResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one booking policy.",
        "tags": [
          "merchant-booking-policies"
        ]
      },
      "patch": {
        "operationId": "MerchantBookingPoliciesController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBookingPolicyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPolicyResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Update a booking policy.",
        "tags": [
          "merchant-booking-policies"
        ]
      },
      "delete": {
        "operationId": "MerchantBookingPoliciesController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPolicyResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Delete a booking policy.",
        "tags": [
          "merchant-booking-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies": {
      "get": {
        "description": "Merchant bearer auth + x-organization-slug; one bounded page of the active organization’s policies under the shared booking-setup cursor contract (`limit`, `cursor`, `{ data, nextCursor }`). Each row carries the revision summary and the published revision, so a client never issues one revisions request per policy.",
        "operationId": "MerchantBookingPricingPoliciesController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List reusable duration pricing policies (bounded cursor page).",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      },
      "post": {
        "description": "Merchant bearer auth + x-organization-slug; the policy is created in the active organization with an immutable revision 1 DRAFT that must be published explicitly.",
        "operationId": "MerchantBookingPricingPoliciesController_create",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingPricingPolicyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyWithRevisionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a pricing policy with its revision 1 draft (booking operations permission required).",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies/preview": {
      "post": {
        "description": "Merchant bearer auth + x-organization-slug; attended authoring preview scoped to the active organization. Evaluates the candidate duration bands through the shared booking pricing resolver without reading or writing any policy state, and independently of the customer-facing PRICING_STRUCTURE runtime gate. Returns evaluated prices, so the response is private and non-cacheable.",
        "operationId": "MerchantBookingPricingPoliciesController_preview",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewBookingPricingPolicyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyPreviewResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Evaluate a candidate revision against sample durations (booking operations permission required).",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies/{policyId}": {
      "get": {
        "description": "Merchant bearer auth + x-organization-slug; 404 unless the policy belongs to the active organization.",
        "operationId": "MerchantBookingPricingPoliciesController_get",
        "parameters": [
          {
            "name": "policyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Fetch one pricing policy.",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies/{policyId}/revisions": {
      "get": {
        "description": "Merchant bearer auth + x-organization-slug; newest revision first, scoped to the active organization, paged with the shared booking-setup cursor contract (`limit`, `cursor`, `{ data, nextCursor }`). This is the per-policy detail read: the library list already carries the published revision and the revision summary.",
        "operationId": "MerchantBookingPricingPoliciesController_listRevisions",
        "parameters": [
          {
            "name": "policyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of setup rows to return.",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "format": "int32",
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from the previous page. Pass back the returned nextCursor.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyRevisionListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List the immutable revisions of one pricing policy (bounded cursor page).",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      },
      "post": {
        "description": "Merchant bearer auth + x-organization-slug; published revisions are immutable, so changes append the next-numbered DRAFT on the active organization’s policy.",
        "operationId": "MerchantBookingPricingPoliciesController_createRevision",
        "parameters": [
          {
            "name": "policyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBookingPricingPolicyRevisionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyRevisionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Create a successor draft revision (booking operations permission required).",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies/{policyId}/revisions/{revisionNumber}/publish": {
      "post": {
        "description": "Merchant bearer auth + x-organization-slug; supersedes the currently published revision of the active organization’s policy after validating every attached service against the candidate.",
        "operationId": "MerchantBookingPricingPoliciesController_publishRevision",
        "parameters": [
          {
            "name": "policyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revisionNumber",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyRevisionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Publish a draft revision (booking operations permission required). Idempotent.",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies/{policyId}/archive": {
      "post": {
        "description": "Merchant bearer auth + x-organization-slug; conflicts while any booking service in the active organization still references the policy.",
        "operationId": "MerchantBookingPricingPoliciesController_archive",
        "parameters": [
          {
            "name": "policyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Archive a detached pricing policy (booking operations permission required). Idempotent.",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-pricing-policies/{policyId}/restore": {
      "post": {
        "description": "Merchant bearer auth + x-organization-slug; scoped to the active organization.",
        "operationId": "MerchantBookingPricingPoliciesController_restore",
        "parameters": [
          {
            "name": "policyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPricingPolicyResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Restore an archived pricing policy (booking operations permission required). Idempotent.",
        "tags": [
          "merchant-booking-pricing-policies"
        ]
      }
    },
    "/api/v1/merchant/booking-services/{serviceId}/pricing-policy": {
      "put": {
        "description": "Merchant bearer auth + x-organization-slug; both rows must belong to the active organization. Conflicts with the shared reason-coded compatibility contract when the service posture or the policy’s published revision is incompatible.",
        "operationId": "MerchantBookingServicePricingPolicyController_attach",
        "parameters": [
          {
            "name": "serviceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachBookingPricingPolicyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Attach a pricing policy to a booking service (booking operations permission required). Idempotent.",
        "tags": [
          "merchant-booking-services"
        ]
      },
      "delete": {
        "description": "Merchant bearer auth + x-organization-slug; scoped to the active organization.",
        "operationId": "MerchantBookingServicePricingPolicyController_detach",
        "parameters": [
          {
            "name": "serviceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingServiceResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Detach the pricing policy from a booking service (booking operations permission required). Idempotent.",
        "tags": [
          "merchant-booking-services"
        ]
      }
    },
    "/api/v1/customer/account/bookings": {
      "get": {
        "description": "Ownership comes only from the authenticated customer identity and active tenant. Merchant notes, allocations, resource identities, and database document ids are excluded.",
        "operationId": "CustomerBookingAccountController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "CONFIRMED",
                "ACTIVE",
                "COMPLETED",
                "CANCELLED",
                "DRAFT",
                "REQUESTED",
                "PENDING_PAYMENT",
                "DECLINED",
                "EXPIRED"
              ]
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "default": 1,
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 20,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerBookingListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the signed-in customer's bookings.",
        "tags": [
          "customer-bookings"
        ]
      }
    },
    "/api/v1/customer/account/bookings/{id}": {
      "get": {
        "description": "Returns a neutral 404 for unknown, cross-tenant, or another customer’s booking.",
        "operationId": "CustomerBookingAccountController_detail",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingCustomerDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read one booking owned by the signed-in customer.",
        "tags": [
          "customer-bookings"
        ]
      }
    },
    "/api/v1/customer/account/bookings/{id}/cancel-request": {
      "post": {
        "operationId": "CustomerBookingAccountController_cancelRequest",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerBookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingChangeRequestResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Submit a cancellation request for an owned booking.",
        "tags": [
          "customer-bookings"
        ]
      }
    },
    "/api/v1/customer/account/bookings/{id}/reschedule-request": {
      "post": {
        "operationId": "CustomerBookingAccountController_rescheduleRequest",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerBookingRescheduleRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingChangeRequestResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Submit a reschedule request for an owned booking.",
        "tags": [
          "customer-bookings"
        ]
      }
    },
    "/api/v1/customer/bookings/{token}": {
      "get": {
        "description": "The booking.manage action token is the credential. Preview is repeatable and remains available after a successful mutation; every miss is the same neutral 404.",
        "operationId": "CustomerBookingActionController_preview",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingCustomerDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Preview a booking through a scoped guest-management action link.",
        "tags": [
          "customer-booking-actions"
        ]
      }
    },
    "/api/v1/customer/bookings/{token}/checkout": {
      "post": {
        "description": "The booking.manage action token authorizes the return. When ADR-043 price confirmation is enabled, the first call returns the frozen tax-inclusive approved offer and a signed receipt; only an explicitly confirmed retry receives a checkout bearer. Accepted Commerce Quotes remain exempt.",
        "operationId": "CustomerBookingActionController_checkout",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingPriceConfirmationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingCheckoutResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "BOOKING_PRICE_CONFIRMATION_REQUIRED returns the typed two-phase confirmation challenge. Other operation-specific conflicts use the canonical API error envelope. TENANT_TAX_NOT_CONFIGURED when a stored stripe_tax policy has a tax base but its connected account or Tax settings are incomplete. A stored manual_no_tax policy with a missing or invalid responsibility acknowledgement also fails before any priced commitment, including free bookings. Unpriced draft/request capture retains its existing behavior. Concurrent tax-policy changes require retrying the operation.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/BookingPriceConfirmationRequiredErrorDto"
                    },
                    {
                      "$ref": "#/components/schemas/ApiErrorDto"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Resume payment for a merchant-approved singular booking.",
        "tags": [
          "customer-booking-actions"
        ]
      }
    },
    "/api/v1/customer/bookings/{token}/cancel-request": {
      "post": {
        "description": "Uses the frozen booking policy, writes the existing BookingChangeRequest operational record, audits through the shared action/activity foundations, and consumes the action link once.",
        "operationId": "CustomerBookingActionController_cancelRequest",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerBookingReasonDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingChangeRequestResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Submit a policy-checked cancellation request.",
        "tags": [
          "customer-booking-actions"
        ]
      }
    },
    "/api/v1/customer/bookings/{token}/reschedule-request": {
      "post": {
        "description": "This request does not claim capacity. Merchant approval performs the transactional availability recheck before the operational window moves.",
        "operationId": "CustomerBookingActionController_rescheduleRequest",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerBookingRescheduleRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingChangeRequestResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Submit a policy-checked reschedule request.",
        "tags": [
          "customer-booking-actions"
        ]
      }
    },
    "/api/v1/customer/agreement-actions/{token}/resume": {
      "post": {
        "description": "This authority-only exchange creates no booking, capacity claim, checkout, or payment. For an OPEN group, the caller must explicitly submit the existing group request command, which re-evaluates all agreement requirements transactionally. A safe nonterminal group already advanced by that command may be replayed after a lost response. Malformed, unknown, expired, revoked, declined, incomplete, cross-tenant, wrong-customer, wrong-subject, and terminal-group actions share one neutral 404.",
        "operationId": "CustomerAgreementBookingGroupRecoveryController_resume",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGroupRecoveryProofDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Exchange a completed native agreement action for its exact booking-group proof.",
        "tags": [
          "customer-agreement-actions"
        ]
      }
    },
    "/api/v1/customer/account/booking-groups": {
      "get": {
        "description": "Ownership comes only from the authenticated tenant-scoped customer id, with normalized-email fallback only when the group has no durable owner. Internal group/member ids and payment capabilities are excluded.",
        "operationId": "CustomerBookingGroupAccountController_list",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "default": 1,
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 20,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerBookingGroupListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the signed-in customer's booking groups.",
        "tags": [
          "customer-booking-groups"
        ]
      }
    },
    "/api/v1/customer/account/booking-groups/{publicRef}": {
      "get": {
        "description": "Unknown, cross-tenant, and another customer’s group all return the same neutral 404.",
        "operationId": "CustomerBookingGroupAccountController_detail",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerBookingGroupDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read one booking group owned by the signed-in customer.",
        "tags": [
          "customer-booking-groups"
        ]
      }
    },
    "/api/v1/customer/account/booking-groups/{publicRef}/resume": {
      "post": {
        "description": "The proof is response-only and stored only as a digest. It is never placed in a URL or rendered account projection.",
        "operationId": "CustomerBookingGroupAccountController_resume",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGroupRecoveryProofDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Mint a fresh scoped resume proof for an owned booking group.",
        "tags": [
          "customer-booking-groups"
        ]
      }
    },
    "/api/v1/customer/booking-groups/actions/exchange": {
      "post": {
        "description": "Malformed, unknown, expired, revoked, cross-tenant, consumed, and wrong-purpose actions share one neutral 404. The action remains retryable until a successful proof-authenticated read.",
        "operationId": "CustomerBookingGroupRecoveryController_exchange",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeBookingGroupActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingGroupRecoveryProofDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Exchange a guest recovery action for a scoped group proof.",
        "tags": [
          "customer-booking-group-recovery"
        ]
      }
    },
    "/api/v1/customer/booking-groups/{publicRef}": {
      "get": {
        "description": "Delegates to the authoritative proof-bound group projection. Only after that read succeeds is the originating action token consumed.",
        "operationId": "CustomerBookingGroupRecoveryController_read",
        "parameters": [
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "booking-group-proof-generation",
            "required": false,
            "in": "header",
            "description": "When selecting a versioned hosted cookie, require this exact current durable proof generation as well as the resume proof.",
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,18})$"
            }
          },
          {
            "name": "booking-group-resume-key",
            "in": "header",
            "description": "Scoped group resume proof. Hosted clients exchange it into an httpOnly cookie before rendering a clean URL.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^g[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read a recovered booking group and acknowledge its action link.",
        "tags": [
          "customer-booking-group-recovery"
        ]
      }
    },
    "/api/v1/merchant/platform-billing": {
      "get": {
        "description": "Returns a strict merchant projection of current plan and cadence, scheduled change, latest operation state, available transitions, and provider-confirmed billing-address readiness. Provider ids, platform case notes, staff identities, recovery controls, and draft history are never returned.",
        "operationId": "MerchantPlatformBillingController_getBillingState",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStateDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active org's authoritative platform billing state.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/plan-change/preview": {
      "post": {
        "description": "Freshly resolves the active organization, provider subscription, published target price, scheduled intent, and provider-confirmed billing-address version. Immediate changes return Stripe-authored money and tax facts; period-end changes return `money: null`. The short-lived opaque confirmation token binds the exact preview and is accepted only in the confirm request body. The same authenticated Owner or Admin who requests the preview must submit its confirmation.",
        "operationId": "MerchantPlatformBillingController_previewPlanChange",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPlanChangePreviewRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPlanChangePreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "`PLATFORM_BILLING_PLAN_CHANGE_REJECTED` means the request is valid but cannot be quoted from the current billing state. `details.reason` is `BILLING_STATE_NOT_ELIGIBLE` or `ADDRESS_NOT_PROVIDER_CONFIRMED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Preview an ordinary Pro cadence change for the active org.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/plan-change/confirm": {
      "post": {
        "description": "Re-reads the active org, provider subscription, target publication, scheduled intent, address version, and immediate invoice preview before admission. An unlinked token that is expired, cross-org, or otherwise drifted fails closed with `REQUOTE_REQUIRED`. Once a token is linked, an exact same-actor retry is idempotent: it resumes only that linked operation or returns its current merchant-safe state without admitting another mutation. The token is also bound to the authenticated Owner or Admin who requested the preview; another user receives the same neutral `REQUOTE_REQUIRED` response. No token or provider identifier is accepted in a URL.",
        "operationId": "MerchantPlatformBillingController_confirmPlanChange",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPlanChangeConfirmRequestDto"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStateDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "`PLATFORM_BILLING_PLAN_CHANGE_REJECTED` with `details.reason=BILLING_STATE_NOT_ELIGIBLE` means the valid request cannot be applied from the current billing state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Confirm the exact current plan-change preview.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/plan-change/scheduled/cancel": {
      "post": {
        "description": "Cancels only the exact provider-confirmed scheduled paid cadence change identified by the opaque state reference and caller request identity. Subscription and schedule identifiers are resolved server-side. Native paid-to-Free cancellation remains on the separate reactivate contract.",
        "operationId": "MerchantPlatformBillingController_cancelScheduledPlanChange",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantScheduledPlanChangeCancelRequestDto"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStateDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "422": {
            "description": "`PLATFORM_BILLING_PLAN_CHANGE_REJECTED` with `details.reason=BILLING_STATE_NOT_ELIGIBLE` means there is no eligible provider-confirmed scheduled cadence change to cancel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Cancel the active org's scheduled cadence change.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/address": {
      "get": {
        "description": "Returns the stored address plus whether it would satisfy the fail-closed tax gate, so the panel can explain a refusal before a subscribe attempt rather than surfacing a bare 4xx after one.",
        "operationId": "MerchantPlatformBillingController_getBillingAddress",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBillingAddressDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the active org's billing address and its tax usability.",
        "tags": [
          "merchant-platform-billing"
        ]
      },
      "put": {
        "description": "Writes the address used to determine the SaaS tax jurisdiction and atomically records its versioned propagation intent. When a platform Stripe customer exists, reconciliation updates its billing address and clears any stale shipping profile; provider failures are retried from the durable intent. A 200 confirms the local address and intent commit, not synchronous provider completion. An unsupported country is refused before the write. This is the organization's one address, which Connect onboarding also reads.",
        "operationId": "MerchantPlatformBillingController_updateBillingAddress",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMerchantBillingAddressDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored address after the write, with its refreshed usability verdict — so the panel renders the new state without a second GET.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantBillingAddressDto"
                }
              }
            }
          },
          "400": {
            "description": "The address is incomplete or malformed. `details.reason` is `BILLING_ADDRESS_REQUIRED` or `BILLING_ADDRESS_INVALID`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "The billing country is outside the supported jurisdiction list. `details.reason` is `COUNTRY_NOT_SUPPORTED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set the active org's billing address.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/subscribe": {
      "post": {
        "description": "Freshly validates the submitted opaque quote, displayed currency, and amount against one sellable CURRENT price row before any Stripe subscription mutation. Active/trialing is idempotently reused. An INCOMPLETE/PAST_DUE subscription returns 409 and must be handled by the separate quote-free resume-payment endpoint, so a new public offer can never replace existing invoice terms. A new create is generation-idempotent and verifies Stripe echoed the exact resolved price. The org's plan flips to Pro only after the authoritative billing webhook confirms it; this call never grants Pro on its own.",
        "operationId": "MerchantPlatformBillingController_subscribe",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscribeRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscribeResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "ADR-008 fail-closed tax gate. `details.reason` is `BILLING_ADDRESS_REQUIRED` (the organization has no billing address set) or `BILLING_ADDRESS_INVALID` (it is incomplete, not ISO 3166-1 alpha-2, or a location Stripe Tax cannot resolve). Set a usable address with `PUT /merchant/platform-billing/address`, then retry subscribe.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Includes `details.reason=COUNTRY_NOT_SUPPORTED` when the billing country is outside the supported jurisdiction list — no payload change resolves this one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "`PLATFORM_BILLING_QUOTE_STALE` when the submitted quote no longer matches the sellable CURRENT row, or `PLATFORM_BILLING_RECOVERY_REQUIRED` when an existing INCOMPLETE/PAST_DUE payment must use resume-payment. `RESOURCE_CONFLICT` with `details.reason=CONCURRENT_SUBSCRIPTION_CHANGED` means another billing generation won while the request was in flight; refresh before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is not available in this environment. `code` is `PLATFORM_BILLING_UNAVAILABLE`; `details.reason` is `NOT_SELLABLE` (the plan is not marked sellable), `PRICE_NOT_CONFIGURED` (no CURRENT Stripe price published for the plan/cadence), `STRIPE_SKIPPED` (Stripe unavailable), or `PUBLISHABLE_KEY_UNAVAILABLE` (no browser-safe publishable key, so the Payment Element could not be rendered). `PAYMENT_TERMS_UNAVAILABLE_AFTER_START` means the subscription was already durably linked, but its invoice terms could not be safely handed off; refresh and use resume-payment rather than creating again. `AUTOMATIC_TAX_NOT_APPLIED` means Stripe did not apply automatic tax to the subscription we asked to be taxed — the platform tax configuration is wrong, and no subscription was persisted. `FLEXIBLE_BILLING_NOT_APPLIED` means Stripe did not echo the required flexible billing mode — the provider configuration is incompatible, and no subscription was persisted. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Start a new self-serve platform Pro subscription.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/resume-payment": {
      "post": {
        "description": "Recovery-only contract for an INCOMPLETE/PAST_DUE subscription. Takes no cadence or public offer and returns authoritative current invoice terms before handing off a Payment Element client secret. This path is distinct from cancellation reversal and never changes the price.",
        "operationId": "MerchantPlatformBillingController_resumePayment",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscribeResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Resume the exact existing platform subscription payment.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/cancel": {
      "post": {
        "description": "Sets `cancel_at_period_end` on the platform subscription. Access is retained for the period already paid for — the plan is NOT demoted here, and the org stays on Pro until the confirming webhook records CANCELLED at the boundary. **Always reconciles with Stripe**, including when the local mirror already says cancellation is scheduled: the mirror can lag or drift, so it is never trusted to skip the provider call. This request therefore depends on Stripe availability and can return 503. Idempotent — repeating it is safe and reports `unchanged: true` when nothing differed from the state you last read. Reversible before the boundary via `POST reactivate`.",
        "operationId": "MerchantPlatformBillingController_cancel",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingCancellationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The org has no platform subscription to cancel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Any of four conflicts, all safe to resolve by re-reading `GET /merchant/platform-billing` and retrying: the subscription is already terminal (CANCELLED/NONE) so there is nothing left to schedule — subscribing again is the recovery; Stripe itself refused the change for the subscription's current state (the mirror had not caught up yet); a concurrent resubscribe replaced the tracked subscription, so the mutation would have landed on one the org no longer bills on; or another renewal change for this organization is already in flight or landed first. Renewal changes are serialized per organization, so a second concurrent cancel/resume is refused rather than interleaved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. `details.reason` is `STRIPE_SKIPPED` for a transient provider failure, or `PROVIDER_OUTCOME_UNKNOWN` when a bounded call timed out — in that case the change MAY have been applied. Re-read the billing state shortly rather than issuing the opposite change; renewal control for this organization stays reserved until the outcome is reconciled. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Schedule the platform subscription to end at the period end.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/reactivate": {
      "post": {
        "description": "Clears `cancel_at_period_end`. Only valid while the subscription is still live — once it has actually ended (status CANCELLED) Stripe cannot revive it and this returns 409; subscribe again instead. That 409 also covers a mirror that still reads ACTIVE while Stripe has already ended the subscription. **Always reconciles with Stripe** rather than trusting the local mirror, so it depends on Stripe availability and can return 503. Idempotent — repeating it is safe and reports `unchanged: true` when nothing differed from the state you last read.",
        "operationId": "MerchantPlatformBillingController_reactivate",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingCancellationDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The org has no platform subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Any of four conflicts, all safe to resolve by re-reading `GET /merchant/platform-billing` and retrying: the subscription already ended (CANCELLED/NONE) and cannot be resumed — subscribe again instead; Stripe itself refused the change for the subscription's current state (the mirror had not caught up yet); a concurrent resubscribe replaced the tracked subscription, so the mutation would have landed on one the org no longer bills on; or another renewal change for this organization is already in flight or landed first. Renewal changes are serialized per organization, so a second concurrent cancel/resume is refused rather than interleaved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. `details.reason` is `STRIPE_SKIPPED` for a transient provider failure, or `PROVIDER_OUTCOME_UNKNOWN` when a bounded call timed out — in that case the change MAY have been applied. Re-read the billing state shortly rather than issuing the opposite change; renewal control for this organization stays reserved until the outcome is reconciled. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Clear a scheduled cancellation so the plan renews.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/payment-method": {
      "post": {
        "description": "Creates a SetupIntent on the platform account for this org and returns a Payment Element client secret plus the platform publishable key. Available whenever the org has a billing customer — deliberately including PAST_DUE and INCOMPLETE, which are the states a merchant needs to recover from. Saving the card is only half of it: call `POST payment-method/confirm` afterwards so the subscription is actually pointed at the new card, otherwise the next renewal still bills the old one.",
        "operationId": "MerchantPlatformBillingController_startPaymentMethodUpdate",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartPaymentMethodUpdateDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The org has no platform billing customer yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Start replacing the card that pays for the platform plan.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/payment-method/confirm": {
      "post": {
        "description": "Verifies the SetupIntent SERVER-side — it must have succeeded and must belong to this organization's own billing customer — then sets it as the subscription default so renewals bill it. Idempotent: safe to repeat with the same SetupIntent, which matters when a merchant closes the tab between confirming the card and returning.",
        "operationId": "MerchantPlatformBillingController_confirmPaymentMethodUpdate",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmPaymentMethodUpdateRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmPaymentMethodUpdateDto"
                }
              }
            }
          },
          "400": {
            "description": "The SetupIntent has not succeeded yet — confirm the card first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No billing account, no subscription to attach the card to, or a SetupIntent that is not this organization’s. All report the same way, so the id cannot be probed for another tenant’s state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Point the subscription at the newly saved card.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/invoices": {
      "get": {
        "description": "Bounded, cursor-paged list of the org's own platform invoices, resolved from the org's persisted Stripe customer (never from a caller-supplied id). Each item carries Stripe-hosted invoice and PDF links. Those are SIGNED, UNAUTHENTICATED URLs — possession is access, so treat them as credentials: never log them or place them in a shared cache. Returns 404 when the org has never started a platform subscription, which is deliberately distinct from an empty list.",
        "operationId": "MerchantPlatformBillingController_listInvoices",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size (1-100).",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 10,
              "type": "number"
            }
          },
          {
            "name": "startingAfter",
            "required": false,
            "in": "query",
            "description": "Cursor from a prior response `nextStartingAfter`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingInvoiceListDto"
                }
              }
            }
          },
          "400": {
            "description": "`startingAfter` is not a valid cursor for this organization — unknown, malformed, or belonging to another customer. Deterministic: retrying the same cursor will not succeed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "The org has no platform billing customer yet (never subscribed).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "This operation can answer 503 for more than one reason, each named by its error code. One of them: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the org's platform invoice history.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/begin": {
      "post": {
        "description": "Owner/Admin only, scoped by the authenticated organization header. Freezes price and confirmed billing address and obtains tax. This does not accept consent, save a method, charge or activate a plan. Preserve all three operation keys for exact recovery.",
        "operationId": "MerchantPlatformBillingPurchaseController_begin",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPurchaseBeginDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Begin a first platform-plan purchase.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/recover-begin": {
      "post": {
        "description": "Reads only retained local state. Does not reserve another purchase or contact the provider; works without admitted provider context. A missing exact binding returns 404.",
        "operationId": "MerchantPlatformBillingPurchaseController_recoverBegin",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPurchaseOperationKeysDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Recover a lost begin response by its three exact operation keys.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/current": {
      "get": {
        "description": "Local read of the one live reservation and its latest retained quote, or null when none exists, so an authenticated return resumes the exact purchase without browser-held keys. availability reports whether the admitted provider context is usable; AVAILABLE does not prove provider acceptance, and a retained purchase stays readable when it is not. No provider call.",
        "operationId": "MerchantPlatformBillingPurchaseController_current",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseCurrentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the organization's retained current purchase and provider availability.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/invoices": {
      "get": {
        "description": "Local read only. Each invoice is rendered from the frozen offer, the accepted terms, the latest retained exact tax calculation, the authoritatively observed payment facts and the durable tax-recording state, with an explicit state (RESERVED, PAYMENT_OBSERVED, FINALIZED). No provider call, no provider identifiers, no hosted invoice; PAYMENT_OBSERVED does not imply paid access, and FINALIZED facts appear only once activation writes them. An empty list is a truthful empty history.",
        "operationId": "MerchantPlatformBillingPurchaseController_invoices",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseInvoiceListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List the organization's local purchase invoices from retained originals.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/invoices/{invoiceId}": {
      "get": {
        "description": "Same rendering as the list for one exact invoice of this organization. A foreign or unknown invoice receives 404 without revealing whether it exists.",
        "operationId": "MerchantPlatformBillingPurchaseController_invoice",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "description": "Local invoice reference from the invoice list.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseInvoiceDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one local purchase invoice from retained originals.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/{purchaseId}/quotes/{quoteId}": {
      "get": {
        "description": "Local read with no provider call. Historical payment outcomes remain readable after quote expiry or source changes. No client secret is returned; successful payment is not plan activation.",
        "operationId": "MerchantPlatformBillingPurchaseController_status",
        "parameters": [
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "description": "Local purchase reference returned by begin or exact recover-begin.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "quoteId",
            "required": true,
            "in": "path",
            "description": "Local tax quote reference returned with this purchase.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained purchase generation; never substitute the latest generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained quote attempt generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseStatusDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the exact retained purchase status.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/{purchaseId}/quotes/{quoteId}/review": {
      "get": {
        "description": "Returns the tax quote’s frozen address, amounts and recurring-use terms, plus immutable accepted consent when present. Local eligibility is advisory: mutations revalidate atomically. Provider readiness is separate and does not prove payment acceptance.",
        "operationId": "MerchantPlatformBillingPurchaseController_review",
        "parameters": [
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "description": "Local purchase reference returned by begin or exact recover-begin.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "quoteId",
            "required": true,
            "in": "path",
            "description": "Local tax quote reference returned with this purchase.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained purchase generation; never substitute the latest generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained quote attempt generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseReviewDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Review frozen billing terms and current action eligibility.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/{purchaseId}/quotes/{quoteId}/consent": {
      "post": {
        "description": "Records consent for the exact quote fingerprint and reserves its setup operation. This does not save a payment method or charge. Exact replay retains the originally accepted terms.",
        "operationId": "MerchantPlatformBillingPurchaseController_acceptConsent",
        "parameters": [
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "description": "Local purchase reference returned by begin or exact recover-begin.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "quoteId",
            "required": true,
            "in": "path",
            "description": "Local tax quote reference returned with this purchase.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained purchase generation; never substitute the latest generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained quote attempt generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPurchaseConsentDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Accept the exact reviewed recurring-use terms.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/{purchaseId}/quotes/{quoteId}/setup": {
      "post": {
        "description": "May return a transient setup confirmation credential. Saving a method is separate from the initial payment. Provider IDs, methods and return destinations come only from the frozen server commitment.",
        "operationId": "MerchantPlatformBillingPurchaseController_setup",
        "parameters": [
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "description": "Local purchase reference returned by begin or exact recover-begin.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "quoteId",
            "required": true,
            "in": "path",
            "description": "Local tax quote reference returned with this purchase.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained purchase generation; never substitute the latest generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained quote attempt generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPurchaseActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Continue the exact consent-bound payment-method setup.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/{purchaseId}/quotes/{quoteId}/initial-payment": {
      "post": {
        "description": "Requires current consent, unexpired exact quote and verified setup. A possibly started payment remains excluded from replacement. Any returned client secret belongs only to this exact payment; a browser callback does not activate the plan.",
        "operationId": "MerchantPlatformBillingPurchaseController_initialPayment",
        "parameters": [
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "description": "Local purchase reference returned by begin or exact recover-begin.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "quoteId",
            "required": true,
            "in": "path",
            "description": "Local tax quote reference returned with this purchase.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained purchase generation; never substitute the latest generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained quote attempt generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPurchaseActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Begin the separate initial payment using the verified saved method.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/purchases/{purchaseId}/quotes/{quoteId}/recover": {
      "post": {
        "description": "Continues the frozen operation and its original identity. It does not accept provider IDs, replace uncertain payments, renew an expired quote or prove activation. No-ID uncertain outcomes remain unresolved.",
        "operationId": "MerchantPlatformBillingPurchaseController_recover",
        "parameters": [
          {
            "name": "purchaseId",
            "required": true,
            "in": "path",
            "description": "Local purchase reference returned by begin or exact recover-begin.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "quoteId",
            "required": true,
            "in": "path",
            "description": "Local tax quote reference returned with this purchase.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained purchase generation; never substitute the latest generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "description": "Exact retained quote attempt generation.",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPurchaseRecoveryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantPurchaseResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "No exact purchase/quote exists for this organization; foreign references receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The retained identity conflicts with the request or current source/action eligibility changed. Re-read the exact quote; do not replace a possibly started payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Platform billing is unavailable. details.reason=CONTEXT_UNAVAILABLE means the admitted provider context is absent; CONTEXT_MISMATCH means it cannot be corroborated. Retained local status and recover-begin do not require that context. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Recover the exact retained tax, setup or initial-payment stage.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/current": {
      "get": {
        "description": "No provider call. Historical activation, debt, coverage and current access are separate facts.",
        "operationId": "MerchantPlatformBillingAgreementController_current",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantAgreementCurrentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the current local recurring agreement and authoritative plan.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}": {
      "get": {
        "operationId": "MerchantPlatformBillingAgreementController_get",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantAgreementDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one exact retained recurring agreement.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/cancellation": {
      "post": {
        "description": "Uses optimistic versioning. Does not refund, erase existing debt or grant access.",
        "operationId": "MerchantPlatformBillingAgreementController_cancellation",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantAgreementCancellationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantAgreementDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Set or reverse the exact period-end cancellation intent.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/renewals/{obligationId}": {
      "get": {
        "operationId": "MerchantPlatformBillingAgreementController_renewal",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "obligationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantRenewalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the same renewal, including immutable invoice and recovery state.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/renewals/{obligationId}/methods": {
      "post": {
        "description": "Stable operation key; no payment or restoration is implied.",
        "operationId": "MerchantPlatformBillingAgreementController_beginMethod",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "obligationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantAgreementOperationDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantRenewalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Begin a separately confirmed replacement method for the same debt.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/renewals/{obligationId}/methods/{methodId}/recover": {
      "post": {
        "operationId": "MerchantPlatformBillingAgreementController_recoverMethod",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "obligationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "methodGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantAgreementActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantRenewalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Recover the exact replacement-method setup.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/renewals/{obligationId}/payments/prepare": {
      "post": {
        "description": "This does not charge. A separate explicit confirmation is required; uncertain predecessors exclude replacement.",
        "operationId": "MerchantPlatformBillingAgreementController_preparePayment",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "obligationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantRenewalPrepareDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantRenewalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Prepare fresh tax for an explicitly selected verified method and the same invoice.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/renewals/{obligationId}/payments/{attemptId}/confirm": {
      "post": {
        "description": "Requires true confirmation and the reviewed invoice fingerprint. Browser success is never access or settlement evidence.",
        "operationId": "MerchantPlatformBillingAgreementController_confirmPayment",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "obligationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "attemptId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantRenewalConfirmDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantRenewalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Explicitly confirm the exact prepared recovery payment.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/agreements/{agreementId}/renewals/{obligationId}/payments/{attemptId}/recover": {
      "post": {
        "description": "No known provider ID means local status only. Does not create or replace a payment.",
        "operationId": "MerchantPlatformBillingAgreementController_recoverPayment",
        "parameters": [
          {
            "name": "agreementId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "obligationId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "attemptId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "purchaseGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "name": "attemptGeneration",
            "required": true,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 2147483647,
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantAgreementActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantRenewalResultDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign references share one response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "Exact version or billing state changed. Re-read the same agreement; never replace an uncertain payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Provider action unavailable. Retained local reads remain available. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retrieve the exact known recovery payment without starting another.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/custom-offers/current": {
      "get": {
        "description": "Owner/Admin only, scoped by the authenticated organization header. Returns immutable offered terms; no provider call or plan activation.",
        "operationId": "MerchantCustomOfferController_current",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomOfferCurrentDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign-organization offers receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The offer was withdrawn or the submitted terms do not match.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Custom commercial capability or schema readiness is unavailable. No acceptance or activation is implied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the current Custom offer.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/custom-offers/{offerId}": {
      "get": {
        "description": "Owner/Admin only. Email links identify an offer but do not authenticate the merchant or select an organization.",
        "operationId": "MerchantCustomOfferController_get",
        "parameters": [
          {
            "name": "offerId",
            "required": true,
            "in": "path",
            "description": "Exact offer identity from the plan-ready email or current offer read.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomOfferResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign-organization offers receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The offer was withdrawn or the submitted terms do not match.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Custom commercial capability or schema readiness is unavailable. No acceptance or activation is implied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read one exact Custom offer.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/merchant/platform-billing/custom-offers/{offerId}/accept": {
      "post": {
        "description": "Records the actual current merchant Owner/Admin and exact terms fingerprint with a durable audit receipt. Replays preserve the original acceptance. This does not charge, authorize recurring payment, or change Free access; continue through purchases/begin and checkout.",
        "operationId": "MerchantCustomOfferController_accept",
        "parameters": [
          {
            "name": "offerId",
            "required": true,
            "in": "path",
            "description": "Exact offer identity from the plan-ready email or current offer read.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptMerchantCustomOfferDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantCustomOfferResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Unknown and foreign-organization offers receive the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "The offer was withdrawn or the submitted terms do not match.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Custom commercial capability or schema readiness is unavailable. No acceptance or activation is implied. It can also mean: Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Accept the exact Custom commercial terms.",
        "tags": [
          "merchant-platform-billing"
        ]
      }
    },
    "/api/v1/customer/account/subscriptions": {
      "get": {
        "description": "Ownership comes only from the verified customer session and active tenant. Results contain normalized lifecycle state and customer-safe public references; database and provider identifiers are never exposed.",
        "operationId": "CustomerSubscriptionAccountController_listAccountSubscriptions",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by the normalized subscription lifecycle state.",
            "schema": {
              "type": "string",
              "enum": [
                "INCOMPLETE",
                "INCOMPLETE_EXPIRED",
                "TRIALING",
                "ACTIVE",
                "PAST_DUE",
                "PAUSED",
                "CANCEL_AT_PERIOD_END",
                "CANCELED",
                "UNPAID"
              ]
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Pass it back unchanged.",
            "schema": {
              "pattern": "^s[0-9a-f]{32}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSubscriptionListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the signed-in customer's subscriptions.",
        "tags": [
          "customer-subscriptions"
        ]
      }
    },
    "/api/v1/customer/account/subscriptions/{publicRef}": {
      "get": {
        "description": "Returns the same neutral 404 for malformed, unknown, cross-tenant, or another customer’s subscription reference. Raw provider state and identifiers are excluded.",
        "operationId": "CustomerSubscriptionAccountController_getAccountSubscription",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^s[0-9a-f]{32}$"
            },
            "description": "Opaque customer-safe subscription handle."
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSubscriptionDetailDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Read one subscription owned by the signed-in customer.",
        "tags": [
          "customer-subscriptions"
        ]
      }
    },
    "/api/v1/customer/account/subscriptions/{publicRef}/reactivate": {
      "post": {
        "description": "Clears only a verified period-end cancellation. The command requires a stable UUID-v4 idempotency key, proves live connected-account ownership, and safely replays an already-completed result.",
        "operationId": "CustomerSubscriptionAccountController_reactivateAccountSubscription",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^s[0-9a-f]{32}$"
            },
            "description": "Opaque customer-safe subscription handle."
          },
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable UUID v4 for this reactivation intent. Retries replay the committed outcome.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSubscriptionReactivationDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Restore renewal for a subscription scheduled to cancel.",
        "tags": [
          "customer-subscriptions"
        ]
      }
    },
    "/api/v1/customer/account/subscriptions/{publicRef}/billing-periods": {
      "get": {
        "description": "Returns normalized period status, dates, and amounts only. Provider invoice identifiers, internal order ids, and metadata are never exposed.",
        "operationId": "CustomerSubscriptionAccountController_listAccountBillingPeriods",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "publicRef",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "pattern": "^s[0-9a-f]{32}$"
            },
            "description": "Opaque customer-safe subscription handle."
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Pass it back unchanged.",
            "schema": {
              "pattern": "^h[0-9a-f]{32}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSubscriptionBillingPeriodListResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List billing history for an owned subscription.",
        "tags": [
          "customer-subscriptions"
        ]
      }
    },
    "/api/v1/customer/subscription-payment-recoveries/actions/exchange": {
      "post": {
        "description": "Malformed, unknown, expired, revoked, consumed, wrong-purpose, terminal, and cross-tenant actions share one neutral 404. Exchange does not consume the action or initiate payment; invoice.paid is the later consumption authority.",
        "operationId": "CustomerSubscriptionPaymentRecoveryActionController_exchange",
        "parameters": [
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeSubscriptionPaymentRecoveryActionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPaymentRecoveryProofDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Exchange a subscription recovery action for a short-lived payment proof.",
        "tags": [
          "customer-subscription-payment-recovery-actions"
        ]
      }
    },
    "/api/v1/customer/subscription-payment-recoveries/actions/resend": {
      "post": {
        "description": "Accepts only the action token from the prior link. It never accepts an email address, returns recovery data, or mints a payment proof. Every action state and eligibility outcome receives the same confirmation; eligible delivery is queued durably and starts only after the response finishes.",
        "operationId": "CustomerSubscriptionPaymentRecoveryActionController_resend",
        "parameters": [
          {
            "name": "x-idempotency-key",
            "in": "header",
            "description": "Stable UUID for one customer resend intent. Retries with the same key replay the original committed outbox intent.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoveryResendRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoveryResendDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Request a replacement subscription recovery link.",
        "tags": [
          "customer-subscription-payment-recovery-actions"
        ]
      }
    },
    "/api/v1/customer/subscription-payment-recoveries/{recoveryId}/action": {
      "get": {
        "description": "Returns the narrow normalized recovery projection only. Provider identifiers, client secrets, raw failure details, and internal dunning vocabulary are excluded.",
        "operationId": "CustomerSubscriptionPaymentRecoveryActionController_read",
        "parameters": [
          {
            "name": "recoveryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-lc-subscription-recovery",
            "in": "header",
            "description": "Short-lived purpose-bound payment recovery proof. Hosted clients keep it in an httpOnly cookie and forward it only in this header.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^p[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPaymentRecoveryActionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Read one proof-bound subscription payment recovery.",
        "tags": [
          "customer-subscription-payment-recovery-actions"
        ]
      }
    },
    "/api/v1/customer/subscription-payment-recoveries/{recoveryId}/payment": {
      "post": {
        "description": "Fully verifies the connected-account InvoicePayment lineage, adopts or reuses the exact existing PaymentIntent through the shared PaymentAttempt model, and returns its in-memory client secret when customer confirmation is still possible. It never creates a PaymentIntent, parallel charge, CheckoutSession, order, or fulfillment row; invoice.paid remains authoritative completion.",
        "operationId": "CustomerSubscriptionPaymentRecoveryActionController_preparePayment",
        "parameters": [
          {
            "name": "recoveryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-lc-subscription-recovery",
            "in": "header",
            "description": "Short-lived purpose-bound payment recovery proof. Hosted clients keep it in an httpOnly cookie and forward it only in this header.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^p[a-z0-9]{25}$"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionPaymentRecoveryPaymentResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": []
          }
        ],
        "summary": "Prepare the failed subscription invoice’s existing PaymentIntent.",
        "tags": [
          "customer-subscription-payment-recovery-actions"
        ]
      }
    },
    "/api/v1/customer/subscription-payment-recoveries": {
      "get": {
        "description": "Requires tenant context plus a CustomerSession and returns only that authenticated customer’s normalized failed-payment cycles, next Stripe retry when known, and paid-only fulfillment eligibility. Raw provider identifiers and internal dunning event names are never exposed.",
        "operationId": "CustomerSubscriptionPaymentRecoveryController_list",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by normalized payment-recovery state.",
            "schema": {
              "type": "string",
              "enum": [
                "PAYMENT_FAILED",
                "RETRY_SCHEDULED",
                "ACTION_REQUIRED",
                "RECOVERED",
                "EXHAUSTED"
              ]
            }
          },
          {
            "name": "subscriptionId",
            "required": false,
            "in": "query",
            "description": "Filter to one local subscription id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Treat it as opaque and pass it back unchanged.",
            "schema": {
              "minLength": 1,
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoveryListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "List the authenticated customer’s subscription payment recovery state.",
        "tags": [
          "customer-subscription-payment-recovery"
        ]
      }
    },
    "/api/v1/merchant/subscription-payment-recoveries/{recoveryId}/resend": {
      "post": {
        "description": "Mints a fresh scoped recovery link, revoking the previous one, and queues one reminder. Retrying with the same idempotency key replays the original outcome and sends no second email. Staff resends are limited to a rolling window; automatic reminders are unlimited and never consume it.",
        "operationId": "MerchantSubscriptionPaymentRecoveryController_resend",
        "parameters": [
          {
            "name": "recoveryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantResendSubscriptionPaymentRecoveryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantSubscriptionPaymentRecoveryResendDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Resend the customer payment-recovery reminder.",
        "tags": [
          "merchant-subscription-payment-recovery"
        ]
      }
    },
    "/api/v1/merchant/subscription-payment-recoveries": {
      "get": {
        "description": "Requires an active merchant membership in the tenant context and returns that organization’s narrow payment-recovery queue/read contract. General subscription workbench, list, and detail behavior is a separate contract.",
        "operationId": "MerchantSubscriptionPaymentRecoveryController_list",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by normalized payment-recovery state.",
            "schema": {
              "type": "string",
              "enum": [
                "PAYMENT_FAILED",
                "RETRY_SCHEDULED",
                "ACTION_REQUIRED",
                "RECOVERED",
                "EXHAUSTED"
              ]
            }
          },
          {
            "name": "subscriptionId",
            "required": false,
            "in": "query",
            "description": "Filter to one local subscription id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor from a previous page (`nextCursor`). Treat it as opaque and pass it back unchanged.",
            "schema": {
              "minLength": 1,
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "description": "Filter to one local customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MerchantSubscriptionPaymentRecoveryListDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "List normalized subscription payment recovery state.",
        "tags": [
          "merchant-subscription-payment-recovery"
        ]
      }
    },
    "/api/v1/customer/entitlements": {
      "get": {
        "description": "Evaluates every subscription the customer holds: per-subscription posture, every current-window grant (honored or not), and the per-key effective rollup. Read/display only.",
        "operationId": "CustomerEntitlementsController_getOwnEntitlements",
        "parameters": [
          {
            "name": "x-litecommerce-api-surface",
            "in": "header",
            "description": "Official cartonium hosted clients send `hosted` to attribute this API call to the included hosted-page daily allowance. This is usage attribution only; it grants no authentication, tenant scope or payment authority. Omitting it preserves the existing unmarked caller accounting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hosted"
              ]
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerAccountEntitlementsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "Storefront origin is unavailable, unverified, belongs to another tenant, or conflicts with the browser origin or requested commerce mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "Marked hosted-page traffic exhausted the included hosted or total daily API allowance. Both reset at UTC midnight. A rejected reservation increments neither counter; details.limitKey is hostedApiCallsPerDay when the hosted sublimit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "CustomerSession": []
          }
        ],
        "summary": "Get the authenticated customer’s effective entitlements.",
        "tags": [
          "customer-entitlements"
        ]
      }
    },
    "/api/v1/merchant/customers/{customerId}/entitlements": {
      "get": {
        "description": "Evaluates every subscription the customer holds in the active org: per-subscription posture, current-window grants, and the per-key effective rollup.",
        "operationId": "MerchantEntitlementsController_getCustomerEntitlements",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "description": "Customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerEntitlementsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Get a customer’s effective entitlements.",
        "tags": [
          "merchant-entitlements"
        ]
      }
    },
    "/api/v1/merchant/subscriptions/{subscriptionId}/entitlements": {
      "get": {
        "description": "Evaluates a single subscription: its posture, current-window grants, and the per-key effective rollup for just this subscription.",
        "operationId": "MerchantEntitlementsController_getSubscriptionEntitlements",
        "parameters": [
          {
            "name": "subscriptionId",
            "required": true,
            "in": "path",
            "description": "Subscription id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerEntitlementsResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Get one subscription’s effective entitlements.",
        "tags": [
          "merchant-entitlements"
        ]
      }
    },
    "/api/v1/storefront/customers/{customerId}/entitlements": {
      "get": {
        "description": "Evaluates every subscription the customer holds under the key’s tenant. Requires the `entitlements:read` scope. Read/display only.",
        "operationId": "StorefrontEntitlementsController_getCustomerEntitlements",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "description": "Customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerEntitlementsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Get a customer’s effective entitlements (server-to-server).",
        "tags": [
          "storefront-entitlements"
        ]
      }
    },
    "/api/v1/storefront/customers/{customerId}/entitlements/{key}": {
      "get": {
        "description": "The authoritative live answer a state-changing flow must take before acting on an entitlement — display tokens are NEVER accepted as proof. An unknown or un-honored key answers `honored: false` (200); only an unknown customer is a 404. Requires `entitlements:read`.",
        "operationId": "StorefrontEntitlementsController_checkEntitlement",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "description": "Customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "required": true,
            "in": "path",
            "description": "Plan-authored entitlement key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitlementCheckResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Reality-check one entitlement key (server truth).",
        "tags": [
          "storefront-entitlements"
        ]
      }
    },
    "/api/v1/storefront/customers/{customerId}/entitlement-consumptions": {
      "post": {
        "description": "The ONE entitlement mutation: evaluator-honor-gated, FOR-UPDATE cap-checked, and exactly-once per `idempotencyKey` (a replay returns the recorded outcome without spending again). Consumes from the window that expires first; one call spends within one window. Requires the `entitlements:consume` scope — `entitlements:read` credentials can never spend. Rejections are 409 `ENTITLEMENT_NOT_CONSUMABLE` with `details.reason`.",
        "operationId": "StorefrontEntitlementsController_consumeEntitlement",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "description": "Customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConsumeEntitlementDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitlementConsumptionResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Consume ALLOWANCE / SERVICE_CREDIT units (guarded).",
        "tags": [
          "storefront-entitlements"
        ]
      }
    },
    "/api/v1/storefront/customers/{customerId}/entitlement-tokens": {
      "post": {
        "description": "Signs the customer’s effective-entitlement rollup into a compact JWS (alg EdDSA, ~10 min TTL) verifiable against `/api/v1/public/entitlement-tokens/jwks`. READ/DISPLAY ONLY — the API never accepts this token as authorization; server-side flows must re-check entitlements. Requires the `entitlements:read` scope. 503 when the environment has no signing key (plain reads keep working).",
        "operationId": "StorefrontEntitlementsController_mintDisplayToken",
        "parameters": [
          {
            "name": "customerId",
            "required": true,
            "in": "path",
            "description": "Customer id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-storefront-origin",
            "required": false,
            "description": "Required for server requests without browser Origin. Forward the actual tenant storefront HTTPS origin (scheme and host only), or the actual hosted cartonium checkout origin. Domains determines the tenant and Production/Sandbox data automatically. Both origin headers, when present, must match. Missing, unregistered, unverified, or wrong-tenant origins fail closed; API deployment and mode headers cannot select a fallback. Local development only: a non-deployed API reached through a loopback connection and local Host also accepts actual http(s)://<tenant>.localhost:<port> and http(s)://<tenant>.sandbox.localhost:<port> checkout origins. These explicit hosted addresses select their own mode; bare localhost is never tenant or mode authority.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://sandbox.store.example"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Optional consistency assertion only. The registered request origin selects commerce mode; this header cannot select a mode or replace a missing origin. If supplied it must match the origin-derived mode. Prefer omitting it. The response x-commerce-environment reports the selected mode.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ]
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitlementDisplayTokenResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed storefront origin context. Server requests must forward their actual HTTPS origin in x-storefront-origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Mint a short-lived signed entitlement display token.",
        "tags": [
          "storefront-entitlements"
        ]
      }
    },
    "/api/v1/public/entitlement-tokens/jwks": {
      "get": {
        "description": "Standard JWKS document carrying the platform’s current Ed25519 public key. Match tokens by `kid`. Empty `keys` means display-token signing is not enabled in this environment.",
        "operationId": "PublicEntitlementTokenKeysController_getJwks",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitlementTokenJwksResponseDto"
                }
              }
            }
          }
        },
        "summary": "Verification keys for entitlement display tokens (JWKS).",
        "tags": [
          "entitlement-token-keys"
        ]
      }
    },
    "/api/v1/public/plan-pricing": {
      "get": {
        "description": "Anonymous, cacheable. Returns the CURRENT price for each SELLABLE platform plan + cadence — display fields only (no Stripe or internal ids). A plan with no published, sellable price is omitted (consumers fall back to their own copy). Empty until an operator publishes + marks a plan sellable.",
        "operationId": "PublicPlanPricingController_list",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublishedPlanPriceDto"
                  }
                }
              }
            }
          }
        },
        "summary": "Published platform plan pricing (safe projection).",
        "tags": [
          "public-plan-pricing"
        ]
      }
    },
    "/api/v1/public/api-schema": {
      "get": {
        "description": "Anonymous and unauthenticated. Returns the content digest of the public OpenAPI document this deployment was built from. Compare it to `info.version` in the API reference you are reading: equal means the reference describes the public contract this runtime serves. Different means the two are out of step — the reference is either ahead of or behind this deployment, and the digest alone does not say which.",
        "operationId": "PublicApiSchemaController_read",
        "parameters": [
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Select production (default) or sandbox for this authenticated or independently scoped operation. Sandbox uses separate tables in the same database and test-only Stripe through cartonium checkout. Keys and tokens belong to exactly one environment; there is no fallback. POS, carrier and email integrations are unavailable in Sandbox.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSchemaIdentityDto"
                }
              }
            }
          },
          "503": {
            "description": "`API_SCHEMA_IDENTITY_UNAVAILABLE`: this deployment was built without a schema digest, so it cannot say which contract it serves. Treat it as unverified, never as a match. Not expected from a correctly built deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "summary": "Schema identity of the running API build.",
        "tags": [
          "public-api-schema"
        ]
      }
    },
    "/api/v1/merchant/sandbox": {
      "get": {
        "description": "Shared merchant identity authorizes access. Does not create Sandbox data. A null storefrontUrl means no Sandbox storefront is configured.",
        "operationId": "SandboxController_status",
        "parameters": [
          {
            "name": "x-organization-slug",
            "in": "header",
            "description": "Organization selected from the authenticated merchant’s current memberships.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxStatusDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Read the tenant Sandbox status",
        "tags": [
          "Merchant Sandbox"
        ]
      },
      "post": {
        "description": "Idempotently creates an empty Sandbox using separate tables in the same database. Never copies live catalog, customers, orders or payment credentials.",
        "operationId": "SandboxController_enable",
        "parameters": [
          {
            "name": "x-organization-slug",
            "in": "header",
            "description": "Organization selected from the authenticated merchant’s current memberships.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxStatusDto"
                }
              }
            }
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Initialize the tenant Sandbox",
        "tags": [
          "Merchant Sandbox"
        ]
      },
      "patch": {
        "deprecated": true,
        "description": "Storefront domains are managed through merchant/domain-verification. Use the staging (Sandbox) proposal and verification flow; this former direct writer never changes data.",
        "operationId": "SandboxController_update",
        "parameters": [
          {
            "name": "x-organization-slug",
            "in": "header",
            "description": "Organization selected from the authenticated merchant’s current memberships.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-commerce-environment",
            "required": false,
            "description": "Merchant identity, team, billing and Sandbox management are shared and always use production account authority.",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "sandbox"
              ],
              "default": "production"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSandboxDto"
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "Use Settings → Storefront domains to configure and verify the Sandbox storefront."
          },
          "503": {
            "description": "Organization access is unavailable (`ORGANIZATION_ACCESS_UNAVAILABLE`): this teammate's first access to the organization could not be recorded, or the check that decides whether to record it could not run. Retry the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "OrganizationSlug": [],
            "BearerAuth": []
          }
        ],
        "summary": "Retired Sandbox storefront URL editor",
        "tags": [
          "Merchant Sandbox"
        ]
      }
    },
    "/api/v1/support-provider/catalog/search": {
      "post": {
        "description": "Read-only, live, and bounded to ten ACTIVE/non-archived products. The tenant, runtime, workspace, resource, and catalog_publish capability come only from the active connection credential. The response is retained-provider-safe and contains no customer proof, private context, inventory quantities, cart action, or checkout action.",
        "operationId": "SupportProviderPublicCatalogController_search",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchSupportProviderCatalogDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportProviderCatalogSearchResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Positive whole-number seconds to wait before retrying the request.",
                "schema": {
                  "type": "string",
                  "pattern": "^[1-9][0-9]*$"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "SupportProviderConnection": []
          }
        ],
        "summary": "Search the connection tenant’s public catalog for Fin.",
        "tags": [
          "support-provider-catalog"
        ]
      }
    }
  },
  "info": {
    "title": "cartonium API",
    "description": "Multi-tenant commerce API. The integrator-facing surface is:\n- `/api/v1/public/*` — anonymous storefront/customer reads + checkout (browser; `x-organization-slug` + CORS)\n- `/api/v1/merchant/*` — authenticated merchant staff (merchant JWT `Bearer` + `x-organization-slug`)\n- `/api/v1/customer/*` — authenticated customer (customer session: `Bearer` opaque session token OR `__Host-` session cookie; plus `x-organization-slug`)\n- `/api/v1/storefront/*` — external/BYO storefront SERVER-TO-SERVER calls, authenticated by a tenant API key (`x-api-key`, server-side only). The tenant is resolved from the key.\n- `/api/v1/import/*` — server-to-server catalog/data IMPORT, authenticated by a tenant API key (`x-api-key`, server-side only) with an `import:*` write scope. Idempotent, batch-first, `dryRun`-capable.\n- `/api/v1/support-provider/*` — provider-to-cartonium callouts authenticated by an active, resource-bound `x-litecommerce-connection-token`; tenant selection is never accepted from the request.\n\nInternal platform-admin (`/api/v1/platform/*`) and service-to-service\n(`/api/v1/internal/*`) routes are intentionally excluded from this\npublic reference. Each namespace is single-mount — no dual-route\naliases.\n\n**Schema identity.** `info.version` on this document is a SCHEMA DIGEST\n(`sha256:<hex>`), not a release or package version — it is opaque, and\n\"newer\" is not decidable from it. The running API serves the same value\nfrom `GET /api/v1/public/api-schema` (public, unauthenticated). If the two\nstrings are equal, the runtime you are calling was built from the same\ngenerated public API surface this reference describes. The digest covers the\nwhole generated document except `servers` (rewritten per publication target)\nand `info.version` itself. Step-by-step comparison:\n`https://docs.litecommerce.io/concepts/environments`.",
    "version": "sha256:c86854e528101c68f509ac81c14f1d06038db9f851f6d3e4ff22a222e051304d",
    "contact": {
      "name": "cartonium",
      "url": "",
      "email": ""
    }
  },
  "tags": [
    {
      "name": "health",
      "description": ""
    },
    {
      "name": "public-api-schema",
      "description": ""
    },
    {
      "name": "public-catalog",
      "description": ""
    },
    {
      "name": "public-inventory",
      "description": ""
    },
    {
      "name": "public-bookings",
      "description": ""
    },
    {
      "name": "public-orders",
      "description": ""
    },
    {
      "name": "public-pages",
      "description": ""
    },
    {
      "name": "public-plan-pricing",
      "description": ""
    },
    {
      "name": "merchant-items",
      "description": ""
    },
    {
      "name": "merchant-collections",
      "description": ""
    },
    {
      "name": "merchant-inventory",
      "description": ""
    },
    {
      "name": "merchant-bookings",
      "description": ""
    },
    {
      "name": "merchant-orders",
      "description": ""
    },
    {
      "name": "merchant-commerce",
      "description": ""
    },
    {
      "name": "merchant-checkout-support",
      "description": ""
    },
    {
      "name": "merchant-pages",
      "description": ""
    },
    {
      "name": "merchant-api-keys",
      "description": ""
    },
    {
      "name": "merchant-uploads",
      "description": ""
    },
    {
      "name": "customer-account",
      "description": ""
    },
    {
      "name": "customer-actions",
      "description": ""
    },
    {
      "name": "customer-auth",
      "description": ""
    },
    {
      "name": "storefront",
      "description": ""
    },
    {
      "name": "import",
      "description": ""
    },
    {
      "name": "support-provider-catalog",
      "description": ""
    },
    {
      "name": "webhooks",
      "description": ""
    },
    {
      "name": "auth",
      "description": ""
    }
  ],
  "servers": [
    {
      "url": "https://api.litecommerce.io",
      "description": "Production"
    },
    {
      "url": "https://api.preview.litecommerce.io",
      "description": "Preview (staging)"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "type": "http"
      },
      "CustomerSession": {
        "scheme": "bearer",
        "bearerFormat": "opaque",
        "type": "http",
        "description": "Customer session — opaque session token (not a JWT); the __Host- session cookie is the browser-side alternative."
      },
      "OrganizationSlug": {
        "type": "apiKey",
        "in": "header",
        "name": "x-organization-slug"
      },
      "BookingGroupResume": {
        "type": "apiKey",
        "in": "header",
        "name": "booking-group-resume-key",
        "description": "Current scoped booking-group resume proof. Never put this value in a URL."
      },
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Tenant API key — `<publicKey>.<secret>` (e.g. `lcp_….lck_…`). Server-side only; never expose in browser JavaScript."
      },
      "SupportProviderConnection": {
        "type": "apiKey",
        "in": "header",
        "name": "x-litecommerce-connection-token",
        "description": "Resource-bound support-provider connection credential. The credential fixes tenant, runtime, provider workspace, resource, and allowed capability; never expose it in browser JavaScript."
      }
    },
    "schemas": {
      "MerchantSessionUserDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "authUserId": {
            "type": "string",
            "nullable": true,
            "description": "Supabase auth user id; `null` until first sign-in."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "lastLoginAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "authUserId",
          "email",
          "firstName",
          "lastName",
          "phone",
          "lastLoginAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "MerchantMembershipDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "organizationSlug": {
            "type": "string"
          },
          "organizationName": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ],
            "example": "owner"
          },
          "permissionGroups": {
            "description": "Effective permission-group keys (preset + direct).",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Applied permission preset, or `null`."
          }
        },
        "required": [
          "id",
          "organizationId",
          "organizationSlug",
          "organizationName",
          "role",
          "permissionGroups",
          "permissionPresetId"
        ]
      },
      "MerchantSessionResponseDto": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/MerchantSessionUserDto"
          },
          "memberships": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantMembershipDto"
            }
          }
        },
        "required": [
          "user",
          "memberships"
        ]
      },
      "ApiErrorDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Open-ended stable string code. Branch on known codes and fall back to the HTTP status and generic error envelope for an unknown code.",
            "example": "VALIDATION_FAILED",
            "x-extensible-enum": [
              "VALIDATION_FAILED",
              "CANADIAN_OPERATING_PROFILE_UNAVAILABLE",
              "AUTH_MISSING_TOKEN",
              "AUTH_INVALID_TOKEN",
              "MEMBERSHIP_REQUIRED",
              "TEAM_REMOVAL_UNAVAILABLE",
              "ROLE_INSUFFICIENT",
              "PLATFORM_ACCESS_DENIED",
              "RESOURCE_NOT_FOUND",
              "RESOURCE_CONFLICT",
              "DATABASE_ERROR",
              "INTERNAL_ERROR",
              "STOREFRONT_CONSENT_UNAVAILABLE",
              "BAD_REQUEST",
              "LIMIT_EXCEEDED",
              "RATE_LIMIT_EXCEEDED",
              "ORGANIZATION_SUSPENDED",
              "ORGANIZATION_ARCHIVED",
              "ORGANIZATION_ACCESS_UNAVAILABLE",
              "API_KEY_SCOPE_INSUFFICIENT",
              "COMMERCE_REVISION_IMMUTABLE",
              "COMMERCE_REVISION_STALE",
              "HIGH_RISK_REASON_REQUIRED",
              "HIGH_RISK_STEP_UP_REQUIRED",
              "COMMERCE_IDEMPOTENCY_CONFLICT",
              "COMMERCE_EXTERNAL_ID_CONFLICT",
              "COMMERCE_LIFECYCLE_INVALID",
              "COMMERCE_PAYMENT_INVALID",
              "COMMERCE_OVERRIDE_ACTIVE",
              "COMMERCE_LINKED_INVOICE_UNAVAILABLE",
              "COMMERCE_INVOICE_ORDER_INELIGIBLE",
              "API_KEY_SCOPE_GATED",
              "IMPORT_ROW_VALIDATION_FAILED",
              "IMPORT_ROW_CONFLICT",
              "IMPORT_ROW_UNRESOLVED_REFERENCE",
              "IMPORT_BATCH_TOO_LARGE",
              "POS_NOT_READY",
              "POS_SESSION_INVALID",
              "POS_ORGANIZATION_REQUIRED",
              "BOOKING_CAPACITY_UNAVAILABLE",
              "BOOKING_IDEMPOTENCY_CONFLICT",
              "BOOKING_CONFIGURATION_BUSY",
              "BOOKING_GROUP_LIMIT_EXCEEDED",
              "BOOKING_GROUP_INCOMPATIBLE",
              "BOOKING_GROUP_SECURITY_AUTH_UNSUPPORTED",
              "BOOKING_GROUP_IDEMPOTENCY_CONFLICT",
              "BOOKING_GROUP_ACTION_REQUIRED",
              "BOOKING_GROUP_ACTION_INVALID",
              "PLATFORM_BILLING_UNAVAILABLE",
              "PLATFORM_BILLING_QUOTE_STALE",
              "PLATFORM_BILLING_RECOVERY_REQUIRED",
              "BOOKING_DELIVERY_INVALID",
              "BOOKING_DELIVERY_DESTINATION_INVALID",
              "BOOKING_DELIVERY_UNAVAILABLE",
              "BOOKING_DELIVERY_OUT_OF_RANGE",
              "BOOKING_DELIVERY_CONFIGURATION_CHANGED",
              "AGREEMENT_ACTION_REQUIRED",
              "AGREEMENT_POLICY_INVALID",
              "AGREEMENT_APPLICABILITY_INVALID",
              "AGREEMENT_WAIVER_REASON_REQUIRED",
              "AGREEMENT_REQUIREMENT_INVALID",
              "ENTITLEMENT_TOKENS_UNAVAILABLE",
              "ENTITLEMENT_NOT_CONSUMABLE",
              "SUBSCRIPTION_PAYMENT_RECOVERY_UNAVAILABLE",
              "SUBSCRIPTION_PAYMENT_RECOVERY_UNSUPPORTED",
              "COMPOSITION_REVISION_STALE",
              "COMPOSITION_INVALID",
              "COMPOSITION_INVENTORY_CONFLICT",
              "COMPOSITION_COMPONENT_MAPPING_MISSING",
              "COMPOSITION_COMPONENT_MAPPING_AMBIGUOUS",
              "SUPPORT_PROVIDER_CONFIGURATION_UNAVAILABLE",
              "SUPPORT_PROVIDER_CONNECTION_CONFLICT",
              "SUBSCRIPTION_PAYMENT_RECOVERY_RESEND_REJECTED",
              "CATALOG_MEDIA_QUARANTINED",
              "EMAIL_SENDING_DOMAIN_LIFECYCLE_UNAVAILABLE",
              "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
              "HOSTED_CHECKOUT_POLICY_UNAVAILABLE",
              "CHECKOUT_UNAVAILABLE",
              "HOSTED_CHECKOUT_RESTART_REFUSED",
              "API_SCHEMA_IDENTITY_UNAVAILABLE",
              "PLATFORM_BILLING_PLAN_CHANGE_REJECTED",
              "BOOKING_PRICE_CONFIRMATION_REQUIRED",
              "BOOKING_PRICE_CONFIRMATION_UNAVAILABLE",
              "EMAIL_TEST_RECIPIENT_REJECTED",
              "EMAIL_TEST_DELIVERY_UNAVAILABLE",
              "PRICING_POLICY_INCOMPATIBLE",
              "CHECKOUT_IDENTITY_CHANGED",
              "CHECKOUT_IDENTITY_VERIFICATION_REQUIRED",
              "ORDER_REFERENCE_UNAVAILABLE",
              "ORDER_REFERENCE_SERVICE_UNAVAILABLE",
              "PLATFORM_TAX_UNAVAILABLE",
              "TENANT_TAX_NOT_CONFIGURED",
              "POS_SALE_REJECTED",
              "POS_SALE_FILTER_READ_UNAVAILABLE",
              "POS_SALE_REJECTION_PERSISTENCE_FAILED",
              "POS_CUSTOMER_CREATE_PERSISTENCE_UNAVAILABLE",
              "POS_SALE_CUSTOMER_CHANGE_UNAVAILABLE",
              "CHECKOUT_ALREADY_PAID",
              "CHECKOUT_SAVED_CARD_CHOICE_MISMATCH",
              "CHECKOUT_ANALYTICS_ADOPTION_UNAVAILABLE",
              "CHECKOUT_ANALYTICS_ADOPTION_REJECTED",
              "PAYMENT_POLICY_SETTINGS_UNAVAILABLE",
              "PAYMENT_POLICY_REVISION_CONFLICT",
              "PAYMENT_POLICY_SAVE_REJECTED",
              "POS_PAYMENT_PROOF_NOT_SETTLED",
              "POS_PAYMENT_PROOF_UNAVAILABLE",
              "POS_TERMINAL_OUTCOME_CONFLICT",
              "POS_TERMINAL_OUTCOME_UNAVAILABLE",
              "POS_TERMINAL_NOTIFICATION_UNAVAILABLE",
              "RETURN_STAFF_CREATION_UNAVAILABLE",
              "DOMAIN_VERIFICATION_UNAVAILABLE",
              "NUMBERING_SAVE_REJECTED",
              "NUMBERING_FORMAT_INVALID",
              "NUMBERING_FORMAT_LOCKED",
              "NUMBERING_WRITES_UNAVAILABLE",
              "NUMBERING_AUDIT_UNAVAILABLE",
              "RETURN_REQUESTED_REVIEW_STALE",
              "USAGE_ALERT_SETTINGS_UNAVAILABLE",
              "STOCK_LOCATION_WRITES_UNAVAILABLE",
              "STOCK_LOCATION_LOOKUP_UNAVAILABLE",
              "COUPON_ATTEMPT_LIMITED",
              "COUPON_ATTEMPT_UNAVAILABLE",
              "CUSTOMS_PROFILE_UNAVAILABLE"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation. Not localized.",
            "example": "Request body failed validation"
          },
          "details": {
            "type": "object",
            "description": "Optional structured context. Shape varies by error code; e.g. VALIDATION_FAILED returns the per-field violation list.",
            "additionalProperties": true
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "UpdateMerchantProfileDto": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "description": "Given name. Send null (or a blank/whitespace string) to clear; omit to leave unchanged.",
            "nullable": true,
            "maxLength": 100,
            "example": "Robin"
          },
          "lastName": {
            "type": "string",
            "description": "Family name. Send null (or a blank/whitespace string) to clear; omit to leave unchanged.",
            "nullable": true,
            "maxLength": 100,
            "example": "Vale"
          }
        }
      },
      "MerchantProfileResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "authUserId": {
            "type": "string",
            "nullable": true,
            "description": "Supabase auth user id; null until the user first signs in."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "lastLoginAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "authUserId",
          "email",
          "firstName",
          "lastName",
          "phone",
          "lastLoginAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "MerchantMembershipUserSnapshotDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "lastLoginAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "deprecated": true,
            "description": "Deprecated and always null (#5741, DR-5741-06). It used to be this person's last sign-in anywhere, across every organization they belong to, so activity elsewhere showed in this organization. Use the membership's `lastAccessedAt` for access to this organization."
          }
        },
        "required": [
          "id",
          "email",
          "firstName",
          "lastName",
          "lastLoginAt"
        ]
      },
      "MerchantMembershipListItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ],
            "example": "staff"
          },
          "permissionGroups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "user": {
            "$ref": "#/components/schemas/MerchantMembershipUserSnapshotDto"
          },
          "lastAccessedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The last time this teammate used THIS organization, through merchant Admin or POS (#5741). It is recorded at most once every five minutes, so it can trail their latest request by up to five minutes. Activity in their other organizations never changes it. Null when no access to this organization has been recorded: they have not used it since per-organization access recording began, which includes every teammate who joined earlier until their next visit. Null alone does not say whether they ever signed in; `invitationPending` says whether their invite is still open."
          },
          "invitationPending": {
            "type": "boolean",
            "description": "True while this teammate was invited as a teammate and has not used this organization yet, so the invite can be resent (`POST …/invitation/resend`) or cancelled (`POST …/invitation/cancel`). False once they have used this organization; activity in their other organizations does not count (#5741, DR-5741-05). A teammate who belonged to this organization before per-organization access was recorded counts as having used it if they had signed in anywhere by then. True is necessary, not sufficient: the caller still needs permission to manage this role, and a resend can still return 409 while an invite is in flight or was sent within the last minute."
          },
          "joined": {
            "type": "boolean",
            "description": "True once this teammate has joined this organization: they have used it through merchant Admin or POS, or made a change here (#5741, DR-5741-05). Activity in their other organizations does not count. A teammate who belonged to this organization before per-organization access was recorded counts as joined if they had signed in anywhere by then. Removing a teammate (`POST …/deactivate`) needs it to be true; a pending invite is removed with `POST …/invitation/cancel` instead. False with `invitationPending` false means they have not joined and have no teammate invite, such as a founding owner who has not signed in yet."
          }
        },
        "required": [
          "id",
          "role",
          "permissionGroups",
          "permissionPresetId",
          "user",
          "lastAccessedAt",
          "invitationPending",
          "joined"
        ]
      },
      "MerchantPermissionPresetDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string",
            "example": "read-only-staff",
            "description": "Stable preset key."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "permissionGroups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "isSystem": {
            "type": "boolean",
            "description": "True for built-in presets the merchant cannot edit."
          }
        },
        "required": [
          "id",
          "key",
          "name",
          "description",
          "permissionGroups",
          "isSystem"
        ]
      },
      "CreateMembershipDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Email of the user to invite. If they have not yet logged in via Supabase Auth, a placeholder users row is created; on their first login MerchantAuthGuard fills in the authUserId."
          },
          "firstName": {
            "type": "string",
            "description": "Optional first name for the invited teammate. When supplied for an existing user, it only fills an empty local profile field.",
            "nullable": true,
            "maxLength": 80
          },
          "lastName": {
            "type": "string",
            "description": "Optional last name for the invited teammate. When supplied for an existing user, it only fills an empty local profile field.",
            "nullable": true,
            "maxLength": 80
          },
          "role": {
            "type": "string",
            "description": "The role to grant.",
            "enum": [
              "OWNER",
              "ADMIN",
              "STAFF"
            ]
          },
          "permissionPresetId": {
            "type": "string",
            "description": "Optional Staff permission preset id. Ignored for Owner/Admin roles.",
            "nullable": true
          },
          "permissionGroups": {
            "description": "Optional direct Staff permission groups. Owner/Admin roles always receive broad access and do not use group assignments.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "email",
          "role"
        ]
      },
      "MerchantMembershipCreateResultDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "organizationSlug": {
            "type": "string"
          },
          "organizationName": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ],
            "example": "staff"
          },
          "permissionGroups": {
            "description": "DIRECT permission-group keys stored on the new membership. If a `permissionPresetId` was assigned, the preset's groups are NOT included here — they merge into the effective set on the next `GET session` read.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Applied permission preset, or `null`."
          },
          "invitationDeliveryStatus": {
            "type": "string",
            "enum": [
              "pending",
              "blocked",
              "failed",
              "provider_accepted",
              "unknown"
            ],
            "description": "Invitation email outcome observed during this creation request, separate from the successfully committed membership. pending means the processor reported pending; blocked means processing was blocked by delivery policy; failed means processing reported a failed attempt. Neither blocked nor failed proves the provider never received the email. provider_accepted means the email provider accepted the request, not that it reached the inbox. unknown means no conclusive result for this invitation was returned (including another worker owning the event or a processor error); it does not mean pending or unsent. This is a request-time observation, not a live delivery-status read."
          }
        },
        "required": [
          "id",
          "organizationId",
          "organizationSlug",
          "organizationName",
          "role",
          "permissionGroups",
          "permissionPresetId",
          "invitationDeliveryStatus"
        ]
      },
      "UpdateMembershipDto": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "Optional role change.",
            "enum": [
              "OWNER",
              "ADMIN",
              "STAFF"
            ]
          },
          "permissionPresetId": {
            "type": "string",
            "description": "Staff permission preset id. Send null to clear the preset.",
            "nullable": true
          },
          "permissionGroups": {
            "description": "Direct Staff permission groups. Replaces the existing direct group list.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MerchantMembershipUpdateResultDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ],
            "example": "admin"
          },
          "permissionGroups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "id",
          "organizationId",
          "role",
          "permissionGroups",
          "permissionPresetId"
        ]
      },
      "ResendMembershipInvitationDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-chosen UUID (version 4) for this one resend. Reuse it when retrying after a lost response: the same caller and teammate get the original result back with `replayed: true` and no second invite. Using it for a different teammate or caller returns 409."
          }
        },
        "required": [
          "requestId"
        ]
      },
      "MerchantMembershipInvitationResendResultDto": {
        "type": "object",
        "properties": {
          "membershipId": {
            "type": "string",
            "format": "uuid"
          },
          "invitationId": {
            "type": "string",
            "format": "uuid",
            "description": "The invite this request queued, equal to the request `requestId`. It identifies the attempt for support only; no route accepts it."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this `requestId` had already queued an invite for this teammate, so nothing new was sent and `invitationDeliveryStatus` is `unknown`."
          },
          "invitationDeliveryStatus": {
            "type": "string",
            "enum": [
              "pending",
              "blocked",
              "failed",
              "provider_accepted",
              "unknown"
            ],
            "description": "Invitation email outcome observed during this request, with the same meanings as on `POST /merchant/auth/memberships`. provider_accepted means the provider accepted the email, not that it reached the inbox. unknown means no conclusive result was returned (including a replay); it does not mean pending or unsent. The previous link stops working once the new one is issued."
          }
        },
        "required": [
          "membershipId",
          "invitationId",
          "replayed",
          "invitationDeliveryStatus"
        ]
      },
      "MerchantMembershipInvitationCancelResultDto": {
        "type": "object",
        "properties": {
          "membershipId": {
            "type": "string",
            "format": "uuid",
            "description": "The removed pending membership. It no longer exists."
          },
          "cancelled": {
            "type": "boolean",
            "description": "Always true on success: the pending membership was removed, its seat freed, any queued invite stopped and any staging invite link revoked. Inviting the same email again starts a fresh invite."
          }
        },
        "required": [
          "membershipId",
          "cancelled"
        ]
      },
      "MerchantDeactivatedMembershipListItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The membership id it had, and gets back on restore."
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ],
            "example": "staff"
          },
          "permissionGroups": {
            "description": "The direct permission groups it had, restored with it.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deactivatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deactivationId": {
            "type": "string",
            "format": "uuid",
            "description": "This removal's own id. `POST …/{id}/restore` names it to undo exactly this removal."
          },
          "user": {
            "$ref": "#/components/schemas/MerchantMembershipUserSnapshotDto"
          },
          "lastAccessedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The last time this teammate used THIS organization before they were removed, through merchant Admin or POS (#5741). Restore brings it back with the membership. Activity in their other organizations never changes it. Null when no access to this organization was recorded before the removal."
          }
        },
        "required": [
          "id",
          "role",
          "permissionGroups",
          "permissionPresetId",
          "deactivatedAt",
          "deactivationId",
          "user",
          "lastAccessedAt"
        ]
      },
      "MerchantDeactivatedMembershipPageDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantDeactivatedMembershipListItemDto"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Removed teammates in this organization when this page was read."
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0,
            "description": "ceil(total / limit); zero when nobody has been removed."
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "totalPages"
        ]
      },
      "MerchantMembershipDeactivateResultDto": {
        "type": "object",
        "properties": {
          "membershipId": {
            "type": "string",
            "format": "uuid",
            "description": "The deactivated membership. It keeps this id, so `POST …/{id}/restore` brings it back."
          },
          "deactivated": {
            "type": "boolean",
            "description": "Always true on success: the teammate has no access to this organization from their next request, and their seat is free."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this membership was already deactivated, so nothing changed. A retry after a lost response answers this way instead of 404."
          },
          "deactivatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deactivationId": {
            "type": "string",
            "format": "uuid",
            "description": "This removal's own id. `POST …/{id}/restore` names it to undo exactly this removal."
          }
        },
        "required": [
          "membershipId",
          "deactivated",
          "replayed",
          "deactivatedAt",
          "deactivationId"
        ]
      },
      "RestoreMembershipDto": {
        "type": "object",
        "properties": {
          "deactivationId": {
            "type": "string",
            "format": "uuid",
            "description": "The removal to undo: its `deactivationId`, as `GET …/memberships/deactivated` or the deactivate response returned it. Each removal gets its own id, so if the teammate has been restored or removed again since, the restore answers 409 `TEAM_CHANGED` instead of undoing a newer removal."
          }
        },
        "required": [
          "deactivationId"
        ]
      },
      "MerchantMembershipRestoreResultDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ],
            "example": "staff"
          },
          "permissionGroups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this membership was already restored, so nothing changed."
          }
        },
        "required": [
          "id",
          "organizationId",
          "role",
          "permissionGroups",
          "permissionPresetId",
          "replayed"
        ]
      },
      "MerchantOnboardingStepDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "stepKey": {
            "type": "string",
            "example": "add_first_item",
            "description": "Stable onboarding step key."
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Completion time, or `null` if incomplete."
          },
          "completedBy": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "User who completed the step, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "stepKey",
          "completedAt",
          "completedBy",
          "createdAt",
          "updatedAt"
        ]
      },
      "MerchantOnboardingSummaryDto": {
        "type": "object",
        "properties": {
          "totalSteps": {
            "type": "number",
            "example": 6
          },
          "completedSteps": {
            "type": "number",
            "example": 2
          },
          "percent": {
            "type": "number",
            "example": 33,
            "description": "Completion percentage (0–100)."
          }
        },
        "required": [
          "totalSteps",
          "completedSteps",
          "percent"
        ]
      },
      "MerchantOnboardingStateDto": {
        "type": "object",
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOnboardingStepDto"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/MerchantOnboardingSummaryDto"
          }
        },
        "required": [
          "steps",
          "summary"
        ]
      },
      "UpdateOnboardingStepDto": {
        "type": "object",
        "properties": {
          "completed": {
            "type": "boolean",
            "description": "New completion state for the step. `true` stamps completedAt + completedBy with the actor; `false` clears both back to null.",
            "example": true
          }
        },
        "required": [
          "completed"
        ]
      },
      "EmailTemplateSlotsDto": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string"
          },
          "heading": {
            "type": "string"
          },
          "bodyText": {
            "type": "string"
          },
          "ctaLabel": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "subject",
          "heading",
          "bodyText",
          "ctaLabel"
        ]
      },
      "EmailTemplateOverrideDto": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "nullable": true
          },
          "heading": {
            "type": "string",
            "nullable": true
          },
          "bodyText": {
            "type": "string",
            "nullable": true
          },
          "ctaLabel": {
            "type": "string",
            "nullable": true
          },
          "fromName": {
            "type": "string",
            "nullable": true
          },
          "replyTo": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "subject",
          "heading",
          "bodyText",
          "ctaLabel",
          "fromName",
          "replyTo"
        ]
      },
      "EmailTemplateVariableDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "sample": {
            "type": "string"
          }
        },
        "required": [
          "key",
          "label",
          "description",
          "sample"
        ]
      },
      "EmailTemplateDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "CUSTOMER_AUTH",
              "ORDER_CONFIRMATION",
              "ABANDONED_CART_RECOVERY",
              "BACK_IN_STOCK",
              "STOCK_NOTIFICATION_CONFIRMATION",
              "NEWSLETTER_CONFIRMATION",
              "RETURN_REQUESTED",
              "RETURN_APPROVED",
              "RETURN_RECEIVED",
              "RETURN_COMPLETED",
              "RETURN_REJECTED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "BOOKING_NOTIFICATION",
              "COMMERCE_PAYMENT_RECEIVED",
              "ORDER_SHIPPED",
              "SUBSCRIPTION_PAYMENT_RECOVERY"
            ]
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "account",
              "checkout",
              "marketing",
              "returns"
            ]
          },
          "defaults": {
            "$ref": "#/components/schemas/EmailTemplateSlotsDto"
          },
          "override": {
            "$ref": "#/components/schemas/EmailTemplateOverrideDto"
          },
          "resolved": {
            "$ref": "#/components/schemas/EmailTemplateSlotsDto"
          },
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplateVariableDto"
            }
          },
          "fromName": {
            "type": "string"
          },
          "replyTo": {
            "type": "string",
            "nullable": true
          },
          "complianceFooter": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "type",
          "label",
          "description",
          "category",
          "defaults",
          "override",
          "resolved",
          "variables",
          "fromName",
          "replyTo",
          "complianceFooter",
          "updatedAt"
        ]
      },
      "ListEmailTemplatesResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplateDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "UpdateEmailTemplateDto": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "maxLength": 180,
            "nullable": true
          },
          "heading": {
            "type": "string",
            "maxLength": 120,
            "nullable": true
          },
          "bodyText": {
            "type": "string",
            "maxLength": 2000,
            "nullable": true
          },
          "ctaLabel": {
            "type": "string",
            "maxLength": 80,
            "nullable": true
          },
          "fromName": {
            "type": "string",
            "maxLength": 80,
            "nullable": true
          },
          "replyTo": {
            "type": "string",
            "maxLength": 254,
            "nullable": true
          }
        }
      },
      "PreviewEmailTemplateDto": {
        "type": "object",
        "properties": {
          "draft": {
            "$ref": "#/components/schemas/UpdateEmailTemplateDto"
          }
        }
      },
      "EmailTemplatePreviewDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "CUSTOMER_AUTH",
              "ORDER_CONFIRMATION",
              "ABANDONED_CART_RECOVERY",
              "BACK_IN_STOCK",
              "STOCK_NOTIFICATION_CONFIRMATION",
              "NEWSLETTER_CONFIRMATION",
              "RETURN_REQUESTED",
              "RETURN_APPROVED",
              "RETURN_RECEIVED",
              "RETURN_COMPLETED",
              "RETURN_REJECTED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "BOOKING_NOTIFICATION",
              "COMMERCE_PAYMENT_RECEIVED",
              "ORDER_SHIPPED",
              "SUBSCRIPTION_PAYMENT_RECOVERY"
            ]
          },
          "label": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "heading": {
            "type": "string"
          },
          "bodyText": {
            "type": "string"
          },
          "ctaLabel": {
            "type": "string",
            "nullable": true
          },
          "fromName": {
            "type": "string"
          },
          "replyTo": {
            "type": "string",
            "nullable": true
          },
          "complianceFooter": {
            "type": "string"
          },
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplateVariableDto"
            }
          }
        },
        "required": [
          "type",
          "label",
          "subject",
          "heading",
          "bodyText",
          "ctaLabel",
          "fromName",
          "replyTo",
          "complianceFooter",
          "variables"
        ]
      },
      "SendTestEmailTemplateDto": {
        "type": "object",
        "properties": {
          "draft": {
            "$ref": "#/components/schemas/UpdateEmailTemplateDto"
          },
          "recipientMode": {
            "type": "string",
            "enum": [
              "SELF",
              "CUSTOM_ADDRESS"
            ],
            "default": "SELF",
            "description": "Selects the server-resolved admin email or the temporary #3358 custom-address bridge. #1744 replaces CUSTOM_ADDRESS with an opaque verified destination identifier when E15 recipient verification ships."
          },
          "recipientEmail": {
            "type": "string",
            "maxLength": 320,
            "description": "Temporary #3358 custom recipient candidate. It is never treated as verified. In the non-production planes where this mode is available, centralized server email policy evaluates it before provider I/O; production rejects this mode before policy evaluation. Omit when recipientMode is SELF."
          }
        }
      },
      "SendTestEmailTemplateResponseDto": {
        "type": "object",
        "properties": {
          "sent": {
            "type": "boolean"
          },
          "skipped": {
            "type": "boolean",
            "deprecated": true,
            "description": "Retained as false for response-shape compatibility. An unavailable provider now returns EMAIL_TEST_DELIVERY_UNAVAILABLE with HTTP 503."
          },
          "messageId": {
            "type": "string",
            "nullable": true,
            "deprecated": true,
            "description": "Retained as null for response-shape compatibility. Provider message identifiers are never exposed to the browser."
          }
        },
        "required": [
          "sent",
          "skipped",
          "messageId"
        ]
      },
      "CreateTenantEmailTemplateVersionDto": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483646,
            "description": "Current authoring version, or 0 for the first version. A stale value returns 409; creation never replaces existing content."
          },
          "subject": {
            "type": "string",
            "maxLength": 512,
            "description": "Sandboxed Liquid subject source; additionally limited to 512 UTF-8 bytes. Credential-bearing variables are forbidden here."
          },
          "html": {
            "type": "string",
            "maxLength": 65536,
            "description": "Sandboxed HTML body source; additionally limited to 65536 UTF-8 bytes. System compliance is appended outside tenant markup."
          },
          "text": {
            "type": "string",
            "maxLength": 16384,
            "description": "Sandboxed plain-text body source; additionally limited to 16384 UTF-8 bytes. System compliance is appended by the renderer."
          }
        },
        "required": [
          "expectedVersion",
          "subject",
          "html",
          "text"
        ]
      },
      "ReturnApprovalLayoutDto": {
        "type": "object",
        "properties": {
          "sections": {
            "type": "array",
            "minItems": 5,
            "maxItems": 5,
            "uniqueItems": true,
            "description": "Exact permutation of all five complete system-owned sections. No omission, repetition, prose, styles, variables or individual fact controls are accepted.",
            "items": {
              "type": "string",
              "enum": [
                "INTRODUCTION",
                "APPROVAL",
                "ITEMS",
                "SHIPPING",
                "CONTACT"
              ]
            }
          },
          "presentation": {
            "type": "string",
            "enum": [
              "COMFORTABLE",
              "COMPACT"
            ],
            "description": "System-defined spacing and container width. Both presentations retain every applicable fact in HTML and plain text."
          }
        },
        "required": [
          "sections",
          "presentation"
        ]
      },
      "TenantEmailTemplateVersionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Immutable authoring version identifier, accepted by the version read and synthetic-preview routes. It is not a delivery or activation capability."
          },
          "type": {
            "type": "string",
            "enum": [
              "CUSTOMER_AUTH",
              "ORDER_CONFIRMATION",
              "ABANDONED_CART_RECOVERY",
              "BACK_IN_STOCK",
              "STOCK_NOTIFICATION_CONFIRMATION",
              "NEWSLETTER_CONFIRMATION",
              "RETURN_REQUESTED",
              "RETURN_APPROVED",
              "RETURN_RECEIVED",
              "RETURN_COMPLETED",
              "RETURN_REJECTED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "BOOKING_NOTIFICATION",
              "COMMERCE_PAYMENT_RECEIVED",
              "ORDER_SHIPPED",
              "SUBSCRIPTION_PAYMENT_RECOVERY"
            ]
          },
          "version": {
            "type": "number",
            "minimum": 1,
            "description": "Monotonic authoring version for this organization and email type. No version is selected for delivery by this API."
          },
          "rendererVersion": {
            "type": "string",
            "description": "Immutable renderer contract. liquid-interpolation-v1 identifies generic synthetic source; legacy RETURN_APPROVED versions are not approval-layout business-delivery candidates. return-approval-layout-v1 identifies complete system-owned approval sections."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "string",
            "description": "Stored sandboxed subject source, or a system-owned marker for an approval layout; not a rendered customer subject."
          },
          "html": {
            "type": "string",
            "description": "Stored tenant HTML source for the generic renderer, or canonical layout JSON for return-approval-layout-v1. Use layout for typed approval sections and the synthetic-preview route for rendered HTML."
          },
          "text": {
            "type": "string",
            "description": "Stored tenant plain-text source, or a system-owned marker for an approval layout. Approval plain text is generated from the same complete system sections as HTML."
          },
          "layout": {
            "description": "Present only for return-approval-layout-v1. Absent for existing generic versions, which remain immutable and readable; absence does not establish selection or delivery readiness.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnApprovalLayoutDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "type",
          "version",
          "rendererVersion",
          "createdAt",
          "subject",
          "html",
          "text"
        ]
      },
      "CreateReturnApprovalLayoutVersionDto": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483646,
            "description": "Latest version in the shared history for this tenant and type, including legacy versions; 0 creates the first version. Stale writes return 409."
          },
          "layout": {
            "$ref": "#/components/schemas/ReturnApprovalLayoutDto"
          }
        },
        "required": [
          "expectedVersion",
          "layout"
        ]
      },
      "TenantEmailTemplateVersionSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Immutable authoring version identifier, accepted by the version read and synthetic-preview routes. It is not a delivery or activation capability."
          },
          "type": {
            "type": "string",
            "enum": [
              "CUSTOMER_AUTH",
              "ORDER_CONFIRMATION",
              "ABANDONED_CART_RECOVERY",
              "BACK_IN_STOCK",
              "STOCK_NOTIFICATION_CONFIRMATION",
              "NEWSLETTER_CONFIRMATION",
              "RETURN_REQUESTED",
              "RETURN_APPROVED",
              "RETURN_RECEIVED",
              "RETURN_COMPLETED",
              "RETURN_REJECTED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "BOOKING_NOTIFICATION",
              "COMMERCE_PAYMENT_RECEIVED",
              "ORDER_SHIPPED",
              "SUBSCRIPTION_PAYMENT_RECOVERY"
            ]
          },
          "version": {
            "type": "number",
            "minimum": 1,
            "description": "Monotonic authoring version for this organization and email type. No version is selected for delivery by this API."
          },
          "rendererVersion": {
            "type": "string",
            "description": "Immutable renderer contract. liquid-interpolation-v1 identifies generic synthetic source; legacy RETURN_APPROVED versions are not approval-layout business-delivery candidates. return-approval-layout-v1 identifies complete system-owned approval sections."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "type",
          "version",
          "rendererVersion",
          "createdAt"
        ]
      },
      "TenantEmailTemplateVersionListDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Newest-first bounded page of authoring versions. Empty means no saved version matches this type and cursor; it does not indicate delivery readiness.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantEmailTemplateVersionSummaryDto"
            }
          },
          "nextBeforeVersion": {
            "type": "number",
            "nullable": true,
            "description": "Exclusive version cursor for the next page, or null when this page exhausts the matching history."
          }
        },
        "required": [
          "data",
          "nextBeforeVersion"
        ]
      },
      "TenantEmailTemplatePreviewDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Immutable authoring version identifier, accepted by the version read and synthetic-preview routes. It is not a delivery or activation capability."
          },
          "type": {
            "type": "string",
            "enum": [
              "CUSTOMER_AUTH",
              "ORDER_CONFIRMATION",
              "ABANDONED_CART_RECOVERY",
              "BACK_IN_STOCK",
              "STOCK_NOTIFICATION_CONFIRMATION",
              "NEWSLETTER_CONFIRMATION",
              "RETURN_REQUESTED",
              "RETURN_APPROVED",
              "RETURN_RECEIVED",
              "RETURN_COMPLETED",
              "RETURN_REJECTED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "BOOKING_NOTIFICATION",
              "COMMERCE_PAYMENT_RECEIVED",
              "ORDER_SHIPPED",
              "SUBSCRIPTION_PAYMENT_RECOVERY"
            ]
          },
          "version": {
            "type": "number",
            "minimum": 1,
            "description": "Monotonic authoring version for this organization and email type. No version is selected for delivery by this API."
          },
          "rendererVersion": {
            "type": "string",
            "description": "Immutable renderer contract. liquid-interpolation-v1 identifies generic synthetic source; legacy RETURN_APPROVED versions are not approval-layout business-delivery candidates. return-approval-layout-v1 identifies complete system-owned approval sections."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "context": {
            "type": "string",
            "enum": [
              "SYNTHETIC"
            ],
            "description": "Server-generated sample variables only; this is not evidence of inbox delivery."
          },
          "subject": {
            "type": "string"
          },
          "html": {
            "type": "string",
            "description": "Safe rendered sample HTML with mandatory system compliance outside tenant markup. Returned as a JSON string, never a browser document."
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "version",
          "rendererVersion",
          "createdAt",
          "context",
          "subject",
          "html",
          "text"
        ]
      },
      "TenantEmailTemplateSelectionDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "CUSTOMER_AUTH",
              "ORDER_CONFIRMATION",
              "ABANDONED_CART_RECOVERY",
              "BACK_IN_STOCK",
              "STOCK_NOTIFICATION_CONFIRMATION",
              "NEWSLETTER_CONFIRMATION",
              "RETURN_REQUESTED",
              "RETURN_APPROVED",
              "RETURN_RECEIVED",
              "RETURN_COMPLETED",
              "RETURN_REJECTED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "BOOKING_NOTIFICATION",
              "COMMERCE_PAYMENT_RECEIVED",
              "ORDER_SHIPPED",
              "SUBSCRIPTION_PAYMENT_RECOVERY"
            ]
          },
          "revision": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Monotonic configuration revision, incremented for every accepted select or clear. Zero means no selection row has ever existed."
          },
          "versionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Selected immutable version, or null if never selected or explicitly cleared (distinguished by revision zero versus a positive revision). This records intent for separately enabled consumers and never activates a flow. For RETURN_APPROVED, inspect the saved rendererVersion: only return-approval-layout-v1 qualifies for constrained ordinary delivery."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Time of the last accepted configuration mutation; null means no selection row has ever existed. Clearing retains this timestamp and its positive revision."
          }
        },
        "required": [
          "type",
          "revision",
          "versionId",
          "updatedAt"
        ]
      },
      "UpdateTenantEmailTemplateSelectionDto": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483646,
            "description": "The current selection revision, or zero if no selection row has ever existed. Stale revisions return 409; clearing never resets the revision."
          },
          "versionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Exact immutable version identifier from this organization and email type. Null explicitly clears the selection for fresh gated consumers; it does not alter an attempted message or activate a flow. Omission is invalid. RETURN_APPROVED ordinary delivery requires return-approval-layout-v1; legacy generic versions remain synthetic-only."
          }
        },
        "required": [
          "expectedRevision",
          "versionId"
        ]
      },
      "TenantEmailTemplateTestSendResponseDto": {
        "type": "object",
        "properties": {
          "sent": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "The provider accepted this one-shot test attempt. This is not evidence of inbox delivery."
          },
          "skipped": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Always false on success; an unavailable or blocked send returns an error."
          },
          "messageId": {
            "type": "string",
            "nullable": true,
            "description": "Always null. Provider message identifiers remain private."
          }
        },
        "required": [
          "sent",
          "skipped",
          "messageId"
        ]
      },
      "CreateStockNotificationDto": {
        "type": "object",
        "properties": {
          "variantId": {
            "type": "string",
            "format": "uuid",
            "description": "Variant id when the customer selected one before signing up.",
            "nullable": true
          },
          "email": {
            "type": "string",
            "description": "Customer email. Normalised lowercase before insert.",
            "example": "customer@example.com",
            "maxLength": 320
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      },
      "StockNotificationResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Always true on a 201 — the anonymous submission was acknowledged. This does not disclose whether an active subscription was created.",
            "example": true
          },
          "alreadySubscribed": {
            "type": "boolean",
            "description": "Compatibility field: true for an idempotent repeat of an active pending signup. False is a neutral acknowledgement and does not imply that a new active subscription was created.",
            "example": false
          }
        },
        "required": [
          "ok",
          "alreadySubscribed"
        ]
      },
      "StockNotificationItemRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "slug"
        ]
      },
      "StockNotificationVariantRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "sku"
        ]
      },
      "MerchantStockNotificationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Requested variant, or `null` for item-level."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "notifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the back-in-stock email fired, or `null`."
          },
          "unsubscribedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Unsubscribe time, or `null`."
          },
          "item": {
            "$ref": "#/components/schemas/StockNotificationItemRefDto"
          },
          "variant": {
            "nullable": true,
            "description": "Variant ref, or `null` for item-level requests.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/StockNotificationVariantRefDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "email",
          "createdAt",
          "notifiedAt",
          "unsubscribedAt",
          "item",
          "variant"
        ]
      },
      "MerchantStockNotificationPageDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantStockNotificationDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor for the next page, or `null` at the end."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "SubscribeNewsletterDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Subscriber email. Normalised lowercase before insert.",
            "example": "customer@example.com",
            "maxLength": 320
          },
          "source": {
            "type": "string",
            "description": "Optional capture-origin tag (e.g. \"footer\", \"checkout\"). Free-form, length-capped, never trusted for control flow.",
            "nullable": true,
            "maxLength": 64
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      },
      "NewsletterSubscribeResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Always true. Constant regardless of subscriber state so the response cannot be used to probe which addresses are already on the list.",
            "example": true
          }
        },
        "required": [
          "ok"
        ]
      },
      "MerchantNewsletterSubscriberDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "UNSUBSCRIBED"
            ],
            "example": "CONFIRMED"
          },
          "source": {
            "type": "string",
            "nullable": true,
            "description": "Signup source, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Double-opt-in confirmation time, or `null`."
          },
          "unsubscribedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Unsubscribe time, or `null`."
          }
        },
        "required": [
          "id",
          "email",
          "status",
          "source",
          "createdAt",
          "confirmedAt",
          "unsubscribedAt"
        ]
      },
      "MerchantNewsletterSubscriberPageDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantNewsletterSubscriberDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor for the next page, or `null` at the end."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "AbandonedCartSnapshotItemDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "maxLength": 500
          },
          "quantity": {
            "type": "number",
            "minimum": 1
          },
          "unitPriceInCents": {
            "type": "number",
            "minimum": 0,
            "description": "Unit price in cents at capture time."
          }
        },
        "required": [
          "itemId",
          "name",
          "quantity",
          "unitPriceInCents"
        ],
        "additionalProperties": false
      },
      "AbandonedCartSnapshotDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AbandonedCartSnapshotItemDto"
            }
          },
          "subtotalInCents": {
            "type": "number",
            "minimum": 0
          },
          "totalInCents": {
            "type": "number",
            "minimum": 0
          }
        },
        "required": [
          "items",
          "subtotalInCents",
          "totalInCents"
        ],
        "additionalProperties": false
      },
      "UpsertAbandonedCartDto": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "description": "Storefront-issued anonymous cart session identifier. Stable for the duration of a browse session; the upsert key for \"same customer abandoning the same cart multiple times.\"",
            "minLength": 8,
            "maxLength": 200
          },
          "captureToken": {
            "type": "string",
            "description": "Client-generated, high-entropy capability token for this session. The storefront generates it once, persists it in localStorage beside the sessionId, and sends it on EVERY capture. The first capture binds it (the API stores only its hash); later updates must present the same token or are rejected (403). It is a separate secret from the sessionId, so leaking the sessionId is not enough to overwrite the cart (#1208). Optional only for degraded clients that cannot generate one — such a capture creates an unprotected, still-adoptable row.",
            "minLength": 16,
            "maxLength": 128
          },
          "email": {
            "type": "string",
            "description": "Customer email if captured. Optional — a cart can be abandoned before the customer enters one. Normalised lowercase before insert.",
            "maxLength": 320
          },
          "snapshot": {
            "description": "Frozen snapshot of cart contents at capture time. Stored verbatim; recovery emails reference this, not live catalog data.",
            "allOf": [
              {
                "$ref": "#/components/schemas/AbandonedCartSnapshotDto"
              }
            ]
          }
        },
        "required": [
          "sessionId",
          "snapshot"
        ],
        "additionalProperties": false
      },
      "AbandonedCartCaptureResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Always true on a 201 — the capture was accepted.",
            "example": true
          },
          "wasCreated": {
            "type": "boolean",
            "description": "True when a new snapshot row was created; false when an existing (organizationId, sessionId) row was updated in place.",
            "example": true
          }
        },
        "required": [
          "ok",
          "wasCreated"
        ]
      },
      "MerchantAbandonedCartDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "sessionId": {
            "type": "string",
            "description": "Storefront cart session that abandoned."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "format": "email",
            "description": "Captured email, or `null` if never provided."
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "capturedAt": {
            "format": "date-time",
            "type": "string"
          },
          "recoveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the cart was recovered, or `null`."
          },
          "recoveryEmailSentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the last recovery email was sent, or `null`."
          },
          "recoveryEmailCount": {
            "type": "number",
            "example": 0,
            "description": "Number of recovery emails sent."
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "sessionId",
          "email",
          "subtotalInCents",
          "totalInCents",
          "capturedAt",
          "recoveredAt",
          "recoveryEmailSentAt",
          "recoveryEmailCount",
          "updatedAt"
        ]
      },
      "MerchantAbandonedCartPageDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAbandonedCartDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor for the next page, or `null` at the end."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "SellMode": {
        "type": "string",
        "enum": [
          "ONE_TIME",
          "SUBSCRIPTION",
          "ONE_TIME_AND_SUBSCRIPTION"
        ],
        "description": "Merchant-configured catalog capability: one-time, subscription, or either. Variant rows carry their server-resolved effective mode separately. A subscription-capable value does not guarantee that an active, published, currently synced subscription plan exists; query the public subscription-plan endpoints for actual offer availability."
      },
      "WeightUnit": {
        "type": "string",
        "enum": [
          "OZ",
          "LB",
          "G",
          "KG"
        ]
      },
      "DimensionUnit": {
        "type": "string",
        "enum": [
          "IN",
          "CM"
        ]
      },
      "PublicItemImageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "storagePath": {
            "type": "string",
            "description": "Structured storage path inside the catalog media bucket."
          },
          "alt": {
            "type": "string"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "number"
          },
          "focalX": {
            "type": "number",
            "nullable": true,
            "description": "Normalised 0..1 horizontal focal point. `null` when unset."
          },
          "focalY": {
            "type": "number",
            "nullable": true,
            "description": "Normalised 0..1 vertical focal point. `null` when unset."
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "bytes": {
            "type": "number",
            "nullable": true
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "itemId",
          "url",
          "storagePath",
          "alt",
          "isPrimary",
          "sortOrder",
          "focalX",
          "focalY",
          "width",
          "height",
          "bytes",
          "mimeType",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicItemVariantDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque variant identifier. Preserve the returned value exactly and use it only with its parent item in the same tenant/environment. Ordinary edits and archive/restore retain it; an explicit identity migration can replace it. No public old-to-new identifier map exists."
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Exact parent item identifier for this variant."
          },
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "description": "#1411 — denormalized tenant scope (always the parent item's organization; the parent item already exposes it publicly)."
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "priceInCents": {
            "type": "number"
          },
          "sellMode": {
            "description": "The variant's effective catalog capability. A null authoring override is resolved server-side to the parent item's mode before this public projection is returned, so storefronts never have to implement the inheritance rule themselves. A subscription-capable value does not guarantee that an active, published, currently synced subscription plan exists; resolve plan availability through the public subscription-plan endpoints.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "compareAtPriceInCents": {
            "type": "number",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "size": "M",
              "color": "Red"
            },
            "description": "The variant's customer-facing option map — a flat string→string map (keys and values are both strings), matching the write contract (`CreateVariantDto.options` + the `IsStringStringMap` validator)."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true
          },
          "featuredImageId": {
            "type": "string",
            "nullable": true,
            "description": "Featured image id (a row in the parent item gallery). `null` falls back to the item's primary image."
          },
          "sortOrder": {
            "type": "number"
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "salePriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Active sale price in cents (variant window wins over the item-level one). `null` when no sale window is active."
          },
          "saleEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When the active sale ends (ISO). `null` when no active sale."
          }
        },
        "description": "A variant of its exact parent item. Public item reads include every non-archived variant, ordered by sortOrder then createdAt, without a nested cap or pagination. Presence does not guarantee stock. Merchant variant reads have their own visibility contract.",
        "required": [
          "id",
          "itemId",
          "organizationId",
          "name",
          "sku",
          "priceInCents",
          "sellMode",
          "compareAtPriceInCents",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "options",
          "metafields",
          "featuredImageId",
          "sortOrder",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "salePriceInCents",
          "saleEndsAt"
        ]
      },
      "PublicItemCompositionComponentDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "itemType": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Units included per one top-level package selection."
          },
          "intrinsicSavingsBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 10000,
            "description": "Intrinsic component savings in basis points. External promotions are not included."
          }
        },
        "required": [
          "name",
          "variantName",
          "itemType",
          "quantity",
          "intrinsicSavingsBasisPoints"
        ]
      },
      "PublicItemCompositionDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Definition revision clients must echo when committing this selection."
          },
          "components": {
            "minItems": 2,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicItemCompositionComponentDto"
            }
          }
        },
        "required": [
          "kind",
          "revision",
          "components"
        ]
      },
      "PublicItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque item identifier. Preserve the returned value exactly in the matching tenant/environment. Ordinary edits and archive/restore retain it; an explicit identity migration can replace it. A slug resolving to a different id is not proof of an old-to-new mapping."
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "shortDescription": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. Public reads only ever return `ACTIVE`; merchant collection-item reads may also return `DRAFT` / `ARCHIVED`."
          },
          "sellMode": {
            "description": "Merchant-configured catalog capability: one-time, subscription, or either. Variant rows carry their server-resolved effective mode separately. A subscription-capable value does not guarantee that an active, published, currently synced subscription plan exists; query the public subscription-plan endpoints for actual offer availability.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "priceInCents": {
            "type": "number"
          },
          "compareAtPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Strikethrough \"compare at\" price. `null` when no sale price."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Legacy free-form metadata blob. `null` when unset."
          },
          "brand": {
            "type": "string",
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "nullable": true
          },
          "productFamily": {
            "type": "string",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true
          },
          "channelPublishStatus": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-channel publish state map."
          },
          "sortOrder": {
            "type": "number",
            "description": "Merchant-controlled display order within the tenant."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp; `null` for active items."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicItemImageDto"
            }
          },
          "variants": {
            "description": "On public reads of an ACTIVE, non-archived parent in the requesting tenant: every non-archived variant, uncapped and ordered by sortOrder then createdAt. Item-list pagination never truncates this nested array. An empty array means no non-archived variants are listed for this parent. An exact reference absent from a successful complete parent read is unavailable for public purchase now; absence does not establish its cause or permanence, and archived variants can be restored. A failed, 404, timed-out or incomplete read establishes no variant retirement. Presence does not guarantee stock. These absence rules apply to public parent reads, not merchant or inventory reads. No public old-to-new map exists; the shopper must explicitly reselect a current option or remove the saved line.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicItemVariantDto"
            }
          },
          "salePriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Active item-level sale price in cents. `null` when no sale window is active (variants carry their own resolution)."
          },
          "saleEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When the active item-level sale ends (ISO). `null` if none."
          },
          "ratingAverage": {
            "type": "number",
            "nullable": true,
            "description": "Derived average rating (`reviewRatingSum / reviewRatingCount`). `null` when there are no published reviews (distinguishes \"unrated\" from \"0\")."
          },
          "ratingCount": {
            "type": "number",
            "description": "Number of published reviews."
          },
          "composition": {
            "nullable": true,
            "description": "Bounded customer-safe package/kit definition. Component and catalog ids, capacity mappings, providers, and tenant internals are omitted.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicItemCompositionDto"
              }
            ]
          },
          "collectionIds": {
            "description": "Current collection membership identifiers for this exact item. Empty means no memberships. Treat these UUID-shaped values as opaque and copy them from the current item read in the matching tenant/environment for cart pricing previews; do not reuse pre-migration collection ids or infer membership from collection names. Membership does not guarantee a discount; checkout resolves it server-side.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "name",
          "description",
          "shortDescription",
          "type",
          "status",
          "sellMode",
          "priceInCents",
          "compareAtPriceInCents",
          "tags",
          "metadata",
          "brand",
          "vendor",
          "productFamily",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "metafields",
          "channelPublishStatus",
          "sortOrder",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "images",
          "variants",
          "salePriceInCents",
          "saleEndsAt",
          "ratingAverage",
          "ratingCount",
          "composition",
          "collectionIds"
        ]
      },
      "ResolvePublicCartItemsDto": {
        "type": "object",
        "properties": {
          "slugs": {
            "minItems": 1,
            "maxItems": 200,
            "uniqueItems": true,
            "description": "Distinct tenant item slugs to resolve for saved-cart restoration.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "slugs"
        ],
        "additionalProperties": false
      },
      "PublicCartCatalogItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "composition": {
            "nullable": true,
            "description": "Current customer-safe package/kit definition, or null for an ordinary item.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicItemCompositionDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "slug",
          "composition"
        ]
      },
      "PublicCollectionCountDto": {
        "type": "object",
        "properties": {
          "collectionItems": {
            "type": "number",
            "description": "Number of items assigned to this collection.",
            "example": 12
          }
        },
        "required": [
          "collectionItems"
        ]
      },
      "PublicCollectionImageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "collectionId": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "storagePath": {
            "type": "string",
            "description": "Structured storage path inside the catalog media bucket."
          },
          "alt": {
            "type": "string"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "number"
          },
          "focalX": {
            "type": "number",
            "nullable": true,
            "description": "Normalised 0..1 horizontal focal point. `null` when unset."
          },
          "focalY": {
            "type": "number",
            "nullable": true,
            "description": "Normalised 0..1 vertical focal point. `null` when unset."
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "bytes": {
            "type": "number",
            "nullable": true
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "collectionId",
          "url",
          "storagePath",
          "alt",
          "isPrimary",
          "sortOrder",
          "focalX",
          "focalY",
          "width",
          "height",
          "bytes",
          "mimeType",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicCollectionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque collection identifier in this tenant/environment. Ordinary edits and archive/restore retain it; an explicit identity migration can replace it. Preserve the returned value exactly. Read current item collectionIds for pricing-preview memberships; no public old-to-new identifier map exists."
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "image": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Legacy single-image JSON blob (pre-Epic-6). `null` when unset; the structured gallery lives in `images`."
          },
          "sortOrder": {
            "type": "number",
            "description": "Merchant-controlled display order within the tenant."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. The public read only ever returns `ACTIVE` rows."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp. Always `null` on the public read (archived collections are filtered out)."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "_count": {
            "$ref": "#/components/schemas/PublicCollectionCountDto"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicCollectionImageDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "name",
          "description",
          "image",
          "sortOrder",
          "status",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "_count",
          "images"
        ]
      },
      "MerchantItemListVariantDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque variant identifier. Preserve the returned value exactly and use it only with its parent item in the same tenant/environment. Ordinary edits and archive/restore retain it; an explicit identity migration can replace it. No public old-to-new identifier map exists."
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Exact parent item identifier for this variant."
          },
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "description": "#1411 — denormalized tenant scope (always the parent item's organization; the parent item already exposes it publicly)."
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "priceInCents": {
            "type": "number"
          },
          "compareAtPriceInCents": {
            "type": "number",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "size": "M",
              "color": "Red"
            },
            "description": "The variant's customer-facing option map — a flat string→string map (keys and values are both strings), matching the write contract (`CreateVariantDto.options` + the `IsStringStringMap` validator)."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true
          },
          "featuredImageId": {
            "type": "string",
            "nullable": true,
            "description": "Featured image id (a row in the parent item gallery). `null` falls back to the item's primary image."
          },
          "sortOrder": {
            "type": "number"
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "salePriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Active sale price in cents (variant window wins over the item-level one). `null` when no sale window is active."
          },
          "saleEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When the active sale ends (ISO). `null` when no active sale."
          },
          "sellMode": {
            "nullable": true,
            "description": "The merchant-editable variant override; `null` inherits the parent item's mode. Public catalog reads resolve this to a non-null mode.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          }
        },
        "required": [
          "id",
          "itemId",
          "organizationId",
          "name",
          "sku",
          "priceInCents",
          "compareAtPriceInCents",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "options",
          "metafields",
          "featuredImageId",
          "sortOrder",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "salePriceInCents",
          "saleEndsAt",
          "sellMode"
        ]
      },
      "MerchantItemListItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque item identifier. Preserve the returned value exactly in the matching tenant/environment. Ordinary edits and archive/restore retain it; an explicit identity migration can replace it. A slug resolving to a different id is not proof of an old-to-new mapping."
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "shortDescription": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. Public reads only ever return `ACTIVE`; merchant collection-item reads may also return `DRAFT` / `ARCHIVED`."
          },
          "sellMode": {
            "description": "Merchant-configured catalog capability: one-time, subscription, or either. Variant rows carry their server-resolved effective mode separately. A subscription-capable value does not guarantee that an active, published, currently synced subscription plan exists; query the public subscription-plan endpoints for actual offer availability.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "priceInCents": {
            "type": "number"
          },
          "compareAtPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Strikethrough \"compare at\" price. `null` when no sale price."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Legacy free-form metadata blob. `null` when unset."
          },
          "brand": {
            "type": "string",
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "nullable": true
          },
          "productFamily": {
            "type": "string",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true
          },
          "channelPublishStatus": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-channel publish state map."
          },
          "sortOrder": {
            "type": "number",
            "description": "Merchant-controlled display order within the tenant."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp; `null` for active items."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicItemImageDto"
            }
          },
          "salePriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Active item-level sale price in cents. `null` when no sale window is active (variants carry their own resolution)."
          },
          "saleEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When the active item-level sale ends (ISO). `null` if none."
          },
          "ratingAverage": {
            "type": "number",
            "nullable": true,
            "description": "Derived average rating (`reviewRatingSum / reviewRatingCount`). `null` when there are no published reviews (distinguishes \"unrated\" from \"0\")."
          },
          "ratingCount": {
            "type": "number",
            "description": "Number of published reviews."
          },
          "composition": {
            "nullable": true,
            "description": "Bounded customer-safe package/kit definition. Component and catalog ids, capacity mappings, providers, and tenant internals are omitted.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicItemCompositionDto"
              }
            ]
          },
          "collectionIds": {
            "description": "Current collection membership identifiers for this exact item. Empty means no memberships. Treat these UUID-shaped values as opaque and copy them from the current item read in the matching tenant/environment for cart pricing previews; do not reuse pre-migration collection ids or infer membership from collection names. Membership does not guarantee a discount; checkout resolves it server-side.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantItemListVariantDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "name",
          "description",
          "shortDescription",
          "type",
          "status",
          "sellMode",
          "priceInCents",
          "compareAtPriceInCents",
          "tags",
          "metadata",
          "brand",
          "vendor",
          "productFamily",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "metafields",
          "channelPublishStatus",
          "sortOrder",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "images",
          "salePriceInCents",
          "saleEndsAt",
          "ratingAverage",
          "ratingCount",
          "composition",
          "collectionIds",
          "variants"
        ]
      },
      "MerchantItemListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantItemListItemDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor — pass back as `?cursor=` for the next page. `null` when there are no more items."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "OrientationPolicy": {
        "type": "string",
        "enum": [
          "CANONICAL_ONLY",
          "ANY_SIDE_RIGHT_ANGLE"
        ],
        "description": "Locked saved face or every distinct right-angle face rotation."
      },
      "MerchantItemImageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "storagePath": {
            "type": "string",
            "description": "Structured storage path inside the catalog media bucket."
          },
          "alt": {
            "type": "string"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "number"
          },
          "focalX": {
            "type": "number",
            "nullable": true,
            "description": "Normalised 0..1 horizontal focal point. `null` when unset."
          },
          "focalY": {
            "type": "number",
            "nullable": true,
            "description": "Normalised 0..1 vertical focal point. `null` when unset."
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "bytes": {
            "type": "number",
            "nullable": true
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "itemId",
          "url",
          "storagePath",
          "alt",
          "isPrimary",
          "sortOrder",
          "focalX",
          "focalY",
          "width",
          "height",
          "bytes",
          "mimeType",
          "createdAt",
          "updatedAt"
        ]
      },
      "MerchantVariantDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "description": "#1411 — denormalized tenant scope (always the parent item's organization)."
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "priceInCents": {
            "type": "number"
          },
          "compareAtPriceInCents": {
            "type": "number",
            "nullable": true
          },
          "sellMode": {
            "nullable": true,
            "description": "M5-3 (#628) — per-variant override of the item's sell mode; `null` inherits the parent item default.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. `null` when unset."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "nullable": true,
            "description": "Null inherits the item orientation policy.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "parcelMeasurementsReviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When a merchant last confirmed that the effective packed weight and dimensions are ready for package-fit recommendations."
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "size": "M",
              "color": "Red"
            },
            "description": "The variant's customer-facing option map — a flat string→string map (keys and values are both strings), matching the write contract (`CreateVariantDto.options` + the `IsStringStringMap` validator)."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true
          },
          "featuredImageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Featured image id (a row in the parent item gallery). `null` falls back to the item's primary image."
          },
          "sortOrder": {
            "type": "number"
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp; `null` for active variants."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "listPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "#3280 — the catalogued list price, echoing `priceInCents`. Named separately so a merchant surface can label the two columns without inferring which is which."
          },
          "resolvedPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "#3280 / `DR-3265-20` — what this actually sells for right now, after any active sale window. Resolved through the same `SaleWindowService.resolveSalePrice` the charge path and the storefront use, so it cannot disagree with what a customer is charged. Equals the list price when no window applies, or when a window sits at or above the base — a sale window never raises a price (`DR-3265-14`).\n\n**Deterministic only.** Coupons, auto-discounts, and bundles are excluded by decision: a cart total or a typed code is not a property of a product, so this is not a quote."
          },
          "resolvedBySaleWindowId": {
            "type": "string",
            "nullable": true,
            "description": "#3280 — the id of the sale window responsible for `resolvedPriceInCents`, or `null` when the list price stands. Deliberately `null` for an ACTIVE but inert window (one at or above the base): the question is which window is setting this price, and such a window is setting nothing."
          },
          "resolvedSaleEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#3280 — when the responsible window ends, or `null` when no window is setting the price."
          },
          "scheduledPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "#3312 — what this will sell for at the NEXT scheduled price change, or `null` when no future boundary discounts it. Every future window start AND end is evaluated through the shared resolver, so scope and never-raise apply at each instant — including an inert masking window's expiry revealing another window's discount, in which case `scheduledStartsAt` is that expiry, not the responsible window's start. Populated only when the effective price actually changes to a discount; reversion to base at an expiry is carried by `resolvedSaleEndsAt` instead. This is a SCHEDULED price, not the current one; a surface that renders it as current is wrong."
          },
          "scheduledBySaleWindowId": {
            "type": "string",
            "nullable": true,
            "description": "#3312 — id of the window that will set `scheduledPriceInCents`, or `null` when none applies."
          },
          "scheduledStartsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#3312 — the boundary at which the scheduled price takes effect for this target (a window start, or a masking window's expiry), or `null` when none applies."
          },
          "scheduledEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#3312 — when the scheduled window stops applying, or `null` when none applies."
          }
        },
        "required": [
          "id",
          "itemId",
          "organizationId",
          "name",
          "sku",
          "priceInCents",
          "compareAtPriceInCents",
          "sellMode",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "orientationPolicy",
          "parcelMeasurementsReviewedAt",
          "options",
          "metafields",
          "featuredImageId",
          "sortOrder",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "SaleWindowValueType": {
        "type": "string",
        "enum": [
          "FIXED_PRICE",
          "AMOUNT_OFF",
          "PERCENT_OFF"
        ],
        "description": "#3324 / `DR-3265-27` — which value arm this window carries. Exactly one of the three arm fields is non-null: the one this names."
      },
      "MerchantItemSaleWindowDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "variantId": {
            "type": "string",
            "nullable": true,
            "description": "Target variant, or `null` for an item-level window that applies to every variant."
          },
          "valueType": {
            "description": "#3324 / `DR-3265-27` — which value arm this window carries. Exactly one of the three arm fields is non-null: the one this names.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SaleWindowValueType"
              }
            ]
          },
          "salePriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "FIXED_PRICE arm — the absolute sale price in cents. `null` on the relative arms."
          },
          "amountOffInCents": {
            "type": "number",
            "nullable": true,
            "description": "AMOUNT_OFF arm — cents off the live base, clamped at $0.00 at resolution. `null` unless `valueType` is AMOUNT_OFF."
          },
          "percentOffBasisPoints": {
            "type": "number",
            "nullable": true,
            "description": "PERCENT_OFF arm — basis points off the live base, floor-rounded discount. `null` unless `valueType` is PERCENT_OFF."
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "variantId",
          "valueType",
          "salePriceInCents",
          "amountOffInCents",
          "percentOffBasisPoints",
          "startsAt",
          "endsAt"
        ]
      },
      "MerchantItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "shortDescription": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "sellMode": {
            "description": "M5-3 (#628) — default purchase model for this item (`ONE_TIME` unless the merchant enables subscriptions). A variant may override it.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. The merchant surface returns ACTIVE / DRAFT / ARCHIVED rows (unlike the public read, which is ACTIVE-only)."
          },
          "priceInCents": {
            "type": "number"
          },
          "compareAtPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "Strikethrough \"compare at\" price. `null` when no sale price."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Legacy free-form metadata blob. `null` when unset."
          },
          "brand": {
            "type": "string",
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "nullable": true
          },
          "productFamily": {
            "type": "string",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Default physical weight, expressed in `weightUnit`. `null` when unset."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "description": "Locked saved face or every distinct right-angle face rotation.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "parcelMeasurementsReviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When a merchant last confirmed that the packed weight and dimensions are ready for package-fit recommendations."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true
          },
          "channelPublishStatus": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-channel publish state map."
          },
          "sortOrder": {
            "type": "number",
            "description": "Merchant-controlled display order within the tenant."
          },
          "reviewRatingSum": {
            "type": "number",
            "description": "Denormalized review-rating sum (#495). The public PDP derives `ratingAverage = reviewRatingSum / reviewRatingCount`; the merchant surface returns the raw counters."
          },
          "reviewRatingCount": {
            "type": "number",
            "description": "Denormalized count of published reviews (#495)."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp; `null` for active items."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantItemImageDto"
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantVariantDto"
            }
          },
          "saleWindows": {
            "description": "#3280 — the item's non-expired sale windows, item-level and variant-scoped alike. Present on MERCHANT reads only: the public catalog strips this relation so anonymous callers cannot read upcoming sale prices and dates (Codex P1, PR #353). A merchant reading their own tenant already sees these in the sale-window admin.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantItemSaleWindowDto"
            }
          },
          "listPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "#3280 — the catalogued list price, echoing `priceInCents`. Named separately so a merchant surface can label the two columns without inferring which is which."
          },
          "resolvedPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "#3280 / `DR-3265-20` — what this actually sells for right now, after any active sale window. Resolved through the same `SaleWindowService.resolveSalePrice` the charge path and the storefront use, so it cannot disagree with what a customer is charged. Equals the list price when no window applies, or when a window sits at or above the base — a sale window never raises a price (`DR-3265-14`).\n\n**Deterministic only.** Coupons, auto-discounts, and bundles are excluded by decision: a cart total or a typed code is not a property of a product, so this is not a quote."
          },
          "resolvedBySaleWindowId": {
            "type": "string",
            "nullable": true,
            "description": "#3280 — the id of the sale window responsible for `resolvedPriceInCents`, or `null` when the list price stands. Deliberately `null` for an ACTIVE but inert window (one at or above the base): the question is which window is setting this price, and such a window is setting nothing."
          },
          "resolvedSaleEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#3280 — when the responsible window ends, or `null` when no window is setting the price."
          },
          "scheduledPriceInCents": {
            "type": "number",
            "nullable": true,
            "description": "#3312 — what this will sell for at the NEXT scheduled price change, or `null` when no future boundary discounts it. Every future window start AND end is evaluated through the shared resolver, so scope and never-raise apply at each instant — including an inert masking window's expiry revealing another window's discount, in which case `scheduledStartsAt` is that expiry, not the responsible window's start. Populated only when the effective price actually changes to a discount; reversion to base at an expiry is carried by `resolvedSaleEndsAt` instead. This is a SCHEDULED price, not the current one; a surface that renders it as current is wrong."
          },
          "scheduledBySaleWindowId": {
            "type": "string",
            "nullable": true,
            "description": "#3312 — id of the window that will set `scheduledPriceInCents`, or `null` when none applies."
          },
          "scheduledStartsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#3312 — the boundary at which the scheduled price takes effect for this target (a window start, or a masking window's expiry), or `null` when none applies."
          },
          "scheduledEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#3312 — when the scheduled window stops applying, or `null` when none applies."
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "name",
          "description",
          "shortDescription",
          "type",
          "sellMode",
          "status",
          "priceInCents",
          "compareAtPriceInCents",
          "tags",
          "metadata",
          "brand",
          "vendor",
          "productFamily",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "orientationPolicy",
          "parcelMeasurementsReviewedAt",
          "metafields",
          "channelPublishStatus",
          "sortOrder",
          "reviewRatingSum",
          "reviewRatingCount",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "images",
          "variants"
        ]
      },
      "ReorderItemsDto": {
        "type": "object",
        "properties": {
          "orderedIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Full ordered list of item ids. Must include every non-archived item currently in the tenant exactly once (archived rows are excluded server-side and must not appear); any missing, extra, or foreign id causes a 400. Must be unique — duplicates are rejected.",
            "minItems": 1,
            "maxItems": 5000,
            "uniqueItems": true
          }
        },
        "required": [
          "orderedIds"
        ]
      },
      "ReorderResultDto": {
        "type": "object",
        "properties": {
          "reordered": {
            "type": "number",
            "description": "Number of rows whose `sortOrder` was normalised.",
            "example": 5
          }
        },
        "required": [
          "reordered"
        ]
      },
      "ItemType": {
        "type": "string",
        "enum": [
          "RENTAL",
          "SALE",
          "SERVICE"
        ]
      },
      "CreateItemDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ItemType"
              }
            ]
          },
          "sellMode": {
            "description": "How this item may be purchased (default `ONE_TIME`). Authoring contract only — sell-mode enforcement and storefront/BYO filtering ship with subscription checkout (#629). A variant may override this per-variant.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0
          },
          "compareAtPriceInCents": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "Send `null` to clear an existing value; omit to leave it alone."
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "shortDescription": {
            "type": "string",
            "maxLength": 500
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "brand": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "productFamily": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. Positive; must be sent together with `weightUnit`."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true,
            "description": "Longest side, expressed in `dimensionUnit`. Positive."
          },
          "width": {
            "type": "number",
            "nullable": true,
            "description": "Width, expressed in `dimensionUnit`. Positive."
          },
          "height": {
            "type": "number",
            "nullable": true,
            "description": "Height, expressed in `dimensionUnit`. Positive."
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "description": "Packed-item orientation. Omit to keep the saved-face default; ANY_SIDE_RIGHT_ANGLE permits every distinct 90-degree face rotation of reviewed dimensions.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "confirmPackedMeasurements": {
            "type": "boolean",
            "description": "Explicit merchant adoption of the packed-unit parcel measurements. Changing any measurement without re-confirming clears the prior review."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary key/value attributes."
          },
          "channelPublishStatus": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-channel publish status, e.g. `{ \"storefront\": \"published\" }`."
          }
        },
        "required": [
          "name",
          "slug",
          "type",
          "status",
          "priceInCents"
        ]
      },
      "UpdateItemDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ItemType"
              }
            ]
          },
          "sellMode": {
            "description": "How this item may be purchased (default `ONE_TIME`). Authoring contract only — sell-mode enforcement and storefront/BYO filtering ship with subscription checkout (#629). A variant may override this per-variant.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0
          },
          "compareAtPriceInCents": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "Send `null` to clear an existing value; omit to leave it alone."
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "shortDescription": {
            "type": "string",
            "maxLength": 500
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "brand": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "productFamily": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. Positive; must be sent together with `weightUnit`."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true,
            "description": "Longest side, expressed in `dimensionUnit`. Positive."
          },
          "width": {
            "type": "number",
            "nullable": true,
            "description": "Width, expressed in `dimensionUnit`. Positive."
          },
          "height": {
            "type": "number",
            "nullable": true,
            "description": "Height, expressed in `dimensionUnit`. Positive."
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "description": "Packed-item orientation. Omit to keep the saved-face default; ANY_SIDE_RIGHT_ANGLE permits every distinct 90-degree face rotation of reviewed dimensions.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "confirmPackedMeasurements": {
            "type": "boolean",
            "description": "Explicit merchant adoption of the packed-unit parcel measurements. Changing any measurement without re-confirming clears the prior review."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary key/value attributes."
          },
          "channelPublishStatus": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-channel publish status, e.g. `{ \"storefront\": \"published\" }`."
          }
        }
      },
      "ReorderVariantsDto": {
        "type": "object",
        "properties": {
          "orderedVariantIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Full ordered list of variant ids. Must include every non-archived variant currently on the item exactly once (archived rows are excluded server-side and must not appear); any missing, extra, or foreign id causes a 400. Must be unique — duplicates are rejected.",
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true
          }
        },
        "required": [
          "orderedVariantIds"
        ]
      },
      "CreateVariantDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sku": {
            "type": "string",
            "description": "Inventory-side identifier. Unique within the parent item. Allowed: alphanumerics, `-`, `_`, `.`",
            "minLength": 1,
            "maxLength": 100
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0
          },
          "compareAtPriceInCents": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "M2 pricing rules — optional \"was\" price for storefront strikethrough. Must be strictly greater than `priceInCents` when set. Send `null` to clear an existing value on PATCH; omit to leave it alone."
          },
          "sellMode": {
            "nullable": true,
            "description": "Per-variant override of the item's `sellMode`. Send `null` (or omit) to inherit the parent item default. Authoring contract only — enforcement is subscription checkout (#629).",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Variant-distinguishing attributes (e.g. `{ \"size\": \"M\", \"color\": \"Red\" }`). Keys and values must both be strings."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary merchant-side attributes."
          },
          "featuredImageId": {
            "type": "string",
            "description": "M2 / #249 — id of an `ItemImage` row to use as this variant's featured image. The referenced image must belong to the same item as the variant (enforced at the service layer). Pass `null` on PATCH to clear. Storefront swaps the PDP hero on variant select via this pointer; falls back to the item's primary image when null.",
            "nullable": true,
            "minLength": 1,
            "maxLength": 64
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. Positive; must be sent together with `weightUnit`. Overrides the parent item weight."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true,
            "description": "Longest side, expressed in `dimensionUnit`. Positive."
          },
          "width": {
            "type": "number",
            "nullable": true,
            "description": "Width, expressed in `dimensionUnit`. Positive."
          },
          "height": {
            "type": "number",
            "nullable": true,
            "description": "Height, expressed in `dimensionUnit`. Positive."
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "nullable": true,
            "description": "Variant orientation override. Null or omitted inherits the item; otherwise choose saved-face only or every distinct 90-degree face rotation.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "confirmPackedMeasurements": {
            "type": "boolean",
            "description": "Explicit merchant adoption of this variant-level packed measurement override. Changing any measurement without re-confirming clears review."
          }
        },
        "required": [
          "name",
          "sku",
          "priceInCents"
        ]
      },
      "UpdateVariantDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sku": {
            "type": "string",
            "description": "Inventory-side identifier. Unique within the parent item. Allowed: alphanumerics, `-`, `_`, `.`",
            "minLength": 1,
            "maxLength": 100
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0
          },
          "compareAtPriceInCents": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "M2 pricing rules — optional \"was\" price for storefront strikethrough. Must be strictly greater than `priceInCents` when set. Send `null` to clear an existing value on PATCH; omit to leave it alone."
          },
          "sellMode": {
            "nullable": true,
            "description": "Per-variant override of the item's `sellMode`. Send `null` (or omit) to inherit the parent item default. Authoring contract only — enforcement is subscription checkout (#629).",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Variant-distinguishing attributes (e.g. `{ \"size\": \"M\", \"color\": \"Red\" }`). Keys and values must both be strings."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary merchant-side attributes."
          },
          "featuredImageId": {
            "type": "string",
            "description": "M2 / #249 — id of an `ItemImage` row to use as this variant's featured image. The referenced image must belong to the same item as the variant (enforced at the service layer). Pass `null` on PATCH to clear. Storefront swaps the PDP hero on variant select via this pointer; falls back to the item's primary image when null.",
            "nullable": true,
            "minLength": 1,
            "maxLength": 64
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. Positive; must be sent together with `weightUnit`. Overrides the parent item weight."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true,
            "description": "Longest side, expressed in `dimensionUnit`. Positive."
          },
          "width": {
            "type": "number",
            "nullable": true,
            "description": "Width, expressed in `dimensionUnit`. Positive."
          },
          "height": {
            "type": "number",
            "nullable": true,
            "description": "Height, expressed in `dimensionUnit`. Positive."
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "nullable": true,
            "description": "Variant orientation override. Null or omitted inherits the item; otherwise choose saved-face only or every distinct 90-degree face rotation.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "confirmPackedMeasurements": {
            "type": "boolean",
            "description": "Explicit merchant adoption of this variant-level packed measurement override. Changing any measurement without re-confirming clears review."
          }
        }
      },
      "MerchantCollectionWithImagesDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "image": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Legacy single-image JSON blob (pre-Epic-6). `null` when unset; the structured gallery lives in the `images` relation (returned by the list read + the dedicated `/images` routes)."
          },
          "sortOrder": {
            "type": "number",
            "description": "Merchant-controlled display order within the tenant."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. The merchant surface returns ACTIVE / DRAFT / ARCHIVED rows (unlike the public read, which is ACTIVE-only)."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp; `null` for active collections."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "_count": {
            "$ref": "#/components/schemas/PublicCollectionCountDto"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicCollectionImageDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "name",
          "description",
          "image",
          "sortOrder",
          "status",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "_count",
          "images"
        ]
      },
      "MerchantCollectionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "image": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Legacy single-image JSON blob (pre-Epic-6). `null` when unset; the structured gallery lives in the `images` relation (returned by the list read + the dedicated `/images` routes)."
          },
          "sortOrder": {
            "type": "number",
            "description": "Merchant-controlled display order within the tenant."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. The merchant surface returns ACTIVE / DRAFT / ARCHIVED rows (unlike the public read, which is ACTIVE-only)."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp; `null` for active collections."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "_count": {
            "$ref": "#/components/schemas/PublicCollectionCountDto"
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "name",
          "description",
          "image",
          "sortOrder",
          "status",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "_count"
        ]
      },
      "CreateCollectionDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "image": {
            "type": "object",
            "additionalProperties": true,
            "description": "Image metadata as an open JSON object. Shape will be tightened by Epic 6 (Catalog Media). Send `null` to clear.",
            "nullable": true
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Display order — collections are listed ascending. Defaults to 0."
          }
        },
        "required": [
          "name",
          "slug",
          "status"
        ]
      },
      "ReorderCollectionsDto": {
        "type": "object",
        "properties": {
          "collectionIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Full ordered list of collection ids. Must include every active + draft collection currently in the tenant (archived rows are excluded server-side and never need to appear); missing rows cause a 400. Must be unique — duplicates are rejected.",
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true
          }
        },
        "required": [
          "collectionIds"
        ]
      },
      "UpdateCollectionDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "image": {
            "type": "object",
            "additionalProperties": true,
            "description": "Image metadata as an open JSON object. Shape will be tightened by Epic 6 (Catalog Media). Send `null` to clear.",
            "nullable": true
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Display order — collections are listed ascending. Defaults to 0."
          }
        }
      },
      "AssignCollectionItemsDto": {
        "type": "object",
        "properties": {
          "itemIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Item ids to add. Up to 100 per call. Must be unique.",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true
          }
        },
        "required": [
          "itemIds"
        ]
      },
      "AssignCollectionItemsResultDto": {
        "type": "object",
        "properties": {
          "added": {
            "type": "number",
            "description": "Number of new collection memberships created.",
            "example": 3
          },
          "skipped": {
            "type": "number",
            "description": "Number of supplied items already in the collection (skipped).",
            "example": 1
          }
        },
        "required": [
          "added",
          "skipped"
        ]
      },
      "CollectionItemRemovalResultDto": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "number",
            "description": "Number of membership rows removed: `1` on success, `0` when the item was already not in the collection (idempotent no-op).",
            "example": 1
          }
        },
        "required": [
          "removed"
        ]
      },
      "ReorderCollectionItemsDto": {
        "type": "object",
        "properties": {
          "itemIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Full ordered list of item ids. Must include every item currently in the collection; missing items cause a 400. Must be unique — duplicates are rejected.",
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true
          }
        },
        "required": [
          "itemIds"
        ]
      },
      "ConfirmItemImageDto": {
        "type": "object",
        "properties": {
          "imageId": {
            "type": "string",
            "description": "Image id returned by the signed-URL endpoint. The service writes the row with this id so it matches the storage object path. The signed-URL endpoint generates UUIDs server-side, so we re-validate as UUID here — the client should never be inventing image ids. Codex PR #117 follow-up: the storage-path check is one validator, but accepting any non-empty string for what becomes a DB primary key AND a storage path segment was too permissive. Locking back to UUID closes that gap without affecting any existing flow (signed uploads have always been UUID-only)."
          },
          "storagePath": {
            "type": "string",
            "description": "Bucket-relative storage path the bytes landed at. Returned by the signed-URL endpoint; the client copies it through verbatim. The service re-validates it against the expected layout before write.",
            "minLength": 1,
            "maxLength": 1024
          },
          "alt": {
            "type": "string",
            "description": "Alt text for screen readers. Required — never default to empty.",
            "minLength": 1,
            "maxLength": 500
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether this image is the primary thumbnail. The service enforces uniqueness within the item — setting `isPrimary=true` clears the flag on every other image for the same item, atomically.",
            "default": false
          },
          "sortOrder": {
            "type": "number",
            "description": "Display order within the gallery. Defaults to 0; use the reorder endpoint to rewrite the whole sequence.",
            "minimum": 0
          },
          "focalX": {
            "type": "number",
            "description": "Normalized focal point x-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "focalY": {
            "type": "number",
            "description": "Normalized focal point y-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "width": {
            "type": "number",
            "minimum": 0
          },
          "height": {
            "type": "number",
            "minimum": 0
          },
          "bytes": {
            "type": "number",
            "minimum": 1
          },
          "mimeType": {
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "imageId",
          "storagePath",
          "alt",
          "bytes"
        ]
      },
      "ReorderImagesDto": {
        "type": "object",
        "properties": {
          "imageIds": {
            "description": "Full ordered list of image ids. Must include every image currently attached to the owner; missing items cause a 400. Must be unique — duplicates are rejected.",
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true,
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "imageIds"
        ]
      },
      "UpdateItemImageDto": {
        "type": "object",
        "properties": {
          "alt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "focalX": {
            "type": "number",
            "description": "Normalized focal point x-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "focalY": {
            "type": "number",
            "description": "Normalized focal point y-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether this image is the primary thumbnail. The service enforces uniqueness within the item — setting `isPrimary=true` clears the flag on every other image for the same item, atomically."
          }
        }
      },
      "DeleteImageResultDto": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "number",
            "description": "Number of image rows removed (1 on success).",
            "example": 1
          }
        },
        "required": [
          "removed"
        ]
      },
      "ConfirmCollectionImageDto": {
        "type": "object",
        "properties": {
          "imageId": {
            "type": "string",
            "description": "Image id returned by the signed-URL endpoint. The service writes the row with this id so it matches the storage object path. The signed-URL endpoint generates UUIDs server-side, so we re-validate as UUID here — the client should never be inventing image ids. Codex PR #117 follow-up: the storage-path check is one validator, but accepting any non-empty string for what becomes a DB primary key AND a storage path segment was too permissive. Locking back to UUID closes that gap without affecting any existing flow (signed uploads have always been UUID-only)."
          },
          "storagePath": {
            "type": "string",
            "description": "Bucket-relative storage path the bytes landed at. Returned by the signed-URL endpoint; the client copies it through verbatim. The service re-validates it against the expected layout before write.",
            "minLength": 1,
            "maxLength": 1024
          },
          "alt": {
            "type": "string",
            "description": "Alt text for screen readers. Required — never default to empty.",
            "minLength": 1,
            "maxLength": 500
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether this image is the primary thumbnail. The service enforces uniqueness within the item — setting `isPrimary=true` clears the flag on every other image for the same item, atomically.",
            "default": false
          },
          "sortOrder": {
            "type": "number",
            "description": "Display order within the gallery. Defaults to 0; use the reorder endpoint to rewrite the whole sequence.",
            "minimum": 0
          },
          "focalX": {
            "type": "number",
            "description": "Normalized focal point x-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "focalY": {
            "type": "number",
            "description": "Normalized focal point y-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "width": {
            "type": "number",
            "minimum": 0
          },
          "height": {
            "type": "number",
            "minimum": 0
          },
          "bytes": {
            "type": "number",
            "minimum": 1
          },
          "mimeType": {
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "imageId",
          "storagePath",
          "alt",
          "bytes"
        ]
      },
      "UpdateCollectionImageDto": {
        "type": "object",
        "properties": {
          "alt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "focalX": {
            "type": "number",
            "description": "Normalized focal point x-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "focalY": {
            "type": "number",
            "description": "Normalized focal point y-axis (0..1).",
            "minimum": 0,
            "maximum": 1
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether this image is the primary thumbnail. The service enforces uniqueness within the item — setting `isPrimary=true` clears the flag on every other image for the same item, atomically."
          }
        }
      },
      "CustomsProfileTargetDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ITEM",
              "VARIANT"
            ]
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Item addressed by the merchant route."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Owned variant addressed by the merchant route. Null for an item target."
          }
        },
        "required": [
          "kind",
          "itemId",
          "variantId"
        ]
      },
      "CustomsProfileDraftFactsDto": {
        "type": "object",
        "properties": {
          "hsCode": {
            "type": "string",
            "nullable": true,
            "description": "Stored HS code. Null means unset. On save, use up to 32 digits and dots separating digit groups."
          },
          "originCountry": {
            "type": "string",
            "nullable": true,
            "description": "Stored country of origin. Null means unset. On save, use an assigned two-letter country code."
          },
          "customsDescription": {
            "type": "string",
            "nullable": true,
            "description": "Stored goods description. Null means unset. On save, use 1–100 characters after trimming."
          }
        },
        "required": [
          "hsCode",
          "originCountry",
          "customsDescription"
        ]
      },
      "MerchantCustomsProfileDto": {
        "type": "object",
        "properties": {
          "target": {
            "$ref": "#/components/schemas/CustomsProfileTargetDto"
          },
          "revision": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Current revision of the addressed target, including a variant that inherits. Null when the target has never had a revision."
          },
          "storedFacts": {
            "description": "Facts stored on the target. Effective inherited facts appear in the resolved result.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomsProfileDraftFactsDto"
              }
            ]
          },
          "inheritance": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "INHERITS_ITEM",
              "OVERRIDES_ITEM"
            ],
            "description": "Items use NOT_APPLICABLE. A wholly cleared or unset variant inherits the item. Any variant override is evaluated as a whole."
          },
          "resolution": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomsProfileResolvedDto"
              },
              {
                "$ref": "#/components/schemas/CustomsProfileUnresolvedDto"
              }
            ],
            "description": "Receipt-verified catalog evidence or the reason it is unavailable. A resolved profile describes catalog facts only."
          }
        },
        "required": [
          "target",
          "revision",
          "storedFacts",
          "inheritance",
          "resolution"
        ]
      },
      "MerchantCustomsPilotUnavailableDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "UNAVAILABLE"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "PILOT_ACCESS_UNAVAILABLE"
            ],
            "description": "Current shipping pilot eligibility did not admit the read. This result contains no target or profile data."
          }
        },
        "required": [
          "status",
          "reason"
        ]
      },
      "CustomsProfileReviewedFactsDto": {
        "type": "object",
        "properties": {
          "hsCode": {
            "type": "string",
            "description": "Reviewed HS code.",
            "example": "6116.10"
          },
          "originCountry": {
            "type": "string",
            "description": "Reviewed country of origin.",
            "example": "US"
          },
          "customsDescription": {
            "type": "string",
            "description": "Reviewed goods description.",
            "example": "Cotton work gloves"
          }
        },
        "required": [
          "hsCode",
          "originCountry",
          "customsDescription"
        ]
      },
      "CustomsProfileResolvedDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "RESOLVED"
            ]
          },
          "source": {
            "type": "object",
            "required": [
              "kind",
              "id",
              "revision"
            ],
            "additionalProperties": false,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ITEM",
                  "VARIANT"
                ]
              },
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "string",
                "format": "uuid"
              }
            },
            "description": "The source and exact revision with a verified review receipt."
          },
          "facts": {
            "$ref": "#/components/schemas/CustomsProfileReviewedFactsDto"
          },
          "reviewedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Server-recorded review time in UTC."
          }
        },
        "required": [
          "status",
          "source",
          "facts",
          "reviewedAt"
        ]
      },
      "CustomsProfileUnresolvedDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "UNAVAILABLE"
            ]
          },
          "source": {
            "type": "object",
            "nullable": true,
            "required": [
              "kind",
              "id",
              "revision"
            ],
            "additionalProperties": false,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ITEM",
                  "VARIANT"
                ]
              },
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "revision": {
                "type": "string",
                "format": "uuid",
                "nullable": true,
                "description": "Null when the source has no revision."
              }
            },
            "description": "Source being evaluated. Null when the source could not be established."
          },
          "reason": {
            "type": "string",
            "enum": [
              "MISSING",
              "INCOMPLETE",
              "INVALID",
              "UNREVIEWED",
              "INVALID_REVIEW",
              "STALE_REVIEW",
              "SOURCE_MISMATCH",
              "REVIEW_RECEIPT_MISSING"
            ],
            "description": "Missing, incomplete or invalid facts need correction before review. An incomplete variant override needs its own facts or a whole-profile clear. A complete profile without a current verified review needs explicit review."
          }
        },
        "required": [
          "status",
          "source",
          "reason"
        ]
      },
      "ReplaceCustomsProfileDto": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "nullable": true,
            "description": "Required current revision of the target profile. Send the token exactly as returned or explicit null when the target has no revision."
          },
          "facts": {
            "description": "All three fields are required. Null clears a field. Three nulls clear the profile and restore item inheritance for a variant.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomsProfileDraftFactsDto"
              }
            ]
          }
        },
        "required": [
          "expectedRevision",
          "facts"
        ]
      },
      "ReviewCustomsProfileDto": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
            "nullable": true,
            "description": "Required current revision of the target profile. Send the token exactly as returned or explicit null when the target has no revision."
          }
        },
        "required": [
          "expectedRevision"
        ]
      },
      "ItemCompositionItemSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ]
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "type",
          "status",
          "archivedAt"
        ]
      },
      "ItemCompositionVariantSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "name",
          "sku",
          "archivedAt"
        ]
      },
      "ItemCompositionComponentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "position": {
            "type": "number",
            "minimum": 0
          },
          "componentItemId": {
            "type": "string"
          },
          "componentVariantId": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647
          },
          "discountBasisPoints": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000
          },
          "capacityMode": {
            "type": "string",
            "enum": [
              "TRACKED",
              "UNTRACKED"
            ]
          },
          "untrackedReason": {
            "type": "string",
            "nullable": true
          },
          "item": {
            "$ref": "#/components/schemas/ItemCompositionItemSummaryDto"
          },
          "variant": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ItemCompositionVariantSummaryDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "position",
          "componentItemId",
          "componentVariantId",
          "quantity",
          "discountBasisPoints",
          "capacityMode",
          "untrackedReason",
          "item",
          "variant"
        ]
      },
      "ItemCompositionDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "description": "Existing parent Item id; the composition has no parallel sellable identity."
          },
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "revision": {
            "type": "number",
            "minimum": 1
          },
          "components": {
            "minItems": 2,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemCompositionComponentDto"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "itemId",
          "kind",
          "revision",
          "components",
          "createdAt",
          "updatedAt"
        ]
      },
      "PutItemCompositionComponentDto": {
        "type": "object",
        "properties": {
          "componentItemId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Tenant-owned component Item id. Source-system ids are resolved by the import boundary and are never accepted here."
          },
          "componentVariantId": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 255,
            "description": "Exact component variant id. Required when the selected component Item has variants."
          },
          "quantity": {
            "type": "number",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647
          },
          "discountBasisPoints": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000,
            "description": "Intrinsic component savings in basis points. Downstream pricing owns materialization."
          },
          "capacityMode": {
            "type": "string",
            "enum": [
              "TRACKED",
              "UNTRACKED"
            ]
          },
          "untrackedReason": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 500,
            "description": "Required, trimmed review reason only when capacityMode is UNTRACKED."
          }
        },
        "required": [
          "componentItemId",
          "quantity",
          "discountBasisPoints",
          "capacityMode"
        ]
      },
      "PutItemCompositionDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "expectedRevision": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483646,
            "description": "Optimistic revision guard. Use 0 to create; an existing definition requires its exact current revision."
          },
          "components": {
            "minItems": 2,
            "maxItems": 20,
            "description": "Whole ordered definition. Array order is authoritative; positions are derived server-side.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PutItemCompositionComponentDto"
            }
          }
        },
        "required": [
          "kind",
          "expectedRevision",
          "components"
        ]
      },
      "ItemCompositionPreviewParentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ]
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "type",
          "status",
          "archivedAt"
        ]
      },
      "ItemCompositionAppliedPricingPolicyDto": {
        "type": "object",
        "properties": {
          "policyId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "bandId": {
            "type": "string",
            "maxLength": 128
          },
          "bandUpperBoundMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 527040
          },
          "factorBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000
          },
          "elapsedMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "minimumDurationMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 527040
          },
          "graceMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 1440
          },
          "effectiveMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 527040
          },
          "derivedUnitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": [
          "policyId",
          "revisionId",
          "revisionNumber",
          "bandId",
          "bandUpperBoundMinutes",
          "factorBasisPoints",
          "elapsedMinutes",
          "minimumDurationMinutes",
          "graceMinutes",
          "effectiveMinutes",
          "derivedUnitPriceInCents"
        ]
      },
      "ItemCompositionPreviewIssueDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "componentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "code",
          "message",
          "componentId"
        ]
      },
      "ItemCompositionComponentPreviewDto": {
        "type": "object",
        "properties": {
          "componentId": {
            "type": "string",
            "format": "uuid"
          },
          "position": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "itemType": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "capacityMode": {
            "type": "string",
            "enum": [
              "TRACKED",
              "UNTRACKED"
            ]
          },
          "mappingStatus": {
            "type": "string",
            "enum": [
              "READY",
              "UNTRACKED",
              "MISSING",
              "AMBIGUOUS",
              "UNAVAILABLE"
            ]
          },
          "priceAuthorityKind": {
            "type": "string",
            "enum": [
              "CATALOG",
              "BOOKING_SERVICE"
            ],
            "nullable": true
          },
          "inventoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "bookingServiceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "appliedPricingPolicy": {
            "nullable": true,
            "description": "Exact published duration-tier evidence when this component uses PRICING_STRUCTURE; null for scalar/catalog pricing.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ItemCompositionAppliedPricingPolicyDto"
              }
            ]
          },
          "requiresServicePeriod": {
            "type": "boolean"
          },
          "definitionQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "effectiveQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "commercialQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "unitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "intrinsicSavingsInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemCompositionPreviewIssueDto"
            }
          }
        },
        "required": [
          "componentId",
          "position",
          "itemId",
          "variantId",
          "itemType",
          "capacityMode",
          "mappingStatus",
          "priceAuthorityKind",
          "inventoryId",
          "bookingServiceId",
          "appliedPricingPolicy",
          "requiresServicePeriod",
          "definitionQuantity",
          "effectiveQuantity",
          "commercialQuantity",
          "unitPriceInCents",
          "subtotalInCents",
          "intrinsicSavingsInCents",
          "totalInCents",
          "issues"
        ]
      },
      "ItemCompositionPreviewDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "selectedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "parent": {
            "$ref": "#/components/schemas/ItemCompositionPreviewParentDto"
          },
          "currency": {
            "type": "string"
          },
          "mappingReady": {
            "type": "boolean",
            "description": "True when every TRACKED/UNTRACKED component resolves the exact current operational authority."
          },
          "salesReady": {
            "type": "boolean",
            "description": "True when the exact definition can be materialized into merchant Sales for the supplied quantity/window."
          },
          "requiresServicePeriod": {
            "type": "boolean"
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "intrinsicSavingsInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemCompositionComponentPreviewDto"
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemCompositionPreviewIssueDto"
            }
          }
        },
        "required": [
          "itemId",
          "kind",
          "revision",
          "selectedQuantity",
          "parent",
          "currency",
          "mappingReady",
          "salesReady",
          "requiresServicePeriod",
          "subtotalInCents",
          "intrinsicSavingsInCents",
          "totalInCents",
          "components",
          "issues"
        ]
      },
      "ItemCompositionPreviewListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemCompositionPreviewDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "SaleWindowResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "The item the sale prices."
          },
          "variantId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Optional variant scope. `null` = item-level sale (applies to the parent item price); when set, references a variant of `itemId`."
          },
          "valueType": {
            "description": "#3324 / `DR-3265-27` — which value arm this window carries. Exactly one of `salePriceInCents` / `amountOffInCents` / `percentOffBasisPoints` is non-null: the one this names (database-enforced). All three arms are writable through the merchant API as of #3325.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SaleWindowValueType"
              }
            ]
          },
          "salePriceInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "FIXED_PRICE arm — the absolute sale price in cents shown while the window is active. `null` when `valueType` names a relative arm."
          },
          "amountOffInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "AMOUNT_OFF arm — cents subtracted from the live base price at resolution time, clamped at $0.00 (`DR-3265-15`). `null` unless `valueType` is AMOUNT_OFF."
          },
          "percentOffBasisPoints": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "PERCENT_OFF arm — basis points off the live base price, with floor rounding on the computed discount (`DR-3265-10`). `null` unless `valueType` is PERCENT_OFF."
          },
          "startsAt": {
            "format": "date-time",
            "type": "string",
            "description": "Inclusive start of the sale window."
          },
          "endsAt": {
            "format": "date-time",
            "type": "string",
            "description": "Exclusive end of the sale window (`endsAt > startsAt`)."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "valueType",
          "salePriceInCents",
          "amountOffInCents",
          "percentOffBasisPoints",
          "startsAt",
          "endsAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "CreateSaleWindowDto": {
        "description": "Create a sale window using the legacy fixed-price shorthand or one explicit natural-unit arm. Exactly one alternative must match.",
        "oneOf": [
          {
            "title": "Legacy fixed price",
            "description": "Backward-compatible FIXED_PRICE body with no valueType property.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "itemId": {
                "type": "string",
                "format": "uuid",
                "description": "Target item. The active org must own this item; cross-tenant references return a 404. Supply the canonical item UUID. Tenant ownership is checked by the service."
              },
              "variantId": {
                "type": "string",
                "format": "uuid",
                "description": "Optional target variant. When set, must belong to `itemId`. When omitted (or null), the sale window applies to the item-level price. Supply the canonical variant UUID.",
                "nullable": true
              },
              "salePriceInCents": {
                "type": "integer",
                "format": "int32",
                "description": "FIXED_PRICE arm: customer-visible price in cents while active. Must be 0..2,147,483,647 (the PostgreSQL INTEGER range), and the write is not blocked at or above the current price. A window never RAISES a price, though: resolution takes the lower of this value and the live base price of the item or variant being priced, so a window at or above the base is inert rather than a price increase. On an item-level window (`variantId` omitted) that comparison is made against each variant's own price.",
                "minimum": 0,
                "maximum": 2147483647
              },
              "startsAt": {
                "type": "string",
                "description": "ISO-8601 inclusive start. Required. The merchant admin sends local-time picker values converted to ISO via the browser; the API stores UTC.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "ISO-8601 exclusive end. Required. Must be strictly after `startsAt`. Two windows that touch at the boundary (one ends exactly when the next starts) are NOT considered overlapping.",
                "format": "date-time"
              }
            },
            "required": [
              "itemId",
              "salePriceInCents",
              "startsAt",
              "endsAt"
            ]
          },
          {
            "title": "Explicit fixed price",
            "description": "FIXED_PRICE requires exactly salePriceInCents.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "itemId": {
                "type": "string",
                "format": "uuid",
                "description": "Target item. The active org must own this item; cross-tenant references return a 404. Supply the canonical item UUID. Tenant ownership is checked by the service."
              },
              "variantId": {
                "type": "string",
                "format": "uuid",
                "description": "Optional target variant. When set, must belong to `itemId`. When omitted (or null), the sale window applies to the item-level price. Supply the canonical variant UUID.",
                "nullable": true
              },
              "valueType": {
                "type": "string",
                "enum": [
                  "FIXED_PRICE"
                ],
                "description": "Natural unit carried by this window. When omitted, the legacy fixed-price body is accepted as FIXED_PRICE. When supplied, exactly the matching arm field must be present and the other two omitted."
              },
              "salePriceInCents": {
                "type": "integer",
                "format": "int32",
                "description": "FIXED_PRICE arm: customer-visible price in cents while active. Must be 0..2,147,483,647 (the PostgreSQL INTEGER range), and the write is not blocked at or above the current price. A window never RAISES a price, though: resolution takes the lower of this value and the live base price of the item or variant being priced, so a window at or above the base is inert rather than a price increase. On an item-level window (`variantId` omitted) that comparison is made against each variant's own price.",
                "minimum": 0,
                "maximum": 2147483647
              },
              "startsAt": {
                "type": "string",
                "description": "ISO-8601 inclusive start. Required. The merchant admin sends local-time picker values converted to ISO via the browser; the API stores UTC.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "ISO-8601 exclusive end. Required. Must be strictly after `startsAt`. Two windows that touch at the boundary (one ends exactly when the next starts) are NOT considered overlapping.",
                "format": "date-time"
              }
            },
            "required": [
              "itemId",
              "valueType",
              "salePriceInCents",
              "startsAt",
              "endsAt"
            ]
          },
          {
            "title": "Explicit amount off",
            "description": "AMOUNT_OFF requires exactly amountOffInCents.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "itemId": {
                "type": "string",
                "format": "uuid",
                "description": "Target item. The active org must own this item; cross-tenant references return a 404. Supply the canonical item UUID. Tenant ownership is checked by the service."
              },
              "variantId": {
                "type": "string",
                "format": "uuid",
                "description": "Optional target variant. When set, must belong to `itemId`. When omitted (or null), the sale window applies to the item-level price. Supply the canonical variant UUID.",
                "nullable": true
              },
              "valueType": {
                "type": "string",
                "enum": [
                  "AMOUNT_OFF"
                ],
                "description": "Natural unit carried by this window. When omitted, the legacy fixed-price body is accepted as FIXED_PRICE. When supplied, exactly the matching arm field must be present and the other two omitted."
              },
              "amountOffInCents": {
                "type": "integer",
                "format": "int32",
                "description": "AMOUNT_OFF arm: cents subtracted from each live item or variant price at resolution time. Clamps at $0.00.",
                "minimum": 1,
                "maximum": 1000000000
              },
              "startsAt": {
                "type": "string",
                "description": "ISO-8601 inclusive start. Required. The merchant admin sends local-time picker values converted to ISO via the browser; the API stores UTC.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "ISO-8601 exclusive end. Required. Must be strictly after `startsAt`. Two windows that touch at the boundary (one ends exactly when the next starts) are NOT considered overlapping.",
                "format": "date-time"
              }
            },
            "required": [
              "itemId",
              "valueType",
              "amountOffInCents",
              "startsAt",
              "endsAt"
            ]
          },
          {
            "title": "Explicit percent off",
            "description": "PERCENT_OFF requires exactly percentOffBasisPoints.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "itemId": {
                "type": "string",
                "format": "uuid",
                "description": "Target item. The active org must own this item; cross-tenant references return a 404. Supply the canonical item UUID. Tenant ownership is checked by the service."
              },
              "variantId": {
                "type": "string",
                "format": "uuid",
                "description": "Optional target variant. When set, must belong to `itemId`. When omitted (or null), the sale window applies to the item-level price. Supply the canonical variant UUID.",
                "nullable": true
              },
              "valueType": {
                "type": "string",
                "enum": [
                  "PERCENT_OFF"
                ],
                "description": "Natural unit carried by this window. When omitted, the legacy fixed-price body is accepted as FIXED_PRICE. When supplied, exactly the matching arm field must be present and the other two omitted."
              },
              "percentOffBasisPoints": {
                "type": "integer",
                "format": "int32",
                "description": "PERCENT_OFF arm in basis points (1% = 100). The computed discount is floor-rounded independently for each live item or variant price.",
                "minimum": 1,
                "maximum": 10000
              },
              "startsAt": {
                "type": "string",
                "description": "ISO-8601 inclusive start. Required. The merchant admin sends local-time picker values converted to ISO via the browser; the API stores UTC.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "ISO-8601 exclusive end. Required. Must be strictly after `startsAt`. Two windows that touch at the boundary (one ends exactly when the next starts) are NOT considered overlapping.",
                "format": "date-time"
              }
            },
            "required": [
              "itemId",
              "valueType",
              "percentOffBasisPoints",
              "startsAt",
              "endsAt"
            ]
          }
        ]
      },
      "UpdateSaleWindowDto": {
        "description": "Patch a sale window without changing its value, or provide exactly one value arm. An omitted valueType is accepted only when that arm matches the persisted row.",
        "oneOf": [
          {
            "title": "Date or scope only",
            "description": "Leaves the persisted valueType and value arm unchanged.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "variantId": {
                "type": "string",
                "description": "Repoint the window to a different variant of the same item, or clear it back to item-level by passing `null`. The service asserts the resulting variant UUID belongs to the row's item.",
                "format": "uuid",
                "nullable": true
              },
              "startsAt": {
                "type": "string",
                "description": "New inclusive start. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "New exclusive end. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              }
            }
          },
          {
            "title": "Fixed price value update",
            "description": "salePriceInCents is required. valueType may be omitted only when the persisted row already uses FIXED_PRICE.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "variantId": {
                "type": "string",
                "description": "Repoint the window to a different variant of the same item, or clear it back to item-level by passing `null`. The service asserts the resulting variant UUID belongs to the row's item.",
                "format": "uuid",
                "nullable": true
              },
              "valueType": {
                "type": "string",
                "enum": [
                  "FIXED_PRICE"
                ],
                "description": "New natural unit. When supplied, exactly the matching value field must be supplied too. Omit this and all value fields for a date/scope-only patch."
              },
              "salePriceInCents": {
                "type": "integer",
                "format": "int32",
                "description": "FIXED_PRICE arm: new customer-visible price in cents. Non-negative. Same rule as create — a value at or above the item / variant price is accepted rather than blocked, and is then inert: a window never raises a price, so resolution takes the lower of this value and the live base. Maximum 2,147,483,647 (the PostgreSQL INTEGER range).",
                "minimum": 0,
                "maximum": 2147483647
              },
              "startsAt": {
                "type": "string",
                "description": "New inclusive start. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "New exclusive end. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              }
            },
            "required": [
              "salePriceInCents"
            ]
          },
          {
            "title": "Amount off value update",
            "description": "amountOffInCents is required. valueType may be omitted only when the persisted row already uses AMOUNT_OFF.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "variantId": {
                "type": "string",
                "description": "Repoint the window to a different variant of the same item, or clear it back to item-level by passing `null`. The service asserts the resulting variant UUID belongs to the row's item.",
                "format": "uuid",
                "nullable": true
              },
              "valueType": {
                "type": "string",
                "enum": [
                  "AMOUNT_OFF"
                ],
                "description": "New natural unit. When supplied, exactly the matching value field must be supplied too. Omit this and all value fields for a date/scope-only patch."
              },
              "amountOffInCents": {
                "type": "integer",
                "format": "int32",
                "description": "AMOUNT_OFF arm in cents. Must be 1..1,000,000,000 and resolves no lower than $0.00.",
                "minimum": 1,
                "maximum": 1000000000
              },
              "startsAt": {
                "type": "string",
                "description": "New inclusive start. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "New exclusive end. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              }
            },
            "required": [
              "amountOffInCents"
            ]
          },
          {
            "title": "Percent off value update",
            "description": "percentOffBasisPoints is required. valueType may be omitted only when the persisted row already uses PERCENT_OFF.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "variantId": {
                "type": "string",
                "description": "Repoint the window to a different variant of the same item, or clear it back to item-level by passing `null`. The service asserts the resulting variant UUID belongs to the row's item.",
                "format": "uuid",
                "nullable": true
              },
              "valueType": {
                "type": "string",
                "enum": [
                  "PERCENT_OFF"
                ],
                "description": "New natural unit. When supplied, exactly the matching value field must be supplied too. Omit this and all value fields for a date/scope-only patch."
              },
              "percentOffBasisPoints": {
                "type": "integer",
                "format": "int32",
                "description": "PERCENT_OFF arm in basis points (1% = 100). Must be 1..10,000.",
                "minimum": 1,
                "maximum": 10000
              },
              "startsAt": {
                "type": "string",
                "description": "New inclusive start. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              },
              "endsAt": {
                "type": "string",
                "description": "New exclusive end. Service re-checks `endsAt > startsAt` against the merged state + re-runs the overlap check.",
                "format": "date-time"
              }
            },
            "required": [
              "percentOffBasisPoints"
            ]
          }
        ]
      },
      "HighRiskReasonDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          }
        },
        "required": [
          "reason"
        ]
      },
      "SaleWindowDeleteResponseDto": {
        "type": "object",
        "properties": {
          "deletedId": {
            "type": "string",
            "format": "uuid",
            "description": "Id of the hard-deleted sale window."
          }
        },
        "required": [
          "deletedId"
        ]
      },
      "PublicInventoryItemSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "Tallow Body Cream"
          },
          "slug": {
            "type": "string",
            "example": "tallow-body-cream"
          }
        },
        "required": [
          "id",
          "name",
          "slug"
        ]
      },
      "PublicInventoryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The variant this stock row is scoped to; `null` for item-level rows."
          },
          "totalQuantity": {
            "type": "number",
            "example": 42,
            "description": "Units on hand (available + reserved)."
          },
          "availableQuantity": {
            "type": "number",
            "example": 38,
            "description": "Units sellable now."
          },
          "reservedQuantity": {
            "type": "number",
            "example": 4,
            "description": "Units earmarked by holds."
          },
          "lowStockThreshold": {
            "type": "number",
            "example": 0,
            "description": "Low-stock alarm point; `0` disables the alarm."
          },
          "stockStatus": {
            "type": "string",
            "enum": [
              "IN_STOCK",
              "LOW_STOCK",
              "OUT_OF_STOCK"
            ],
            "example": "IN_STOCK"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string",
            "example": "2026-06-21T04:19:08.000Z"
          },
          "item": {
            "$ref": "#/components/schemas/PublicInventoryItemSummaryDto"
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "totalQuantity",
          "availableQuantity",
          "reservedQuantity",
          "lowStockThreshold",
          "stockStatus",
          "updatedAt",
          "item"
        ]
      },
      "CheckAvailabilityDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Item UUID to check availability for."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "description": "Optional variant UUID. When omitted, availability is checked against the item-level booking inventory row."
          },
          "startDate": {
            "type": "string",
            "description": "Inclusive start instant (ISO-8601 date-time with timezone offset). Availability uses a half-open interval: [startDate, endDate).",
            "format": "date-time"
          },
          "endDate": {
            "type": "string",
            "description": "Exclusive end instant (ISO-8601 date-time with timezone offset), strictly after startDate. Availability uses a half-open interval: [startDate, endDate), so back-to-back bookings may touch at this instant.",
            "format": "date-time"
          }
        },
        "required": [
          "itemId",
          "startDate",
          "endDate"
        ]
      },
      "AvailabilityCheckResponseDto": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "Whether at least one unit is available across the requested range.",
            "example": true
          },
          "quantity": {
            "type": "number",
            "description": "Remaining bookable quantity for the range (reservation-aware available stock minus overlapping holds), floored at 0.",
            "example": 3
          }
        },
        "required": [
          "available",
          "quantity"
        ]
      },
      "StockholdingLocationListRowDto": {
        "type": "object",
        "properties": {
          "stockLocationId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "Current stored label. Several locations can have the same label."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          }
        },
        "required": [
          "stockLocationId",
          "label",
          "revision"
        ]
      },
      "StockholdingLocationListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockholdingLocationListRowDto"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit",
          "totalPages"
        ]
      },
      "StockStatus": {
        "type": "string",
        "enum": [
          "IN_STOCK",
          "LOW_STOCK",
          "OUT_OF_STOCK"
        ]
      },
      "MerchantInventoryItemSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "1d6c9085-74c6-5038-b23d-af3650468db2"
          },
          "name": {
            "type": "string",
            "example": "Tallow Body Cream"
          },
          "slug": {
            "type": "string",
            "example": "tallow-body-cream"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT",
              "ARCHIVED"
            ],
            "example": "ACTIVE",
            "description": "The item's current lifecycle status. Merchant reads return rows for ACTIVE, DRAFT and ARCHIVED items alike unless `itemStatus` filters the list."
          },
          "type": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ],
            "example": "SALE",
            "description": "The item's type. Only SALE items are stock-managed and get new inventory rows; a row on a SERVICE or RENTAL item was created before that rule and is still returned to merchants."
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "status",
          "type"
        ]
      },
      "MerchantInventoryVariantSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "4e1245f6-bfe0-5862-9d9d-7f8d96d0b14e",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "Unscented"
          },
          "sku": {
            "type": "string",
            "example": "EKG-TBC-UNS"
          },
          "options": {
            "type": "object",
            "additionalProperties": true,
            "example": {
              "Size": "2.5 oz"
            },
            "description": "The variant's customer-facing option map (merchant-defined). Always an object, possibly empty (`{}`); never null — the column is `ItemVariant.options Json @default(\"{}\")`."
          }
        },
        "required": [
          "id",
          "name",
          "sku",
          "options"
        ]
      },
      "MerchantInventoryRowDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "inv_ekgis_tallow_unscented"
          },
          "organizationId": {
            "type": "string",
            "example": "eda051de-ff53-52d3-acc7-c0794d55f828",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "example": "1d6c9085-74c6-5038-b23d-af3650468db2"
          },
          "variantId": {
            "type": "string",
            "nullable": true,
            "example": "4e1245f6-bfe0-5862-9d9d-7f8d96d0b14e",
            "format": "uuid",
            "description": "The variant this stock row is scoped to; `null` for item-level rows."
          },
          "totalQuantity": {
            "type": "number",
            "example": 42,
            "description": "Units on hand (available + reserved)."
          },
          "availableQuantity": {
            "type": "number",
            "example": 38,
            "description": "Units sellable now."
          },
          "reservedQuantity": {
            "type": "number",
            "example": 4,
            "description": "Units earmarked by holds (reserve/release move these)."
          },
          "lowStockThreshold": {
            "type": "number",
            "example": 0,
            "description": "Low-stock alarm point; `0` disables the alarm."
          },
          "stockStatus": {
            "type": "string",
            "enum": [
              "IN_STOCK",
              "LOW_STOCK",
              "OUT_OF_STOCK"
            ],
            "example": "IN_STOCK"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "example": "2026-06-21T04:19:08.000Z"
          },
          "item": {
            "$ref": "#/components/schemas/MerchantInventoryItemSummaryDto"
          },
          "variant": {
            "nullable": true,
            "description": "Variant summary on variant-scoped rows; `null` for item-level rows. Always present on the merchant response (the Prisma `include` returns the relation key, `null` when the row has no variant).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantInventoryVariantSummaryDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "totalQuantity",
          "availableQuantity",
          "reservedQuantity",
          "lowStockThreshold",
          "stockStatus",
          "updatedAt",
          "item",
          "variant"
        ]
      },
      "MerchantInventorySummaryDto": {
        "type": "object",
        "properties": {
          "inStock": {
            "type": "number",
            "example": 128,
            "description": "Rows with `stockStatus = IN_STOCK`."
          },
          "lowStock": {
            "type": "number",
            "example": 6,
            "description": "Rows with `stockStatus = LOW_STOCK`."
          },
          "outOfStock": {
            "type": "number",
            "example": 3,
            "description": "Rows with `stockStatus = OUT_OF_STOCK`."
          },
          "total": {
            "type": "number",
            "example": 137,
            "description": "Sum of the three buckets (`inStock + lowStock + outOfStock`)."
          }
        },
        "required": [
          "inStock",
          "lowStock",
          "outOfStock",
          "total"
        ]
      },
      "InventoryTargetDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "description": "Target discriminator.",
            "enum": [
              "variant",
              "item-default"
            ]
          },
          "itemId": {
            "type": "string",
            "description": "Parent item id (payload plumbing)."
          },
          "itemName": {
            "type": "string",
            "description": "Parent item display name."
          },
          "variantId": {
            "type": "string",
            "description": "Variant id for `kind: 'variant'`; `null` for `kind: 'item-default'` (the item-level row).",
            "nullable": true
          },
          "variantName": {
            "type": "string",
            "description": "Variant display name (`kind: 'variant'` only).",
            "nullable": true
          },
          "sku": {
            "type": "string",
            "description": "Variant SKU (`kind: 'variant'` only; items have no SKU).",
            "nullable": true
          },
          "hasInventoryRow": {
            "type": "boolean",
            "description": "Whether the inventory row for this target already exists. `false` targets are the create-missing (#1850) population."
          }
        },
        "required": [
          "kind",
          "itemId",
          "itemName",
          "variantId",
          "variantName",
          "sku",
          "hasInventoryRow"
        ]
      },
      "InventoryTargetListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InventoryTargetDto"
            }
          },
          "nextOffset": {
            "type": "integer",
            "description": "Offset for the next page of the merged variant + item-default list, or `null` when this page is the last. Bounded — deep paging is unsupported by design; refine the search.",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextOffset"
        ]
      },
      "CreateInventoryDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "The tenant-owned item to create the stock row for.",
            "example": "1d6c9085-74c6-5038-b23d-af3650468db2"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Scope the row to a specific variant of the item. Omit (or null) for an item-level row on a variant-less product.",
            "example": "4e1245f6-bfe0-5862-9d9d-7f8d96d0b14e"
          },
          "totalQuantity": {
            "type": "number",
            "description": "Opening on-hand quantity. `availableQuantity` mirrors this on the new row (reserved starts at 0). Defaults to 0 (OUT_OF_STOCK until stocked).",
            "minimum": 0,
            "default": 0,
            "example": 25
          },
          "lowStockThreshold": {
            "type": "number",
            "description": "Low-stock alarm point for the new row. `0` (default) disables the LOW_STOCK signal.",
            "minimum": 0,
            "default": 0,
            "example": 5
          }
        },
        "required": [
          "itemId"
        ]
      },
      "EnsureInventoryResponseDto": {
        "type": "object",
        "properties": {
          "created": {
            "type": "boolean",
            "description": "True when a NEW row was created. False when an existing row was returned unchanged — the requested opening quantity/threshold were NOT applied (use the adjust endpoint to change an existing row).",
            "example": true
          },
          "row": {
            "description": "The created (or pre-existing) inventory row.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantInventoryRowDto"
              }
            ]
          }
        },
        "required": [
          "created",
          "row"
        ]
      },
      "AdjustInventoryDto": {
        "type": "object",
        "properties": {
          "delta": {
            "type": "number",
            "description": "Signed change applied to both totalQuantity and availableQuantity. Must be non-zero — submit nothing to keep the row unchanged.",
            "example": 5
          },
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for the adjustment. Captured in the audit log for traceability.",
            "minLength": 1,
            "maxLength": 200,
            "example": "Received PO #1234"
          }
        },
        "required": [
          "delta",
          "reason"
        ]
      },
      "UpdateThresholdDto": {
        "type": "object",
        "properties": {
          "lowStockThreshold": {
            "type": "number",
            "description": "New low-stock threshold. `0` disables the alarm (no LOW_STOCK signal regardless of availableQuantity). Positive integers set an inclusive trip-point.",
            "minimum": 0,
            "example": 5
          }
        },
        "required": [
          "lowStockThreshold"
        ]
      },
      "ReserveInventoryDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "number",
            "description": "Number of units to move from available to reserved.",
            "minimum": 1,
            "example": 1
          },
          "reason": {
            "type": "string",
            "description": "Optional explanation captured in the audit log. Suggested format: a short note describing the source of the reservation (e.g. \"booking #abc123\", \"manual hold for repair\").",
            "maxLength": 200
          }
        },
        "required": [
          "quantity"
        ]
      },
      "ReleaseInventoryDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "number",
            "description": "Number of units to move from reserved back to available.",
            "minimum": 1,
            "example": 1
          },
          "reason": {
            "type": "string",
            "description": "Optional explanation captured in the audit log (e.g. \"booking cancelled\", \"order timeout cleanup\").",
            "maxLength": 200
          }
        },
        "required": [
          "quantity"
        ]
      },
      "CreateStockholdingLocationDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Label for the stockholding location. Supply well-formed Unicode text with 1 to 160 code points and no NUL.",
            "minLength": 1,
            "maxLength": 160,
            "example": "Warehouse"
          },
          "reason": {
            "type": "string",
            "description": "Required reason for the change. After trimming, it must be well-formed Unicode text with 1 to 500 code points and no NUL.",
            "minLength": 1,
            "example": "Open the west warehouse"
          }
        },
        "required": [
          "label",
          "reason"
        ],
        "additionalProperties": false
      },
      "StockholdingLocationWriteResponseDto": {
        "type": "object",
        "properties": {
          "stockLocationId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-assigned location ID to use in the merchant rename route for the same commerce environment."
          },
          "revision": {
            "type": "integer",
            "description": "Committed location revision. Use it as expectedRevision for a later rename when it is still current.",
            "minimum": 1,
            "maximum": 2147483646
          }
        },
        "required": [
          "stockLocationId",
          "revision"
        ]
      },
      "RenameStockholdingLocationDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Label for the stockholding location. Supply well-formed Unicode text with 1 to 160 code points and no NUL.",
            "minLength": 1,
            "maxLength": 160,
            "example": "Warehouse"
          },
          "reason": {
            "type": "string",
            "description": "Required reason for the change. After trimming, it must be well-formed Unicode text with 1 to 500 code points and no NUL.",
            "minLength": 1,
            "example": "Open the west warehouse"
          },
          "expectedRevision": {
            "type": "integer",
            "description": "The current location revision expected by the merchant. A stale revision causes a conflict.",
            "minimum": 1,
            "maximum": 2147483646,
            "example": 1
          }
        },
        "required": [
          "label",
          "reason",
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "AssignOpeningStockDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "description": "Verified free units to assign to this location: 0 or more. 0 records a verified-empty location.",
            "minimum": 0,
            "maximum": 2147483647,
            "example": 12
          },
          "evidenceReference": {
            "type": "string",
            "description": "Evidence for the count: a count sheet, receipt or document reference. After trimming, well-formed Unicode text with 1 to 200 code points and no NUL.",
            "minLength": 1,
            "example": "Count sheet 2026-11-27 #14"
          },
          "reason": {
            "type": "string",
            "description": "Required reason for the assignment. After trimming, well-formed Unicode text with 1 to 500 code points and no NUL.",
            "minLength": 1,
            "example": "Opening count for the west store"
          }
        },
        "required": [
          "quantity",
          "evidenceReference",
          "reason"
        ],
        "additionalProperties": false
      },
      "OpeningStockAssignmentResponseDto": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "description": "The stored stock operation. A replay of the same request returns the same value.",
            "format": "uuid"
          },
          "inventoryId": {
            "type": "string",
            "description": "The Inventory row (SKU) whose stock was assigned."
          },
          "stockLocationId": {
            "type": "string",
            "description": "The stockholding location that now holds the assigned stock.",
            "format": "uuid"
          },
          "positionId": {
            "type": "string",
            "description": "The stock position at this SKU and location.",
            "format": "uuid"
          },
          "positionRevision": {
            "type": "integer",
            "description": "The position revision after the assignment.",
            "example": 1
          },
          "reconciliationState": {
            "type": "string",
            "description": "The position state after the assignment.",
            "enum": [
              "RECONCILED"
            ],
            "example": "RECONCILED"
          },
          "totalQuantity": {
            "type": "integer",
            "description": "Units on hand at this location after the assignment.",
            "example": 12
          },
          "availableQuantity": {
            "type": "integer",
            "description": "Units available at this location after the assignment.",
            "example": 12
          },
          "reservedQuantity": {
            "type": "integer",
            "description": "Units reserved at this location. An opening assignment never moves reserved units.",
            "example": 0
          }
        },
        "required": [
          "operationId",
          "inventoryId",
          "stockLocationId",
          "positionId",
          "positionRevision",
          "reconciliationState",
          "totalQuantity",
          "availableQuantity",
          "reservedQuantity"
        ]
      },
      "StockPositionBalanceDto": {
        "type": "object",
        "properties": {
          "totalQuantity": {
            "type": "integer",
            "description": "Units on hand.",
            "minimum": 0,
            "maximum": 2147483647
          },
          "availableQuantity": {
            "type": "integer",
            "description": "Units available to sell.",
            "minimum": 0,
            "maximum": 2147483647
          },
          "reservedQuantity": {
            "type": "integer",
            "description": "Units reserved for orders.",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": [
          "totalQuantity",
          "availableQuantity",
          "reservedQuantity"
        ]
      },
      "StockPositionListRowDto": {
        "type": "object",
        "properties": {
          "stockLocationId": {
            "type": "string",
            "description": "The stockholding location of this position.",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "positionId": {
            "type": "string",
            "description": "Identifies the stored position at this SKU and location in responses. No request accepts it: the opening-stock assignment addresses the position by its inventoryId and stockLocationId.",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "positionRevision": {
            "type": "integer",
            "description": "The stored position revision. 0 is a position that has never been assigned.",
            "minimum": 0,
            "maximum": 2147483646
          },
          "reconciliationState": {
            "type": "string",
            "description": "The stored reconciliation state.",
            "enum": [
              "UNRECONCILED",
              "RECONCILED",
              "QUARANTINED"
            ]
          },
          "totalQuantity": {
            "type": "integer",
            "description": "Units on hand at this location.",
            "minimum": 0,
            "maximum": 2147483647
          },
          "availableQuantity": {
            "type": "integer",
            "description": "Units available at this location.",
            "minimum": 0,
            "maximum": 2147483647
          },
          "reservedQuantity": {
            "type": "integer",
            "description": "Units reserved at this location.",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": [
          "stockLocationId",
          "positionId",
          "positionRevision",
          "reconciliationState",
          "totalQuantity",
          "availableQuantity",
          "reservedQuantity"
        ]
      },
      "StockPositionListDto": {
        "type": "object",
        "properties": {
          "inventoryId": {
            "type": "string",
            "description": "The Inventory row (SKU) these positions belong to.",
            "minLength": 1,
            "maxLength": 200
          },
          "anchor": {
            "description": "The SKU's own counters.",
            "allOf": [
              {
                "$ref": "#/components/schemas/StockPositionBalanceDto"
              }
            ]
          },
          "located": {
            "description": "The sum of every position of this SKU, at every location, whatever the page or filter.",
            "allOf": [
              {
                "$ref": "#/components/schemas/StockPositionBalanceDto"
              }
            ]
          },
          "unlocated": {
            "description": "What no location holds yet: the SKU's counters minus the located sum. On-hand units that are neither available nor reserved stay in totalQuantity and never count as available.",
            "allOf": [
              {
                "$ref": "#/components/schemas/StockPositionBalanceDto"
              }
            ]
          },
          "data": {
            "description": "This page of positions, ordered by location ID. It is empty in three cases, told apart by the request and total. Without a stockLocationId filter, total 0 means the SKU has no positions. With a filter, total 0 means it has none at that location, though it may have positions elsewhere. A page past totalPages is empty while total still counts the matches. The located and unlocated balances cover the whole SKU in every case.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockPositionListRowDto"
            }
          },
          "total": {
            "type": "integer",
            "description": "Positions matching the optional location filter.",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "inventoryId",
          "anchor",
          "located",
          "unlocated",
          "data",
          "total",
          "page",
          "limit",
          "totalPages"
        ]
      },
      "PublicBookingDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The booked item variant, or `null` for item-level bookings."
          },
          "startDate": {
            "format": "date-time",
            "type": "string"
          },
          "endDate": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ],
            "example": "PENDING"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "example": 1
          }
        },
        "required": [
          "id",
          "itemId",
          "variantId",
          "startDate",
          "endDate",
          "status",
          "quantity"
        ]
      },
      "CreateBookingDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the item being booked."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "description": "Optional variant UUID."
          },
          "startDate": {
            "type": "string",
            "description": "Booking start instant (ISO-8601 date-time with timezone offset), inclusive. Booking windows use a half-open interval: [startDate, endDate).",
            "format": "date-time"
          },
          "endDate": {
            "type": "string",
            "description": "Booking end instant (ISO-8601 date-time with timezone offset), exclusive. Back-to-back bookings may share this boundary without overlapping.",
            "format": "date-time"
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000
          },
          "notes": {
            "type": "string",
            "description": "Free-form customer note (max 2000 chars)."
          }
        },
        "required": [
          "itemId",
          "startDate",
          "endDate",
          "quantity"
        ]
      },
      "BookingPriceConfirmationComparablePriceDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32",
            "example": 10000
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32",
            "example": 0
          },
          "shippingInCents": {
            "type": "integer",
            "format": "int32",
            "example": 0
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32",
            "example": 800
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "example": 10800
          }
        },
        "required": [
          "currency",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents"
        ],
        "additionalProperties": false
      },
      "BookingPriceConfirmationRequiredDetailsDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "CONFIRMED_PRICE_RECEIPT_MISSING",
              "CONFIRMED_PRICE_RECEIPT_INVALID",
              "CONFIRMED_PRICE_RECEIPT_EXPIRED",
              "PRICE_CONFIRMATION_NOT_EXPLICIT",
              "CONFIRMED_PRICE_CHANGED",
              "CUSTOMER_CONFIRMATION_REQUIRED"
            ],
            "description": "Stable bind-time reason. Clients render currentPrice, clear stale confirmation state, and retry only with the replacement receipt when one is present."
          },
          "acknowledgedPrice": {
            "nullable": true,
            "description": "Previously authenticated and explicitly acknowledged total, or null when no live acknowledgement exists.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingPriceConfirmationComparablePriceDto"
              }
            ]
          },
          "currentPrice": {
            "$ref": "#/components/schemas/BookingPriceConfirmationComparablePriceDto"
          },
          "confirmedPriceReceipt": {
            "type": "string",
            "nullable": true,
            "maxLength": 32768,
            "description": "Short-lived signed receipt for a customer-present bind retry. Null when no customer can confirm or the binding authority has expired."
          },
          "receiptExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Expiry of confirmedPriceReceipt, or null when no replacement receipt is returned."
          }
        },
        "required": [
          "reason",
          "acknowledgedPrice",
          "currentPrice",
          "confirmedPriceReceipt",
          "receiptExpiresAt"
        ]
      },
      "BookingPriceConfirmationRequiredErrorDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "BOOKING_PRICE_CONFIRMATION_REQUIRED"
            ],
            "example": "BOOKING_PRICE_CONFIRMATION_REQUIRED"
          },
          "message": {
            "type": "string",
            "example": "Confirm the current tax-inclusive booking total and retry."
          },
          "details": {
            "$ref": "#/components/schemas/BookingPriceConfirmationRequiredDetailsDto"
          }
        },
        "required": [
          "code",
          "message",
          "details"
        ]
      },
      "CheckoutAddressDto": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "description": "Leading and trailing whitespace is trimmed and letters are uppercased before the normalized two-letter alphabetic country-code check.",
            "example": "US",
            "pattern": "^\\s*[A-Za-z]{2}\\s*$"
          },
          "state": {
            "type": "string",
            "description": "State / province / region — ISO 3166-2 subdivision code when possible (e.g. `NY`, `CA`). Strongly recommended for accurate US sales tax.",
            "maxLength": 100
          },
          "city": {
            "type": "string",
            "description": "City / town.",
            "maxLength": 200
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP / postal code. Recommended for local-jurisdiction tax.",
            "maxLength": 20
          },
          "line1": {
            "type": "string",
            "description": "Address line 1.",
            "maxLength": 300
          },
          "line2": {
            "type": "string",
            "description": "Address line 2.",
            "maxLength": 300
          },
          "company": {
            "type": "string",
            "description": "#998 — optional ship-to company / organization name, collected in the hosted checkout Contact step. Persisted on the address JSON; doesn't participate in tax.",
            "maxLength": 200
          }
        },
        "required": [
          "country"
        ],
        "additionalProperties": false
      },
      "CreateBookingCheckoutDto": {
        "type": "object",
        "properties": {
          "confirmedPriceReceipt": {
            "type": "string",
            "maxLength": 32768,
            "description": "Signed, request-bound tax-inclusive quote receipt returned by a prior BOOKING_PRICE_CONFIRMATION_REQUIRED response."
          },
          "priceConfirmed": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Must be literal true after the customer renders and explicitly accepts the receipt total."
          },
          "customerName": {
            "type": "string",
            "maxLength": 200
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "customerPhone": {
            "type": "string",
            "nullable": true,
            "maxLength": 50
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/CheckoutAddressDto"
          },
          "billingAddress": {
            "$ref": "#/components/schemas/CheckoutAddressDto"
          }
        },
        "required": [
          "customerName",
          "customerEmail"
        ]
      },
      "BookingDeliveryDestinationAddressResponseDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "maxLength": 300,
            "example": "1120 S Rackham Way"
          },
          "line2": {
            "type": "string",
            "maxLength": 300,
            "example": "Suite 300"
          },
          "city": {
            "type": "string",
            "maxLength": 200,
            "example": "Meridian"
          },
          "state": {
            "type": "string",
            "maxLength": 200,
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "maxLength": 32,
            "example": "83642"
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "example": "US",
            "pattern": "^[A-Z]{2}$"
          }
        },
        "required": [
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ],
        "additionalProperties": false
      },
      "BookingDeliverySelectionBandResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "maxDistanceMeters": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "feeInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "label",
          "maxDistanceMeters",
          "feeInCents"
        ],
        "additionalProperties": false
      },
      "BookingDeliverySelectionResponseDto": {
        "description": "Method-discriminated browser-safe delivery evidence. DELIVERY is either pending evaluation or fully rated; distance and band become non-null together.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method",
              "destinationAddress",
              "distanceMeters",
              "band"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "PICKUP"
                ]
              },
              "destinationAddress": {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              },
              "distanceMeters": {
                "type": "integer",
                "format": "int32",
                "nullable": true,
                "enum": [
                  null
                ]
              },
              "band": {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method",
              "destinationAddress",
              "distanceMeters",
              "band"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "DELIVERY"
                ]
              },
              "destinationAddress": {
                "$ref": "#/components/schemas/BookingDeliveryDestinationAddressResponseDto"
              },
              "distanceMeters": {
                "type": "integer",
                "format": "int32",
                "nullable": true,
                "enum": [
                  null
                ]
              },
              "band": {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method",
              "destinationAddress",
              "distanceMeters",
              "band"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "DELIVERY"
                ]
              },
              "destinationAddress": {
                "$ref": "#/components/schemas/BookingDeliveryDestinationAddressResponseDto"
              },
              "distanceMeters": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "band": {
                "$ref": "#/components/schemas/BookingDeliverySelectionBandResponseDto"
              }
            }
          }
        ]
      },
      "PublicBookingLifecycleCommerceDto": {
        "type": "object",
        "properties": {
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32"
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "commercialStatus",
          "paymentStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "balanceDueInCents",
          "displayNumber"
        ]
      },
      "PublicBookingLifecycleDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "approvalStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "APPROVED",
              "DECLINED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "delivery": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
              }
            ]
          },
          "commerce": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingLifecycleCommerceDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "serviceId",
          "startsAt",
          "endsAt",
          "quantity",
          "status",
          "approvalStatus",
          "currency",
          "totalInCents",
          "archivedAt",
          "delivery",
          "commerce"
        ]
      },
      "PublicBookingCheckoutResponseDto": {
        "type": "object",
        "properties": {
          "flow": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "REQUEST",
              "CONFIRMED",
              "TERMINAL"
            ],
            "description": "PAYMENT exposes a live hosted checkout; REQUEST awaits merchant action; CONFIRMED covers confirmed/active/completed bookings; TERMINAL covers declined, cancelled, expired, or an expired checkout awaiting sweep convergence."
          },
          "booking": {
            "$ref": "#/components/schemas/PublicBookingLifecycleDto"
          },
          "checkoutToken": {
            "type": "string",
            "nullable": true,
            "description": "Raw c-token; present only for PAYMENT."
          },
          "checkoutExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "amountDueNowInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "remainingBalanceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "flow",
          "booking",
          "checkoutToken",
          "checkoutExpiresAt",
          "amountDueNowInCents",
          "remainingBalanceInCents"
        ]
      },
      "PublicBookingGroupCartQuoteInputDto": {
        "type": "object",
        "properties": {
          "requestFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "quoteFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "acknowledgedPrice": {
            "$ref": "#/components/schemas/BookingPriceConfirmationComparablePriceDto"
          },
          "cartQuoteReceipt": {
            "type": "string",
            "maxLength": 32768,
            "description": "Opaque, short-lived server receipt proving the preceding anonymous cart quote. It is not customer confirmation and cannot authorize checkout."
          }
        },
        "required": [
          "requestFingerprint",
          "quoteFingerprint",
          "acknowledgedPrice",
          "cartQuoteReceipt"
        ],
        "additionalProperties": false
      },
      "PublicBookingResourceSelectionDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000,
            "default": 1
          }
        },
        "required": [
          "requirementId",
          "resourceId",
          "quantity"
        ],
        "additionalProperties": false
      },
      "BookingDeliveryDestinationAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "example": "1120 S Rackham Way",
            "pattern": "\\S",
            "description": "Required value; leading and trailing whitespace is trimmed before the normalized 300-character limit and non-empty check."
          },
          "line2": {
            "type": "string",
            "example": "Suite 300",
            "description": "Optional value; leading and trailing whitespace is trimmed before the normalized 300-character limit, and whitespace-only input normalizes to the empty string."
          },
          "city": {
            "type": "string",
            "example": "Meridian",
            "pattern": "\\S",
            "description": "Required value; leading and trailing whitespace is trimmed before the normalized 200-character limit and non-empty check."
          },
          "state": {
            "type": "string",
            "example": "ID",
            "pattern": "\\S",
            "description": "Required value; leading and trailing whitespace is trimmed before the normalized 200-character limit and non-empty check."
          },
          "postalCode": {
            "type": "string",
            "example": "83642",
            "pattern": "\\S",
            "description": "Required value; leading and trailing whitespace is trimmed before the normalized 32-character limit and non-empty check."
          },
          "country": {
            "type": "string",
            "example": "US",
            "pattern": "^\\s*[A-Za-z]{2}\\s*$",
            "description": "Leading and trailing whitespace is trimmed and letters are uppercased before the normalized two-letter alphabetic country-code check."
          }
        },
        "required": [
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ],
        "additionalProperties": false
      },
      "BookingDeliverySelectionInputDto": {
        "description": "Method-discriminated booking delivery input. PICKUP forbids destinationAddress; DELIVERY requires it. Unknown keys are rejected.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "PICKUP"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method",
              "destinationAddress"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "DELIVERY"
                ]
              },
              "destinationAddress": {
                "$ref": "#/components/schemas/BookingDeliveryDestinationAddressDto"
              }
            }
          }
        ]
      },
      "PublicBookingGroupGuestDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "phone": {
            "type": "string",
            "maxLength": 64
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "PublicBookingGroupIntakeAnswerDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "value": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "CreatePublicBookingGroupMemberDto": {
        "type": "object",
        "properties": {
          "callerReference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$",
            "description": "Stable caller correlation unique within this complete group intent."
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000,
            "default": 1
          },
          "expectedCompositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Required for a package member. Must match the revision returned by the public booking-service projection."
          },
          "resourceSelections": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingResourceSelectionDto"
            }
          },
          "delivery": {
            "description": "Omitted or null means pickup.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionInputDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "guest": {
            "$ref": "#/components/schemas/PublicBookingGroupGuestDto"
          },
          "intake": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingGroupIntakeAnswerDto"
            }
          }
        },
        "required": [
          "callerReference",
          "serviceId",
          "startsAt",
          "endsAt"
        ],
        "additionalProperties": false
      },
      "CreatePublicBookingGroupDto": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "type": "string",
            "enum": [
              "booking.group/v1"
            ],
            "example": "booking.group/v1"
          },
          "customerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "customerPhone": {
            "type": "string",
            "maxLength": 64,
            "nullable": true
          },
          "shippingAddress": {
            "description": "Group shipping tax address. Delivery members always replace this with their frozen delivery destination; pickup members fall back to billing when omitted.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Group billing tax address, frozen independently onto every normalized member intent.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressDto"
              }
            ]
          },
          "cartQuote": {
            "description": "The last tax-inclusive quote rendered for this exact normalized cart. Existing clients may omit it; when present, the server re-evaluates it before any PAY_NOW capacity hold.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingGroupCartQuoteInputDto"
              }
            ]
          },
          "members": {
            "minItems": 1,
            "maxItems": 20,
            "description": "The complete intent. V1 accepts at most 20 submitted selections, 20 normalized members, and 100 server-expanded capacity anchors across the group. Groups containing composed selections additionally cap the complete materialized Commerce graph at 100 lines.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePublicBookingGroupMemberDto"
            }
          }
        },
        "required": [
          "contractVersion",
          "customerName",
          "customerEmail",
          "members"
        ],
        "additionalProperties": false
      },
      "PublicBookingAppliedPricingPolicyDto": {
        "type": "object",
        "properties": {
          "revisionNumber": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "bandUpperBoundMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "factorBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "elapsedMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "minimumDurationMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "graceMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "effectiveMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "derivedUnitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "revisionNumber",
          "bandUpperBoundMinutes",
          "factorBasisPoints",
          "elapsedMinutes",
          "minimumDurationMinutes",
          "graceMinutes",
          "effectiveMinutes",
          "derivedUnitPriceInCents"
        ]
      },
      "PublicBookingPricingLineDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "commercialQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Frozen commercial line quantity. This can differ from the operational booking quantity."
          },
          "unitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Frozen unit price. May be negative only for an ADJUSTMENT credit line."
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Frozen line subtotal. May be negative only for an ADJUSTMENT credit line."
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Frozen line total. May be negative only for an ADJUSTMENT credit line."
          },
          "appliedPricingPolicy": {
            "nullable": true,
            "description": "Frozen customer-safe duration-band evidence. Internal policy, revision, and band identifiers are omitted.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingAppliedPricingPolicyDto"
              }
            ]
          }
        },
        "required": [
          "name",
          "commercialQuantity",
          "unitPriceInCents",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "appliedPricingPolicy"
        ]
      },
      "PublicBookingPricingPresentationDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "pricedAt": {
            "type": "string",
            "format": "date-time"
          },
          "elapsedMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1,
            "description": "Frozen elapsed duration when the priced lines agree on one duration-policy evaluation; null for scalar or legacy pricing."
          },
          "operationalQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Operational quantity reserved by the booking, kept separate from commercial line quantities."
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingPricingLineDto"
            }
          }
        },
        "required": [
          "currency",
          "pricedAt",
          "elapsedMinutes",
          "operationalQuantity",
          "totalInCents",
          "lines"
        ]
      },
      "PublicBookingGroupCartQuoteMemberDto": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "callerReference": {
            "type": "string"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "pricing": {
            "nullable": true,
            "description": "Customer-safe pricing presentation when the frozen pricing evidence is presentable. Null does not change the authoritative quoted money.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingPricingPresentationDto"
              }
            ]
          }
        },
        "required": [
          "ordinal",
          "callerReference",
          "serviceId",
          "pricing"
        ]
      },
      "PublicBookingGroupCartQuoteResponseDto": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "type": "string",
            "enum": [
              "booking.group/v1"
            ]
          },
          "requestFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "quoteFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "price": {
            "$ref": "#/components/schemas/BookingPriceConfirmationComparablePriceDto"
          },
          "cartQuoteReceipt": {
            "type": "string",
            "maxLength": 32768
          },
          "quoteExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingGroupCartQuoteMemberDto"
            }
          }
        },
        "required": [
          "contractVersion",
          "requestFingerprint",
          "quoteFingerprint",
          "price",
          "cartQuoteReceipt",
          "quoteExpiresAt",
          "members"
        ]
      },
      "BookingCartQuoteStaleDetailsDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "CART_QUOTE_STALE"
            ]
          },
          "acknowledgedPrice": {
            "$ref": "#/components/schemas/BookingPriceConfirmationComparablePriceDto"
          },
          "currentPrice": {
            "$ref": "#/components/schemas/BookingPriceConfirmationComparablePriceDto"
          },
          "requestFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "currentQuoteFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "confirmedPriceReceipt": {
            "type": "string",
            "nullable": true,
            "example": null
          },
          "receiptExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "example": null
          }
        },
        "required": [
          "reason",
          "acknowledgedPrice",
          "currentPrice",
          "requestFingerprint",
          "currentQuoteFingerprint",
          "confirmedPriceReceipt",
          "receiptExpiresAt"
        ]
      },
      "BookingCartQuoteStaleErrorDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "BOOKING_PRICE_CONFIRMATION_REQUIRED"
            ],
            "example": "BOOKING_PRICE_CONFIRMATION_REQUIRED"
          },
          "message": {
            "type": "string",
            "example": "The tax-inclusive booking total changed. Review the current total and retry."
          },
          "details": {
            "$ref": "#/components/schemas/BookingCartQuoteStaleDetailsDto"
          }
        },
        "required": [
          "code",
          "message",
          "details"
        ]
      },
      "CheckoutTaxDisclosureDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "manual_no_tax"
            ],
            "description": "Tax posture recorded for this order/session."
          },
          "provider": {
            "type": "string",
            "example": "manual_no_tax",
            "description": "Snapshot provider discriminator."
          },
          "litecommerceCalculated": {
            "type": "boolean",
            "example": false,
            "description": "False when cartonium did not calculate tax for this order."
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32",
            "example": 0,
            "description": "Tax amount recorded on the snapshot."
          },
          "label": {
            "type": "string",
            "example": "Tax not calculated by litecommerce"
          },
          "message": {
            "type": "string",
            "example": "litecommerce did not calculate sales tax for this order. The merchant accepted responsibility for manual tax handling."
          },
          "warning": {
            "type": "string",
            "nullable": true,
            "description": "Operator-visible warning recorded on the snapshot."
          },
          "acknowledgementVersion": {
            "type": "string",
            "nullable": true,
            "description": "Server acknowledgement contract version recorded at save time."
          },
          "acknowledgedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the tenant owner/admin acknowledgement was recorded."
          },
          "settingsRevision": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Organization settings revision used when the manual/no-tax snapshot was written."
          }
        },
        "required": [
          "mode",
          "provider",
          "litecommerceCalculated",
          "taxInCents",
          "label",
          "message",
          "warning",
          "acknowledgementVersion",
          "acknowledgedAt",
          "settingsRevision"
        ]
      },
      "PublicBookingGroupPricingSummaryDto": {
        "type": "object",
        "properties": {
          "subtotalInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Frozen aggregate line subtotal from the authoritative CheckoutSession or member Sales records."
          },
          "discountInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Frozen aggregate discount allocated by the server. Clients must not infer this from total differences."
          },
          "taxInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe aggregate manual/no-tax disclosure. Raw tax evidence and member addresses remain server-only.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Frozen commercial total: subtotal minus discount plus tax. Booking delivery is a member fee already included in subtotal, not a separate retail shipping charge."
          },
          "amountDueNowInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Initial server-authoritative collection amount. Zero for APPROVE_PAY_LATER and zero-total groups."
          },
          "remainingBalanceInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Frozen balance outside the initial due-now collection. It is always total minus due now; APPROVE_PAY_LATER therefore preserves the bound member Sales total while each member commerce summary separately reports its current balance."
          }
        },
        "required": [
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "totalInCents",
          "amountDueNowInCents",
          "remainingBalanceInCents"
        ]
      },
      "CustomerPackageComponentDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "commercialQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Commercial pricing quantity. For FIXED_PRICE booking components this intentionally remains 1."
          },
          "includedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Frozen operational quantity included in the selected package. This is the composition effective quantity."
          },
          "unitPriceInCents": {
            "type": "number",
            "description": "Frozen unit price in minor units (cents)."
          },
          "subtotalInCents": {
            "type": "number"
          },
          "intrinsicSavingsInCents": {
            "type": "number",
            "description": "Intrinsic COMPOSED_PRODUCT savings allocated to this component."
          },
          "promotionDiscountInCents": {
            "type": "number",
            "description": "Later coupon, automatic, bundle, or entitlement savings allocated to this component, excluding intrinsic package savings."
          },
          "discountInCents": {
            "type": "number",
            "description": "Total component discount: intrinsic package savings plus external promotions."
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          }
        },
        "required": [
          "name",
          "commercialQuantity",
          "includedQuantity",
          "unitPriceInCents",
          "subtotalInCents",
          "intrinsicSavingsInCents",
          "promotionDiscountInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents"
        ]
      },
      "CustomerPackageGroupDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "title": {
            "type": "string"
          },
          "selectedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Top-level package quantity selected by the customer."
          },
          "subtotalInCents": {
            "type": "number"
          },
          "intrinsicSavingsInCents": {
            "type": "number"
          },
          "promotionDiscountInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          },
          "components": {
            "minItems": 2,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageComponentDto"
            }
          }
        },
        "required": [
          "kind",
          "title",
          "selectedQuantity",
          "subtotalInCents",
          "intrinsicSavingsInCents",
          "promotionDiscountInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "components"
        ]
      },
      "PublicBookingGroupCheckoutSummaryDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ]
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "amountDueNowInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe aggregate manual/no-tax disclosure. Raw tax evidence and member addresses remain server-only.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          }
        },
        "required": [
          "status",
          "totalInCents",
          "amountDueNowInCents",
          "taxInCents",
          "taxDisclosure",
          "expiresAt",
          "packages"
        ]
      },
      "PublicBookingGroupAgreementDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "ACTION_REQUIRED",
              "READY_TO_RESUME",
              "COMPLETED",
              "REMEDIATION_REQUIRED"
            ]
          },
          "nextAction": {
            "type": "string",
            "enum": [
              "COMPLETE_AGREEMENT",
              "RESUME_BOOKING_REQUEST"
            ],
            "nullable": true,
            "description": "The only agreement-specific customer action. Null once the frozen request has advanced or no booking-request agreement applies."
          }
        },
        "required": [
          "status",
          "nextAction"
        ]
      },
      "PublicBookingGroupCommerceSummaryDto": {
        "type": "object",
        "properties": {
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe manual/no-tax disclosure. Provider evidence, addresses, and calculation identifiers are never exposed.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          }
        },
        "required": [
          "commercialStatus",
          "paymentStatus",
          "totalInCents",
          "taxInCents",
          "taxDisclosure",
          "amountPaidInCents",
          "balanceDueInCents",
          "displayNumber",
          "packages"
        ]
      },
      "PublicBookingGroupMemberResponseDto": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "callerReference": {
            "type": "string"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "AGREEMENT_REQUIRED",
              "PENDING_REQUEST",
              "REQUESTED",
              "HELD",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "FAILED"
            ]
          },
          "delivery": {
            "nullable": true,
            "description": "Frozen browser-safe delivery evidence. HELD groups read the active hold; commercially bound groups read the authoritative member Sales snapshot. Null before approval/capacity or when unavailable.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
              }
            ]
          },
          "commerce": {
            "nullable": true,
            "description": "Member-scoped shared Sales summary after aggregate commercial binding.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingGroupCommerceSummaryDto"
              }
            ]
          },
          "pricingDetails": {
            "nullable": true,
            "description": "Frozen line, quantity, per-unit, duration-band, revision-number, and total evidence from the persisted Commerce revision. Null before commercial binding or for legacy pricing snapshots.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingPricingPresentationDto"
              }
            ]
          }
        },
        "required": [
          "ordinal",
          "callerReference",
          "serviceId",
          "startsAt",
          "endsAt",
          "quantity",
          "status",
          "delivery",
          "commerce",
          "pricingDetails"
        ]
      },
      "PublicBookingGroupResponseDto": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "type": "string",
            "enum": [
              "booking.group/v1"
            ]
          },
          "publicRef": {
            "type": "string",
            "pattern": "^b[a-z0-9]{25}$",
            "description": "Non-authorizing correlation reference."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "AWAITING_APPROVAL",
              "HELD",
              "AWAITING_PAYMENT",
              "CONFIRMING",
              "RECONCILIATION_REQUIRED",
              "CONFIRMED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "FAILED"
            ]
          },
          "settlementPosture": {
            "type": "string",
            "enum": [
              "PAY_NOW",
              "APPROVE_THEN_PAY",
              "APPROVE_PAY_LATER"
            ]
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "expiresAt": {
            "format": "date-time",
            "type": "string"
          },
          "serverTime": {
            "format": "date-time",
            "type": "string"
          },
          "expiresInSeconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "resumeToken": {
            "type": "string",
            "nullable": true,
            "description": "Fresh response-only resume proof on create/recovery replay; never persisted raw and null on ordinary reads."
          },
          "pricing": {
            "nullable": true,
            "description": "Authoritative aggregate commercial breakdown after binding. Null before pricing exists and on legacy idempotency outcomes that predate this additive projection; clients must not fabricate missing values. APPROVE_PAY_LATER has pricing without a CheckoutSession or payment handoff.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingGroupPricingSummaryDto"
              }
            ]
          },
          "checkout": {
            "nullable": true,
            "description": "Safe aggregate collection summary. No CheckoutSession id or raw capability is exposed.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingGroupCheckoutSummaryDto"
              }
            ]
          },
          "resumeExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "agreement": {
            "description": "Neutral action state for the exact frozen booking-request requirement. It exposes no database, execution, participant, or verification identifiers.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingGroupAgreementDto"
              }
            ]
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingGroupMemberResponseDto"
            }
          }
        },
        "required": [
          "contractVersion",
          "publicRef",
          "status",
          "settlementPosture",
          "currency",
          "expiresAt",
          "serverTime",
          "expiresInSeconds",
          "resumeToken",
          "pricing",
          "checkout",
          "resumeExpiresAt",
          "agreement",
          "members"
        ]
      },
      "BookingPriceConfirmationDto": {
        "type": "object",
        "properties": {
          "confirmedPriceReceipt": {
            "type": "string",
            "maxLength": 32768,
            "description": "Signed, request-bound tax-inclusive quote receipt returned by a prior BOOKING_PRICE_CONFIRMATION_REQUIRED response."
          },
          "priceConfirmed": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Must be literal true after the customer renders and explicitly accepts the receipt total."
          }
        },
        "additionalProperties": false
      },
      "HandoffPublicKeyDto": {
        "type": "object",
        "properties": {
          "crv": {
            "type": "string",
            "enum": [
              "P-256"
            ]
          },
          "kty": {
            "type": "string",
            "enum": [
              "EC"
            ]
          },
          "x": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "y": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          }
        },
        "required": [
          "crv",
          "kty",
          "x",
          "y"
        ],
        "additionalProperties": false
      },
      "MintHostedHandoffDto": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "pattern": "^a[a-z0-9]{25}$",
            "description": "Caller-generated CSPRNG action value. Body only; API retains only its digest."
          },
          "mintOperationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Stable caller-generated mint operation; distinct from the later signed exchange operation."
          },
          "publicKey": {
            "description": "Exactly the four public P-256 JWK fields; private key remains non-exportable in the initiating browser.",
            "allOf": [
              {
                "$ref": "#/components/schemas/HandoffPublicKeyDto"
              }
            ]
          },
          "expectedCapabilityGeneration": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]{0,18})$",
            "description": "Required for intentional replacement in the same admission epoch. Never resets deadlines or the eight-exchange/eight-candidate budgets."
          }
        },
        "required": [
          "action",
          "mintOperationId",
          "publicKey"
        ],
        "additionalProperties": false
      },
      "HostedHandoffMetadataDto": {
        "type": "object",
        "properties": {
          "publicRef": {
            "type": "string"
          },
          "actionUrl": {
            "type": "string",
            "description": "Exact HTTPS body-only form POST destination. No query, fragment or reusable capability."
          },
          "sourceOrigin": {
            "type": "string"
          },
          "hostedOrigin": {
            "type": "string"
          },
          "returnPath": {
            "type": "string"
          },
          "actionHash": {
            "type": "string",
            "description": "API-issued canonical base64url SHA-256 action digest."
          },
          "capabilityGeneration": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]{0,18})$"
          },
          "admittedProofGeneration": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]{0,18})$"
          },
          "nonce": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "proofCeilingAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "publicRef",
          "actionUrl",
          "sourceOrigin",
          "hostedOrigin",
          "returnPath",
          "actionHash",
          "capabilityGeneration",
          "admittedProofGeneration",
          "nonce",
          "expiresAt",
          "proofCeilingAt"
        ]
      },
      "BookingReasonDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "reason"
        ]
      },
      "RefundComponentAllocationDto": {
        "type": "object",
        "properties": {
          "componentKind": {
            "type": "string",
            "enum": [
              "LINE",
              "SHIPPING"
            ],
            "description": "LINE allocates refund value to one frozen Sales line; SHIPPING allocates it to the frozen shipping component."
          },
          "lineId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Required when componentKind=LINE and forbidden for SHIPPING. The id must belong to the record's frozen revision."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Gross refund cents assigned to this component, including that component's tax where applicable."
          }
        },
        "required": [
          "componentKind",
          "amountInCents"
        ]
      },
      "BookingGroupRefundReconciliationAllocationDto": {
        "type": "object",
        "properties": {
          "callerReference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$",
            "description": "Stable booking-group caller reference whose original charge allocation receives this refund amount."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Exact cents from the imported provider refund to freeze against this member."
          },
          "components": {
            "minItems": 1,
            "maxItems": 100,
            "description": "Exact component allocation inside this member Sales record. Gross component cents must sum to amountInCents.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RefundComponentAllocationDto"
            }
          }
        },
        "required": [
          "callerReference",
          "amountInCents",
          "components"
        ]
      },
      "IssueBookingGroupRefundDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "allocations": {
            "minItems": 1,
            "maxItems": 20,
            "description": "Exact member allocation plan. Caller references must be unique and amounts must sum to the imported refund.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingGroupRefundReconciliationAllocationDto"
            }
          }
        },
        "required": [
          "reason",
          "allocations"
        ]
      },
      "BookingGroupRefundReconciliationResultAllocationDto": {
        "type": "object",
        "properties": {
          "callerReference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$",
            "description": "Stable booking-group caller reference whose original charge allocation receives this refund amount."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Exact cents from the imported provider refund to freeze against this member."
          }
        },
        "required": [
          "callerReference",
          "amountInCents"
        ]
      },
      "BookingGroupSharedRefundResponseDto": {
        "type": "object",
        "properties": {
          "bookingGroupId": {
            "type": "string",
            "format": "uuid"
          },
          "refundPaymentAttemptId": {
            "type": "string",
            "format": "uuid"
          },
          "stripeRefundId": {
            "type": "string",
            "example": "re_3N..."
          },
          "providerStatus": {
            "type": "string",
            "enum": [
              "PROCESSING",
              "SUCCEEDED"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingGroupRefundReconciliationResultAllocationDto"
            }
          }
        },
        "required": [
          "bookingGroupId",
          "refundPaymentAttemptId",
          "stripeRefundId",
          "providerStatus",
          "amountInCents",
          "currency",
          "allocations"
        ]
      },
      "ReconcileBookingGroupRefundDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "allocations": {
            "minItems": 1,
            "maxItems": 20,
            "description": "Exact member allocation plan. Caller references must be unique and amounts must sum to the imported refund.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingGroupRefundReconciliationAllocationDto"
            }
          }
        },
        "required": [
          "reason",
          "allocations"
        ]
      },
      "BookingGroupRefundReconciliationResponseDto": {
        "type": "object",
        "properties": {
          "bookingGroupId": {
            "type": "string",
            "format": "uuid"
          },
          "refundPaymentAttemptId": {
            "type": "string",
            "format": "uuid"
          },
          "stripeRefundId": {
            "type": "string",
            "example": "re_3N..."
          },
          "reconciliationStatus": {
            "type": "string",
            "enum": [
              "RESOLVED"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingGroupRefundReconciliationResultAllocationDto"
            }
          }
        },
        "required": [
          "bookingGroupId",
          "refundPaymentAttemptId",
          "stripeRefundId",
          "reconciliationStatus",
          "amountInCents",
          "currency",
          "allocations"
        ]
      },
      "BookingResourceSelectionDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          }
        },
        "required": [
          "requirementId",
          "resourceId",
          "quantity"
        ],
        "additionalProperties": false
      },
      "CreateMerchantBookingDto": {
        "type": "object",
        "properties": {
          "intent": {
            "type": "string",
            "enum": [
              "DRAFT",
              "REQUEST",
              "RESERVE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000,
            "default": 1
          },
          "expectedCompositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Required catalog composition revision when the selected service is sold as a package."
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 44640
          },
          "resourceSelections": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingResourceSelectionDto"
            }
          },
          "delivery": {
            "description": "Omitted or null means pickup. Otherwise, pickup or delivery intent is evaluated when RESERVE is requested; DRAFT/REQUEST retain it for the later reserve action.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionInputDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "description": "Existing customer in the active tenant. Mutually exclusive with inline customer fields."
          },
          "customerName": {
            "type": "string",
            "maxLength": 200
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "customerPhone": {
            "type": "string",
            "nullable": true,
            "maxLength": 50
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/CheckoutAddressDto"
          },
          "billingAddress": {
            "$ref": "#/components/schemas/CheckoutAddressDto"
          }
        },
        "required": [
          "intent",
          "serviceId",
          "startsAt",
          "endsAt"
        ],
        "additionalProperties": false
      },
      "BookingLifecycleCommerceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32"
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "commercialStatus",
          "paymentStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "balanceDueInCents",
          "displayNumber"
        ]
      },
      "BookingLifecycleDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "approvalStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "APPROVED",
              "DECLINED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "delivery": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
              }
            ]
          },
          "commerce": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingLifecycleCommerceDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "serviceId",
          "startsAt",
          "endsAt",
          "quantity",
          "status",
          "approvalStatus",
          "currency",
          "totalInCents",
          "archivedAt",
          "delivery",
          "commerce"
        ]
      },
      "PublicBookingAvailabilitySearchDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "description": "Exactly one of serviceId or serviceSlug is required."
          },
          "serviceSlug": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "description": "Exactly one of serviceId or serviceSlug is required."
          },
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive search start. For EXACT_RANGE this is the requested booking start."
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive search end. For EXACT_RANGE this is the requested booking end."
          },
          "timezone": {
            "type": "string",
            "description": "Presentation timezone. Candidate generation remains anchored to the service/rule timezones."
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000,
            "default": 1
          },
          "expectedCompositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Required for a package service. Must match the revision returned by the public service projection."
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 44640,
            "description": "Required when choosing a non-default FIXED_DURATION option."
          },
          "resourceSelections": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingResourceSelectionDto"
            }
          }
        },
        "required": [
          "startsAt",
          "endsAt"
        ],
        "additionalProperties": false
      },
      "PublicBookingAvailabilityDiagnosticsDto": {
        "type": "object",
        "properties": {
          "requestedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "availableQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "resourceSelectionRequired": {
            "type": "boolean"
          }
        },
        "required": [
          "requestedQuantity",
          "availableQuantity",
          "resourceSelectionRequired"
        ]
      },
      "PublicBookingResourceOptionDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "availableQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "requirementId",
          "resourceId",
          "slug",
          "name",
          "resourceType",
          "availableQuantity"
        ]
      },
      "PublicBookingRequirementOptionsDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "selectionStrategy": {
            "type": "string",
            "enum": [
              "ANY_AVAILABLE",
              "SPECIFIC_RESOURCE",
              "CUSTOMER_SELECTS",
              "MERCHANT_ASSIGN"
            ]
          },
          "requiredQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingResourceOptionDto"
            }
          }
        },
        "required": [
          "requirementId",
          "selectionStrategy",
          "requiredQuantity",
          "options"
        ]
      },
      "PublicBookingPricingHookDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "FLAT_TIME",
              "FIXED_PRICE",
              "PRICING_STRUCTURE"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "RESERVED_WINDOW",
              "CHARGED_DURATION",
              "FIXED_PRICE"
            ]
          },
          "basePriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Configured base price only."
          },
          "pricingIntervalMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1,
            "description": "Minutes represented by one base-price unit for FLAT_TIME; null for fixed pricing."
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "authoritative": {
            "type": "boolean",
            "example": false,
            "description": "Always false in #640: checkout/shared commerce remains authoritative for final pricing."
          },
          "fromPriceInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 0,
            "description": "ADR-043 reachable From price: the minimum evaluated per-unit total across the actual bookable-duration domain of the service, including the published minimum-then-grace transform - never the first stored rate band merely because it exists. Null when the service has no bookable-duration domain, when the pricing configuration cannot be evaluated, or on slot-level hooks (slots name their own concrete window). Not authoritative."
          },
          "fromDurationMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1,
            "description": "The bookable-duration-domain minutes fromPriceInCents was evaluated at. Null exactly when fromPriceInCents is null."
          }
        },
        "required": [
          "mode",
          "basis",
          "basePriceInCents",
          "pricingIntervalMinutes",
          "currency",
          "authoritative",
          "fromPriceInCents",
          "fromDurationMinutes"
        ]
      },
      "PublicBookingAvailabilitySlotDto": {
        "type": "object",
        "properties": {
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "availableQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "diagnostics": {
            "$ref": "#/components/schemas/PublicBookingAvailabilityDiagnosticsDto"
          },
          "resourceOptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingRequirementOptionsDto"
            }
          },
          "pricing": {
            "$ref": "#/components/schemas/PublicBookingPricingHookDto"
          }
        },
        "required": [
          "startsAt",
          "endsAt",
          "availableQuantity",
          "diagnostics",
          "resourceOptions",
          "pricing"
        ]
      },
      "PublicBookingAvailabilityResponseDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "periodMode": {
            "type": "string",
            "enum": [
              "EXACT_RANGE",
              "FIXED_DURATION",
              "FIXED_SLOT"
            ]
          },
          "timezone": {
            "type": "string"
          },
          "generatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the hard candidate cap was reached; narrow the search window to continue."
          },
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingAvailabilitySlotDto"
            }
          },
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "LIMITED",
              "UNAVAILABLE"
            ],
            "description": "Top-level availability for the complete selection after all package components are reconciled."
          },
          "availableQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Maximum complete-selection quantity available across the returned slots."
          },
          "compositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true,
            "description": "Frozen package definition revision used for this availability result; null for an ordinary service."
          }
        },
        "required": [
          "serviceId",
          "periodMode",
          "timezone",
          "generatedAt",
          "truncated",
          "slots",
          "availability",
          "availableQuantity",
          "compositionRevision"
        ]
      },
      "MerchantBookingServiceRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ]
          },
          "periodMode": {
            "type": "string",
            "enum": [
              "EXACT_RANGE",
              "FIXED_DURATION",
              "FIXED_SLOT"
            ]
          },
          "timezone": {
            "type": "string",
            "description": "Effective service timezone (service override, else organization)."
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "bookingType",
          "periodMode",
          "timezone"
        ]
      },
      "MerchantBookingCommerceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ]
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Display-only agreement compatibility summary; never a booking or payment gate."
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32"
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int32"
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32"
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "outboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "physicalProductQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "physicallyAllocatedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "physicallyFulfilledQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "displayNumber",
          "type",
          "commercialStatus",
          "paymentStatus",
          "fulfillmentStatus",
          "signatureStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "orderId",
          "outboundFulfillmentMode",
          "outboundDueAt",
          "inboundFulfillmentMode",
          "inboundDueAt",
          "physicalProductQuantity",
          "physicallyAllocatedQuantity",
          "physicallyFulfilledQuantity"
        ]
      },
      "MerchantBookingResourceSummaryItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "allocationCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "assignedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "shortageQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "name",
          "resourceType",
          "allocationCount",
          "assignedQuantity",
          "shortageQuantity"
        ]
      },
      "MerchantBookingResourceUnitRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "identifier": {
            "type": "string"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "identifier",
          "sku",
          "barcode"
        ]
      },
      "MerchantBookingAllocationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "requirementId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "allocationMode": {
            "type": "string",
            "enum": [
              "POOLED_QUANTITY",
              "EXACT_UNIT"
            ]
          },
          "resourceUnit": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantBookingResourceUnitRefDto"
              }
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "shortageQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "shortageReason": {
            "type": "string",
            "nullable": true
          },
          "shortageApprovedByUserId": {
            "type": "string",
            "nullable": true
          },
          "shortageApprovedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "shortageResolution": {
            "type": "string",
            "enum": [
              "SUBSTITUTED",
              "EXTERNALLY_SOURCED",
              "CAPACITY_ADDED"
            ],
            "nullable": true
          },
          "shortageResolutionNote": {
            "type": "string",
            "nullable": true
          },
          "shortageResolvedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "requirementId",
          "resourceId",
          "allocationMode",
          "resourceUnit",
          "quantity",
          "shortageQuantity",
          "shortageReason",
          "shortageApprovedByUserId",
          "shortageApprovedAt",
          "shortageResolution",
          "shortageResolutionNote",
          "shortageResolvedAt"
        ]
      },
      "MerchantBookingResourceSummaryDto": {
        "type": "object",
        "properties": {
          "requirementCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "requiredQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "allocationCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "assignedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "shortageQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unresolvedShortageQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "allocationConflict": {
            "type": "boolean"
          },
          "overrideCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingResourceSummaryItemDto"
            }
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingAllocationDto"
            }
          }
        },
        "required": [
          "requirementCount",
          "requiredQuantity",
          "allocationCount",
          "assignedQuantity",
          "shortageQuantity",
          "unresolvedShortageQuantity",
          "allocationConflict",
          "overrideCount",
          "resources",
          "allocations"
        ]
      },
      "MerchantBookingAllowedActionsDto": {
        "type": "object",
        "properties": {
          "approve": {
            "type": "boolean"
          },
          "decline": {
            "type": "boolean"
          },
          "cancel": {
            "type": "boolean"
          },
          "reschedule": {
            "type": "boolean"
          },
          "start": {
            "type": "boolean"
          },
          "complete": {
            "type": "boolean"
          },
          "archive": {
            "type": "boolean"
          }
        },
        "required": [
          "approve",
          "decline",
          "cancel",
          "reschedule",
          "start",
          "complete",
          "archive"
        ]
      },
      "MerchantBookingAttentionFlagsDto": {
        "type": "object",
        "properties": {
          "needsApproval": {
            "type": "boolean"
          },
          "paymentDue": {
            "type": "boolean"
          },
          "unassigned": {
            "type": "boolean"
          },
          "shortage": {
            "type": "boolean"
          },
          "allocationConflict": {
            "type": "boolean"
          },
          "overridden": {
            "type": "boolean"
          }
        },
        "required": [
          "needsApproval",
          "paymentDue",
          "unassigned",
          "shortage",
          "allocationConflict",
          "overridden"
        ]
      },
      "MerchantBookingChangeRequestDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "RESCHEDULE",
              "CANCEL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "DECLINED",
              "WITHDRAWN"
            ]
          },
          "requestedStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "requestedEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "status",
          "requestedStartsAt",
          "requestedEndsAt",
          "reason",
          "createdAt"
        ]
      },
      "MerchantBookingDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "startDate": {
            "format": "date-time",
            "type": "string"
          },
          "endDate": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "totalPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Compatibility total: canonical Sales total for modern bookings, legacy local total only for service-less rows."
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "commerceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "customerPhone": {
            "type": "string",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "description": "Effective booking timezone (booking snapshot, service override, then organization)."
          },
          "approvalStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "APPROVED",
              "DECLINED"
            ]
          },
          "cancellationReason": {
            "type": "string",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "delivery": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
              }
            ]
          },
          "shippingAddress": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressDto"
              }
            ]
          },
          "service": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantBookingServiceRefDto"
              }
            ]
          },
          "commerce": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantBookingCommerceDto"
              }
            ]
          },
          "resourceSummary": {
            "$ref": "#/components/schemas/MerchantBookingResourceSummaryDto"
          },
          "allowedActions": {
            "$ref": "#/components/schemas/MerchantBookingAllowedActionsDto"
          },
          "attentionFlags": {
            "$ref": "#/components/schemas/MerchantBookingAttentionFlagsDto"
          },
          "pendingChangeRequest": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantBookingChangeRequestDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "userId",
          "startDate",
          "endDate",
          "status",
          "quantity",
          "totalPriceInCents",
          "notes",
          "serviceId",
          "commerceRecordId",
          "customerId",
          "customerEmail",
          "customerName",
          "customerPhone",
          "timezone",
          "approvalStatus",
          "cancellationReason",
          "cancelledAt",
          "completedAt",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "delivery",
          "shippingAddress",
          "billingAddress",
          "service",
          "commerce",
          "resourceSummary",
          "allowedActions",
          "attentionFlags",
          "pendingChangeRequest"
        ]
      },
      "MerchantBookingListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "MerchantBookingCalendarEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable milestone key (`bookingId:start|end`)."
          },
          "kind": {
            "type": "string",
            "enum": [
              "BOOKING_START",
              "BOOKING_END",
              "DELIVERY_DUE",
              "CUSTOMER_PICKUP_DUE",
              "RETRIEVAL_DUE",
              "CUSTOMER_RETURN_DUE"
            ]
          },
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "occursAt": {
            "format": "date-time",
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "BOOKING",
              "SHARED_COMMERCE"
            ]
          },
          "posture": {
            "type": "string",
            "enum": [
              "SCHEDULED",
              "DUE"
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "bookingId",
          "occursAt",
          "source",
          "posture"
        ]
      },
      "MerchantBookingCalendarBlackoutDto": {
        "type": "object",
        "properties": {
          "occurrenceId": {
            "type": "string",
            "description": "Stable occurrence key (`blackoutId:startsAt`) for calendar rendering."
          },
          "blackoutId": {
            "type": "string",
            "format": "uuid"
          },
          "targetType": {
            "type": "string",
            "enum": [
              "ORGANIZATION",
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "resourceName": {
            "type": "string",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "reason": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "occurrenceId",
          "blackoutId",
          "targetType",
          "serviceId",
          "resourceId",
          "serviceName",
          "resourceName",
          "startsAt",
          "endsAt",
          "reason"
        ]
      },
      "MerchantBookingStatusCountDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "status",
          "count"
        ]
      },
      "MerchantBookingCalendarSummaryDto": {
        "type": "object",
        "properties": {
          "bookingCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "blackoutCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "eventCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "needsApprovalCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "paymentDueCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unassignedCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "shortageCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "overriddenCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingStatusCountDto"
            }
          }
        },
        "required": [
          "bookingCount",
          "blackoutCount",
          "eventCount",
          "needsApprovalCount",
          "paymentDueCount",
          "unassignedCount",
          "shortageCount",
          "overriddenCount",
          "statuses"
        ]
      },
      "MerchantBookingCalendarDto": {
        "type": "object",
        "properties": {
          "timezone": {
            "type": "string",
            "description": "Organization IANA timezone."
          },
          "from": {
            "format": "date-time",
            "type": "string"
          },
          "to": {
            "format": "date-time",
            "type": "string"
          },
          "bookings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingDto"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingCalendarEventDto"
            }
          },
          "blackouts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingCalendarBlackoutDto"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/MerchantBookingCalendarSummaryDto"
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the bounded booking, recurring-source scan, or expanded-occurrence cap was reached; narrow/filter the range."
          }
        },
        "required": [
          "timezone",
          "from",
          "to",
          "bookings",
          "events",
          "blackouts",
          "summary",
          "truncated"
        ]
      },
      "UpdateMerchantBookingTaxAddressesDto": {
        "type": "object",
        "properties": {
          "shippingAddress": {
            "nullable": true,
            "description": "Normalized shipping tax address. Omit to retain it or send null to clear it. A frozen delivery destination remains authoritative.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "nullable": true,
            "description": "Normalized billing tax address. Omit to retain it or send null to clear it.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressDto"
              }
            ]
          }
        }
      },
      "UpdateBookingPhysicalPlanDto": {
        "type": "object",
        "properties": {
          "outboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "ResolveBookingShortageDto": {
        "type": "object",
        "properties": {
          "resolution": {
            "type": "string",
            "enum": [
              "SUBSTITUTED",
              "EXTERNALLY_SOURCED",
              "CAPACITY_ADDED"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "resolution",
          "reason"
        ]
      },
      "RescheduleBookingDto": {
        "type": "object",
        "properties": {
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "resourceSelections": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingResourceSelectionDto"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "startsAt",
          "endsAt",
          "reason"
        ]
      },
      "MerchantBookingAssignmentRequirementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ],
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "required": {
            "type": "boolean"
          },
          "selectionStrategy": {
            "type": "string",
            "enum": [
              "ANY_AVAILABLE",
              "SPECIFIC_RESOURCE",
              "CUSTOMER_SELECTS",
              "MERCHANT_ASSIGN"
            ]
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "resourceId",
          "resourceType",
          "quantity",
          "required",
          "selectionStrategy",
          "sortOrder"
        ]
      },
      "MerchantBookingAssignmentProviderDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "enum": [
              "OWNER",
              "ADMIN",
              "STAFF"
            ]
          }
        },
        "required": [
          "userId",
          "email",
          "firstName",
          "lastName",
          "role"
        ]
      },
      "MerchantBookingCurrentAllocationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "requirementId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceName": {
            "type": "string"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "resourceUnitId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceUnitIdentifier": {
            "type": "string",
            "nullable": true
          },
          "allocationMode": {
            "type": "string",
            "enum": [
              "POOLED_QUANTITY",
              "EXACT_UNIT"
            ]
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "shortageQuantity": {
            "type": "integer",
            "minimum": 0
          },
          "shortageApprovedByUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "shortageApprovedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "shortageReason": {
            "type": "string",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "provider": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantBookingAssignmentProviderDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "requirementId",
          "resourceId",
          "resourceName",
          "resourceType",
          "resourceUnitId",
          "resourceUnitIdentifier",
          "allocationMode",
          "quantity",
          "shortageQuantity",
          "shortageApprovedByUserId",
          "shortageApprovedAt",
          "shortageReason",
          "startsAt",
          "endsAt",
          "provider"
        ]
      },
      "MerchantBookingAssignmentCandidateDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceName": {
            "type": "string"
          },
          "resourceSlug": {
            "type": "string"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "allocationMode": {
            "type": "string",
            "enum": [
              "POOLED_QUANTITY",
              "EXACT_UNIT"
            ]
          },
          "configuredCapacity": {
            "type": "integer",
            "minimum": 0
          },
          "activeUnitCount": {
            "type": "integer",
            "minimum": 0
          },
          "remainingQuantity": {
            "type": "integer",
            "minimum": 0
          },
          "available": {
            "type": "boolean"
          },
          "blockerCodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "provider": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantBookingAssignmentProviderDto"
              }
            ]
          }
        },
        "required": [
          "requirementId",
          "resourceId",
          "resourceName",
          "resourceSlug",
          "resourceType",
          "allocationMode",
          "configuredCapacity",
          "activeUnitCount",
          "remainingQuantity",
          "available",
          "blockerCodes",
          "provider"
        ]
      },
      "MerchantBookingAssignmentWorkspaceDto": {
        "type": "object",
        "properties": {
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "canAssign": {
            "type": "boolean"
          },
          "expectedAllocationFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "requirements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingAssignmentRequirementDto"
            }
          },
          "currentAllocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingCurrentAllocationDto"
            }
          },
          "candidates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingAssignmentCandidateDto"
            }
          },
          "conflictSignals": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "bookingId",
          "serviceId",
          "serviceName",
          "startsAt",
          "endsAt",
          "status",
          "canAssign",
          "expectedAllocationFingerprint",
          "requirements",
          "currentAllocations",
          "candidates",
          "conflictSignals"
        ]
      },
      "MerchantBookingAssignmentSelectionDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "resourceUnitIds": {
            "maxItems": 1000,
            "description": "Optional explicit serialized units. Omit to let the guarded capacity engine choose active units deterministically.",
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "requirementId",
          "resourceId",
          "quantity"
        ]
      },
      "ReplaceMerchantBookingAssignmentsDto": {
        "type": "object",
        "properties": {
          "expectedAllocationFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 fence returned by the latest assignment workspace read. The replacement fails if the live allocation set changed concurrently."
          },
          "resourceSelections": {
            "maxItems": 100,
            "description": "Complete explicit resource-selection intent. Requirements that use automatic allocation remain server-selected.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantBookingAssignmentSelectionDto"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "expectedAllocationFingerprint",
          "resourceSelections",
          "reason"
        ]
      },
      "BookingChecklistTaskDto": {
        "type": "object",
        "properties": {
          "taskKey": {
            "type": "string",
            "description": "Stable derived task key. Allocation and commerce-line source ids remain owned by their respective ledgers."
          },
          "phase": {
            "type": "string",
            "enum": [
              "PREP",
              "LOAD_OUT",
              "RETURN"
            ]
          },
          "sourceType": {
            "type": "string",
            "enum": [
              "ALLOCATION",
              "COMMERCE_LINE",
              "CUSTOM"
            ]
          },
          "sourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "label": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETE",
              "BLOCKED"
            ]
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedByUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "taskKey",
          "phase",
          "sourceType",
          "sourceId",
          "label",
          "quantity",
          "status",
          "notes",
          "completedAt",
          "completedByUserId"
        ]
      },
      "BookingChecklistProgressDto": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "complete": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "blocked": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "total",
          "complete",
          "blocked"
        ]
      },
      "BookingChecklistProductLineDto": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "plannedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "fulfilledQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "lineId",
          "name",
          "sku",
          "quantity",
          "plannedQuantity",
          "fulfilledQuantity"
        ]
      },
      "BookingChecklistShipmentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "PLANNED",
              "READY",
              "SHIPPED",
              "DELIVERED",
              "CANCELLED"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ]
          },
          "carrier": {
            "type": "string",
            "nullable": true
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true
          },
          "trackingUrl": {
            "type": "string",
            "nullable": true
          },
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "status",
          "mode",
          "carrier",
          "trackingNumber",
          "trackingUrl",
          "shippedAt",
          "deliveredAt"
        ]
      },
      "BookingPhysicalFulfillmentProjectionDto": {
        "type": "object",
        "properties": {
          "commerceRecordId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ]
          },
          "outboundMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "productLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingChecklistProductLineDto"
            }
          },
          "shipments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingChecklistShipmentDto"
            }
          }
        },
        "required": [
          "commerceRecordId",
          "status",
          "outboundMode",
          "outboundDueAt",
          "inboundMode",
          "inboundDueAt",
          "productLines",
          "shipments"
        ]
      },
      "BookingReturnProjectionDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string",
            "format": "uuid"
          },
          "returnItemId": {
            "type": "string",
            "format": "uuid"
          },
          "returnStatus": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ]
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid"
          },
          "commerceLineId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "condition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ]
          },
          "intakeNotes": {
            "type": "string",
            "nullable": true
          },
          "restockDisposition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESTOCKED",
              "NOT_ELIGIBLE",
              "NOT_APPLICABLE"
            ]
          },
          "restockedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "returnId",
          "returnItemId",
          "returnStatus",
          "receivedAt",
          "completedAt",
          "orderItemId",
          "commerceLineId",
          "name",
          "quantity",
          "condition",
          "intakeNotes",
          "restockDisposition",
          "restockedAt"
        ]
      },
      "BookingFulfillmentChecklistDto": {
        "type": "object",
        "properties": {
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "bookingStatus": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingChecklistTaskDto"
            }
          },
          "progress": {
            "$ref": "#/components/schemas/BookingChecklistProgressDto"
          },
          "physicalFulfillment": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingPhysicalFulfillmentProjectionDto"
              }
            ]
          },
          "returns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingReturnProjectionDto"
            }
          }
        },
        "required": [
          "bookingId",
          "bookingStatus",
          "startsAt",
          "endsAt",
          "serviceName",
          "tasks",
          "progress",
          "physicalFulfillment",
          "returns"
        ]
      },
      "UpdateBookingChecklistTaskDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETE",
              "BLOCKED"
            ]
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000,
            "description": "Booking-owned staff note. Null or blank clears the note."
          }
        }
      },
      "BookingReportDimensionOptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "name",
          "archivedAt"
        ]
      },
      "BookingReportDimensionsDto": {
        "type": "object",
        "properties": {
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingReportDimensionOptionDto"
            }
          },
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingReportDimensionOptionDto"
            }
          }
        },
        "required": [
          "services",
          "resources"
        ]
      },
      "BookingAvailabilityReportRowDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceName": {
            "type": "string",
            "nullable": true
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ],
            "nullable": true
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "configuredCapacity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "activeUnitCapacity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "openWindowCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "requirementCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "requiredQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "heldQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "committedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "shortageQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "remainingCapacity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "blackoutCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "controlledShortageApprovalCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "blockerCodes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "NO_OPEN_WINDOW",
                "REQUIRED_RESOURCE_UNAVAILABLE",
                "BLACKOUT",
                "CAPACITY_FULL",
                "CONTROLLED_SHORTAGE"
              ]
            }
          }
        },
        "required": [
          "serviceId",
          "serviceName",
          "resourceId",
          "resourceName",
          "resourceType",
          "userId",
          "configuredCapacity",
          "activeUnitCapacity",
          "openWindowCount",
          "requirementCount",
          "requiredQuantity",
          "heldQuantity",
          "committedQuantity",
          "shortageQuantity",
          "remainingCapacity",
          "blackoutCount",
          "controlledShortageApprovalCount",
          "blockerCodes"
        ]
      },
      "BookingAvailabilityReportDto": {
        "type": "object",
        "properties": {
          "generatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "from": {
            "format": "date-time",
            "type": "string"
          },
          "to": {
            "format": "date-time",
            "type": "string"
          },
          "rangeDimension": {
            "type": "string",
            "enum": [
              "AVAILABILITY_WINDOW",
              "FULFILLMENT_MILESTONE",
              "BOOKING_START",
              "DOCUMENT_DUE_OR_EXPIRY"
            ]
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the bounded row limit was reached."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingAvailabilityReportRowDto"
            }
          }
        },
        "required": [
          "generatedAt",
          "from",
          "to",
          "rangeDimension",
          "truncated",
          "rows"
        ]
      },
      "BookingFulfillmentDemandReportRowDto": {
        "type": "object",
        "properties": {
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "outboundMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ],
            "nullable": true
          },
          "shipmentStatuses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "PLANNED",
                "READY",
                "SHIPPED",
                "DELIVERED",
                "CANCELLED"
              ]
            }
          },
          "neededQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "assignedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "shortageQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "assignedResources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "exactAssignedAssets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "missingAssignment": {
            "type": "boolean"
          },
          "allocationConflict": {
            "type": "boolean"
          }
        },
        "required": [
          "bookingId",
          "serviceId",
          "serviceName",
          "customerName",
          "startsAt",
          "endsAt",
          "outboundMode",
          "outboundDueAt",
          "inboundMode",
          "inboundDueAt",
          "fulfillmentStatus",
          "shipmentStatuses",
          "neededQuantity",
          "assignedQuantity",
          "shortageQuantity",
          "assignedResources",
          "exactAssignedAssets",
          "missingAssignment",
          "allocationConflict"
        ]
      },
      "BookingFulfillmentDemandReportDto": {
        "type": "object",
        "properties": {
          "generatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "from": {
            "format": "date-time",
            "type": "string"
          },
          "to": {
            "format": "date-time",
            "type": "string"
          },
          "rangeDimension": {
            "type": "string",
            "enum": [
              "AVAILABILITY_WINDOW",
              "FULFILLMENT_MILESTONE",
              "BOOKING_START",
              "DOCUMENT_DUE_OR_EXPIRY"
            ],
            "description": "FULFILLMENT_MILESTONE selects bookings whose service window overlaps the half-open range or whose shared outbound/inbound due milestone falls inside it."
          },
          "truncated": {
            "type": "boolean"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingFulfillmentDemandReportRowDto"
            }
          }
        },
        "required": [
          "generatedAt",
          "from",
          "to",
          "rangeDimension",
          "truncated",
          "rows"
        ]
      },
      "BookingCurrencyRevenueTotalDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code stored on shared Sales."
          },
          "revenueInCents": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "currency",
          "revenueInCents"
        ]
      },
      "BookingLifecycleRevenueReportRowDto": {
        "type": "object",
        "properties": {
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "approvalStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "APPROVED",
              "DECLINED"
            ]
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "revenueBasis": {
            "type": "string",
            "enum": [
              "BOOKED_ORDER",
              "FINALIZED_INVOICE",
              "CASH_PAYMENT"
            ]
          },
          "revenueInCents": {
            "type": "integer",
            "format": "int32"
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "bookingId",
          "serviceId",
          "serviceName",
          "status",
          "approvalStatus",
          "startsAt",
          "endsAt",
          "revenueBasis",
          "revenueInCents",
          "balanceDueInCents",
          "paymentStatus",
          "currency"
        ]
      },
      "BookingLifecycleRevenueReportDto": {
        "type": "object",
        "properties": {
          "generatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "from": {
            "format": "date-time",
            "type": "string"
          },
          "to": {
            "format": "date-time",
            "type": "string"
          },
          "rangeDimension": {
            "type": "string",
            "enum": [
              "AVAILABILITY_WINDOW",
              "FULFILLMENT_MILESTONE",
              "BOOKING_START",
              "DOCUMENT_DUE_OR_EXPIRY"
            ]
          },
          "revenueBasis": {
            "type": "string",
            "enum": [
              "BOOKED_ORDER",
              "FINALIZED_INVOICE",
              "CASH_PAYMENT"
            ]
          },
          "truncated": {
            "type": "boolean"
          },
          "bookingCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "cancelledCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "declinedCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "completedCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "description": "The sole row currency when all money-bearing rows share one currency; null for empty or mixed-currency results."
          },
          "totalRevenueInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Safe single-currency total; null for empty or mixed-currency results. Use currencyTotals for the complete aggregate."
          },
          "currencyTotals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingCurrencyRevenueTotalDto"
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingLifecycleRevenueReportRowDto"
            }
          }
        },
        "required": [
          "generatedAt",
          "from",
          "to",
          "rangeDimension",
          "revenueBasis",
          "truncated",
          "bookingCount",
          "cancelledCount",
          "declinedCount",
          "completedCount",
          "currency",
          "totalRevenueInCents",
          "currencyTotals",
          "rows"
        ]
      },
      "BookingDocumentPaymentAgingReportRowDto": {
        "type": "object",
        "properties": {
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "documentType": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "CONTRACT",
              "BOOKING_ACTION"
            ]
          },
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "commerceRecordType": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ],
            "nullable": true
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ],
            "nullable": true
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dueOrExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "ageDays": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "agingStatus": {
            "type": "string",
            "enum": [
              "OPEN",
              "DUE_SOON",
              "OVERDUE",
              "COMPLETE"
            ]
          },
          "openActionLinkCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "accepted": {
            "type": "boolean"
          },
          "signed": {
            "type": "boolean"
          }
        },
        "required": [
          "bookingId",
          "serviceId",
          "documentType",
          "documentId",
          "displayNumber",
          "commerceRecordType",
          "commercialStatus",
          "paymentStatus",
          "sentAt",
          "dueOrExpiresAt",
          "ageDays",
          "balanceDueInCents",
          "currency",
          "agingStatus",
          "openActionLinkCount",
          "accepted",
          "signed"
        ]
      },
      "BookingDocumentPaymentAgingReportDto": {
        "type": "object",
        "properties": {
          "generatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "from": {
            "format": "date-time",
            "type": "string"
          },
          "to": {
            "format": "date-time",
            "type": "string"
          },
          "rangeDimension": {
            "type": "string",
            "enum": [
              "AVAILABILITY_WINDOW",
              "FULFILLMENT_MILESTONE",
              "BOOKING_START",
              "DOCUMENT_DUE_OR_EXPIRY"
            ]
          },
          "truncated": {
            "type": "boolean"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingDocumentPaymentAgingReportRowDto"
            }
          }
        },
        "required": [
          "generatedAt",
          "from",
          "to",
          "rangeDimension",
          "truncated",
          "rows"
        ]
      },
      "MerchantAgreementTargetResponseDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "COMMERCE_RECORD",
              "COMMERCE_REVISION",
              "BOOKING",
              "BOOKING_GROUP"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "kind",
          "id",
          "label",
          "customerId",
          "customerName"
        ]
      },
      "MerchantAgreementSubjectMemberResponseDto": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "minimum": 0
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "ordinal",
          "serviceId",
          "serviceName",
          "startsAt",
          "endsAt",
          "quantity"
        ]
      },
      "MerchantAgreementSatisfactionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "executionId": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "enum": [
              "NATIVE_EXECUTION",
              "VERIFIED_EXTERNAL"
            ]
          },
          "satisfiedAt": {
            "format": "date-time",
            "type": "string"
          },
          "revokedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "executionId",
          "source",
          "satisfiedAt",
          "revokedAt"
        ]
      },
      "MerchantAgreementRequirementResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "requirementKey": {
            "type": "string"
          },
          "policyVersion": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "WAIVED",
              "VOIDED",
              "EXPIRED",
              "REPLACED"
            ]
          },
          "gateActions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "QUOTE_ACCEPTANCE",
                "BOOKING_REQUEST",
                "BOOKING_APPROVAL",
                "BOOKING_CONFIRMATION",
                "FULFILLMENT_HANDOFF"
              ]
            }
          },
          "acceptedOrigins": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "NATIVE",
                "EXTERNAL"
              ]
            }
          },
          "requiredRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "satisfied": {
            "type": "boolean"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "stateChangedAt": {
            "format": "date-time",
            "type": "string"
          },
          "satisfactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementSatisfactionResponseDto"
            }
          }
        },
        "required": [
          "id",
          "requirementKey",
          "policyVersion",
          "state",
          "gateActions",
          "acceptedOrigins",
          "requiredRoles",
          "satisfied",
          "createdAt",
          "stateChangedAt",
          "satisfactions"
        ]
      },
      "MerchantAgreementParticipantResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "roleKey": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "roleKey",
          "state",
          "name",
          "completedAt"
        ]
      },
      "MerchantAgreementArtifactSummaryResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "RENDERED_PDF",
              "EXECUTED_PDF",
              "EXTERNAL_ORIGINAL",
              "EXECUTION_CERTIFICATE",
              "SAFE_PREVIEW"
            ]
          },
          "safetyStatus": {
            "type": "string",
            "enum": [
              "PENDING_SCAN",
              "SAFE",
              "QUARANTINED",
              "REJECTED",
              "DESTROYED"
            ]
          },
          "sizeBytes": {
            "type": "integer",
            "format": "int64"
          },
          "destroyedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "safetyStatus",
          "sizeBytes",
          "destroyedAt",
          "createdAt"
        ]
      },
      "MerchantAgreementVerificationResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "decision": {
            "type": "string",
            "enum": [
              "VERIFIED",
              "REJECTED",
              "INSUFFICIENT",
              "REVOKED"
            ]
          },
          "method": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "previousDecisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "decidedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "decision",
          "method",
          "reason",
          "previousDecisionId",
          "decidedAt"
        ]
      },
      "MerchantAgreementEventResponseDto": {
        "type": "object",
        "properties": {
          "eventType": {
            "type": "string"
          },
          "actorType": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "occurredAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "eventType",
          "actorType",
          "reason",
          "occurredAt"
        ]
      },
      "MerchantAgreementExecutionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "origin": {
            "type": "string",
            "enum": [
              "NATIVE",
              "EXTERNAL",
              "LEGACY_LITECOMMERCE"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ISSUED",
              "IN_PROGRESS",
              "EXECUTED",
              "DECLINED",
              "EXPIRED",
              "VOIDED",
              "REPLACED"
            ]
          },
          "agreementRevisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "revisionNumber": {
            "type": "number",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "sourceSystem": {
            "type": "string",
            "nullable": true
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "The number this agreement shows, by origin (E29). NATIVE: its revision's Agreement number, or null when that revision predates Agreement numbers. LEGACY_LITECOMMERCE: the contract packet's send-time number, or null for a packet that was never sent. EXTERNAL: the reference the outside agreement was supplied with."
          },
          "termsVersion": {
            "type": "string",
            "nullable": true
          },
          "issuedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "executedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementParticipantResponseDto"
            }
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementArtifactSummaryResponseDto"
            }
          },
          "verifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementVerificationResponseDto"
            }
          },
          "satisfactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementSatisfactionResponseDto"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementEventResponseDto"
            }
          }
        },
        "required": [
          "id",
          "origin",
          "state",
          "agreementRevisionId",
          "revisionNumber",
          "title",
          "sourceSystem",
          "displayNumber",
          "termsVersion",
          "issuedAt",
          "executedAt",
          "expiresAt",
          "createdAt",
          "participants",
          "artifacts",
          "verifications",
          "satisfactions",
          "events"
        ]
      },
      "MerchantAgreementCommerceLinkResponseDto": {
        "type": "object",
        "properties": {
          "commerceRecordId": {
            "type": "string",
            "format": "uuid"
          },
          "commerceRecordRevisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "commerceRecordId",
          "commerceRecordRevisionId",
          "displayNumber"
        ]
      },
      "MerchantAgreementSubjectResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "COMMERCE_RECORD",
              "COMMERCE_REVISION",
              "BOOKING",
              "BOOKING_GROUP"
            ]
          },
          "label": {
            "type": "string"
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementSubjectMemberResponseDto"
            }
          },
          "requirements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementRequirementResponseDto"
            }
          },
          "executions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementExecutionResponseDto"
            }
          },
          "commerceLinks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementCommerceLinkResponseDto"
            }
          }
        },
        "required": [
          "id",
          "kind",
          "label",
          "customerId",
          "createdAt",
          "members",
          "requirements",
          "executions",
          "commerceLinks"
        ]
      },
      "MerchantAgreementWorkspaceResponseDto": {
        "type": "object",
        "properties": {
          "target": {
            "$ref": "#/components/schemas/MerchantAgreementTargetResponseDto"
          },
          "subjects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAgreementSubjectResponseDto"
            }
          }
        },
        "required": [
          "target",
          "subjects"
        ]
      },
      "AttachMerchantAgreementRequirementDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "COMMERCE_RECORD",
              "COMMERCE_REVISION",
              "BOOKING",
              "BOOKING_GROUP"
            ]
          },
          "targetId": {
            "type": "string",
            "format": "uuid"
          },
          "requirementKey": {
            "type": "string",
            "example": "customer-terms"
          },
          "policyVersion": {
            "type": "string",
            "example": "customer-terms/v1"
          },
          "gateActions": {
            "type": "array",
            "description": "Named non-payment actions this requirement gates. An empty list records supporting evidence without gating a command.",
            "items": {
              "type": "string",
              "enum": [
                "QUOTE_ACCEPTANCE",
                "BOOKING_REQUEST",
                "BOOKING_APPROVAL",
                "BOOKING_CONFIRMATION",
                "FULFILLMENT_HANDOFF"
              ]
            }
          },
          "acceptedOrigins": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "NATIVE",
                "EXTERNAL"
              ]
            }
          },
          "requiredRoles": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "customer",
                "merchant"
              ]
            }
          },
          "acceptedTermsVersions": {
            "maxItems": 50,
            "description": "Exact lower-case terms versions accepted from outside evidence. Required when EXTERNAL is accepted.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "acceptedSourceSystems": {
            "type": "array",
            "maxItems": 6,
            "description": "Outside systems whose verified evidence may satisfy this requirement. Required when EXTERNAL is accepted.",
            "items": {
              "type": "string",
              "enum": [
                "booqable",
                "wet-signed",
                "docusign",
                "pandadoc",
                "authentisign",
                "other-external"
              ]
            }
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "kind",
          "targetId",
          "requirementKey",
          "policyVersion",
          "gateActions",
          "acceptedOrigins",
          "requiredRoles",
          "acceptedTermsVersions",
          "acceptedSourceSystems",
          "idempotencyKey",
          "reason"
        ]
      },
      "AttachMerchantAgreementRequirementResponseDto": {
        "type": "object",
        "properties": {
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "requirement": {
            "$ref": "#/components/schemas/MerchantAgreementRequirementResponseDto"
          }
        },
        "required": [
          "subjectId",
          "requirement"
        ]
      },
      "WaiveAgreementRequirementDto": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "idempotencyKey",
          "reason"
        ]
      },
      "AgreementRequirementWaiverResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "requirementKey": {
            "type": "string"
          },
          "policyVersion": {
            "type": "string"
          },
          "gateActions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "QUOTE_ACCEPTANCE",
                "BOOKING_REQUEST",
                "BOOKING_APPROVAL",
                "BOOKING_CONFIRMATION",
                "FULFILLMENT_HANDOFF"
              ]
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "WAIVED"
            ]
          },
          "stateChangedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "subjectId",
          "requirementKey",
          "policyVersion",
          "gateActions",
          "state",
          "stateChangedAt"
        ]
      },
      "AgreementContentSectionDto": {
        "type": "object",
        "properties": {
          "heading": {
            "type": "string",
            "maxLength": 500
          },
          "paragraphs": {
            "minItems": 1,
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 40000
            }
          }
        },
        "required": [
          "paragraphs"
        ]
      },
      "AgreementContentDto": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": [
              "agreement-content/v1"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 240
          },
          "sections": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementContentSectionDto"
            }
          }
        },
        "required": [
          "schemaVersion",
          "title",
          "sections"
        ]
      },
      "AgreementTemplateVersionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "templateId": {
            "type": "string",
            "format": "uuid"
          },
          "versionNumber": {
            "type": "number"
          },
          "contentSchemaVersion": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/AgreementContentDto"
          },
          "mergeFields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "templateSha256": {
            "type": "string"
          },
          "reason": {
            "type": "object",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "templateId",
          "versionNumber",
          "contentSchemaVersion",
          "content",
          "mergeFields",
          "templateSha256",
          "createdAt"
        ]
      },
      "AgreementTemplateResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "templateKey": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "object",
            "nullable": true
          },
          "archivedAt": {
            "type": "object",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "latestVersion": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/AgreementTemplateVersionResponseDto"
              }
            ]
          },
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementTemplateVersionResponseDto"
            }
          }
        },
        "required": [
          "id",
          "templateKey",
          "name",
          "createdAt",
          "updatedAt"
        ]
      },
      "CreateAgreementTemplateDto": {
        "type": "object",
        "properties": {
          "templateKey": {
            "type": "string",
            "example": "standard-rental"
          },
          "name": {
            "type": "string",
            "example": "Standard rental agreement"
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "templateKey",
          "name"
        ]
      },
      "UpdateAgreementTemplateDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Updated rental agreement"
          },
          "description": {
            "type": "object",
            "nullable": true
          }
        }
      },
      "AppendAgreementTemplateVersionDto": {
        "type": "object",
        "properties": {
          "content": {
            "description": "Exact agreement-content/v1 document. Only the server merge-field allowlist is accepted.",
            "allOf": [
              {
                "$ref": "#/components/schemas/AgreementContentDto"
              }
            ]
          },
          "reason": {
            "type": "string",
            "description": "Operator-authored reason for the new immutable version."
          }
        },
        "required": [
          "content"
        ]
      },
      "AgreementDisclosureVersionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "disclosureKey": {
            "type": "string"
          },
          "versionNumber": {
            "type": "number"
          },
          "title": {
            "type": "string"
          },
          "contentSchemaVersion": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/AgreementContentDto"
          },
          "disclosureSha256": {
            "type": "string"
          },
          "approvedAt": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "disclosureKey",
          "versionNumber",
          "title",
          "contentSchemaVersion",
          "content",
          "disclosureSha256",
          "approvedAt",
          "createdAt"
        ]
      },
      "AppendAgreementDisclosureVersionDto": {
        "type": "object",
        "properties": {
          "disclosureKey": {
            "type": "string",
            "example": "electronic-record-consent"
          },
          "content": {
            "description": "Exact agreement-content/v1 disclosure text.",
            "allOf": [
              {
                "$ref": "#/components/schemas/AgreementContentDto"
              }
            ]
          }
        },
        "required": [
          "disclosureKey",
          "content"
        ]
      },
      "PreviewAgreementTemplateDto": {
        "type": "object",
        "properties": {
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "templateVersionId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "subjectId",
          "templateVersionId"
        ]
      },
      "AgreementPreviewResponseDto": {
        "type": "object",
        "properties": {
          "templateVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "templateVersionNumber": {
            "type": "number"
          },
          "templateSha256": {
            "type": "string"
          },
          "resolvedContent": {
            "$ref": "#/components/schemas/AgreementContentDto"
          },
          "contentSha256": {
            "type": "string"
          },
          "contextSha256": {
            "type": "string"
          },
          "resolvedMergeFields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "html": {
            "type": "string"
          }
        },
        "required": [
          "templateVersionId",
          "templateVersionNumber",
          "templateSha256",
          "resolvedContent",
          "contentSha256",
          "contextSha256",
          "resolvedMergeFields",
          "html"
        ]
      },
      "AgreementRevisionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "number"
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ISSUED",
              "SUPERSEDED",
              "VOIDED"
            ]
          },
          "templateVersionId": {
            "type": "object",
            "format": "uuid",
            "nullable": true
          },
          "templateVersionNumber": {
            "type": "object",
            "nullable": true
          },
          "templateSha256": {
            "type": "object",
            "nullable": true
          },
          "disclosureVersionId": {
            "type": "object",
            "format": "uuid",
            "nullable": true
          },
          "disclosureVersionNumber": {
            "type": "object",
            "nullable": true
          },
          "disclosureSha256": {
            "type": "object",
            "nullable": true
          },
          "title": {
            "type": "object",
            "nullable": true
          },
          "contentSchemaVersion": {
            "type": "string"
          },
          "content": {
            "description": "Exact canonical agreement-content/v1 terms for issued native revisions; draft and imported legacy history can carry a noncanonical object.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/AgreementContentDto"
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ]
          },
          "contentSha256": {
            "type": "object",
            "nullable": true
          },
          "contextSha256": {
            "type": "object",
            "nullable": true
          },
          "renderSchemaVersion": {
            "type": "object",
            "nullable": true
          },
          "renderedHtml": {
            "type": "object",
            "nullable": true
          },
          "retentionPolicyVersion": {
            "type": "object",
            "nullable": true
          },
          "predecessorRevisionId": {
            "type": "object",
            "format": "uuid",
            "nullable": true
          },
          "reissueReason": {
            "type": "object",
            "nullable": true
          },
          "issuedAt": {
            "type": "object",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "subjectId",
          "revisionNumber",
          "state",
          "contentSchemaVersion",
          "content",
          "createdAt"
        ]
      },
      "AgreementArtifactGrantDto": {
        "type": "object",
        "properties": {
          "expiresInSeconds": {
            "type": "number",
            "default": 300,
            "minimum": 1,
            "maximum": 300
          }
        }
      },
      "AgreementArtifactGrantResponseDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "url",
          "expiresAt"
        ]
      },
      "CustomerAgreementRequirementResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "requirementKey": {
            "type": "string"
          },
          "policyVersion": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "WAIVED",
              "VOIDED",
              "EXPIRED",
              "REPLACED"
            ]
          },
          "gateActions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "QUOTE_ACCEPTANCE",
                "BOOKING_REQUEST",
                "BOOKING_APPROVAL",
                "BOOKING_CONFIRMATION",
                "FULFILLMENT_HANDOFF"
              ]
            }
          },
          "satisfied": {
            "type": "boolean"
          },
          "satisfyingExecutionId": {
            "type": "string",
            "pattern": "^(?:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|agreement-execution:[a-f0-9]{64})$",
            "nullable": true,
            "description": "ID of the execution that currently satisfies this requirement. Null when no compatible satisfaction is current."
          },
          "satisfactionSource": {
            "type": "string",
            "enum": [
              "NATIVE_EXECUTION",
              "VERIFIED_EXTERNAL"
            ],
            "nullable": true
          },
          "satisfiedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "subjectId",
          "requirementKey",
          "policyVersion",
          "state",
          "gateActions",
          "satisfied",
          "satisfyingExecutionId",
          "satisfactionSource",
          "satisfiedAt"
        ]
      },
      "CustomerAgreementSubjectMemberResponseDto": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "minimum": 0
          },
          "serviceName": {
            "type": "string"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "ordinal",
          "serviceName",
          "startsAt",
          "endsAt",
          "quantity"
        ]
      },
      "CustomerAgreementSubjectResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "COMMERCE_RECORD",
              "COMMERCE_REVISION",
              "BOOKING",
              "BOOKING_GROUP"
            ]
          },
          "label": {
            "type": "string"
          },
          "bookingGroupPublicRef": {
            "type": "string",
            "nullable": true,
            "pattern": "^b[a-z0-9]{25}$",
            "description": "Non-authorizing public booking-group reference when this subject covers a group."
          },
          "bookingGroupStatus": {
            "type": "string",
            "nullable": true
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAgreementSubjectMemberResponseDto"
            }
          }
        },
        "required": [
          "id",
          "kind",
          "label",
          "bookingGroupPublicRef",
          "bookingGroupStatus",
          "members"
        ]
      },
      "CustomerAgreementNativeBindingResponseDto": {
        "type": "object",
        "properties": {
          "agreementRevisionId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "number"
          },
          "templateSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "contentSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "disclosureVersionNumber": {
            "type": "number"
          },
          "disclosureSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "agreementRevisionId",
          "revisionNumber",
          "templateSha256",
          "contentSha256",
          "disclosureVersionNumber",
          "disclosureSha256"
        ]
      },
      "CustomerAgreementParticipantResponseDto": {
        "type": "object",
        "properties": {
          "roleKey": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "shownAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "acceptedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "roleKey",
          "state",
          "name",
          "shownAt",
          "acceptedAt",
          "completedAt"
        ]
      },
      "CustomerAgreementArtifactResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^(?:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|external-artifact:[a-f0-9]{64})$",
            "description": "Artifact ID used with its owning execution ID for signed-in downloads. Native artifacts use UUIDs."
          },
          "kind": {
            "type": "string",
            "enum": [
              "RENDERED_PDF",
              "EXECUTED_PDF",
              "EXTERNAL_ORIGINAL",
              "EXECUTION_CERTIFICATE",
              "SAFE_PREVIEW"
            ]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "sizeBytes": {
            "type": "integer",
            "format": "int64"
          },
          "available": {
            "type": "boolean"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "sha256",
          "sizeBytes",
          "available",
          "createdAt"
        ]
      },
      "CustomerAgreementExecutionActionsResponseDto": {
        "type": "object",
        "properties": {
          "canSign": {
            "type": "boolean"
          },
          "canDecline": {
            "type": "boolean"
          }
        },
        "required": [
          "canSign",
          "canDecline"
        ]
      },
      "CustomerAgreementExecutionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^(?:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|agreement-execution:[a-f0-9]{64})$",
            "description": "Opaque agreement execution ID. Use it in the signed-in artifact download route for this origin with the artifact’s own ID."
          },
          "origin": {
            "type": "string",
            "enum": [
              "NATIVE",
              "EXTERNAL",
              "LEGACY_LITECOMMERCE"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ISSUED",
              "IN_PROGRESS",
              "EXECUTED",
              "DECLINED",
              "EXPIRED",
              "VOIDED",
              "REPLACED"
            ]
          },
          "title": {
            "type": "string"
          },
          "subject": {
            "$ref": "#/components/schemas/CustomerAgreementSubjectResponseDto"
          },
          "nativeBinding": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerAgreementNativeBindingResponseDto"
              }
            ]
          },
          "sourceSystem": {
            "type": "string",
            "nullable": true
          },
          "sourceLabel": {
            "type": "string",
            "nullable": true
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "The number this agreement shows, by origin (E29). NATIVE: its revision's Agreement number, or null when that revision predates Agreement numbers. LEGACY_LITECOMMERCE: the contract packet's send-time number, or null for a packet that was never sent. EXTERNAL: the reference the outside agreement was supplied with."
          },
          "termsVersion": {
            "type": "string",
            "nullable": true
          },
          "verificationStatus": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "UNVERIFIED",
              "VERIFIED",
              "REJECTED",
              "INSUFFICIENT",
              "REVOKED"
            ]
          },
          "issuedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "executedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAgreementParticipantResponseDto"
            }
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAgreementArtifactResponseDto"
            }
          },
          "satisfiesRequirementIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "actions": {
            "$ref": "#/components/schemas/CustomerAgreementExecutionActionsResponseDto"
          }
        },
        "required": [
          "id",
          "origin",
          "state",
          "title",
          "subject",
          "nativeBinding",
          "sourceSystem",
          "sourceLabel",
          "displayNumber",
          "termsVersion",
          "verificationStatus",
          "issuedAt",
          "executedAt",
          "expiresAt",
          "createdAt",
          "participants",
          "artifacts",
          "satisfiesRequirementIds",
          "actions"
        ]
      },
      "CustomerAgreementHistoryResponseDto": {
        "type": "object",
        "properties": {
          "requirements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAgreementRequirementResponseDto"
            }
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAgreementExecutionResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "pattern": "^(?:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|agreement-execution:[a-f0-9]{64})$",
            "nullable": true,
            "description": "Pass this value unchanged as cursor to continue the same history query. Null when there is no next page."
          }
        },
        "required": [
          "requirements",
          "data",
          "nextCursor"
        ]
      },
      "CustomerExternalAgreementArtifactGrantDto": {
        "type": "object",
        "properties": {
          "expiresInSeconds": {
            "type": "number",
            "default": 60,
            "minimum": 1,
            "maximum": 60
          }
        }
      },
      "ExternalAgreementDownloadDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "url",
          "expiresAt"
        ]
      },
      "ExternalAgreementSignerDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "role",
          "name",
          "completedAt"
        ]
      },
      "ExternalAgreementArtifactDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "RENDERED_PDF",
              "EXECUTED_PDF",
              "EXTERNAL_ORIGINAL",
              "EXECUTION_CERTIFICATE",
              "SAFE_PREVIEW"
            ]
          },
          "safetyStatus": {
            "type": "string",
            "enum": [
              "PENDING_SCAN",
              "SAFE",
              "QUARANTINED",
              "REJECTED",
              "DESTROYED"
            ]
          },
          "sha256": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "format": "int64"
          },
          "retentionPolicyVersion": {
            "type": "string",
            "description": "Current policy version a governed destruction request must bind exactly."
          },
          "destroyedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "safetyStatus",
          "sha256",
          "sizeBytes",
          "retentionPolicyVersion",
          "destroyedAt",
          "createdAt"
        ]
      },
      "ExternalAgreementVerificationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "decision": {
            "type": "string",
            "enum": [
              "VERIFIED",
              "REJECTED",
              "INSUFFICIENT",
              "REVOKED"
            ]
          },
          "method": {
            "type": "string"
          },
          "actorType": {
            "type": "string"
          },
          "actorId": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string"
          },
          "decidedAt": {
            "format": "date-time",
            "type": "string"
          },
          "previousDecisionId": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "decision",
          "method",
          "actorType",
          "actorId",
          "reason",
          "decidedAt",
          "previousDecisionId"
        ]
      },
      "ExternalAgreementSatisfactionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "requirementId": {
            "type": "string"
          },
          "verificationDecisionId": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "type": "string",
            "enum": [
              "NATIVE_EXECUTION",
              "VERIFIED_EXTERNAL"
            ]
          },
          "satisfiedAt": {
            "format": "date-time",
            "type": "string"
          },
          "actorType": {
            "type": "string"
          },
          "actorId": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string"
          },
          "revokedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "revokedByType": {
            "type": "string",
            "nullable": true
          },
          "revokedById": {
            "type": "string",
            "nullable": true
          },
          "revocationReason": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "requirementId",
          "verificationDecisionId",
          "source",
          "satisfiedAt",
          "actorType",
          "actorId",
          "reason",
          "revokedAt",
          "revokedByType",
          "revokedById",
          "revocationReason"
        ]
      },
      "ExternalAgreementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "sourceSystem": {
            "type": "string"
          },
          "externalId": {
            "type": "string",
            "nullable": true
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "importBatchId": {
            "type": "string",
            "nullable": true
          },
          "importRowKey": {
            "type": "string",
            "nullable": true
          },
          "sourceStatus": {
            "type": "string",
            "nullable": true
          },
          "termsVersion": {
            "type": "string",
            "nullable": true
          },
          "signedAt": {
            "format": "date-time",
            "type": "string"
          },
          "countersignedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "attachmentStatus": {
            "type": "string",
            "enum": [
              "PENDING",
              "ATTACHED"
            ]
          },
          "attachedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "attachedByType": {
            "type": "string",
            "nullable": true
          },
          "attachedById": {
            "type": "string",
            "nullable": true
          },
          "attachmentReason": {
            "type": "string",
            "nullable": true
          },
          "executedAt": {
            "format": "date-time",
            "type": "string"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "signers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalAgreementSignerDto"
            }
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalAgreementArtifactDto"
            }
          },
          "verifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalAgreementVerificationDto"
            }
          },
          "satisfactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalAgreementSatisfactionDto"
            }
          }
        },
        "required": [
          "id",
          "subjectId",
          "sourceSystem",
          "externalId",
          "displayNumber",
          "importBatchId",
          "importRowKey",
          "sourceStatus",
          "termsVersion",
          "signedAt",
          "countersignedAt",
          "attachmentStatus",
          "attachedAt",
          "attachedByType",
          "attachedById",
          "attachmentReason",
          "executedAt",
          "notes",
          "signers",
          "artifacts",
          "verifications",
          "satisfactions"
        ]
      },
      "ExternalAgreementListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalAgreementDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "ExternalAgreementDecisionDto": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "VERIFIED",
              "REJECTED",
              "INSUFFICIENT"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "manual-document-review",
              "provider-audit-certificate"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "decision",
          "method",
          "reason",
          "idempotencyKey"
        ]
      },
      "SatisfyExternalAgreementRequirementDto": {
        "type": "object",
        "properties": {
          "requirementId": {
            "type": "string"
          },
          "verificationDecisionId": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "requirementId",
          "verificationDecisionId",
          "reason"
        ]
      },
      "RevokeExternalAgreementVerificationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "reason",
          "idempotencyKey"
        ]
      },
      "DestroyExternalAgreementArtifactDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "disposition": {
            "type": "string",
            "enum": [
              "RETENTION_EXPIRED",
              "PRIVACY_ERASURE",
              "TENANT_OFFBOARDING",
              "AUTHORIZED_EVIDENCE_DESTRUCTION"
            ]
          },
          "authorizationReference": {
            "type": "string",
            "description": "Bounded case, approval, erasure, or offboarding reference authorizing this irreversible action.",
            "minLength": 1,
            "maxLength": 500
          },
          "expectedRetentionPolicyVersion": {
            "type": "string",
            "description": "Exact retained policy version reviewed by the authorizer. A stale value fails closed.",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": [
          "reason",
          "idempotencyKey",
          "disposition",
          "authorizationReference",
          "expectedRetentionPolicyVersion"
        ]
      },
      "ExternalAgreementArtifactDestructionDto": {
        "type": "object",
        "properties": {
          "executionId": {
            "type": "string"
          },
          "artifactId": {
            "type": "string"
          },
          "safetyStatus": {
            "type": "string",
            "enum": [
              "DESTROYED"
            ]
          },
          "disposition": {
            "type": "string",
            "enum": [
              "RETENTION_EXPIRED",
              "PRIVACY_ERASURE",
              "TENANT_OFFBOARDING",
              "AUTHORIZED_EVIDENCE_DESTRUCTION"
            ]
          },
          "retentionPolicyVersion": {
            "type": "string"
          },
          "requestedAt": {
            "format": "date-time",
            "type": "string"
          },
          "destroyedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "executionId",
          "artifactId",
          "safetyStatus",
          "disposition",
          "retentionPolicyVersion",
          "requestedAt",
          "destroyedAt"
        ]
      },
      "NativeAgreementRevisionBindingDto": {
        "type": "object",
        "properties": {
          "templateVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedTemplateSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Optional compare-and-bind expectation. The server computes and returns the authoritative template digest."
          },
          "disclosureVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedDisclosureSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Optional compare-and-bind expectation. The server computes and returns the authoritative disclosure digest."
          }
        },
        "required": [
          "templateVersionId",
          "disclosureVersionId"
        ]
      },
      "NativeAgreementCustomerSignerDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string",
            "format": "uuid"
          },
          "participantKey": {
            "type": "string",
            "default": "customer",
            "maxLength": 128,
            "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$"
          }
        },
        "required": [
          "customerId"
        ]
      },
      "NativeAgreementMerchantCountersignerDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "Tenant member user identity. The server resolves membership and snapshots the signer; the request cannot supply identity evidence."
          },
          "participantKey": {
            "type": "string",
            "default": "merchant",
            "maxLength": 128,
            "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$"
          }
        },
        "required": [
          "userId"
        ]
      },
      "CreateNativeAgreementExecutionDto": {
        "type": "object",
        "properties": {
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "binding": {
            "$ref": "#/components/schemas/NativeAgreementRevisionBindingDto"
          },
          "customerSigner": {
            "$ref": "#/components/schemas/NativeAgreementCustomerSignerDto"
          },
          "merchantCountersigner": {
            "$ref": "#/components/schemas/NativeAgreementMerchantCountersignerDto"
          },
          "requirementId": {
            "type": "string",
            "format": "uuid",
            "description": "One exact ACTIVE requirement this execution may satisfy after complete native execution. Omission creates supporting evidence only."
          },
          "retentionPolicyVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          }
        },
        "required": [
          "subjectId",
          "binding",
          "customerSigner",
          "retentionPolicyVersion",
          "idempotencyKey"
        ]
      },
      "NativeAgreementRevisionBindingResponseDto": {
        "type": "object",
        "properties": {
          "agreementRevisionId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "number"
          },
          "templateVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "templateVersionNumber": {
            "type": "number"
          },
          "templateSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "contentSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "disclosureVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "disclosureVersionNumber": {
            "type": "number"
          },
          "disclosureSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "agreementRevisionId",
          "revisionNumber",
          "templateVersionId",
          "templateVersionNumber",
          "templateSha256",
          "contentSha256",
          "disclosureVersionId",
          "disclosureVersionNumber",
          "disclosureSha256"
        ]
      },
      "NativeAgreementParticipantResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "participantKey": {
            "type": "string"
          },
          "roleKey": {
            "type": "string"
          },
          "routingOrder": {
            "type": "number"
          },
          "required": {
            "type": "boolean"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "authenticationMethod": {
            "type": "string",
            "nullable": true
          },
          "shownAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "acceptedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "participantKey",
          "roleKey",
          "routingOrder",
          "required",
          "state",
          "name",
          "authenticationMethod",
          "shownAt",
          "acceptedAt",
          "completedAt"
        ]
      },
      "NativeAgreementArtifactResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "EXECUTED_PDF",
              "EXECUTION_CERTIFICATE"
            ]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "sizeBytes": {
            "type": "integer",
            "format": "int64"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "sha256",
          "sizeBytes",
          "createdAt"
        ]
      },
      "NativeAgreementLifecycleEventResponseDto": {
        "type": "object",
        "properties": {
          "eventType": {
            "type": "string"
          },
          "actorType": {
            "type": "string"
          },
          "participantId": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "occurredAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "eventType",
          "actorType",
          "participantId",
          "occurredAt"
        ]
      },
      "NativeAgreementExecutionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subjectId": {
            "type": "string",
            "format": "uuid"
          },
          "origin": {
            "type": "string",
            "enum": [
              "NATIVE"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ISSUED",
              "IN_PROGRESS",
              "EXECUTED",
              "DECLINED",
              "EXPIRED",
              "VOIDED",
              "REPLACED"
            ]
          },
          "binding": {
            "$ref": "#/components/schemas/NativeAgreementRevisionBindingResponseDto"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "The Agreement number (E29), shared by every revision of this agreement. Null when the bound revision predates Agreement numbers; the agreement receives its first number with its next revision."
          },
          "predecessorExecutionId": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "replacementExecutionId": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "issuedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "executedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NativeAgreementParticipantResponseDto"
            }
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NativeAgreementArtifactResponseDto"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NativeAgreementLifecycleEventResponseDto"
            }
          }
        },
        "required": [
          "id",
          "subjectId",
          "origin",
          "state",
          "binding",
          "displayNumber",
          "predecessorExecutionId",
          "replacementExecutionId",
          "issuedAt",
          "executedAt",
          "expiresAt",
          "createdAt",
          "participants",
          "artifacts",
          "events"
        ]
      },
      "NativeAgreementExecutionListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "NativeAgreementReasonedCommandDto": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "idempotencyKey",
          "reason"
        ]
      },
      "NativeAgreementPresentedContentDto": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": [
              "agreement-content/v1"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 240
          },
          "sections": {
            "minItems": 1,
            "maxItems": 101,
            "description": "The exact issued sections. Terms issued with an Agreement number (E29) lead with { \"heading\": \"Agreement number\", \"paragraphs\": [<the number>] }, which counts outside the 100-section and 1,000,000-character template limits.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementContentSectionDto"
            }
          }
        },
        "required": [
          "schemaVersion",
          "title",
          "sections"
        ]
      },
      "NativeAgreementPresentedTermsDto": {
        "type": "object",
        "properties": {
          "revisionId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "number"
          },
          "title": {
            "type": "string"
          },
          "contentSchemaVersion": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/NativeAgreementPresentedContentDto"
          },
          "contentSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "renderSchemaVersion": {
            "type": "string"
          },
          "renderedHtml": {
            "type": "string"
          }
        },
        "required": [
          "revisionId",
          "revisionNumber",
          "title",
          "contentSchemaVersion",
          "content",
          "contentSha256",
          "renderSchemaVersion",
          "renderedHtml"
        ]
      },
      "NativeAgreementPresentedDisclosureDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "disclosureKey": {
            "type": "string"
          },
          "versionNumber": {
            "type": "number"
          },
          "title": {
            "type": "string"
          },
          "contentSchemaVersion": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/AgreementContentDto"
          },
          "disclosureSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "id",
          "disclosureKey",
          "versionNumber",
          "title",
          "contentSchemaVersion",
          "content",
          "disclosureSha256"
        ]
      },
      "NativeAgreementAcceptanceRequirementsDto": {
        "type": "object",
        "properties": {
          "agreementAcceptanceRequired": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "disclosureAcceptanceRequired": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "typedSignerIdentityRequired": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "agreementAcceptanceRequired",
          "disclosureAcceptanceRequired",
          "typedSignerIdentityRequired"
        ]
      },
      "NativeAgreementPresentationResponseDto": {
        "type": "object",
        "properties": {
          "execution": {
            "$ref": "#/components/schemas/NativeAgreementExecutionResponseDto"
          },
          "participant": {
            "$ref": "#/components/schemas/NativeAgreementParticipantResponseDto"
          },
          "presentationEventId": {
            "type": "string",
            "format": "uuid"
          },
          "presentedAt": {
            "format": "date-time",
            "type": "string"
          },
          "agreement": {
            "$ref": "#/components/schemas/NativeAgreementPresentedTermsDto"
          },
          "disclosure": {
            "$ref": "#/components/schemas/NativeAgreementPresentedDisclosureDto"
          },
          "acceptanceRequirements": {
            "$ref": "#/components/schemas/NativeAgreementAcceptanceRequirementsDto"
          }
        },
        "required": [
          "execution",
          "participant",
          "presentationEventId",
          "presentedAt",
          "agreement",
          "disclosure",
          "acceptanceRequirements"
        ]
      },
      "MerchantCountersignNativeAgreementDto": {
        "type": "object",
        "properties": {
          "presentationEventId": {
            "type": "string",
            "format": "uuid"
          },
          "agreementRevisionId": {
            "type": "string",
            "format": "uuid"
          },
          "agreementContentSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "disclosureVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "disclosureSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "agreementAccepted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "disclosureAccepted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "typedSignerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "presentationEventId",
          "agreementRevisionId",
          "agreementContentSha256",
          "disclosureVersionId",
          "disclosureSha256",
          "agreementAccepted",
          "disclosureAccepted",
          "typedSignerName",
          "idempotencyKey",
          "reason"
        ]
      },
      "MerchantDeclineNativeAgreementDto": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "idempotencyKey",
          "reason"
        ]
      },
      "ReissueNativeAgreementExecutionDto": {
        "type": "object",
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/NativeAgreementRevisionBindingDto"
          },
          "customerSigner": {
            "$ref": "#/components/schemas/NativeAgreementCustomerSignerDto"
          },
          "merchantCountersigner": {
            "$ref": "#/components/schemas/NativeAgreementMerchantCountersignerDto"
          },
          "requirementId": {
            "type": "string",
            "format": "uuid"
          },
          "retentionPolicyVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "binding",
          "customerSigner",
          "retentionPolicyVersion",
          "idempotencyKey",
          "reason"
        ]
      },
      "NativeAgreementArtifactGrantDto": {
        "type": "object",
        "properties": {
          "expiresInSeconds": {
            "type": "number",
            "default": 300,
            "minimum": 1,
            "maximum": 300
          }
        }
      },
      "NativeAgreementArtifactGrantResponseDto": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "EXECUTED_PDF",
              "EXECUTION_CERTIFICATE"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "artifactId",
          "kind",
          "url",
          "expiresAt"
        ]
      },
      "SignNativeAgreementDto": {
        "type": "object",
        "properties": {
          "presentationEventId": {
            "type": "string",
            "format": "uuid"
          },
          "agreementRevisionId": {
            "type": "string",
            "format": "uuid"
          },
          "agreementContentSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "disclosureVersionId": {
            "type": "string",
            "format": "uuid"
          },
          "disclosureSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "agreementAccepted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "disclosureAccepted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "typedSignerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          }
        },
        "required": [
          "presentationEventId",
          "agreementRevisionId",
          "agreementContentSha256",
          "disclosureVersionId",
          "disclosureSha256",
          "agreementAccepted",
          "disclosureAccepted",
          "typedSignerName",
          "idempotencyKey"
        ]
      },
      "DeclineNativeAgreementDto": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "idempotencyKey"
        ]
      },
      "CustomerAgreementActionContextResponseDto": {
        "type": "object",
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/CustomerAgreementSubjectResponseDto"
          },
          "title": {
            "type": "string"
          },
          "continuationStatus": {
            "type": "string",
            "enum": [
              "NONE",
              "AWAITING_SIGNATURES",
              "READY_TO_RESUME",
              "HISTORY_ONLY"
            ]
          }
        },
        "required": [
          "subject",
          "title",
          "continuationStatus"
        ]
      },
      "RequestLinkDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Email address to send the passwordless login challenge to.",
            "maxLength": 254,
            "example": "alice@example.com"
          },
          "returnTo": {
            "type": "string",
            "description": "Optional local return target for the emailed magic link. Only the fixed routed account destinations (`/account`, `/account/orders`, `/account/bookings`, `/account/agreements`, `/account/documents`, `/account/addresses`, `/account/payment-methods`, `/account/profile`) are honored, plus one order or document detail. An order detail (`/account/orders/{number}`) and a document detail (`/account/documents/{number}`) accept exactly the published commerce-number grammar: 1 to 64 ASCII letters, digits, `-`, `_`, `{` or `}`, or an issued legacy order number of up to 79 characters in the `SLUG-YYYY-sequence` shape. The number must be percent-encoded exactly once, in canonical form (`{` and `}` as `%7B` and `%7D`). An invalid order detail normalizes to `/account/orders`, and an invalid document detail normalizes to `/account/documents`. A hosted-checkout target is honored only for `/session/{token}` where the token is exactly `c` followed by 25 lowercase letters or digits; an invalid checkout-session target is omitted. The legacy `/account#bookings` anchor normalizes onto `/account/bookings`; only the routed bookings marker and bounded orders-list page are preserved from query input, while all other query and fragment state is removed server-side. Unrecognized, external, and oversized targets are omitted, as is any target with a `.` or `..` path segment, raw or percent-encoded. Checkout-session targets are additionally dropped when the link is minted on a BYO customer-action origin (the session route only exists on the hosted origin).",
            "maxLength": 512,
            "example": "/account/orders/LC-2026-001"
          }
        },
        "required": [
          "email"
        ]
      },
      "RequestChallengeResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Always present. Generic confirmation that, IF the address belongs to an account, a login email has been sent. Never reveals existence.",
            "example": "If an account exists for that email, a login link has been sent."
          }
        },
        "required": [
          "message"
        ]
      },
      "VerifyDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Opaque magic-link token (from the emailed link).",
            "maxLength": 64
          },
          "email": {
            "type": "string",
            "description": "Email the OTP was issued to (required with `code`).",
            "maxLength": 254
          },
          "code": {
            "type": "string",
            "description": "Numeric OTP code (required with `email`).",
            "maxLength": 12
          },
          "orderReference": {
            "type": "string",
            "description": "Exact public order reference. Presence selects only the private ORDER_RECOVERY OTP lane; it never supplies authorization by itself.",
            "maxLength": 128,
            "pattern": "^or1_[0-9a-f]{32}$",
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "persistSession": {
            "type": "boolean",
            "description": "E28 (`DR-3340-10-C`) — the shopper's affirmative \"Keep me signed in on this browser\" choice. ONLY a literal `true` mints the persistent session windows (30-day idle / 365-day absolute); omitted or `false` always receives the default windows (6-hour idle / 24-hour absolute). The server never infers persistence from browser state."
          }
        },
        "additionalProperties": false
      },
      "VerifySessionResponseDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Opaque session bearer token. Send as `Authorization: Bearer <token>` on subsequent customer requests (BYO frontends). Also set as an httpOnly cookie for the hosted surface. Shown once; store securely."
          },
          "expiresAt": {
            "type": "string",
            "description": "Absolute session expiry (ISO 8601), fixed at mint: 24 hours for a default session, 365 days when `persistSession: true` was accepted (`DR-3340-10-C`). The session is live only while BOTH this and `idleExpiresAt` hold.",
            "example": "2026-06-12T14:36:18.000Z"
          },
          "idleExpiresAt": {
            "type": "string",
            "description": "Idle-window deadline (ISO 8601): 6 hours for a default session, 30 days when persistent. Slides forward on authenticated use, capped at `expiresAt`; the EFFECTIVE expiry is the earlier of the two.",
            "example": "2026-06-11T20:36:18.000Z"
          },
          "persistent": {
            "type": "boolean",
            "description": "Whether the session was minted with the affirmative \"keep me signed in\" choice. Only a literal `persistSession: true` on verify produces `true` here."
          },
          "customerId": {
            "type": "string",
            "description": "The authenticated customer id."
          }
        },
        "required": [
          "token",
          "expiresAt",
          "idleExpiresAt",
          "persistent",
          "customerId"
        ]
      },
      "OrderRecoveryRequestDto": {
        "type": "object",
        "properties": {
          "orderReference": {
            "type": "string",
            "pattern": "^or1_[0-9a-f]{32}$",
            "maxLength": 128,
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          }
        },
        "required": [
          "orderReference",
          "email"
        ],
        "additionalProperties": false
      },
      "OrderRecoveryRequestResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "If this order can be recovered, a sign-in message will be sent."
          }
        },
        "required": [
          "message"
        ]
      },
      "PublicBookingFixedSlotDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "example": "Morning"
          },
          "startMinuteOfDay": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 1439,
            "example": 540
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1440,
            "example": 180
          }
        },
        "required": [
          "label",
          "startMinuteOfDay",
          "durationMinutes"
        ]
      },
      "PublicBookingElapsedDurationRangeDto": {
        "type": "object",
        "properties": {
          "minimumElapsedMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 44640,
            "description": "Inclusive lower edge of this selectable elapsed-duration range."
          },
          "maximumElapsedMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 44640,
            "description": "Inclusive upper edge of this selectable elapsed-duration range."
          }
        },
        "required": [
          "minimumElapsedMinutes",
          "maximumElapsedMinutes"
        ]
      },
      "PublicBookingDurationRateTableEntryDto": {
        "type": "object",
        "properties": {
          "unitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Evaluated, non-authoritative per-unit total for every selectable elapsed-duration range in this entry."
          },
          "elapsedDurationRanges": {
            "minItems": 1,
            "description": "Inclusive elapsed-minute ranges that select this rate. Discrete service options remain discrete rather than implying intervening durations are bookable.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingElapsedDurationRangeDto"
            }
          }
        },
        "required": [
          "unitPriceInCents",
          "elapsedDurationRanges"
        ]
      },
      "PublicBookingServicePricingDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "FLAT_TIME",
              "FIXED_PRICE",
              "PRICING_STRUCTURE"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "RESERVED_WINDOW",
              "CHARGED_DURATION",
              "FIXED_PRICE"
            ]
          },
          "basePriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Configured base price only."
          },
          "pricingIntervalMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1,
            "description": "Minutes represented by one base-price unit for FLAT_TIME; null for fixed pricing."
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "authoritative": {
            "type": "boolean",
            "example": false,
            "description": "Always false in #640: checkout/shared commerce remains authoritative for final pricing."
          },
          "fromPriceInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 0,
            "description": "ADR-043 reachable From price: the minimum evaluated per-unit total across the actual bookable-duration domain of the service, including the published minimum-then-grace transform - never the first stored rate band merely because it exists. Null when the service has no bookable-duration domain, when the pricing configuration cannot be evaluated, or on slot-level hooks (slots name their own concrete window). Not authoritative."
          },
          "fromDurationMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1,
            "description": "The bookable-duration-domain minutes fromPriceInCents was evaluated at. Null exactly when fromPriceInCents is null."
          },
          "durationRateTable": {
            "maxItems": 24,
            "description": "ADR-043 reachable duration-rate table. Each entry contains only an evaluated total and the actual bookable elapsed-duration ranges that select it; policy, revision, factor, band, minimum, and grace metadata are never exposed. Empty for scalar or unevaluable pricing.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingDurationRateTableEntryDto"
            }
          }
        },
        "required": [
          "mode",
          "basis",
          "basePriceInCents",
          "pricingIntervalMinutes",
          "currency",
          "authoritative",
          "fromPriceInCents",
          "fromDurationMinutes",
          "durationRateTable"
        ]
      },
      "PublicBookingCheckoutPostureDto": {
        "type": "object",
        "properties": {
          "approvalMode": {
            "type": "string",
            "enum": [
              "AUTO_CONFIRM",
              "MANUAL_APPROVAL"
            ]
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "PAY_LATER",
              "DEPOSIT_PERCENT",
              "FULL_PAYMENT"
            ]
          },
          "paymentDepositPercent": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 0,
            "maximum": 100
          },
          "securityDepositMode": {
            "type": "string",
            "enum": [
              "NONE",
              "FIXED_AMOUNT",
              "PERCENTAGE_OF_ORDER",
              "PERCENTAGE_OF_RESOURCE_VALUES"
            ]
          },
          "securityDepositAmountInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 0
          },
          "securityDepositPercent": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 0,
            "maximum": 100
          }
        },
        "required": [
          "approvalMode",
          "paymentMode",
          "paymentDepositPercent",
          "securityDepositMode",
          "securityDepositAmountInCents",
          "securityDepositPercent"
        ]
      },
      "PublicBookingPackageComponentDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "itemType": {
            "type": "string",
            "enum": [
              "RENTAL",
              "SALE",
              "SERVICE"
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Units included per one top-level package selection."
          },
          "intrinsicSavingsBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 10000,
            "description": "Intrinsic package savings in basis points. External promotions are not included."
          }
        },
        "required": [
          "name",
          "variantName",
          "itemType",
          "quantity",
          "intrinsicSavingsBasisPoints"
        ]
      },
      "PublicBookingPackageDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Definition revision clients must echo on availability and booking-group requests."
          },
          "components": {
            "minItems": 2,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingPackageComponentDto"
            }
          }
        },
        "required": [
          "kind",
          "revision",
          "components"
        ]
      },
      "PublicBookingServiceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ]
          },
          "deliveryPosture": {
            "type": "string",
            "enum": [
              "PICKUP_ONLY",
              "OPTIONAL",
              "REQUIRED"
            ]
          },
          "periodMode": {
            "type": "string",
            "enum": [
              "EXACT_RANGE",
              "FIXED_DURATION",
              "FIXED_SLOT"
            ]
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "durationOptionsMinutes": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            }
          },
          "fixedSlots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingFixedSlotDto"
            }
          },
          "timePickerIncrementMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "defaultStartMinuteOfDay": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "defaultEndMinuteOfDay": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "minPartySize": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "maxPartySize": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "timezone": {
            "type": "string"
          },
          "leadTimeMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "maxAdvanceDays": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "pricing": {
            "$ref": "#/components/schemas/PublicBookingServicePricingDto"
          },
          "checkout": {
            "$ref": "#/components/schemas/PublicBookingCheckoutPostureDto"
          },
          "resourceSelectionRequired": {
            "type": "boolean",
            "description": "True when at least one requirement is explicitly customer-selectable. Options are returned per available slot."
          },
          "package": {
            "nullable": true,
            "description": "Customer-safe package definition for one top-level selection. Capacity mappings and internal identifiers are omitted.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingPackageDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "itemId",
          "slug",
          "name",
          "description",
          "bookingType",
          "deliveryPosture",
          "periodMode",
          "durationMinutes",
          "durationOptionsMinutes",
          "fixedSlots",
          "timePickerIncrementMinutes",
          "defaultStartMinuteOfDay",
          "defaultEndMinuteOfDay",
          "minPartySize",
          "maxPartySize",
          "timezone",
          "leadTimeMinutes",
          "maxAdvanceDays",
          "pricing",
          "checkout",
          "resourceSelectionRequired",
          "package"
        ]
      },
      "PublicBookingServiceListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingServiceDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreatePublicBookingHoldDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "delivery": {
            "description": "Omitted or null means pickup.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionInputDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000,
            "default": 1
          },
          "expectedCompositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Required for a package service. Must match the revision returned by the availability selection."
          },
          "resourceSelections": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingResourceSelectionDto"
            }
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "nullable": true,
            "maxLength": 320
          },
          "sessionId": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Non-secret storefront/checkout correlation id."
          }
        },
        "required": [
          "serviceId",
          "startsAt",
          "endsAt"
        ],
        "additionalProperties": false
      },
      "PublicBookingHoldResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "delivery": {
            "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CONSUMED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "expiresAt": {
            "format": "date-time",
            "type": "string"
          },
          "serverTime": {
            "format": "date-time",
            "type": "string"
          },
          "expiresInSeconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "serviceId",
          "startsAt",
          "endsAt",
          "quantity",
          "delivery",
          "status",
          "expiresAt",
          "serverTime",
          "expiresInSeconds"
        ]
      },
      "BookingDeliveryOriginAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "maxLength": 300,
            "example": "1120 S Rackham Way"
          },
          "line2": {
            "type": "string",
            "maxLength": 300,
            "example": "Suite 300"
          },
          "city": {
            "type": "string",
            "maxLength": 200,
            "example": "Meridian"
          },
          "state": {
            "type": "string",
            "maxLength": 200,
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "maxLength": 32,
            "example": "83642"
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "example": "US"
          }
        },
        "required": [
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "BookingDeliveryRadiusBandResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "maxDistanceMeters": {
            "type": "number",
            "minimum": 1,
            "maximum": 1609344
          },
          "feeInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000
          }
        },
        "required": [
          "id",
          "label",
          "maxDistanceMeters",
          "feeInCents"
        ]
      },
      "BookingDeliveryConfigurationResponseDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "number",
            "minimum": 0
          },
          "originAddress": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliveryOriginAddressDto"
              }
            ]
          },
          "originPlaceId": {
            "type": "string",
            "nullable": true
          },
          "originVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "bands": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingDeliveryRadiusBandResponseDto"
            }
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "enabled",
          "revision",
          "originAddress",
          "originPlaceId",
          "originVerifiedAt",
          "bands",
          "updatedAt"
        ]
      },
      "BookingDeliveryRadiusBandInputDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "example": "Local delivery"
          },
          "maxDistanceMeters": {
            "type": "number",
            "minimum": 1,
            "maximum": 1609344,
            "description": "Inclusive straight-line radius upper bound in integer meters (maximum 1,000 miles).",
            "example": 16093
          },
          "feeInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Delivery fee in integer cents. Zero creates a free-delivery band.",
            "example": 2500
          }
        },
        "required": [
          "label",
          "maxDistanceMeters",
          "feeInCents"
        ]
      },
      "UpdateBookingDeliveryConfigurationDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether booking delivery can be offered. Enabling requires a verified origin and at least one radius band."
          },
          "originAddress": {
            "nullable": true,
            "description": "Merchant-entered delivery origin. Null is accepted only while disabled with no bands and clears the saved origin.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliveryOriginAddressDto"
              }
            ]
          },
          "bands": {
            "maxItems": 50,
            "description": "Ordered radius bands. Bounds must be strictly increasing and unique.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingDeliveryRadiusBandInputDto"
            }
          }
        },
        "required": [
          "enabled",
          "originAddress",
          "bands"
        ]
      },
      "BookingGeocodingProviderStatusDto": {
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "provider": {
            "type": "string",
            "enum": [
              "google"
            ],
            "example": "google"
          },
          "keyMask": {
            "type": "string",
            "nullable": true,
            "example": "••••aB12"
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "disabled": {
            "type": "boolean"
          },
          "cipherConfigured": {
            "type": "boolean",
            "description": "Whether the server-side outbound-vendor credential cipher is configured."
          }
        },
        "required": [
          "connected",
          "provider",
          "keyMask",
          "connectedAt",
          "lastVerifiedAt",
          "disabled",
          "cipherConfigured"
        ]
      },
      "ConnectBookingGeocodingProviderDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "apiKey": {
            "type": "string",
            "minLength": 20,
            "maxLength": 200,
            "writeOnly": true,
            "description": "The merchant's own Google Geocoding API key. Write-only; stored encrypted and never returned."
          }
        },
        "required": [
          "reason",
          "apiKey"
        ]
      },
      "TestBookingGeocodingProviderResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "code": {
            "type": "string",
            "enum": [
              "connection_disabled",
              "cipher_unavailable",
              "unauthorized",
              "rate_limit_exceeded",
              "timeout",
              "network",
              "provider_error",
              "zero_results",
              "ambiguous",
              "insufficient_precision"
            ],
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "ok"
        ]
      },
      "CheckoutSupportPaymentAttemptDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "AUTHORIZATION",
              "SETUP",
              "REFUND"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUIRES_PAYMENT_METHOD",
              "REQUIRES_ACTION",
              "PROCESSING",
              "REQUIRES_CAPTURE",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "amountInCents": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "paymentContextType": {
            "type": "string",
            "nullable": true,
            "description": "Commercial context type for the attempt (for example checkout_session)."
          },
          "paymentContextId": {
            "type": "string",
            "nullable": true,
            "description": "Commercial context id for the attempt. Current checkout attempts point at the checkout session id."
          },
          "processor": {
            "type": "string"
          },
          "processorObjectType": {
            "type": "string",
            "enum": [
              "PAYMENT_INTENT",
              "CHECKOUT_SESSION",
              "SETUP_INTENT",
              "REFUND"
            ],
            "nullable": true
          },
          "processorObjectId": {
            "type": "string",
            "nullable": true
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Connected account the provider object lives on, as persisted at create (#932). Null does NOT have a single meaning and must not be read as one. When processorObjectId is also null no provider object was ever created, so there is nowhere for it to live. When processorObjectId is present, null means the object was created on the cartonium platform account rather than the tenant own account — possible for attempts predating the tenant connecting one, and the reason such an object is absent from the tenant provider dashboard. Use organizationHasConnectedAccount on the session detail to separate that from a tenant that has never connected an account at all, where null is simply normal."
          },
          "processorStatus": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "amountInCents",
          "currency",
          "processor",
          "stripeAccountId",
          "createdAt",
          "updatedAt"
        ]
      },
      "CheckoutSupportSessionListItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "subtotalInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          },
          "shippingInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Merchant/support-safe disclosure when cartonium did not calculate tax for this session/order (manual/no-tax mode).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number"
          },
          "isBinding": {
            "type": "boolean"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reservationExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "finalOrderId": {
            "type": "string",
            "nullable": true
          },
          "finalOrderNumber": {
            "type": "string",
            "nullable": true
          },
          "latestPaymentAttempt": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSupportPaymentAttemptDto"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "status",
          "currency",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "taxDisclosure",
          "totalInCents",
          "isBinding",
          "createdAt",
          "updatedAt"
        ]
      },
      "ListMerchantCheckoutSessionsResponseDto": {
        "type": "object",
        "properties": {
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportSessionListItemDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "sessions"
        ]
      },
      "CheckoutSupportSessionLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "itemId": {
            "type": "string"
          },
          "variantId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitPriceInCents": {
            "type": "number"
          },
          "totalPriceInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "itemId",
          "name",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents",
          "discountInCents"
        ]
      },
      "CheckoutSupportSessionEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "payload": {
            "type": "object",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "type",
          "createdAt"
        ]
      },
      "CheckoutSupportProcessorEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "processor": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "RECEIVED",
              "PROCESSED",
              "SKIPPED",
              "UNRESOLVED",
              "FAILED"
            ]
          },
          "reconciliationRequired": {
            "type": "boolean",
            "description": "True when automatic application has stopped and this event is parked for operator reconciliation; status is SKIPPED and error retains the reason. False only means the event is not in this parked state; it does not imply payment success or that every issue is resolved."
          },
          "paymentAttemptId": {
            "type": "string",
            "nullable": true
          },
          "checkoutSessionId": {
            "type": "string",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time"
          },
          "processedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "processor",
          "eventId",
          "type",
          "status",
          "reconciliationRequired",
          "receivedAt"
        ]
      },
      "CheckoutSupportSessionDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "subtotalInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          },
          "shippingInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Merchant/support-safe disclosure when cartonium did not calculate tax for this session/order (manual/no-tax mode).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number"
          },
          "isBinding": {
            "type": "boolean"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reservationExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "finalOrderId": {
            "type": "string",
            "nullable": true
          },
          "finalOrderNumber": {
            "type": "string",
            "nullable": true
          },
          "latestPaymentAttempt": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSupportPaymentAttemptDto"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "shippingAddress": {
            "type": "object",
            "nullable": true
          },
          "billingAddress": {
            "type": "object",
            "nullable": true
          },
          "shippingMethod": {
            "type": "object",
            "nullable": true
          },
          "discountSnapshot": {
            "type": "object",
            "nullable": true
          },
          "taxSnapshot": {
            "type": "object",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportSessionLineDto"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportSessionEventDto"
            }
          },
          "paymentAttempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportPaymentAttemptDto"
            }
          },
          "processorEvents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportProcessorEventDto"
            }
          },
          "organizationHasConnectedAccount": {
            "type": "boolean",
            "description": "Whether the organization currently has a connected account at all. The comparison surface for an attempt stripeAccountId of null: with a connected account present, null means that object lives on the cartonium platform account and will not be found in the tenant own dashboard; without one, null is simply normal and says nothing. A boolean rather than the account id, because only its presence is needed and this read carries no role restriction."
          }
        },
        "required": [
          "id",
          "status",
          "currency",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "taxDisclosure",
          "totalInCents",
          "isBinding",
          "createdAt",
          "updatedAt",
          "lines",
          "events",
          "paymentAttempts",
          "processorEvents",
          "organizationHasConnectedAccount"
        ]
      },
      "CheckoutSupportPaymentListItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "AUTHORIZATION",
              "SETUP",
              "REFUND"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUIRES_PAYMENT_METHOD",
              "REQUIRES_ACTION",
              "PROCESSING",
              "REQUIRES_CAPTURE",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "amountInCents": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "paymentContextType": {
            "type": "string",
            "nullable": true,
            "description": "Commercial context type for the attempt (for example checkout_session)."
          },
          "paymentContextId": {
            "type": "string",
            "nullable": true,
            "description": "Commercial context id for the attempt. Current checkout attempts point at the checkout session id."
          },
          "processor": {
            "type": "string"
          },
          "processorObjectType": {
            "type": "string",
            "enum": [
              "PAYMENT_INTENT",
              "CHECKOUT_SESSION",
              "SETUP_INTENT",
              "REFUND"
            ],
            "nullable": true
          },
          "processorObjectId": {
            "type": "string",
            "nullable": true
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Connected account the provider object lives on, as persisted at create (#932). Null does NOT have a single meaning and must not be read as one. When processorObjectId is also null no provider object was ever created, so there is nowhere for it to live. When processorObjectId is present, null means the object was created on the cartonium platform account rather than the tenant own account — possible for attempts predating the tenant connecting one, and the reason such an object is absent from the tenant provider dashboard. Use organizationHasConnectedAccount on the session detail to separate that from a tenant that has never connected an account at all, where null is simply normal."
          },
          "processorStatus": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "checkoutSession": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSupportSessionListItemDto"
              }
            ]
          },
          "processorEvents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportProcessorEventDto"
            }
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "amountInCents",
          "currency",
          "processor",
          "stripeAccountId",
          "createdAt",
          "updatedAt",
          "processorEvents"
        ]
      },
      "ListMerchantPaymentsResponseDto": {
        "type": "object",
        "properties": {
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSupportPaymentListItemDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "payments"
        ]
      },
      "AbandonedCheckoutDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Checkout id accepted by the merchant recovery-email operation; not a public checkout credential."
          },
          "email": {
            "type": "string"
          },
          "customerName": {
            "type": "string",
            "nullable": true,
            "description": "Null when the shopper did not provide a name."
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "number",
            "description": "Checkout snapshot total in currency minor units; a future purchase is repriced."
          },
          "itemCount": {
            "type": "number"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last checkout update; recovery candidates have been inactive for at least one hour."
          },
          "recoveryStatus": {
            "type": "string",
            "enum": [
              "NOT_SENT",
              "QUEUED",
              "ACCEPTED",
              "BLOCKED",
              "FAILED"
            ],
            "description": "ACCEPTED means the email provider accepted the send, not delivery. FAILED may be retried by the durable queue."
          },
          "canSend": {
            "type": "boolean",
            "description": "Whether a new manual request may be queued now. Delivery separately requires configured transport and current recipient policy."
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "User-safe reason a new send cannot be requested; null when requestable."
          }
        },
        "required": [
          "id",
          "email",
          "customerName",
          "currency",
          "totalInCents",
          "itemCount",
          "createdAt",
          "updatedAt",
          "recoveryStatus",
          "canSend",
          "unavailableReason"
        ]
      },
      "ListAbandonedCheckoutsResponseDto": {
        "type": "object",
        "properties": {
          "items": {
            "description": "Inactive hosted one-time checkout records with contact email. Empty means no matching recoverable checkouts, not zero storefront cart activity.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AbandonedCheckoutDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page; null when no more matching rows remain."
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when another page exists; this response is bounded by the requested limit."
          }
        },
        "required": [
          "items",
          "nextCursor",
          "hasMore"
        ]
      },
      "RequestCheckoutRecoveryResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "ACCEPTED",
              "BLOCKED",
              "FAILED"
            ],
            "description": "Current durable request state. ACCEPTED is provider acceptance, never a claim of delivery."
          },
          "outboxEventId": {
            "type": "string",
            "description": "Identifier of the durable request; repeated requests reuse it rather than send another email."
          }
        },
        "required": [
          "status",
          "outboxEventId"
        ]
      },
      "CheckoutBookingSecurityDepositDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "NONE",
              "FIXED_AMOUNT",
              "PERCENTAGE_OF_ORDER",
              "PERCENTAGE_OF_RESOURCE_VALUES"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "percent": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "authorizationDeferred": {
            "type": "boolean",
            "description": "True when authorization/capture is intentionally deferred beyond #641."
          }
        },
        "required": [
          "mode",
          "amountInCents",
          "percent",
          "authorizationDeferred"
        ]
      },
      "CheckoutBookingContextDto": {
        "type": "object",
        "properties": {
          "bookingId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string"
          },
          "bookingType": {
            "type": "string"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "PAY_LATER",
              "DEPOSIT_PERCENT",
              "FULL_PAYMENT"
            ]
          },
          "depositPercent": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "securityDeposit": {
            "$ref": "#/components/schemas/CheckoutBookingSecurityDepositDto"
          },
          "delivery": {
            "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
          },
          "requiresShipping": {
            "type": "boolean"
          }
        },
        "required": [
          "bookingId",
          "serviceId",
          "serviceName",
          "bookingType",
          "startsAt",
          "endsAt",
          "timezone",
          "quantity",
          "paymentMode",
          "depositPercent",
          "securityDeposit",
          "delivery",
          "requiresShipping"
        ]
      },
      "CheckoutSubscriptionSummaryDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "INCOMPLETE",
              "INCOMPLETE_EXPIRED",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "PAUSED",
              "CANCEL_AT_PERIOD_END",
              "CANCELED",
              "UNPAID"
            ],
            "description": "Webhook/reconciliation-authoritative subscription lifecycle state; a browser callback never promotes it."
          },
          "trialMode": {
            "type": "string",
            "enum": [
              "NONE",
              "CARD_UPFRONT",
              "NO_CARD"
            ],
            "description": "Frozen tenant-configured trial posture used when this checkout created the subscription."
          },
          "trialDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "trialEndBehavior": {
            "type": "string",
            "enum": [
              "CANCEL",
              "CREATE_INVOICE",
              "PAUSE"
            ],
            "nullable": true
          },
          "trialEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextRenewalAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Current provider-authoritative renewal boundary. Null when no renewal is presently scheduled."
          },
          "todayPaymentResult": {
            "type": "string",
            "enum": [
              "REQUIRED",
              "PROCESSING",
              "PAID",
              "FAILED",
              "NOT_REQUIRED"
            ],
            "description": "Truthful result for this checkout origin invoice only; later renewal invoices never replace it."
          },
          "todayPaymentFailureVersion": {
            "type": "string",
            "nullable": true,
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque replay-stable version of today’s distinct origin-invoice payment failures. Hosted retry polling uses it only to distinguish a stale failed baseline from a later webhook; null means no durable failure event has been recorded."
          },
          "todayOrderResult": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "NOT_CREATED",
              "NOT_REQUIRED"
            ],
            "description": "Fulfillment-order result for today. Itemless subscriptions need no order, and a failed initial payment never reports CONFIRMED."
          },
          "recurringCardExplanation": {
            "type": "string",
            "description": "Customer-facing explanation of whether a card was stored today and how future recurring charges will work."
          },
          "managementUrl": {
            "type": "string",
            "nullable": true,
            "description": "Tenant-trusted account or sign-in entry point for subscription management; never a provider portal URL or processor id."
          },
          "managementRequiresAuthentication": {
            "type": "boolean",
            "description": "Always true: management requires customer authentication even when the returned URL already points at an account surface."
          }
        },
        "required": [
          "status",
          "trialMode",
          "trialDays",
          "trialEndBehavior",
          "trialEndsAt",
          "nextRenewalAt",
          "todayPaymentResult",
          "todayPaymentFailureVersion",
          "todayOrderResult",
          "recurringCardExplanation",
          "managementUrl",
          "managementRequiresAuthentication"
        ]
      },
      "CheckoutSessionLineDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "description": "Catalog item id. Null only for an itemless membership/service-access subscription line.",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "description": "Variant id when the line targets a specific variant.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Display name (item, or \"item — variant\")."
          },
          "productName": {
            "type": "string",
            "nullable": true,
            "example": "Deodorant",
            "description": "#4017 (UAT F08) — the PRODUCT half of `name`, or `null` when the frozen line name was not segmented. `name` remains the authoritative frozen identity and is unchanged; this field and `variantName` are an additive, lossless view of it — they are non-null TOGETHER or not at all, and when present `productName + \" — \" + variantName` reconstructs `name` exactly, so a non-null value here is always a real product half and never a whole combined name. Produced by the SAME rule the order-status and account order-detail projections use: a proven pricing origin first, then both CURRENT catalog names separator-free and rebuilding the stored string exactly. The server never splits on a hyphen and never parses the stored value. `null` means render `name` as a single line — a line with no proven pricing origin, an item-level line with no variant, a product or variant renamed or deleted since purchase, or a catalog name that itself contains \" — \". Additionally `null` on every projection that is not a CONFIRMED one-time read: the pre-payment create/reprice/bind responses and the subscription projection never carry it, because the catalog names are resolved only for the paid confirmation (see `confirmedLineCatalogNames`). Legacy and unsegmentable lines therefore render exactly as they did before #4017."
          },
          "variantName": {
            "type": "string",
            "nullable": true,
            "example": "Unscented",
            "description": "#4017 (UAT F08) — the VARIANT half of `name`, exactly as the catalog stores it (never trimmed, so the two halves rejoin losslessly). `null` whenever `productName` is `null`; the two are always resolved together."
          },
          "imageUrl": {
            "type": "string",
            "description": "Catalog thumbnail URL for this line (#982) — the variant featured image when set, else the item primary image. `null` when the item has no image; the hosted/BYO surface renders a placeholder. Snapshotted at reprice so it stays stable for the session. Always present (required), value may be null.",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "Units on this line."
          },
          "unitPriceInCents": {
            "type": "number",
            "description": "Server-resolved per-unit price (sale price when active)."
          },
          "totalPriceInCents": {
            "type": "number",
            "description": "`unitPriceInCents * quantity`."
          },
          "purchaseMode": {
            "type": "string",
            "enum": [
              "ONE_TIME",
              "SUBSCRIPTION"
            ]
          },
          "subscriptionPlanId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "subscriptionPriceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "recurringInterval": {
            "type": "string",
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ],
            "nullable": true
          },
          "recurringIntervalCount": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          },
          "isPackageComponent": {
            "type": "boolean",
            "description": "True when this flat compatibility row is represented inside packages[].components."
          }
        },
        "required": [
          "itemId",
          "name",
          "productName",
          "variantName",
          "imageUrl",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents",
          "purchaseMode",
          "subscriptionPlanId",
          "subscriptionPriceId",
          "recurringInterval",
          "recurringIntervalCount",
          "isPackageComponent"
        ]
      },
      "CheckoutSelectionLineDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "expectedCompositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true,
            "description": "Package definition revision to echo on reprice/bind; null for an ordinary catalog line."
          }
        },
        "required": [
          "itemId",
          "variantId",
          "quantity",
          "expectedCompositionRevision"
        ]
      },
      "CheckoutDeliveryEstimateDto": {
        "type": "object",
        "properties": {
          "displayStyle": {
            "type": "string",
            "enum": [
              "ship_by",
              "delivery_window",
              "both"
            ],
            "description": "How to render: `ship_by`, `delivery_window`, or `both` (tenant choice)."
          },
          "shipByDate": {
            "type": "string",
            "description": "Local date the order is expected to ship by (ISO yyyy-MM-dd)."
          },
          "deliveryStartDate": {
            "type": "string",
            "description": "Local delivery window start, inclusive (ISO yyyy-MM-dd)."
          },
          "deliveryEndDate": {
            "type": "string",
            "description": "Local delivery window end, inclusive (ISO yyyy-MM-dd)."
          }
        },
        "required": [
          "displayStyle",
          "shipByDate",
          "deliveryStartDate",
          "deliveryEndDate"
        ]
      },
      "CheckoutShippingMethodDto": {
        "type": "object",
        "properties": {
          "rateId": {
            "type": "string",
            "description": "Id of the rate the server applied. After a reprice or bind that sent `shippingRateId`, it can differ from the id sent: when a live carrier id (`se:`) has rotated and the server can match it to the same service from this session's recent quote, it re-selects that service under the fresh quote's id. Adopt this id as the selection and send it as `shippingRateId` from then on."
          },
          "name": {
            "type": "string",
            "description": "Customer-facing method/rate name (e.g. \"Standard\")."
          },
          "priceInCents": {
            "type": "number",
            "description": "The rate's own price in minor units (cents). The amount actually charged is `shippingInCents` — `0` when a FREE_SHIPPING rule waived it (`freeShipping` is then true while this price keeps the rate sticker)."
          },
          "freeShipping": {
            "type": "boolean",
            "description": "True when a FREE_SHIPPING coupon/auto-discount/bundle waived the charge: the method is still recorded but `shippingInCents` is `0`."
          },
          "presentationMode": {
            "type": "string",
            "enum": [
              "exact_services",
              "delivery_promises"
            ],
            "description": "#2000 — frozen checkout presentation mode. Absent on legacy sessions."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Frozen customer promise description, when configured."
          },
          "deliveryEstimate": {
            "nullable": true,
            "description": "#2000 — absolute delivery bounds frozen at bind. Present for a valid delivery promise; may also be present for structured exact-service quotes.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutDeliveryEstimateDto"
              }
            ]
          }
        },
        "required": [
          "rateId",
          "name",
          "priceInCents",
          "freeShipping"
        ]
      },
      "CheckoutSessionCustomerDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Captured checkout email for the authenticated matching customer."
          },
          "name": {
            "type": "string",
            "description": "Captured checkout name, or null when the session has none.",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "description": "Captured checkout phone, or null when the session has none.",
            "nullable": true
          }
        },
        "required": [
          "email",
          "name",
          "phone"
        ]
      },
      "CheckoutSessionAddressDto": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code."
          },
          "company": {
            "type": "string",
            "description": "Ship-to company."
          },
          "state": {
            "type": "string",
            "description": "State / province / region."
          },
          "city": {
            "type": "string",
            "description": "City / town."
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP / postal code."
          },
          "line1": {
            "type": "string",
            "description": "Address line 1."
          },
          "line2": {
            "type": "string",
            "description": "Address line 2."
          }
        },
        "required": [
          "country"
        ]
      },
      "CheckoutNormalizedAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "description": "Standardized address line 1."
          },
          "line2": {
            "type": "string",
            "description": "Standardized address line 2, or null when the address has none.",
            "nullable": true
          },
          "city": {
            "type": "string",
            "description": "Standardized city / town."
          },
          "state": {
            "type": "string",
            "description": "Standardized state / province / region."
          },
          "postalCode": {
            "type": "string",
            "description": "Standardized ZIP / postal code."
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code."
          }
        },
        "required": [
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "CheckoutAddressValidationDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "warning",
              "invalid",
              "unknown"
            ],
            "description": "Verdict on the submitted destination: `verified` (every carrier rated it clean), `warning` (deliverable but flagged — see `messages`), `invalid` (the carriers rejected it), or `unknown` (the provider could not judge it). Advisory except at an ordinary physical bind, where an invalid address or a provider-cleaned U.S. address that materially changes the submitted country, state, or five-digit ZIP is a 400."
          },
          "messages": {
            "description": "Display-safe, shopper-actionable provider messages about the submitted destination address (deduped, at most 5). Empty when the provider offered no address detail. Provider notices about the merchant's parcel, carrier, account, or billing configuration are withheld from this list — the shopper cannot act on them — and surface only in operator diagnostics (#3375).",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "normalized": {
            "nullable": true,
            "description": "The carrier-standardized form of the submitted address, offered as a correction the shopper can accept. `null` when the provider returned no cleaned address, its cleaned form is identical (case/trim-insensitively), or a verified U.S. cleanup changes only case, spacing, or punctuation in the street lines and/or enriches a submitted five-digit ZIP with ZIP+4 while country, state, city, and five-digit ZIP remain unchanged. Replacing or removing an entered ZIP+4 extension remains a correction. Street names, suffixes, and house or unit numbers are not treated as formatting-only.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutNormalizedAddressDto"
              }
            ]
          }
        },
        "required": [
          "status",
          "messages",
          "normalized"
        ]
      },
      "CheckoutShippingQuoteFailureDto": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "shipping_rate_quote"
            ],
            "description": "Always `shipping_rate_quote`: the live quote failed while previewing delivery options, before any bind or payment. The bind-time equivalent is the separate `details.shippingFailure` refusal (`stage: shipping_rate_bind`)."
          },
          "category": {
            "type": "string",
            "enum": [
              "invalid_address",
              "unknown_provider_rejection",
              "configuration_failure",
              "authentication_failure",
              "rate_limited",
              "timeout",
              "network_failure",
              "provider_outage",
              "no_usable_rates"
            ],
            "description": "Normalized cause. `timeout`, `network_failure`, `provider_outage`, and `rate_limited` are transient service conditions and say nothing about the address. `invalid_address` means the carriers rejected the destination; the same response then also carries `shippingAddressValidation` guidance. `no_usable_rates` means the provider answered but returned no usable service for this delivery. `configuration_failure` and `authentication_failure` are store-side and cannot be fixed by the shopper. `unknown_provider_rejection` is an unclassified provider refusal."
          },
          "retryable": {
            "type": "boolean",
            "description": "Canonical for the category: `true` means a later EXPLICIT refresh of the same inputs (reprice with `refreshShippingRates: true`) could recover. It never authorizes an automatic retry loop, bind, or payment. `false` means repeating the same inputs will not help: the address or the store configuration has to change."
          },
          "supportReference": {
            "type": "string",
            "pattern": "^lrq_[A-Za-z0-9_-]{16}$",
            "description": "Opaque reference minted for THIS response. It correlates with exactly one redacted server event for support; no route accepts it as input and it identifies no session, order, or customer. A later reprice, even with an identical failure, returns a new reference."
          },
          "retryAfterSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400,
            "description": "Seconds to wait before an explicit refresh. Present only for `rate_limited` when the provider supplied a delay; absent for every other category and for a `rate_limited` failure without one."
          }
        },
        "required": [
          "stage",
          "category",
          "retryable",
          "supportReference"
        ]
      },
      "CheckoutShippingUnavailableDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "SHIPPING_NOT_CONFIGURED",
              "DESTINATION_NOT_SERVED",
              "NO_SHIPPING_METHOD",
              "RATES_TEMPORARILY_UNAVAILABLE"
            ],
            "description": "`SHIPPING_NOT_CONFIGURED`: the store has no active shipping zone, so it cannot ship this order anywhere yet. `DESTINATION_NOT_SERVED`: no active zone serves the destination country. `NO_SHIPPING_METHOD`: a zone with live carrier rates serves the destination, but this response has no usable method from it, typically because the quote failed (also classified in `shippingQuoteFailure`) or the store’s service policy excludes every quoted service. `RATES_TEMPORARILY_UNAVAILABLE`: the live quote did not settle for a reason that is neither a classified provider failure nor a store fact, for example the store’s delivery settings changing while this response was priced; repeat the preview for the same destination, since bind refuses the same state as temporarily unavailable. None of these blames the shopper’s address; a carrier-rejected address is reported through `shippingAddressValidation` instead."
          }
        },
        "required": [
          "reason"
        ]
      },
      "CheckoutShippingOptionDto": {
        "type": "object",
        "properties": {
          "rateId": {
            "type": "string",
            "description": "Rate id — resend as `shippingRateId` on reprice (preview) and bind. **Quote-scoped** (#3052): treat every id as belonging to the quote it arrived on. Flat-rate ids are stable tenant configuration; live carrier ids (`se:`) wrap the provider's per-quote id and DO rotate between quotes; delivery-promise ids (`dp:`) derive from a durable promise tier, so the id is stable while that promise is still offered, though the promise itself can stop being offered and a stable id never implies a stable price (the server always charges the fresh quote). Replace the entire option set from every fresh response; never keep a pre-reprice id once a fresh response has answered, infer meaning from its prefix, or re-match a prior choice by `name` (labels are neither unique nor stable). Send the current selection as `shippingRateId` with each reprice, then replace it from the response: after a reprice that sent it, a non-null `shippingMethod.rateId` is the server-applied selection — adopt it even when the id you sent is absent from the fresh set (a rotated live id re-selected as the same service), and never clear it for that reason. Only when no method was applied — `shippingMethod` is `null`, or a fresh set that did not re-quote the selection (such as a pre-bind read) no longer lists it — clear the selection, then read the fresh set: if it lists methods, require the shopper to explicitly reconfirm one; if it is empty, follow `shippingQuoteFailure` or `shippingUnavailable` when either is present; if it is empty with neither for a complete destination, there is nothing to reconfirm — a served destination whose rates do not apply to this cart binds without `shippingRateId` and with no shipping charge (bind still requires a complete destination for a cart that ships). A bind carrying an id whose service can no longer be quoted is rejected with `400` `details.reason: SHIPPING_RATE_NOT_QUOTABLE`, while a reprice answers `shippingMethod: null`."
          },
          "name": {
            "type": "string",
            "description": "Customer-facing rate name (e.g. \"Standard\")."
          },
          "priceInCents": {
            "type": "number",
            "description": "The rate's price in minor units (cents)."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Minimum order subtotal (cents) this rate requires — already satisfied by the current cart (options below the floor are omitted from the list)."
          },
          "estimatedDelivery": {
            "type": "string",
            "description": "Free-text delivery estimate (e.g. \"3–5 business days\").",
            "nullable": true
          },
          "freeShipping": {
            "type": "boolean",
            "description": "True when selecting THIS option charges nothing — a FREE_SHIPPING coupon/auto-discount/bundle is active AND this rate is at/below the baseline (cheapest applicable) rate it waives (#1014). A pricier upgrade stays `false` and charges its full `priceInCents`: a free-ship promo covers standard shipping, not premium upgrades. The surface renders \"Free\" when this is true so each option label matches the amount that selecting it will charge."
          },
          "deliveryEstimate": {
            "nullable": true,
            "description": "#1103 — computed ship-by / delivery-window dates when the tenant enabled structured estimates and this rate has a transit window; null otherwise (fall back to `estimatedDelivery`).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutDeliveryEstimateDto"
              }
            ]
          },
          "presentationMode": {
            "type": "string",
            "enum": [
              "exact_services",
              "delivery_promises"
            ],
            "description": "#2000 — present for live quotes. `delivery_promises` means the name is a merchant promise tier, not the hidden anchor carrier service."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Promise-mode customer description. Omitted for exact services/flat rates."
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0,
            "description": "Promise-mode merchant display order. Omitted for exact services/flat rates."
          }
        },
        "required": [
          "rateId",
          "name",
          "priceInCents",
          "minimumSubtotalInCents",
          "estimatedDelivery",
          "freeShipping",
          "deliveryEstimate"
        ]
      },
      "CheckoutAppliedCouponDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Canonical code of the coupon applied to this cart."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ]
          },
          "value": {
            "type": "number",
            "description": "Configured coupon value: basis points for PERCENTAGE, minor units (cents) for FIXED_AMOUNT, and 0 for FREE_SHIPPING. A Buy X, Get Y coupon is PERCENTAGE with value 0: its percentage applies to its reward units only, so its saving is `discountInCents`."
          },
          "discountInCents": {
            "type": "number",
            "description": "Clamped amount this coupon removed from the cart subtotal, in minor units (cents). FREE_SHIPPING is represented separately and keeps this 0."
          },
          "freeShipping": {
            "type": "boolean",
            "description": "True when this coupon waives the selected shipping charge instead of removing value from the cart subtotal."
          }
        },
        "required": [
          "code",
          "type",
          "value",
          "discountInCents",
          "freeShipping"
        ]
      },
      "CheckoutDiscountSnapshotDto": {
        "type": "object",
        "properties": {
          "appliedCoupon": {
            "description": "Coupon applied to THIS submitted cart state. Always present within a discount snapshot; null means no coupon is applied. On an existing session, repricing or binding without `couponCode` removes any prior coupon and returns null here. A supplied but rejected code also returns null; the typed public contract does not expose a reason discriminator.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CheckoutAppliedCouponDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          }
        },
        "required": [
          "appliedCoupon"
        ]
      },
      "OrderEmailProcessingFactsDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "FAILED",
              "BLOCKED",
              "SENT"
            ],
            "nullable": true,
            "description": "Persisted outbox state; null when detailed source facts are unavailable. SENT describes queue completion, not provider or inbox proof."
          },
          "failedAttempts": {
            "type": "number",
            "nullable": true,
            "description": "Recorded failed/blocked processing completions. This counter excludes successful processing, the current claim and crashes, and is not a total processing or provider-call count. Null means unavailable."
          },
          "queuedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC durable enqueue time; null when source facts are unavailable."
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC start of the current processing claim, not a complete processing history. Null when no current claim is recorded or facts are unavailable."
          },
          "failedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC failure time currently retained by the outbox. Null means not recorded or unavailable, not no prior failure."
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC queue completion time. Null means not recorded or unavailable; presence does not prove provider acceptance or inbox delivery."
          },
          "nextEligibleAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Persisted UTC next eligibility time for PENDING/FAILED queue work only. Not a promised execution/send time or permission: workers, policy, pinned request and provider safety still gate delivery. Preview crons do not establish automatic execution. Null means no eligible queue state or unavailable facts."
          }
        },
        "required": [
          "state",
          "failedAttempts",
          "queuedAt",
          "startedAt",
          "failedAt",
          "completedAt",
          "nextEligibleAt"
        ]
      },
      "OrderEmailProviderFactsDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NOT_OBSERVED",
              "ADMITTED",
              "IN_FLIGHT",
              "ACCEPTED",
              "FAILED_OR_UNKNOWN",
              "QUARANTINED",
              "UNAVAILABLE"
            ],
            "description": "State of the exact structurally attached provider attempt. NOT_OBSERVED is missing attachment evidence, never proof that no send occurred. Failure/in-flight/quarantine do not prove nonacceptance. ACCEPTED is provider acceptance only."
          },
          "submissionClaims": {
            "type": "number",
            "nullable": true,
            "description": "Durable provider submission claims. Claims precede final policy checks and HTTP, so this is not an actual provider-call count. Null means no trusted attached attempt or unavailable facts."
          },
          "actualCallCount": {
            "type": "number",
            "nullable": true,
            "description": "Always null: the current canonical stores do not persist an exact HTTP provider-call count. Neither processing failures nor submission claims can substitute for it."
          },
          "firstAttemptAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC first provider submission claim, which starts the existing safe retry window. Null means no recorded claim or unavailable facts, not proof of no provider I/O."
          },
          "lastAttemptAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC latest retained provider submission claim. Null means no recorded claim or unavailable facts."
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC recorded provider acceptance. Null means not recorded or unavailable, never conclusive nonacceptance. Acceptance survives later queue finalization failures and is not inbox delivery."
          },
          "safeRetryUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "UTC end of the existing provider-safe retry window measured from its first durable claim. Null means the window has not started or cannot be established. An open window alone never authorizes retry."
          },
          "safeRetryWindow": {
            "type": "string",
            "enum": [
              "NOT_STARTED",
              "OPEN",
              "EXPIRED",
              "UNAVAILABLE"
            ],
            "description": "Window timing at observedAt, not a recovery capability. NOT_STARTED requires an exact ADMITTED attempt with zero claims and no first claim. EXPIRED does not prove nonacceptance."
          }
        },
        "required": [
          "state",
          "submissionClaims",
          "actualCallCount",
          "firstAttemptAt",
          "lastAttemptAt",
          "acceptedAt",
          "safeRetryUntil",
          "safeRetryWindow"
        ]
      },
      "OrderEmailRecoveryCapabilityDto": {
        "type": "object",
        "properties": {
          "canRetry": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Always false: this read exposes no safe self-service retry/resend action. Repeated reads cannot submit email."
          },
          "reason": {
            "type": "string",
            "enum": [
              "NO_SAFE_SELF_SERVICE_RECOVERY"
            ],
            "description": "Attended recovery needs separately authorized, conclusive nonacceptance, no surviving in-flight submission, pinned-request/identity validation and attributable audit. No failure code grants this authority."
          }
        },
        "required": [
          "canRetry",
          "reason"
        ]
      },
      "OrderConfirmationEmailRetryDto": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "ORDER_CONFIRMATION"
            ],
            "description": "Only the original order-confirmation communication; later shipment and other messages have independent outcomes in order email history."
          },
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE means this exact recorded source can be read, not complete historical coverage. Capture-off, legacy, ambiguous, deleted and unreadable sources remain UNAVAILABLE."
          },
          "unavailableReason": {
            "type": "string",
            "enum": [
              "CAPTURE_DISABLED",
              "ENVIRONMENT_UNAVAILABLE",
              "SCHEMA_UNAVAILABLE",
              "MISSING_SOURCE",
              "AMBIGUOUS_SOURCE",
              "STORE_UNAVAILABLE"
            ],
            "nullable": true,
            "description": "Fixed reason for unavailable facts; null when available. Missing source does not mean no email was queued or sent."
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "PROCESSING",
              "RETRY_SCHEDULED",
              "PROVIDER_ACCEPTED",
              "OUTCOME_UNKNOWN",
              "STOPPED",
              "UNAVAILABLE"
            ],
            "description": "Redacted current guidance state. RETRY_SCHEDULED describes durable eligible work only; OUTCOME_UNKNOWN must not be retried blindly. STOPPED never establishes conclusive provider nonacceptance."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC database snapshot observation time; unavailable responses use API observation time. Facts and retry-window timing are observed, not live guarantees."
          },
          "timezone": {
            "type": "string",
            "enum": [
              "UTC"
            ],
            "description": "Timezone of every timestamp in this response."
          },
          "missingHistoryPossible": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Always true. Capture may have been off or records absent/retired; this read never claims a complete historical send census."
          },
          "processing": {
            "$ref": "#/components/schemas/OrderEmailProcessingFactsDto"
          },
          "provider": {
            "$ref": "#/components/schemas/OrderEmailProviderFactsDto"
          },
          "failureCategory": {
            "type": "string",
            "enum": [
              "NONE",
              "POLICY_OR_CONFIGURATION",
              "REQUEST_INTEGRITY",
              "RETRY_WINDOW_EXPIRED",
              "OUTCOME_UNCERTAIN",
              "PROCESSING_FAILURE",
              "UNAVAILABLE"
            ],
            "description": "Allowlisted failure class only, never raw payload, recipient, policy code, provider response or credentials. NONE is no currently classified failure, not proof no failure ever occurred."
          },
          "guidance": {
            "type": "string",
            "enum": [
              "WAIT_FOR_PROCESSING",
              "WAIT_FOR_AUTOMATIC_RETRY",
              "ACCEPTANCE_RECORDED",
              "CONTACT_SUPPORT",
              "DETAILS_UNAVAILABLE"
            ],
            "description": "Read-only next-step guidance. Waiting does not guarantee a scheduled worker will execute; support guidance grants no resend authority."
          },
          "inbox": {
            "type": "string",
            "enum": [
              "NOT_PROVEN"
            ],
            "description": "This projection cannot prove inbox placement. Provider acceptance, a sent webhook or destination-MX acceptance is not inbox proof."
          },
          "recovery": {
            "$ref": "#/components/schemas/OrderEmailRecoveryCapabilityDto"
          }
        },
        "required": [
          "scope",
          "availability",
          "unavailableReason",
          "state",
          "observedAt",
          "timezone",
          "missingHistoryPossible",
          "processing",
          "provider",
          "failureCategory",
          "guidance",
          "inbox",
          "recovery"
        ]
      },
      "CustomerCommunicationStatusDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "QUEUED",
              "PROVIDER_ACCEPTED",
              "FAILED",
              "POLICY_DISABLED"
            ],
            "description": "Safe delivery result. `QUEUED` means the durable event is eligible under current server policy; `PROVIDER_ACCEPTED` means the provider accepted the request, not that the inbox received it. `FAILED` carries no provider/internal error detail. `POLICY_DISABLED` means delivery was prevented before provider acceptance by environment policy or configuration. `NOT_APPLICABLE` means no matching communication was queued."
          },
          "retry": {
            "description": "Merchant order detail only: redacted persisted confirmation retry facts and read-only guidance. Omitted from customer-facing and other legacy callers. Omission means this surface does not publish the details, never no processing or no email. Detailed unavailable facts do not turn the legacy coarse state into canonical provider or inbox proof.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderConfirmationEmailRetryDto"
              }
            ]
          }
        },
        "required": [
          "state"
        ]
      },
      "CheckoutSessionSummaryDto": {
        "type": "object",
        "properties": {
          "purchaseMode": {
            "type": "string",
            "enum": [
              "ONE_TIME",
              "SUBSCRIPTION"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ],
            "description": "Lifecycle status. Cart sessions begin OPEN; server-priced booking sessions begin PENDING_PAYMENT; subscription sessions are advanced only by verified Billing outcomes. Confirmation/expiry moves every flow forward."
          },
          "isBinding": {
            "type": "boolean",
            "description": "For cart checkout, false after create/reprice (mutable estimate) and true after bind. Booking checkout is server-priced and true at creation. Subscription checkout becomes true only after its provider subscription and exact first invoice are verified. #604 refuses to create an ordinary payment session unless this is true."
          },
          "contextType": {
            "type": "string",
            "enum": [
              "CART",
              "BOOKING"
            ]
          },
          "booking": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutBookingContextDto"
              }
            ]
          },
          "subscription": {
            "nullable": true,
            "description": "Subscription-specific payment/order/renewal truth. Present only when purchaseMode is SUBSCRIPTION.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSubscriptionSummaryDto"
              }
            ]
          },
          "refundInitiated": {
            "type": "boolean",
            "description": "True only when this session is CANCELLED *and* it was CHARGED then auto-refunded by the webhook-authoritative confirmation path (#871) — a stale-PI reprice amount/currency mismatch or an oversell-after-charge race flipped the session to CANCELLED and enqueued the per-attempt refund (`checkout-refund:${paymentAttemptId}` outbox, idempotent). It lets the hosted/BYO surface tell a charged-then-refunded CANCELLED session apart from a plain cancelled/expired one and render honest \"payment received — your refund is on the way\" copy instead of the generic not-payable block. Scoped to CANCELLED on purpose: the confirmation path also refunds an extra duplicate charge on an already-CONFIRMED session without cancelling it, so a refunded-event check alone is not sufficient. Customer-safe by construction: a single boolean derived from the presence of the internal `checkout_session.refunded` event — it carries NO processor ids, amounts, or failure detail. `false` on every session that is not a charged-then-refunded CANCELLED one (OPEN, EXPIRED, a plain CANCELLED, and CONFIRMED — including a CONFIRMED session whose duplicate charge was refunded)."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code (e.g. `usd`)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSessionLineDto"
            }
          },
          "packages": {
            "description": "Frozen package selections with every component, operational quantity, savings, tax, and total.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "selections": {
            "description": "Top-level server-accepted catalog selections for exact reprice/bind retry. Package components never replace their parent here.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSelectionLineDto"
            }
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Sum of gross line totals. For a trial subscription this still includes the recurring sticker price; the amount deferred by the trial appears in discountInCents so the due-today equation remains exact."
          },
          "discountInCents": {
            "type": "number",
            "description": "Amount subtracted from the gross subtotal. For subscription checkout it can include recurring value deferred from the first invoice by a trial, not only promotional discounts."
          },
          "taxInCents": {
            "type": "number",
            "description": "Computed sales tax folded into the binding total (#449, ADR-008). `0` when no tax provider is enabled (the default) — the reference storefronts read THIS instead of their flat-8% placeholder. Non-zero cart tax is computed at `bind` from the captured address; a booking session may instead carry its persisted tax-preflight posture at creation."
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe tax posture disclosure. Present when the transaction used the audited manual/no-tax escape hatch, so checkout/receipt surfaces can clearly state that cartonium did not calculate tax.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charge folded into the binding total (#854). `0` until `bind` resolves a customer-selected `shippingRateId` against the active zone matching the captured address — the price is re-derived server-side from the rate (never a client amount, ADR-006). Stays `0` when no rate is selected or a FREE_SHIPPING coupon/auto-discount/bundle waives the charge (the chosen method is still recorded on the session). The hosted/BYO surface renders THIS as the shipping line."
          },
          "totalInCents": {
            "type": "number",
            "description": "Commercial transaction total (`subtotal - discount + tax + shipping`). For cart/full-payment checkout this is also charged now; a booking deposit charges amountDueNowInCents instead (ADR-006). For a subscription this is the verified first-invoice total only, never the lifetime value or a future renewal amount."
          },
          "amountDueNowInCents": {
            "type": "number",
            "description": "Amount due now. Equals totalInCents for carts/full payment, may be smaller for a booking deposit, and is the verified first-invoice amount for a subscription (0 for a no-card trial)."
          },
          "remainingBalanceInCents": {
            "type": "number",
            "description": "Commercial balance remaining after the due-now amount for this checkout. Always 0 for subscription checkout; future renewals are described by subscription.nextRenewalAt and are not a checkout balance."
          },
          "requiresFreeConfirmation": {
            "type": "boolean",
            "description": "#3263 — `true` when this bound checkout must be completed through `POST …/sessions/:token/confirm-free` rather than `payment-session`, because its total cannot be charged: either zero, or above zero but below the payment provider's per-currency minimum (which the provider rejects, surfacing as a generic 500). Surfaces are expected to branch on THIS FLAG rather than testing the total themselves — the minimum is a provider fact that varies by currency and changes on the provider schedule, so a client-side comparison duplicates a threshold that will drift. `false` on a non-binding session, since a session that has not bound has no server-authoritative total yet. Also `false` for booking, booking-group, and subscription checkouts: they have no no-charge completion path, so a below-minimum total there is refused rather than routed."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The customer-selected shipping method (#854/#1002), so the hosted/BYO surface can show WHICH option is chosen before payment. Populated on reprice (a preview) AND bind (the commitment) when a resolvable `shippingRateId` is selected; `null` on create, and whenever no rate is selected or the selected rate does not resolve (on reprice it simply clears the estimate; on bind an invalid rate is a `400`). The charged amount is `shippingInCents`; this carries the method label and whether a FREE_SHIPPING rule waived the charge.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingMethodDto"
              }
            ]
          },
          "customer": {
            "nullable": true,
            "description": "#1170 — captured customer contact for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer. This keeps the anonymous session-read projection PII-free; #3231 deliberately exposes only the bound email through the separate payment-session handoff.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionCustomerDto"
              }
            ]
          },
          "shippingAddress": {
            "nullable": true,
            "description": "#1170 — captured shipping address for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionAddressDto"
              }
            ]
          },
          "shippingAddressValidation": {
            "nullable": true,
            "description": "#1563/#4201 — provider verdict on the shipping address, produced by a live-rate quote or configured fulfillment validation. Present ONLY on reprice/bind responses when provider validation was attempted and returned a verdict. PII posture (#1170/#606): echoes a cleaned form of the address the caller submitted on this request and is never present on anonymous session reads. #3231 separately permits that token to obtain only the bound email through the payment-session handoff, never this address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressValidationDto"
              }
            ]
          },
          "shippingQuoteFailure": {
            "description": "#4673 — present ONLY on a reprice response whose live carrier-rate quote for the submitted destination failed: a fresh provider failure, or one the server reused from its short failure cache (an explicit `refreshShippingRates: true` reprice bypasses that cache). Omitted on every other response — create, bind, and session reads (none of which reports a quote outcome), a reprice whose live quote succeeded, and a reprice that attempted no live quote (incomplete destination, live rates not configured for the destination, nothing to ship). Absence therefore never proves rates exist; read `availableShippingOptions`. Present with an EMPTY `availableShippingOptions`: no delivery method is currently usable because the quote failed — not proof the destination is unserviceable. Keep the shopper at delivery, show the category, and offer an explicit refresh when `retryable` is true; do not blame the address unless the category is `invalid_address`. Present beside a NON-EMPTY list: those listed options (for example configured flat rates) remain valid choices while carrier rates are unavailable. A merchant service policy that excludes every quoted service is not a provider failure and is never classified here.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingQuoteFailureDto"
              }
            ]
          },
          "shippingUnavailable": {
            "description": "#4673 — present ONLY on a reprice response for a cart that requires shipping, with a destination country and an EMPTY `availableShippingOptions`, when a bind of that cart to that destination would be refused for lack of a delivery method. Keep the shopper at delivery; it can be combined with `shippingQuoteFailure`, whose retry guidance then applies. Omitted on every other response, including create, bind, and session reads, and whenever the cart ships nothing, no destination country is known, options exist, or the address itself was rejected (see `shippingAddressValidation`). Absence does not prove a bind will succeed: an empty option set without this field can still be valid, for example a served destination whose configured rates do not apply to this cart binds with no shipping charge.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingUnavailableDto"
              }
            ]
          },
          "availableShippingOptions": {
            "description": "For ordinary one-time checkout, server-derived shipping options applicable to the captured destination + cart subtotal (#1002), so the hosted/BYO surface can show — and let the shopper switch between — fulfillment methods BEFORE payment. Resolved from the active zone matching the address country, filtered to rates the subtotal clears. **Populated only on ordinary reprice/bind responses and on a read of an ordinary session that is not yet binding** (#3052): its create response and any read of a BOUND session return `[]` by design (no destination resolved yet, and the picker is a pre-payment surface the confirmation poll must not re-query). Physical-subscription summaries also return `[]`: that flow has no public option preflight (#3482), so this field is not its selection source. An empty array on those responses therefore means \"not offered here\", NOT \"no rates available\" — never let one clear a rendered option set or a confirmed selection. It is also empty when no address, zone, or applicable rate exists, and when a live carrier quote failed with no other applicable rate — a reprice distinguishes that last case with `shippingQuoteFailure`, and reports through `shippingUnavailable` when an empty set for a cart that ships means a bind would be refused. For ordinary checkout, select one and resend its `rateId` as `shippingRateId`: reprice previews the resulting total; bind re-resolves and commits it only if it is still valid. The charged amount is always server-derived (ADR-006). An option is current only for the response it arrived on, not a promise that a later bind will succeed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutShippingOptionDto"
            }
          },
          "discountSnapshot": {
            "description": "Current server-authored discount attribution, persisted verbatim and copied onto the final order for attribution. The property is always present. It is an object for server-repriced cart/subscription sessions (even when no discount applies), and null only for booking, booking-group, or legacy sessions that have no discount snapshot. Within an object, `appliedCoupon: null` is the authoritative proof that no coupon is applied; aggregate discounts or totals can still reflect other rules. Only `appliedCoupon` is modeled by this schema; any additional server-authored attribution keys are intentionally not declared as public identifiers or schema fields.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CheckoutDiscountSnapshotDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "description": "When an unbound session may expire before provider creation. Once a durable provider-create intent exists, this timestamp remains useful for shopper messaging but authoritative reconciliation decides the outcome instead of a token read silently expiring provider-bound work. Null only in the (not-issued-here) no-expiry case.",
            "nullable": true,
            "format": "date-time"
          },
          "reservationExpiresAt": {
            "type": "string",
            "description": "When a Mode-B (reserve-during-checkout) pre-payment inventory hold expires — the secondary countdown source for \"your items are held for N min\". Null under Mode A (reserve-at-confirmation, the only live mode today), where the session carries no hold. #605 Slice 3 ships this as a SEAM: it is populated only once Mode B is wired (no holds are minted in M3).",
            "nullable": true,
            "format": "date-time"
          },
          "orderReference": {
            "type": "string",
            "description": "Stable public order address. Always present as a nullable field: null before finalOrderId exists and the exact non-null Order reference afterward. The locator is never an authentication credential.",
            "nullable": true,
            "pattern": "^or1_[0-9a-f]{32}$",
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "orderNumber": {
            "type": "string",
            "description": "The resulting order number once this session is CONFIRMED (#991) — the in-flow confirmation surface renders it as the post-payment receipt reference. Joined from `CheckoutSession.finalOrderId`; `null` on every non-confirmed read and on create/reprice/bind (no order exists yet). ALWAYS PRESENT (nullable), like `returnToStoreUrl` — every summary path emits it, so it belongs in the schema `required` set. Non-PII: the same `Order.orderNumber` the #818 order-status page and the signed-in account already show. The order-status `o`-token is hash-at-rest (ADR-007) and intentionally NOT reconstructable here, so this is a reference + account next-action, not a regenerated forwardable status link.",
            "nullable": true
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived, customer-safe state of the order-confirmation email. Always present. It never includes the recipient, provider id, policy code, or raw outbox error.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "returnToStoreUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe return-to-store destination for hosted/BYO checkout surfaces. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe post-checkout completion destination. Prefers trusted `checkoutSettings.postCheckoutRedirectUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. Hosted checkout may auto-redirect here only after the server read shows CONFIRMED; never from a client-side processor callback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutRetryUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe retry/start-over checkout destination. Prefers trusted `checkoutSettings.checkoutRetryUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutCancelUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe canceled/expired checkout destination. Prefers trusted `checkoutSettings.checkoutCancelUrl`, then `checkoutRetryUrl`, `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "accountUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer account URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout account origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "accountSignInUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer sign-in URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout sign-in origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "#996 — whether the tenant enabled the hosted-checkout marketing opt-in (`checkoutSettings.marketingOptInEnabled`). When true, the surface shows a DEFAULT-UNCHECKED opt-in checkbox before payment and sends the shopper's choice as the bind `marketingOptIn`. ALWAYS PRESENT (in the schema `required` set); `false` unless the tenant turned it on."
          },
          "marketingOptInCopy": {
            "type": "string",
            "description": "#996 — the label to render beside the opt-in checkbox when `marketingOptInEnabled` is true: the tenant-configured copy, else a safe default. Plain text (no URL). `null` when the opt-in is disabled (no checkbox). ALWAYS PRESENT (nullable).",
            "nullable": true
          }
        },
        "required": [
          "purchaseMode",
          "status",
          "isBinding",
          "contextType",
          "booking",
          "subscription",
          "refundInitiated",
          "currency",
          "lines",
          "packages",
          "selections",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "totalInCents",
          "amountDueNowInCents",
          "remainingBalanceInCents",
          "requiresFreeConfirmation",
          "customer",
          "shippingAddress",
          "availableShippingOptions",
          "discountSnapshot",
          "orderReference",
          "orderNumber",
          "orderConfirmationEmail",
          "returnToStoreUrl",
          "postCheckoutRedirectUrl",
          "checkoutRetryUrl",
          "checkoutCancelUrl",
          "accountUrl",
          "accountSignInUrl",
          "marketingOptInEnabled",
          "marketingOptInCopy"
        ]
      },
      "CheckoutPaymentWalletsDto": {
        "type": "object",
        "properties": {
          "applePay": {
            "type": "string",
            "enum": [
              "auto",
              "never"
            ],
            "description": "Apple Pay, from this payment generation's frozen wallet preference. `auto` permits the Payment Element to offer it when the device, browser and account support it; it does not guarantee it appears. `never` hides it."
          },
          "googlePay": {
            "type": "string",
            "enum": [
              "auto",
              "never"
            ],
            "description": "Google Pay, from this payment generation's frozen wallet preference, with the same meaning as `applePay`."
          },
          "link": {
            "type": "string",
            "enum": [
              "never"
            ],
            "description": "Link is always `never` here: it is not offered for checkouts with a frozen payment policy. A card-only payment alone does not prove the Payment Element will not offer Link, so set this explicitly."
          }
        },
        "required": [
          "applePay",
          "googlePay",
          "link"
        ]
      },
      "CheckoutPaymentPresentationDto": {
        "type": "object",
        "properties": {
          "basis": {
            "type": "string",
            "enum": [
              "ADMISSION",
              "DRAFT"
            ],
            "description": "`ADMISSION`: the payment generation frozen when payment was prepared, which the server enforces. `DRAFT`: what that generation would admit, read before any payment exists for it; visibility only, never purchase authority. A payment hand-off always answers `ADMISSION`."
          },
          "paymentMethodTypes": {
            "minItems": 1,
            "description": "The exact Stripe payment method types this payment generation admits, in a stable order; never empty. Today this is `[\"card\"]`.",
            "example": [
              "card"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "wallets": {
            "description": "The Payment Element `wallets` option; pass it unchanged. Apple Pay and Google Pay are card payments, so the server cannot refuse them by payment method type: this option is what keeps a `never` wallet off the page.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPaymentWalletsDto"
              }
            ]
          }
        },
        "required": [
          "basis",
          "paymentMethodTypes",
          "wallets"
        ]
      },
      "CheckoutPaymentDisplayPreviewDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "UNMARKED",
              "DISPLAY",
              "NO_PAYABLE_METHOD",
              "UNAVAILABLE",
              "CHANGED"
            ],
            "description": "`UNMARKED`: the checkout carries no frozen payment policy; keep today’s card entry. `DISPLAY`: what the observed payment generation displays; see `basis`. `NO_PAYABLE_METHOD`: the frozen payment policy admits no payment method, so this checkout cannot be paid online. `UNAVAILABLE`: the frozen payment policy cannot be used for this checkout here; see `reason`. `CHANGED`: this response no longer describes the checkout. It left a payable state, or its payment generation or binding changed while this read ran. Read the checkout again; do not repeat requests automatically. Only `DISPLAY` configures a payment form. No state authorizes a payment: the payment hand-off (`POST …/payment-session`) decides again and may still refuse."
          },
          "basis": {
            "type": "string",
            "enum": [
              "UNBOUND_PREVIEW",
              "BOUND_DRAFT",
              "ADMITTED"
            ],
            "description": "Present exactly when `state` is `DISPLAY`; omitted otherwise. `ADMITTED`: the frozen admission recorded when payment was prepared for this generation. `BOUND_DRAFT`: what this bound generation would admit; no payment exists for it yet. `UNBOUND_PREVIEW`: what this generation would admit, read before bind. Bind still settles the amount, and the hand-off decides the payment."
          },
          "paymentGeneration": {
            "type": "number",
            "minimum": 0,
            "description": "Present exactly when `state` is `DISPLAY`; omitted otherwise. The checkout payment generation this preview describes, as this read observed it; the saved-card reads report the same value as `paymentGeneration` for the same generation. No request accepts it, and it is not a lease: a reprice, rebind or saved-card preference write can start a new generation at any time."
          },
          "paymentMethodTypes": {
            "minItems": 1,
            "example": [
              "card"
            ],
            "description": "Present exactly when `state` is `DISPLAY`; omitted otherwise. The exact Stripe payment method types this generation admits or, for `BOUND_DRAFT` and `UNBOUND_PREVIEW`, would admit, in a stable order; never empty. Today this is `[\"card\"]`.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "wallets": {
            "description": "Present exactly when `state` is `DISPLAY`; omitted otherwise. The Payment Element `wallets` option for this generation, with the same meaning as on `paymentPresentation`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPaymentWalletsDto"
              }
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "NOT_ACTIVATED",
              "SESSION_SHAPE_NOT_ENFORCED",
              "POLICY_EVIDENCE_UNUSABLE",
              "ACCOUNT_BINDING_CHANGED",
              "SESSION_STATUS",
              "PAYMENT_GENERATION"
            ],
            "description": "Present exactly when `state` is `UNAVAILABLE` or `CHANGED`; omitted otherwise. With `UNAVAILABLE`: `NOT_ACTIVATED`, the payment policy is not active here yet; `SESSION_SHAPE_NOT_ENFORCED`, this kind of checkout is not covered yet; `POLICY_EVIDENCE_UNUSABLE`, the frozen payment policy or this generation’s record of it cannot be used; `ACCOUNT_BINDING_CHANGED`, the store’s payment account changed after this checkout began. With `CHANGED`: `SESSION_STATUS`, the checkout is no longer open for payment; `PAYMENT_GENERATION`, its payment generation or binding changed, or a replacement payment is still pending."
          }
        },
        "required": [
          "state"
        ]
      },
      "PaymentEntryResponseDto": {
        "type": "object",
        "properties": {
          "publishableKey": {
            "type": "string",
            "description": "Public Stripe key paired with this API environment."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Connected account for card collection; null only on an admitted platform-account path."
          },
          "amountInCents": {
            "type": "number",
            "description": "Current provisional total in minor units; bind and payment-session remain authoritative."
          },
          "currency": {
            "type": "string",
            "description": "Lowercase ISO currency code."
          },
          "taxAddressSource": {
            "type": "string",
            "enum": [
              "shipping",
              "billing"
            ],
            "description": "Address to use for a tax preview: shipping when any current checkout line requires delivery, otherwise billing. Preview reprices and validates this again."
          },
          "paymentMethodTypes": {
            "type": "array",
            "description": "The existing ordinary one-time checkout card-only collection policy.",
            "items": {
              "type": "string",
              "enum": [
                "card"
              ]
            }
          },
          "paymentPresentation": {
            "description": "E31 #4359 (ADR-050 §16): the payment presentation for the current payment generation, from the checkout's frozen payment policy: `ADMISSION` once payment was prepared for it, otherwise `DRAFT`, what it would admit. Visibility only; it never authorizes a payment. Omitted when the checkout carries no frozen payment policy (today every checkout until its payment-policy rollout), and also while a checkout that carries one has no bound, payable payment generation yet, for example before bind. This field alone does not tell those two cases apart; `paymentDisplayPreview` does, from a server that provides it. The payment hand-off (`POST …/payment-session`) returns the presentation that applies to the payment it prepares.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPaymentPresentationDto"
              }
            ]
          },
          "paymentDisplayPreview": {
            "description": "E31 #4359 (PRE-BIND): what this checkout may display for payment, from its frozen payment policy for the payment generation this read observed, before bind as well as after. Display only: it never authorizes a payment, and the payment hand-off decides again. A server that provides it puts it on every successful response, including `UNMARKED` for a checkout with no frozen payment policy; it is omitted only by a server that predates it, so treat absence as no preview and keep today’s card entry. It is a separate read from `paymentPresentation`: the two can disagree when the checkout changes between them, and the payment hand-off is authoritative.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPaymentDisplayPreviewDto"
              }
            ]
          }
        },
        "required": [
          "publishableKey",
          "stripeAccountId",
          "amountInCents",
          "currency",
          "taxAddressSource",
          "paymentMethodTypes"
        ]
      },
      "PresentedSavedCardChoiceDto": {
        "type": "object",
        "properties": {
          "savePaymentMethod": {
            "type": "boolean",
            "description": "True only when the page presents affirmative consent to save the card used for this purchase for future off-session use."
          },
          "selectedPaymentMethodId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Customer-safe id of the existing saved card the page presents for this payment, or null when the page presents new-card entry."
          }
        },
        "required": [
          "savePaymentMethod",
          "selectedPaymentMethodId"
        ]
      },
      "CreatePaymentSessionDto": {
        "type": "object",
        "properties": {
          "presentedSavedCardChoice": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PresentedSavedCardChoiceDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The saved-card choice this page presents for the current payment generation. Omit it, or send null, when the page presents new-card entry without save consent. Payment preparation applies a recorded saved card or save consent only when this value presents exactly that choice; otherwise it answers 409 `CHECKOUT_SAVED_CARD_CHOICE_MISMATCH` without preparing a payment for that choice."
          },
          "supportsSameCardRetry": {
            "type": "boolean",
            "description": "Declares that this client supports the same-card retry handoff. Only a request sending literal `true` can receive `sameCardRetry` in the response. Omit it, or send `false`, to keep the refusal described for a saved card after a decline. The declaration governs only what this API returns; it cannot constrain client secrets already issued or confirmations made directly with the payment provider. It is necessary, not sufficient: the server still requires current provider proof of an issuer decline of the recorded card and every payment check."
          }
        }
      },
      "CanonicalBillingAddressResponseDto": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "description": "Canonical uppercase ISO 3166-1 alpha-2 country code.",
            "minLength": 2,
            "maxLength": 2,
            "pattern": "^[A-Z]{2}$",
            "example": "US"
          },
          "company": {
            "type": "string",
            "description": "Canonical company or organization name. Omitted when the shopper supplied no non-blank value.",
            "maxLength": 200
          },
          "line1": {
            "type": "string",
            "description": "Canonical street-address line 1.",
            "maxLength": 300
          },
          "line2": {
            "type": "string",
            "description": "Canonical apartment, suite, or address line 2. Omitted when the shopper supplied no non-blank value.",
            "maxLength": 300
          },
          "city": {
            "type": "string",
            "description": "Canonical city or town.",
            "maxLength": 200
          },
          "state": {
            "type": "string",
            "description": "Canonical uppercase state, province, or region value.",
            "maxLength": 100
          },
          "postalCode": {
            "type": "string",
            "description": "Canonical uppercase ZIP or postal code.",
            "maxLength": 20
          }
        },
        "required": [
          "country",
          "line1",
          "city",
          "state",
          "postalCode"
        ]
      },
      "CheckoutPaymentContextDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Payment-context wire contract version. Always 1.",
            "example": 1
          },
          "paymentGeneration": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "The exact payment generation of this handoff’s final frozen admission. Server-derived metadata, never a client-supplied generation or payment authority.",
            "example": 0
          }
        },
        "required": [
          "version",
          "paymentGeneration"
        ]
      },
      "SameCardRetryHandoffDto": {
        "type": "object",
        "properties": {
          "paymentMethod": {
            "type": "string",
            "description": "Payment-provider identifier of the saved card this checkout recorded (a Stripe PaymentMethod id, `pm_…`). Use it only as the `payment_method` confirmation parameter for this retry: confirm the returned `clientSecret` with exactly this card, as a deliberate shopper action, never automatically on page load, reload or network recovery. No cartonium route accepts it, and it grants no other authority.",
            "example": "pm_123"
          }
        },
        "required": [
          "paymentMethod"
        ]
      },
      "PaymentSessionResponseDto": {
        "type": "object",
        "properties": {
          "clientSecret": {
            "type": "string",
            "description": "Stripe PaymentIntent client secret. Render the Payment Element against this. Forwarded to the browser only — never stored."
          },
          "publishableKey": {
            "type": "string",
            "description": "Browser-safe Stripe publishable key from the API environment that created the PaymentIntent. Initialize Stripe.js with this key and the returned `stripeAccountId` when present. This is not a secret.",
            "example": "pk_test_123"
          },
          "paymentAttemptId": {
            "type": "string",
            "description": "Internal PaymentAttempt id this payment is tracked under."
          },
          "amountInCents": {
            "type": "number",
            "description": "The server-authoritative amount (smallest currency unit) the PaymentIntent was created to charge NOW — i.e. the CheckoutSession `amountDueNowInCents`. This equals the transaction total for a cart / full-payment checkout, but is the smaller due-now amount for a booking deposit (ADR-006), NOT the full transaction total. Compare or display it as the amount being charged now."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code (e.g. `usd`)."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "The checkout-time customer email bound to this payment session. Supply it as `payment_method_data.billing_details.email` when confirming the PaymentIntent; it is not a receipt-delivery request. Omitted only for a missing/blank legacy checkout-session snapshot; clients must then retain provider `auto` email collection.",
            "example": "shopper@example.com"
          },
          "billingAddress": {
            "description": "The canonical order-time billing address from the current ordinary checkout bind. Supply it as `payment_method_data.billing_details.address` when confirming the PaymentIntent. Omitted for booking/legacy handoffs that do not participate in the E28 ordinary-checkout contract. This client-secret-bearing handoff is separate from the PII-free anonymous checkout-session read.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CanonicalBillingAddressResponseDto"
              }
            ]
          },
          "status": {
            "type": "string",
            "description": "Stripe PaymentIntent status at creation (e.g. `requires_payment_method`). Advisory only — webhook reconciliation is authoritative."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "#932 — the tenant's connected Stripe account (`acct_…`) the PaymentIntent was created on. The client MUST initialize Stripe.js with this account (`loadStripe(pk, { stripeAccount })`) so the Payment Element renders against the connected-account intent. null when the intent is on the platform account (test/sandbox).",
            "example": "acct_123"
          },
          "paymentPresentation": {
            "description": "E31 #4359 (ADR-050 §16): the payment presentation for this payment generation, taken from the checkout's frozen payment policy as admitted when this payment was prepared (`basis` is always `ADMISSION` here). Create the Payment Element with `wallets` set to `paymentPresentation.wallets`. Omitted when the checkout carries no frozen payment policy, which today is every checkout until its payment-policy rollout; then keep the existing card entry. Booking and booking-group payments never carry it yet. Presentation is not authorization: the server enforces the admitted payment method types on every payment request, whatever the page renders. Apple Pay and Google Pay are card payments that this check cannot refuse, so pass `wallets` to the Payment Element unchanged.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPaymentPresentationDto"
              }
            ]
          },
          "paymentContext": {
            "description": "Optional, never null. Paired with paymentPresentation from the same final ADMISSION on ordinary one-time create, reuse and same-card retry handoffs. Omitted for UNMARKED checkouts, excluded booking and booking-group handoffs, and older API builds. Absence for the same client secret can mean an older server; it grants no legacy authority and does not establish a changed payment. Existing consumers may ignore this additive metadata. It is a generation witness for this handoff, distinct from PaymentAttempt.paymentContextType and paymentContextId. It is not a lease or authority; no request accepts it and it never permits automatic confirmation. The shopper’s Pay action and applicable consent remain required. A DISPLAY generation may differ compatibly when the ordered rails and all wallets agree.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPaymentContextDto"
              }
            ]
          },
          "sameCardRetry": {
            "description": "Present only when the request declared `supportsSameCardRetry: true` and the server proved, from the payment provider, that the issuer declined the recorded saved card on this checkout's PaymentIntent. The `clientSecret` is then that same PaymentIntent's secret, with `status` `requires_payment_method`; confirm it with `sameCardRetry.paymentMethod`. Omitted from every other response, including a first preparation and a reused intent. Its presence does not mean the bank will approve the retry, that earlier client secrets stopped working, or that any other holder of a secret must use this card. The card may still need authentication (3D Secure).",
            "allOf": [
              {
                "$ref": "#/components/schemas/SameCardRetryHandoffDto"
              }
            ]
          }
        },
        "required": [
          "clientSecret",
          "publishableKey",
          "paymentAttemptId",
          "amountInCents",
          "currency",
          "status",
          "stripeAccountId"
        ]
      },
      "RepriceLineDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Catalog item id for the requested line.",
            "minLength": 1
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "description": "Variant id when the line targets a specific variant. Optional — for an item with no variants, omission or `null` prices against the item-level price. A SALE item with variants requires one exact variant id. When set, the variant must belong to `itemId` (cross-item references are rejected with a structured 400).",
            "nullable": true,
            "minLength": 1
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Number of units requested on this line. Lines with quantity <= 0 should be omitted rather than included with a zero."
          },
          "expectedCompositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Required for a package selection. Must match the public catalog composition revision."
          }
        },
        "required": [
          "itemId",
          "quantity"
        ],
        "additionalProperties": false
      },
      "CheckoutCustomerDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Customer email for receipts / order-status links.",
            "maxLength": 320
          },
          "name": {
            "type": "string",
            "description": "Customer name.",
            "maxLength": 200
          },
          "phone": {
            "type": "string",
            "description": "Customer phone. Conditionally required at ordinary cart checkout bind when the tenant public config reports `phoneRequired: true`; it may be supplied here or persisted from create / an earlier reprice. Subscription and booking checkout are excluded.",
            "maxLength": 50
          }
        }
      },
      "CountryAwareCheckoutAddressDto": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "description": "Leading and trailing whitespace is trimmed and letters are uppercased before the normalized two-letter alphabetic country-code check.",
            "example": "US",
            "pattern": "^\\s*[A-Za-z]{2}\\s*$"
          },
          "state": {
            "type": "string",
            "description": "State / province / region. For `US`, a USPS two-letter state, territory, or military code is required; an unambiguous full name is accepted and canonicalized before persistence (for example, `Nevada` becomes `NV`). Other countries retain their region text.",
            "maxLength": 100,
            "example": "NV"
          },
          "city": {
            "type": "string",
            "description": "City / town.",
            "maxLength": 200
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP / postal code. For `US`, accepts five digits or ZIP+4 and stores ZIP+4 with a hyphen. Other countries retain their postal-code format.",
            "maxLength": 20,
            "example": "89501"
          },
          "line1": {
            "type": "string",
            "description": "Address line 1.",
            "maxLength": 300
          },
          "line2": {
            "type": "string",
            "description": "Address line 2.",
            "maxLength": 300
          },
          "company": {
            "type": "string",
            "description": "#998 — optional ship-to company / organization name, collected in the hosted checkout Contact step. Persisted on the address JSON; doesn't participate in tax.",
            "maxLength": 200
          }
        },
        "required": [
          "country"
        ],
        "additionalProperties": false
      },
      "CreateCheckoutSessionDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Requested catalog lines (refs + quantities, no prices).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepriceLineDto"
            }
          },
          "couponCode": {
            "type": "string",
            "description": "Coupon selection for THIS submitted full-cart state, not a patch to the prior session. On an existing checkout, OMIT this property to remove any coupon applied by an earlier create, reprice, or bind; omission does not retain the prior coupon, and no separate clear action is required. A blank or whitespace-only string follows the same no-code path as omission and clears the coupon. A supplied non-blank code is matched case-insensitively, revalidated, and applied server-side against the resolved subtotal. An invalid / expired / below-minimum / exhausted code does NOT fail the call. In the omitted, blank, or rejected-code case, the response proves that no coupon is applied with `discountSnapshot.appliedCoupon: null`. The typed public contract does not distinguish those no-coupon cases; do not depend on undeclared discount-snapshot keys. Do not infer coupon removal from aggregate discount or totals because other discounts can remain.",
            "maxLength": 128
          },
          "customer": {
            "description": "Optional customer contact. May be supplied at create OR progressively on reprice/bind. A non-blank `email` is REQUIRED before payment: `bind` rejects a session that still has no customer email (#605 — a CONFIRMED order must carry a real contact address that customer-facing flows match on). Provided fields are persisted onto the `CheckoutSession`; never trusted as authenticated identity.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutCustomerDto"
              }
            ]
          },
          "marketingOptIn": {
            "type": "boolean",
            "description": "#996 — the shopper's marketing opt-in choice. Honored only when the tenant enabled the checkout opt-in (`marketingOptInEnabled` in checkoutSettings); persisted on the session and acted on at confirmation (a `true` subscribes the email to the tenant newsletter via double opt-in). OMITTED or false ⇒ no subscription — the server never infers consent. BYO clients pass this to collect the same consent."
          },
          "shippingAddress": {
            "description": "Optional customer shipping address. May be supplied at create OR progressively on reprice/bind, and is persisted onto the `CheckoutSession`. An ordinary one-time physical-cart `bind` REQUIRES a complete country-aware shipping destination regardless of tax or shipping-rate type. Separately, every ordinary one-time `bind` requires the complete billing address documented below. When a tax provider is enabled (ADR-008), `bind` also requires an effective shipping or billing address so destination-based tax can be computed and folded into the binding total.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Customer billing address, accepted progressively on create/reprice and persisted onto the `CheckoutSession`. An ordinary one-time checkout MUST supply a complete current billing address at bind before payment or free confirmation. Same-as-delivery callers send a second canonical snapshot equal to `shippingAddress`; distinct billing is sent independently. It is also the tax-calculation address when no shipping address is present.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "shippingRateId": {
            "type": "string",
            "description": "Optional id of the shopper-confirmed shipping option. Ignored on create. For ordinary checkout, choose a `rateId` ONLY from the latest `availableShippingOptions` for that checkout session; obtain or refresh the set with an address-bearing `POST /api/v1/public/checkout/sessions/{token}/reprice`. `GET /api/v1/public/shipping/zones` is configuration/eligibility and must not drive the ordinary-checkout picker. On reprice and bind (#1002), the server recomputes current eligibility and amount from server-owned configuration or a fresh quote, never a client amount (ADR-006). Reprice with an omitted or unresolvable selection yields no shipping and returns refreshed options. At bind, the missing-selection guard is a `400` only when the cart requires shipping and the freshly resolved option set is non-empty (#952); an all-service/digital cart is never forced to select a method. At bind, any supplied id is revalidated with the effective address; an invalid selection is a `400`. A FREE_SHIPPING coupon/auto-discount/bundle zeroes an eligible baseline-priced method; a pricier upgrade keeps its server-derived charge (#1014).",
            "maxLength": 100
          },
          "refreshShippingRates": {
            "type": "boolean",
            "description": "Explicit mutable-preview retry hint. On the reprice endpoints only, `true` bypasses a matching cached failed live-rate outcome for this request so the server contacts the rate provider again. It does not bypass a successful quote cache, does not prove that provider recovery succeeded, and does not retry bind or payment. Omitted or `false` keeps normal failure-cache behavior. Send it once per shopper action, typically after a response carried a retryable `shippingQuoteFailure`; success is a later response without that field whose options are usable. Create and bind accept this inherited property for wire compatibility but ignore it."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency for the session (lowercase, e.g. `usd`). Optional — when omitted the session adopts the currency the repricing engine priced in (`usd` today, the only currency every tenant supports). When supplied it is VALIDATED against that priced currency, not used as a preference: a mismatch (e.g. requesting `eur` for a `usd`-priced checkout) is rejected with a `400`, never silently coerced to `usd`.",
            "minLength": 3,
            "maxLength": 3,
            "example": "usd"
          }
        },
        "required": [
          "lines"
        ]
      },
      "CreateCheckoutSessionResponseDto": {
        "type": "object",
        "properties": {
          "purchaseMode": {
            "type": "string",
            "enum": [
              "ONE_TIME",
              "SUBSCRIPTION"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ],
            "description": "Lifecycle status. Cart sessions begin OPEN; server-priced booking sessions begin PENDING_PAYMENT; subscription sessions are advanced only by verified Billing outcomes. Confirmation/expiry moves every flow forward."
          },
          "isBinding": {
            "type": "boolean",
            "description": "For cart checkout, false after create/reprice (mutable estimate) and true after bind. Booking checkout is server-priced and true at creation. Subscription checkout becomes true only after its provider subscription and exact first invoice are verified. #604 refuses to create an ordinary payment session unless this is true."
          },
          "contextType": {
            "type": "string",
            "enum": [
              "CART",
              "BOOKING"
            ]
          },
          "booking": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutBookingContextDto"
              }
            ]
          },
          "subscription": {
            "nullable": true,
            "description": "Subscription-specific payment/order/renewal truth. Present only when purchaseMode is SUBSCRIPTION.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSubscriptionSummaryDto"
              }
            ]
          },
          "refundInitiated": {
            "type": "boolean",
            "description": "True only when this session is CANCELLED *and* it was CHARGED then auto-refunded by the webhook-authoritative confirmation path (#871) — a stale-PI reprice amount/currency mismatch or an oversell-after-charge race flipped the session to CANCELLED and enqueued the per-attempt refund (`checkout-refund:${paymentAttemptId}` outbox, idempotent). It lets the hosted/BYO surface tell a charged-then-refunded CANCELLED session apart from a plain cancelled/expired one and render honest \"payment received — your refund is on the way\" copy instead of the generic not-payable block. Scoped to CANCELLED on purpose: the confirmation path also refunds an extra duplicate charge on an already-CONFIRMED session without cancelling it, so a refunded-event check alone is not sufficient. Customer-safe by construction: a single boolean derived from the presence of the internal `checkout_session.refunded` event — it carries NO processor ids, amounts, or failure detail. `false` on every session that is not a charged-then-refunded CANCELLED one (OPEN, EXPIRED, a plain CANCELLED, and CONFIRMED — including a CONFIRMED session whose duplicate charge was refunded)."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code (e.g. `usd`)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSessionLineDto"
            }
          },
          "packages": {
            "description": "Frozen package selections with every component, operational quantity, savings, tax, and total.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "selections": {
            "description": "Top-level server-accepted catalog selections for exact reprice/bind retry. Package components never replace their parent here.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSelectionLineDto"
            }
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Sum of gross line totals. For a trial subscription this still includes the recurring sticker price; the amount deferred by the trial appears in discountInCents so the due-today equation remains exact."
          },
          "discountInCents": {
            "type": "number",
            "description": "Amount subtracted from the gross subtotal. For subscription checkout it can include recurring value deferred from the first invoice by a trial, not only promotional discounts."
          },
          "taxInCents": {
            "type": "number",
            "description": "Computed sales tax folded into the binding total (#449, ADR-008). `0` when no tax provider is enabled (the default) — the reference storefronts read THIS instead of their flat-8% placeholder. Non-zero cart tax is computed at `bind` from the captured address; a booking session may instead carry its persisted tax-preflight posture at creation."
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe tax posture disclosure. Present when the transaction used the audited manual/no-tax escape hatch, so checkout/receipt surfaces can clearly state that cartonium did not calculate tax.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charge folded into the binding total (#854). `0` until `bind` resolves a customer-selected `shippingRateId` against the active zone matching the captured address — the price is re-derived server-side from the rate (never a client amount, ADR-006). Stays `0` when no rate is selected or a FREE_SHIPPING coupon/auto-discount/bundle waives the charge (the chosen method is still recorded on the session). The hosted/BYO surface renders THIS as the shipping line."
          },
          "totalInCents": {
            "type": "number",
            "description": "Commercial transaction total (`subtotal - discount + tax + shipping`). For cart/full-payment checkout this is also charged now; a booking deposit charges amountDueNowInCents instead (ADR-006). For a subscription this is the verified first-invoice total only, never the lifetime value or a future renewal amount."
          },
          "amountDueNowInCents": {
            "type": "number",
            "description": "Amount due now. Equals totalInCents for carts/full payment, may be smaller for a booking deposit, and is the verified first-invoice amount for a subscription (0 for a no-card trial)."
          },
          "remainingBalanceInCents": {
            "type": "number",
            "description": "Commercial balance remaining after the due-now amount for this checkout. Always 0 for subscription checkout; future renewals are described by subscription.nextRenewalAt and are not a checkout balance."
          },
          "requiresFreeConfirmation": {
            "type": "boolean",
            "description": "#3263 — `true` when this bound checkout must be completed through `POST …/sessions/:token/confirm-free` rather than `payment-session`, because its total cannot be charged: either zero, or above zero but below the payment provider's per-currency minimum (which the provider rejects, surfacing as a generic 500). Surfaces are expected to branch on THIS FLAG rather than testing the total themselves — the minimum is a provider fact that varies by currency and changes on the provider schedule, so a client-side comparison duplicates a threshold that will drift. `false` on a non-binding session, since a session that has not bound has no server-authoritative total yet. Also `false` for booking, booking-group, and subscription checkouts: they have no no-charge completion path, so a below-minimum total there is refused rather than routed."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The customer-selected shipping method (#854/#1002), so the hosted/BYO surface can show WHICH option is chosen before payment. Populated on reprice (a preview) AND bind (the commitment) when a resolvable `shippingRateId` is selected; `null` on create, and whenever no rate is selected or the selected rate does not resolve (on reprice it simply clears the estimate; on bind an invalid rate is a `400`). The charged amount is `shippingInCents`; this carries the method label and whether a FREE_SHIPPING rule waived the charge.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingMethodDto"
              }
            ]
          },
          "customer": {
            "nullable": true,
            "description": "#1170 — captured customer contact for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer. This keeps the anonymous session-read projection PII-free; #3231 deliberately exposes only the bound email through the separate payment-session handoff.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionCustomerDto"
              }
            ]
          },
          "shippingAddress": {
            "nullable": true,
            "description": "#1170 — captured shipping address for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionAddressDto"
              }
            ]
          },
          "shippingAddressValidation": {
            "nullable": true,
            "description": "#1563/#4201 — provider verdict on the shipping address, produced by a live-rate quote or configured fulfillment validation. Present ONLY on reprice/bind responses when provider validation was attempted and returned a verdict. PII posture (#1170/#606): echoes a cleaned form of the address the caller submitted on this request and is never present on anonymous session reads. #3231 separately permits that token to obtain only the bound email through the payment-session handoff, never this address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressValidationDto"
              }
            ]
          },
          "shippingQuoteFailure": {
            "description": "#4673 — present ONLY on a reprice response whose live carrier-rate quote for the submitted destination failed: a fresh provider failure, or one the server reused from its short failure cache (an explicit `refreshShippingRates: true` reprice bypasses that cache). Omitted on every other response — create, bind, and session reads (none of which reports a quote outcome), a reprice whose live quote succeeded, and a reprice that attempted no live quote (incomplete destination, live rates not configured for the destination, nothing to ship). Absence therefore never proves rates exist; read `availableShippingOptions`. Present with an EMPTY `availableShippingOptions`: no delivery method is currently usable because the quote failed — not proof the destination is unserviceable. Keep the shopper at delivery, show the category, and offer an explicit refresh when `retryable` is true; do not blame the address unless the category is `invalid_address`. Present beside a NON-EMPTY list: those listed options (for example configured flat rates) remain valid choices while carrier rates are unavailable. A merchant service policy that excludes every quoted service is not a provider failure and is never classified here.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingQuoteFailureDto"
              }
            ]
          },
          "shippingUnavailable": {
            "description": "#4673 — present ONLY on a reprice response for a cart that requires shipping, with a destination country and an EMPTY `availableShippingOptions`, when a bind of that cart to that destination would be refused for lack of a delivery method. Keep the shopper at delivery; it can be combined with `shippingQuoteFailure`, whose retry guidance then applies. Omitted on every other response, including create, bind, and session reads, and whenever the cart ships nothing, no destination country is known, options exist, or the address itself was rejected (see `shippingAddressValidation`). Absence does not prove a bind will succeed: an empty option set without this field can still be valid, for example a served destination whose configured rates do not apply to this cart binds with no shipping charge.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingUnavailableDto"
              }
            ]
          },
          "availableShippingOptions": {
            "description": "For ordinary one-time checkout, server-derived shipping options applicable to the captured destination + cart subtotal (#1002), so the hosted/BYO surface can show — and let the shopper switch between — fulfillment methods BEFORE payment. Resolved from the active zone matching the address country, filtered to rates the subtotal clears. **Populated only on ordinary reprice/bind responses and on a read of an ordinary session that is not yet binding** (#3052): its create response and any read of a BOUND session return `[]` by design (no destination resolved yet, and the picker is a pre-payment surface the confirmation poll must not re-query). Physical-subscription summaries also return `[]`: that flow has no public option preflight (#3482), so this field is not its selection source. An empty array on those responses therefore means \"not offered here\", NOT \"no rates available\" — never let one clear a rendered option set or a confirmed selection. It is also empty when no address, zone, or applicable rate exists, and when a live carrier quote failed with no other applicable rate — a reprice distinguishes that last case with `shippingQuoteFailure`, and reports through `shippingUnavailable` when an empty set for a cart that ships means a bind would be refused. For ordinary checkout, select one and resend its `rateId` as `shippingRateId`: reprice previews the resulting total; bind re-resolves and commits it only if it is still valid. The charged amount is always server-derived (ADR-006). An option is current only for the response it arrived on, not a promise that a later bind will succeed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutShippingOptionDto"
            }
          },
          "discountSnapshot": {
            "description": "Current server-authored discount attribution, persisted verbatim and copied onto the final order for attribution. The property is always present. It is an object for server-repriced cart/subscription sessions (even when no discount applies), and null only for booking, booking-group, or legacy sessions that have no discount snapshot. Within an object, `appliedCoupon: null` is the authoritative proof that no coupon is applied; aggregate discounts or totals can still reflect other rules. Only `appliedCoupon` is modeled by this schema; any additional server-authored attribution keys are intentionally not declared as public identifiers or schema fields.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CheckoutDiscountSnapshotDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "description": "When an unbound session may expire before provider creation. Once a durable provider-create intent exists, this timestamp remains useful for shopper messaging but authoritative reconciliation decides the outcome instead of a token read silently expiring provider-bound work. Null only in the (not-issued-here) no-expiry case.",
            "nullable": true,
            "format": "date-time"
          },
          "reservationExpiresAt": {
            "type": "string",
            "description": "When a Mode-B (reserve-during-checkout) pre-payment inventory hold expires — the secondary countdown source for \"your items are held for N min\". Null under Mode A (reserve-at-confirmation, the only live mode today), where the session carries no hold. #605 Slice 3 ships this as a SEAM: it is populated only once Mode B is wired (no holds are minted in M3).",
            "nullable": true,
            "format": "date-time"
          },
          "orderReference": {
            "type": "string",
            "description": "Stable public order address. Always present as a nullable field: null before finalOrderId exists and the exact non-null Order reference afterward. The locator is never an authentication credential.",
            "nullable": true,
            "pattern": "^or1_[0-9a-f]{32}$",
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "orderNumber": {
            "type": "string",
            "description": "The resulting order number once this session is CONFIRMED (#991) — the in-flow confirmation surface renders it as the post-payment receipt reference. Joined from `CheckoutSession.finalOrderId`; `null` on every non-confirmed read and on create/reprice/bind (no order exists yet). ALWAYS PRESENT (nullable), like `returnToStoreUrl` — every summary path emits it, so it belongs in the schema `required` set. Non-PII: the same `Order.orderNumber` the #818 order-status page and the signed-in account already show. The order-status `o`-token is hash-at-rest (ADR-007) and intentionally NOT reconstructable here, so this is a reference + account next-action, not a regenerated forwardable status link.",
            "nullable": true
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived, customer-safe state of the order-confirmation email. Always present. It never includes the recipient, provider id, policy code, or raw outbox error.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "returnToStoreUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe return-to-store destination for hosted/BYO checkout surfaces. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe post-checkout completion destination. Prefers trusted `checkoutSettings.postCheckoutRedirectUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. Hosted checkout may auto-redirect here only after the server read shows CONFIRMED; never from a client-side processor callback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutRetryUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe retry/start-over checkout destination. Prefers trusted `checkoutSettings.checkoutRetryUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutCancelUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe canceled/expired checkout destination. Prefers trusted `checkoutSettings.checkoutCancelUrl`, then `checkoutRetryUrl`, `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "accountUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer account URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout account origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "accountSignInUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer sign-in URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout sign-in origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "#996 — whether the tenant enabled the hosted-checkout marketing opt-in (`checkoutSettings.marketingOptInEnabled`). When true, the surface shows a DEFAULT-UNCHECKED opt-in checkbox before payment and sends the shopper's choice as the bind `marketingOptIn`. ALWAYS PRESENT (in the schema `required` set); `false` unless the tenant turned it on."
          },
          "marketingOptInCopy": {
            "type": "string",
            "description": "#996 — the label to render beside the opt-in checkbox when `marketingOptInEnabled` is true: the tenant-configured copy, else a safe default. Plain text (no URL). `null` when the opt-in is disabled (no checkbox). ALWAYS PRESENT (nullable).",
            "nullable": true
          },
          "token": {
            "type": "string",
            "description": "The raw checkout-session token (prefix `c`). Returned only on create and never again — store it client-side; the server keeps only its hash. Used as `:token` on every subsequent session call."
          }
        },
        "required": [
          "purchaseMode",
          "status",
          "isBinding",
          "contextType",
          "booking",
          "subscription",
          "refundInitiated",
          "currency",
          "lines",
          "packages",
          "selections",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "totalInCents",
          "amountDueNowInCents",
          "remainingBalanceInCents",
          "requiresFreeConfirmation",
          "customer",
          "shippingAddress",
          "availableShippingOptions",
          "discountSnapshot",
          "orderReference",
          "orderNumber",
          "orderConfirmationEmail",
          "returnToStoreUrl",
          "postCheckoutRedirectUrl",
          "checkoutRetryUrl",
          "checkoutCancelUrl",
          "accountUrl",
          "accountSignInUrl",
          "marketingOptInEnabled",
          "marketingOptInCopy",
          "token"
        ]
      },
      "RepriceCheckoutSessionDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Requested catalog lines (refs + quantities, no prices).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepriceLineDto"
            }
          },
          "couponCode": {
            "type": "string",
            "description": "Coupon selection for THIS submitted full-cart state, not a patch to the prior session. On an existing checkout, OMIT this property to remove any coupon applied by an earlier create, reprice, or bind; omission does not retain the prior coupon, and no separate clear action is required. A blank or whitespace-only string follows the same no-code path as omission and clears the coupon. A supplied non-blank code is matched case-insensitively, revalidated, and applied server-side against the resolved subtotal. An invalid / expired / below-minimum / exhausted code does NOT fail the call. In the omitted, blank, or rejected-code case, the response proves that no coupon is applied with `discountSnapshot.appliedCoupon: null`. The typed public contract does not distinguish those no-coupon cases; do not depend on undeclared discount-snapshot keys. Do not infer coupon removal from aggregate discount or totals because other discounts can remain.",
            "maxLength": 128
          },
          "customer": {
            "description": "Optional customer contact. May be supplied at create OR progressively on reprice/bind. A non-blank `email` is REQUIRED before payment: `bind` rejects a session that still has no customer email (#605 — a CONFIRMED order must carry a real contact address that customer-facing flows match on). Provided fields are persisted onto the `CheckoutSession`; never trusted as authenticated identity.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutCustomerDto"
              }
            ]
          },
          "marketingOptIn": {
            "type": "boolean",
            "description": "#996 — the shopper's marketing opt-in choice. Honored only when the tenant enabled the checkout opt-in (`marketingOptInEnabled` in checkoutSettings); persisted on the session and acted on at confirmation (a `true` subscribes the email to the tenant newsletter via double opt-in). OMITTED or false ⇒ no subscription — the server never infers consent. BYO clients pass this to collect the same consent."
          },
          "shippingAddress": {
            "description": "Optional customer shipping address. May be supplied at create OR progressively on reprice/bind, and is persisted onto the `CheckoutSession`. An ordinary one-time physical-cart `bind` REQUIRES a complete country-aware shipping destination regardless of tax or shipping-rate type. Separately, every ordinary one-time `bind` requires the complete billing address documented below. When a tax provider is enabled (ADR-008), `bind` also requires an effective shipping or billing address so destination-based tax can be computed and folded into the binding total.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Customer billing address, accepted progressively on create/reprice and persisted onto the `CheckoutSession`. An ordinary one-time checkout MUST supply a complete current billing address at bind before payment or free confirmation. Same-as-delivery callers send a second canonical snapshot equal to `shippingAddress`; distinct billing is sent independently. It is also the tax-calculation address when no shipping address is present.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "shippingRateId": {
            "type": "string",
            "description": "Optional id of the shopper-confirmed shipping option. Ignored on create. For ordinary checkout, choose a `rateId` ONLY from the latest `availableShippingOptions` for that checkout session; obtain or refresh the set with an address-bearing `POST /api/v1/public/checkout/sessions/{token}/reprice`. `GET /api/v1/public/shipping/zones` is configuration/eligibility and must not drive the ordinary-checkout picker. On reprice and bind (#1002), the server recomputes current eligibility and amount from server-owned configuration or a fresh quote, never a client amount (ADR-006). Reprice with an omitted or unresolvable selection yields no shipping and returns refreshed options. At bind, the missing-selection guard is a `400` only when the cart requires shipping and the freshly resolved option set is non-empty (#952); an all-service/digital cart is never forced to select a method. At bind, any supplied id is revalidated with the effective address; an invalid selection is a `400`. A FREE_SHIPPING coupon/auto-discount/bundle zeroes an eligible baseline-priced method; a pricier upgrade keeps its server-derived charge (#1014).",
            "maxLength": 100
          },
          "refreshShippingRates": {
            "type": "boolean",
            "description": "Explicit mutable-preview retry hint. On the reprice endpoints only, `true` bypasses a matching cached failed live-rate outcome for this request so the server contacts the rate provider again. It does not bypass a successful quote cache, does not prove that provider recovery succeeded, and does not retry bind or payment. Omitted or `false` keeps normal failure-cache behavior. Send it once per shopper action, typically after a response carried a retryable `shippingQuoteFailure`; success is a later response without that field whose options are usable. Create and bind accept this inherited property for wire compatibility but ignore it."
          }
        },
        "required": [
          "lines"
        ]
      },
      "SaveCheckoutContactDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320,
            "description": "Contact email entered in hosted checkout, or the email of the authenticated shopper. Saving contact does not subscribe this address or authorize payment."
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Order contact name. Omission retains the current name."
          },
          "phone": {
            "type": "string",
            "maxLength": 50,
            "description": "Order contact phone. Omission retains the current phone."
          }
        },
        "required": [
          "email"
        ]
      },
      "SaveCheckoutContactResponseDto": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "boolean",
            "description": "True when the contact snapshot is durably saved. This grants no payment, email-delivery or customer-account authority."
          }
        },
        "required": [
          "saved"
        ]
      },
      "CheckoutTaxPreviewRequestDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Requested catalog lines (refs + quantities, no prices).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepriceLineDto"
            }
          },
          "couponCode": {
            "type": "string",
            "description": "Coupon selection for THIS submitted full-cart state, not a patch to the prior session. On an existing checkout, OMIT this property to remove any coupon applied by an earlier create, reprice, or bind; omission does not retain the prior coupon, and no separate clear action is required. A blank or whitespace-only string follows the same no-code path as omission and clears the coupon. A supplied non-blank code is matched case-insensitively, revalidated, and applied server-side against the resolved subtotal. An invalid / expired / below-minimum / exhausted code does NOT fail the call. In the omitted, blank, or rejected-code case, the response proves that no coupon is applied with `discountSnapshot.appliedCoupon: null`. The typed public contract does not distinguish those no-coupon cases; do not depend on undeclared discount-snapshot keys. Do not infer coupon removal from aggregate discount or totals because other discounts can remain.",
            "maxLength": 128
          },
          "shippingAddress": {
            "description": "Optional customer shipping address. May be supplied at create OR progressively on reprice/bind, and is persisted onto the `CheckoutSession`. An ordinary one-time physical-cart `bind` REQUIRES a complete country-aware shipping destination regardless of tax or shipping-rate type. Separately, every ordinary one-time `bind` requires the complete billing address documented below. When a tax provider is enabled (ADR-008), `bind` also requires an effective shipping or billing address so destination-based tax can be computed and folded into the binding total.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Customer billing address, accepted progressively on create/reprice and persisted onto the `CheckoutSession`. An ordinary one-time checkout MUST supply a complete current billing address at bind before payment or free confirmation. Same-as-delivery callers send a second canonical snapshot equal to `shippingAddress`; distinct billing is sent independently. It is also the tax-calculation address when no shipping address is present.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "shippingRateId": {
            "type": "string",
            "description": "Optional id of the shopper-confirmed shipping option. Ignored on create. For ordinary checkout, choose a `rateId` ONLY from the latest `availableShippingOptions` for that checkout session; obtain or refresh the set with an address-bearing `POST /api/v1/public/checkout/sessions/{token}/reprice`. `GET /api/v1/public/shipping/zones` is configuration/eligibility and must not drive the ordinary-checkout picker. On reprice and bind (#1002), the server recomputes current eligibility and amount from server-owned configuration or a fresh quote, never a client amount (ADR-006). Reprice with an omitted or unresolvable selection yields no shipping and returns refreshed options. At bind, the missing-selection guard is a `400` only when the cart requires shipping and the freshly resolved option set is non-empty (#952); an all-service/digital cart is never forced to select a method. At bind, any supplied id is revalidated with the effective address; an invalid selection is a `400`. A FREE_SHIPPING coupon/auto-discount/bundle zeroes an eligible baseline-priced method; a pricier upgrade keeps its server-derived charge (#1014).",
            "maxLength": 100
          }
        },
        "required": [
          "lines"
        ]
      },
      "CheckoutTaxPreviewResponseDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "Server-priced ISO currency for this estimate."
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Server-priced merchandise subtotal before discounts, in minor units."
          },
          "discountInCents": {
            "type": "number",
            "description": "Applied merchandise discounts, in minor units."
          },
          "shippingInCents": {
            "type": "number",
            "description": "Resolved shipping charge after applicable waivers, in minor units."
          },
          "taxInCents": {
            "type": "number",
            "description": "Estimated tax, in minor units. Zero is a calculated outcome, not a payment authorization."
          },
          "totalInCents": {
            "type": "number",
            "description": "Estimated amount including shipping and tax. Bind recalculates it before payment; this read grants no payment authority."
          },
          "amountDueNowInCents": {
            "type": "number",
            "description": "Provisional amount payable now, preserving an explicit due-now amount when present. Final payment preparation remains authoritative."
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Manual/no-tax policy disclosure, or null when no such disclosure applies. Null does not imply tax exemption.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "couponRemovalRequired": {
            "type": "boolean",
            "description": "When true, the amounts are for the cart without the promo code, whose effect could not be verified. The shopper must explicitly remove the code and accept this total before binding. Absent on ordinary estimates and proved comparisons."
          }
        },
        "required": [
          "currency",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents",
          "amountDueNowInCents",
          "taxDisclosure"
        ]
      },
      "BindCheckoutCustomerDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Customer email for receipts / order-status links.",
            "maxLength": 320
          },
          "name": {
            "type": "string",
            "description": "Customer name. REQUIRED and non-blank at bind — a CONFIRMED order must carry a real customer name (shown on the order / receipt). May be collected progressively before bind, but must be present by the bind call (here or persisted from create / an earlier reprice).",
            "maxLength": 200
          },
          "phone": {
            "type": "string",
            "description": "Customer phone. Conditionally required and non-blank when the tenant public config reports `phoneRequired: true` for ordinary cart checkout; it may be supplied here or persisted from create / an earlier reprice. Subscription and booking checkout are excluded.",
            "maxLength": 50
          }
        },
        "required": [
          "name"
        ]
      },
      "CheckoutCouponRemovalQuoteDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of the accepted total, in lowercase."
          },
          "totalInCents": {
            "type": "number",
            "description": "The accepted ordinary total including shipping and tax, in minor units."
          }
        },
        "required": [
          "currency",
          "totalInCents"
        ]
      },
      "BindCheckoutSessionDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Requested catalog lines (refs + quantities, no prices).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepriceLineDto"
            }
          },
          "couponCode": {
            "type": "string",
            "description": "Coupon selection for THIS submitted full-cart state, not a patch to the prior session. On an existing checkout, OMIT this property to remove any coupon applied by an earlier create, reprice, or bind; omission does not retain the prior coupon, and no separate clear action is required. A blank or whitespace-only string follows the same no-code path as omission and clears the coupon. A supplied non-blank code is matched case-insensitively, revalidated, and applied server-side against the resolved subtotal. An invalid / expired / below-minimum / exhausted code does NOT fail the call. In the omitted, blank, or rejected-code case, the response proves that no coupon is applied with `discountSnapshot.appliedCoupon: null`. The typed public contract does not distinguish those no-coupon cases; do not depend on undeclared discount-snapshot keys. Do not infer coupon removal from aggregate discount or totals because other discounts can remain.",
            "maxLength": 128
          },
          "marketingOptIn": {
            "type": "boolean",
            "description": "#996 — the shopper's marketing opt-in choice. Honored only when the tenant enabled the checkout opt-in (`marketingOptInEnabled` in checkoutSettings); persisted on the session and acted on at confirmation (a `true` subscribes the email to the tenant newsletter via double opt-in). OMITTED or false ⇒ no subscription — the server never infers consent. BYO clients pass this to collect the same consent."
          },
          "shippingAddress": {
            "description": "Optional customer shipping address. May be supplied at create OR progressively on reprice/bind, and is persisted onto the `CheckoutSession`. An ordinary one-time physical-cart `bind` REQUIRES a complete country-aware shipping destination regardless of tax or shipping-rate type. Separately, every ordinary one-time `bind` requires the complete billing address documented below. When a tax provider is enabled (ADR-008), `bind` also requires an effective shipping or billing address so destination-based tax can be computed and folded into the binding total.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Customer billing address, accepted progressively on create/reprice and persisted onto the `CheckoutSession`. An ordinary one-time checkout MUST supply a complete current billing address at bind before payment or free confirmation. Same-as-delivery callers send a second canonical snapshot equal to `shippingAddress`; distinct billing is sent independently. It is also the tax-calculation address when no shipping address is present.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "shippingRateId": {
            "type": "string",
            "description": "Optional id of the shopper-confirmed shipping option. Ignored on create. For ordinary checkout, choose a `rateId` ONLY from the latest `availableShippingOptions` for that checkout session; obtain or refresh the set with an address-bearing `POST /api/v1/public/checkout/sessions/{token}/reprice`. `GET /api/v1/public/shipping/zones` is configuration/eligibility and must not drive the ordinary-checkout picker. On reprice and bind (#1002), the server recomputes current eligibility and amount from server-owned configuration or a fresh quote, never a client amount (ADR-006). Reprice with an omitted or unresolvable selection yields no shipping and returns refreshed options. At bind, the missing-selection guard is a `400` only when the cart requires shipping and the freshly resolved option set is non-empty (#952); an all-service/digital cart is never forced to select a method. At bind, any supplied id is revalidated with the effective address; an invalid selection is a `400`. A FREE_SHIPPING coupon/auto-discount/bundle zeroes an eligible baseline-priced method; a pricier upgrade keeps its server-derived charge (#1014).",
            "maxLength": 100
          },
          "refreshShippingRates": {
            "type": "boolean",
            "description": "Explicit mutable-preview retry hint. On the reprice endpoints only, `true` bypasses a matching cached failed live-rate outcome for this request so the server contacts the rate provider again. It does not bypass a successful quote cache, does not prove that provider recovery succeeded, and does not retry bind or payment. Omitted or `false` keeps normal failure-cache behavior. Send it once per shopper action, typically after a response carried a retryable `shippingQuoteFailure`; success is a later response without that field whose options are usable. Create and bind accept this inherited property for wire compatibility but ignore it."
          },
          "customer": {
            "description": "Customer contact. REQUIRED at bind (the pay step): its `name` must be non-blank so a CONFIRMED order carries a real customer name. A non-blank `email` is likewise required before payment (bind rejects a session that still has none — #605). The name/email may have been supplied at create or on an earlier reprice; if so this object can repeat them (or omit a field to leave the persisted value intact, provided the effective name and email are non-blank). Persisted onto the `CheckoutSession`; never trusted as authenticated identity.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BindCheckoutCustomerDto"
              }
            ]
          },
          "shippingAddressValidationDecision": {
            "type": "string",
            "enum": [
              "KEEP_ENTERED"
            ],
            "description": "Bind-only explicit response to a prior `SHIPPING_ADDRESS_REVIEW_REQUIRED` rejection. `KEEP_ENTERED` asks the server to revalidate the current address and proceed with the submitted values only if the fresh result is still advisory. It never overrides an invalid address, a material country/state/five-digit-ZIP correction, or provider unavailability.",
            "example": "KEEP_ENTERED"
          },
          "acceptedCouponRemovalQuote": {
            "description": "Explicit acceptance of a total quoted without the promo code. Omit couponCode on this bind. A changed currency or total is refused before binding. Omit this field for a normal bind.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutCouponRemovalQuoteDto"
              }
            ]
          }
        },
        "required": [
          "lines",
          "customer"
        ]
      },
      "CheckoutIdentityNextActionRequestDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "The checkout email to evaluate. Normalized server-side (trim + lowercase); resubmitting a normalization-equivalent value is idempotent, while a meaningful change advances the server-owned identity version.",
            "maxLength": 320,
            "example": "shopper@example.com"
          }
        },
        "required": [
          "email"
        ]
      },
      "CheckoutIdentityNextActionResponseDto": {
        "type": "object",
        "properties": {
          "nextAction": {
            "type": "string",
            "description": "The neutral next step for this checkout email. `verify` means the shopper should verify this email before payment; `proceed` means continue as-is. The value is durable per server-owned identity version: repeating the same normalized email returns the same cached action.",
            "enum": [
              "proceed",
              "verify"
            ],
            "example": "proceed"
          }
        },
        "required": [
          "nextAction"
        ]
      },
      "CustomerPaymentMethodResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Customer-safe payment method id."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DETACHED"
            ]
          },
          "brand": {
            "type": "string",
            "nullable": true,
            "example": "visa"
          },
          "last4": {
            "type": "string",
            "nullable": true,
            "example": "4242"
          },
          "expMonth": {
            "type": "number",
            "nullable": true,
            "example": 12
          },
          "expYear": {
            "type": "number",
            "nullable": true,
            "example": 2030
          },
          "funding": {
            "type": "string",
            "nullable": true,
            "example": "credit"
          },
          "country": {
            "type": "string",
            "nullable": true,
            "example": "US"
          },
          "isDefault": {
            "type": "boolean",
            "example": true
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601.",
            "example": "2026-06-08T01:20:00.000Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601.",
            "example": "2026-06-08T01:20:00.000Z"
          }
        },
        "required": [
          "id",
          "status",
          "brand",
          "last4",
          "expMonth",
          "expYear",
          "funding",
          "country",
          "isDefault",
          "createdAt",
          "updatedAt"
        ]
      },
      "HostedCheckoutSavedCardOptionsDto": {
        "type": "object",
        "properties": {
          "savePaymentMethod": {
            "type": "boolean",
            "description": "Durable affirmative consent for the current checkout payment generation."
          },
          "consentRevision": {
            "type": "number",
            "minimum": 0,
            "description": "Monotonic revision of the checkout saved-card preference. It is copied onto the exact PaymentAttempt and save-enrolment owner."
          },
          "selectedPaymentMethodId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Customer-safe id of the existing saved card selected for this checkout, or null when the shopper will enter a new card. If the stored card is no longer selectable, the list read returns 409 until the shopper explicitly updates this preference."
          },
          "paymentGeneration": {
            "type": "number",
            "minimum": 0,
            "description": "Checkout payment generation that owns this exact preference snapshot."
          },
          "methods": {
            "description": "The complete set of currently selectable ACTIVE saved methods known to this checkout for the verified Customer and frozen connected account at read time. An empty array means no saved method can currently be selected, so the shopper must enter a new card. It does not prove the provider has no other cards or that pending save enrolment has completed. Unavailable Cards policy or connected-account context returns 404 instead.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPaymentMethodResponseDto"
            }
          }
        },
        "required": [
          "savePaymentMethod",
          "consentRevision",
          "selectedPaymentMethodId",
          "paymentGeneration",
          "methods"
        ]
      },
      "UpdateCheckoutSavedCardPreferenceDto": {
        "type": "object",
        "properties": {
          "savePaymentMethod": {
            "type": "boolean",
            "description": "Affirmative consent to save the card used for this purchase for future off-session use. False withdraws consent. The server never infers this choice from authentication, prior cards, or browser state."
          },
          "selectedPaymentMethodId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Customer-safe id of an existing saved card to use for this checkout. Omit or send null to enter a new card. The server resolves the provider id only after proving the exact verified Customer and charging account."
          }
        },
        "required": [
          "savePaymentMethod"
        ]
      },
      "CheckoutSavedCardAvailabilityDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Whether the saved-card list, selection and save consent are available for this checkout’s current payment generation. `AVAILABLE` means Cards is in both the checkout’s frozen payment-policy ceiling and this generation’s admission, on the checkout’s connected account. It is visibility, not purchase proof: payment preparation decides again under its own locks and may still refuse."
          },
          "reason": {
            "type": "string",
            "enum": [
              "NOT_POLICY_BEARING",
              "NOT_ACTIVATED",
              "POLICY_UNAVAILABLE",
              "NO_PAYABLE_METHOD",
              "CARDS_NOT_ADMITTED",
              "ACCOUNT_CHANGED",
              "CHECKOUT_CHANGED",
              "PAYMENTS_UNAVAILABLE"
            ],
            "nullable": true,
            "description": "Why saved cards are unavailable; `null` exactly when `status` is `AVAILABLE`. `NOT_POLICY_BEARING`: the checkout carries no frozen payment policy, so saved cards are not offered and card entry continues as before. `NOT_ACTIVATED`: the checkout’s payment policy is not active here yet; no payment can be prepared. `POLICY_UNAVAILABLE`: the checkout’s frozen payment policy cannot be used; no payment can be prepared. `NO_PAYABLE_METHOD`: the frozen policy admits no payment method; the checkout cannot be paid online. `CARDS_NOT_ADMITTED`: this payment generation does not admit Cards; saved cards are not offered. `ACCOUNT_CHANGED`: the store’s payment account changed after this checkout began; start a new checkout. `CHECKOUT_CHANGED`: the checkout changed or is no longer payable; refresh it, bind again and read again. `PAYMENTS_UNAVAILABLE`: the store cannot take card payments right now."
          },
          "paymentGeneration": {
            "type": "number",
            "minimum": 0,
            "description": "The checkout payment generation this answer describes. A saved-card preference write, reprice or rebind starts a new generation, so read again after one. The generation alone does not make an answer stable or safe to cache: the current charging-account gate (`PAYMENTS_UNAVAILABLE`, `ACCOUNT_CHANGED`) can change the answer within the same generation."
          }
        },
        "required": [
          "status",
          "reason",
          "paymentGeneration"
        ]
      },
      "CheckoutPurchaseProofGrantDto": {
        "type": "object",
        "properties": {
          "capability": {
            "type": "string",
            "writeOnly": true,
            "pattern": "^v[A-Za-z0-9_-]{43}$",
            "minLength": 44,
            "maxLength": 44,
            "description": "Secret purchase-proof key, token family `v`: `v` then 43 base64url characters, the encoding of 32 bytes the storefront generates with a cryptographically secure random generator. Generate it, persist it durably in server-side custody, and only then send this request; if the write fails, do not send the key. Use one key per checkout attempt and repeat the same key, recovery key and body on every retry. Never generate a replacement for an attempt whose response was lost, and never log it or place it in a URL or client storage. The platform stores only its hash and cannot recover it: a lost key leaves the attempt unresolved. The pattern is a format check only. It cannot establish randomness, strength or possession. The key reads and revokes this grant only; it grants no checkout, order, account or payment access."
          },
          "captureCorrelation": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{16,64}$",
            "minLength": 16,
            "maxLength": 64,
            "example": "9b2f5c7e-1d4a-4e8b-a6f3-0c5d2e7a91b4",
            "description": "Non-secret, unguessable identifier of the basket capture this attempt handed to checkout, returned unchanged by the proof read. It is unique per tenant and environment: a creation under a different recovery key that reuses a correlation another checkout already holds answers the generic `409`. Disclosure alone causes no conflict, and an exact retry under the same recovery key converges on the original session."
          },
          "captureDeadlineAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$",
            "example": "2026-11-05T22:00:00.000Z",
            "description": "Absolute UTC instant at which the storefront itself stops reading for this capture, with at most millisecond precision. Freeze it with the request body: retries repeat it byte for byte. The grant expires at the earlier of this instant and 4 hours after the transaction that creates the session starts (T0), by the database clock, and nothing extends it. When the instant is at or before T0, the session is created without a grant. When it passes after T0 but before creation commits, the grant is stored already expired and its read answers the neutral 404."
          }
        },
        "required": [
          "capability",
          "captureCorrelation",
          "captureDeadlineAt"
        ]
      },
      "CreateHostedCheckoutSessionDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Requested catalog lines (refs + quantities, no prices).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepriceLineDto"
            }
          },
          "couponCode": {
            "type": "string",
            "description": "Coupon selection for THIS submitted full-cart state, not a patch to the prior session. On an existing checkout, OMIT this property to remove any coupon applied by an earlier create, reprice, or bind; omission does not retain the prior coupon, and no separate clear action is required. A blank or whitespace-only string follows the same no-code path as omission and clears the coupon. A supplied non-blank code is matched case-insensitively, revalidated, and applied server-side against the resolved subtotal. An invalid / expired / below-minimum / exhausted code does NOT fail the call. In the omitted, blank, or rejected-code case, the response proves that no coupon is applied with `discountSnapshot.appliedCoupon: null`. The typed public contract does not distinguish those no-coupon cases; do not depend on undeclared discount-snapshot keys. Do not infer coupon removal from aggregate discount or totals because other discounts can remain.",
            "maxLength": 128
          },
          "customer": {
            "description": "Optional customer contact. May be supplied at create OR progressively on reprice/bind. A non-blank `email` is REQUIRED before payment: `bind` rejects a session that still has no customer email (#605 — a CONFIRMED order must carry a real contact address that customer-facing flows match on). Provided fields are persisted onto the `CheckoutSession`; never trusted as authenticated identity.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutCustomerDto"
              }
            ]
          },
          "marketingOptIn": {
            "type": "boolean",
            "description": "#996 — the shopper's marketing opt-in choice. Honored only when the tenant enabled the checkout opt-in (`marketingOptInEnabled` in checkoutSettings); persisted on the session and acted on at confirmation (a `true` subscribes the email to the tenant newsletter via double opt-in). OMITTED or false ⇒ no subscription — the server never infers consent. BYO clients pass this to collect the same consent."
          },
          "shippingAddress": {
            "description": "Optional customer shipping address. May be supplied at create OR progressively on reprice/bind, and is persisted onto the `CheckoutSession`. An ordinary one-time physical-cart `bind` REQUIRES a complete country-aware shipping destination regardless of tax or shipping-rate type. Separately, every ordinary one-time `bind` requires the complete billing address documented below. When a tax provider is enabled (ADR-008), `bind` also requires an effective shipping or billing address so destination-based tax can be computed and folded into the binding total.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Customer billing address, accepted progressively on create/reprice and persisted onto the `CheckoutSession`. An ordinary one-time checkout MUST supply a complete current billing address at bind before payment or free confirmation. Same-as-delivery callers send a second canonical snapshot equal to `shippingAddress`; distinct billing is sent independently. It is also the tax-calculation address when no shipping address is present.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CountryAwareCheckoutAddressDto"
              }
            ]
          },
          "shippingRateId": {
            "type": "string",
            "description": "Optional id of the shopper-confirmed shipping option. Ignored on create. For ordinary checkout, choose a `rateId` ONLY from the latest `availableShippingOptions` for that checkout session; obtain or refresh the set with an address-bearing `POST /api/v1/public/checkout/sessions/{token}/reprice`. `GET /api/v1/public/shipping/zones` is configuration/eligibility and must not drive the ordinary-checkout picker. On reprice and bind (#1002), the server recomputes current eligibility and amount from server-owned configuration or a fresh quote, never a client amount (ADR-006). Reprice with an omitted or unresolvable selection yields no shipping and returns refreshed options. At bind, the missing-selection guard is a `400` only when the cart requires shipping and the freshly resolved option set is non-empty (#952); an all-service/digital cart is never forced to select a method. At bind, any supplied id is revalidated with the effective address; an invalid selection is a `400`. A FREE_SHIPPING coupon/auto-discount/bundle zeroes an eligible baseline-priced method; a pricier upgrade keeps its server-derived charge (#1014).",
            "maxLength": 100
          },
          "refreshShippingRates": {
            "type": "boolean",
            "description": "Explicit mutable-preview retry hint. On the reprice endpoints only, `true` bypasses a matching cached failed live-rate outcome for this request so the server contacts the rate provider again. It does not bypass a successful quote cache, does not prove that provider recovery succeeded, and does not retry bind or payment. Omitted or `false` keeps normal failure-cache behavior. Send it once per shopper action, typically after a response carried a retryable `shippingQuoteFailure`; success is a later response without that field whose options are usable. Create and bind accept this inherited property for wire compatibility but ignore it."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency for the session (lowercase, e.g. `usd`). Optional — when omitted the session adopts the currency the repricing engine priced in (`usd` today, the only currency every tenant supports). When supplied it is VALIDATED against that priced currency, not used as a preference: a mismatch (e.g. requesting `eur` for a `usd`-priced checkout) is rejected with a `400`, never silently coerced to `usd`.",
            "minLength": 3,
            "maxLength": 3,
            "example": "usd"
          },
          "purchaseProofGrant": {
            "description": "Optional, dormant purchase-proof grant for this creation only (ADR-055). It commits with the session or not at all and is part of the creation digest. A session created without one never gains one, and restart, generic creation and every other operation refuse it. The creation response adds no field. Omit the member rather than sending `null`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutPurchaseProofGrantDto"
              }
            ]
          }
        },
        "required": [
          "lines"
        ]
      },
      "HostedCheckoutCreationResponseDto": {
        "type": "object",
        "properties": {
          "purchaseMode": {
            "type": "string",
            "enum": [
              "ONE_TIME",
              "SUBSCRIPTION"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ],
            "description": "Lifecycle status. Cart sessions begin OPEN; server-priced booking sessions begin PENDING_PAYMENT; subscription sessions are advanced only by verified Billing outcomes. Confirmation/expiry moves every flow forward."
          },
          "isBinding": {
            "type": "boolean",
            "description": "For cart checkout, false after create/reprice (mutable estimate) and true after bind. Booking checkout is server-priced and true at creation. Subscription checkout becomes true only after its provider subscription and exact first invoice are verified. #604 refuses to create an ordinary payment session unless this is true."
          },
          "contextType": {
            "type": "string",
            "enum": [
              "CART",
              "BOOKING"
            ]
          },
          "booking": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutBookingContextDto"
              }
            ]
          },
          "subscription": {
            "nullable": true,
            "description": "Subscription-specific payment/order/renewal truth. Present only when purchaseMode is SUBSCRIPTION.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSubscriptionSummaryDto"
              }
            ]
          },
          "refundInitiated": {
            "type": "boolean",
            "description": "True only when this session is CANCELLED *and* it was CHARGED then auto-refunded by the webhook-authoritative confirmation path (#871) — a stale-PI reprice amount/currency mismatch or an oversell-after-charge race flipped the session to CANCELLED and enqueued the per-attempt refund (`checkout-refund:${paymentAttemptId}` outbox, idempotent). It lets the hosted/BYO surface tell a charged-then-refunded CANCELLED session apart from a plain cancelled/expired one and render honest \"payment received — your refund is on the way\" copy instead of the generic not-payable block. Scoped to CANCELLED on purpose: the confirmation path also refunds an extra duplicate charge on an already-CONFIRMED session without cancelling it, so a refunded-event check alone is not sufficient. Customer-safe by construction: a single boolean derived from the presence of the internal `checkout_session.refunded` event — it carries NO processor ids, amounts, or failure detail. `false` on every session that is not a charged-then-refunded CANCELLED one (OPEN, EXPIRED, a plain CANCELLED, and CONFIRMED — including a CONFIRMED session whose duplicate charge was refunded)."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code (e.g. `usd`)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSessionLineDto"
            }
          },
          "packages": {
            "description": "Frozen package selections with every component, operational quantity, savings, tax, and total.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "selections": {
            "description": "Top-level server-accepted catalog selections for exact reprice/bind retry. Package components never replace their parent here.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSelectionLineDto"
            }
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Sum of gross line totals. For a trial subscription this still includes the recurring sticker price; the amount deferred by the trial appears in discountInCents so the due-today equation remains exact."
          },
          "discountInCents": {
            "type": "number",
            "description": "Amount subtracted from the gross subtotal. For subscription checkout it can include recurring value deferred from the first invoice by a trial, not only promotional discounts."
          },
          "taxInCents": {
            "type": "number",
            "description": "Computed sales tax folded into the binding total (#449, ADR-008). `0` when no tax provider is enabled (the default) — the reference storefronts read THIS instead of their flat-8% placeholder. Non-zero cart tax is computed at `bind` from the captured address; a booking session may instead carry its persisted tax-preflight posture at creation."
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe tax posture disclosure. Present when the transaction used the audited manual/no-tax escape hatch, so checkout/receipt surfaces can clearly state that cartonium did not calculate tax.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charge folded into the binding total (#854). `0` until `bind` resolves a customer-selected `shippingRateId` against the active zone matching the captured address — the price is re-derived server-side from the rate (never a client amount, ADR-006). Stays `0` when no rate is selected or a FREE_SHIPPING coupon/auto-discount/bundle waives the charge (the chosen method is still recorded on the session). The hosted/BYO surface renders THIS as the shipping line."
          },
          "totalInCents": {
            "type": "number",
            "description": "Commercial transaction total (`subtotal - discount + tax + shipping`). For cart/full-payment checkout this is also charged now; a booking deposit charges amountDueNowInCents instead (ADR-006). For a subscription this is the verified first-invoice total only, never the lifetime value or a future renewal amount."
          },
          "amountDueNowInCents": {
            "type": "number",
            "description": "Amount due now. Equals totalInCents for carts/full payment, may be smaller for a booking deposit, and is the verified first-invoice amount for a subscription (0 for a no-card trial)."
          },
          "remainingBalanceInCents": {
            "type": "number",
            "description": "Commercial balance remaining after the due-now amount for this checkout. Always 0 for subscription checkout; future renewals are described by subscription.nextRenewalAt and are not a checkout balance."
          },
          "requiresFreeConfirmation": {
            "type": "boolean",
            "description": "#3263 — `true` when this bound checkout must be completed through `POST …/sessions/:token/confirm-free` rather than `payment-session`, because its total cannot be charged: either zero, or above zero but below the payment provider's per-currency minimum (which the provider rejects, surfacing as a generic 500). Surfaces are expected to branch on THIS FLAG rather than testing the total themselves — the minimum is a provider fact that varies by currency and changes on the provider schedule, so a client-side comparison duplicates a threshold that will drift. `false` on a non-binding session, since a session that has not bound has no server-authoritative total yet. Also `false` for booking, booking-group, and subscription checkouts: they have no no-charge completion path, so a below-minimum total there is refused rather than routed."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The customer-selected shipping method (#854/#1002), so the hosted/BYO surface can show WHICH option is chosen before payment. Populated on reprice (a preview) AND bind (the commitment) when a resolvable `shippingRateId` is selected; `null` on create, and whenever no rate is selected or the selected rate does not resolve (on reprice it simply clears the estimate; on bind an invalid rate is a `400`). The charged amount is `shippingInCents`; this carries the method label and whether a FREE_SHIPPING rule waived the charge.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingMethodDto"
              }
            ]
          },
          "customer": {
            "nullable": true,
            "description": "#1170 — captured customer contact for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer. This keeps the anonymous session-read projection PII-free; #3231 deliberately exposes only the bound email through the separate payment-session handoff.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionCustomerDto"
              }
            ]
          },
          "shippingAddress": {
            "nullable": true,
            "description": "#1170 — captured shipping address for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionAddressDto"
              }
            ]
          },
          "shippingAddressValidation": {
            "nullable": true,
            "description": "#1563/#4201 — provider verdict on the shipping address, produced by a live-rate quote or configured fulfillment validation. Present ONLY on reprice/bind responses when provider validation was attempted and returned a verdict. PII posture (#1170/#606): echoes a cleaned form of the address the caller submitted on this request and is never present on anonymous session reads. #3231 separately permits that token to obtain only the bound email through the payment-session handoff, never this address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressValidationDto"
              }
            ]
          },
          "shippingQuoteFailure": {
            "description": "#4673 — present ONLY on a reprice response whose live carrier-rate quote for the submitted destination failed: a fresh provider failure, or one the server reused from its short failure cache (an explicit `refreshShippingRates: true` reprice bypasses that cache). Omitted on every other response — create, bind, and session reads (none of which reports a quote outcome), a reprice whose live quote succeeded, and a reprice that attempted no live quote (incomplete destination, live rates not configured for the destination, nothing to ship). Absence therefore never proves rates exist; read `availableShippingOptions`. Present with an EMPTY `availableShippingOptions`: no delivery method is currently usable because the quote failed — not proof the destination is unserviceable. Keep the shopper at delivery, show the category, and offer an explicit refresh when `retryable` is true; do not blame the address unless the category is `invalid_address`. Present beside a NON-EMPTY list: those listed options (for example configured flat rates) remain valid choices while carrier rates are unavailable. A merchant service policy that excludes every quoted service is not a provider failure and is never classified here.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingQuoteFailureDto"
              }
            ]
          },
          "shippingUnavailable": {
            "description": "#4673 — present ONLY on a reprice response for a cart that requires shipping, with a destination country and an EMPTY `availableShippingOptions`, when a bind of that cart to that destination would be refused for lack of a delivery method. Keep the shopper at delivery; it can be combined with `shippingQuoteFailure`, whose retry guidance then applies. Omitted on every other response, including create, bind, and session reads, and whenever the cart ships nothing, no destination country is known, options exist, or the address itself was rejected (see `shippingAddressValidation`). Absence does not prove a bind will succeed: an empty option set without this field can still be valid, for example a served destination whose configured rates do not apply to this cart binds with no shipping charge.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingUnavailableDto"
              }
            ]
          },
          "availableShippingOptions": {
            "description": "For ordinary one-time checkout, server-derived shipping options applicable to the captured destination + cart subtotal (#1002), so the hosted/BYO surface can show — and let the shopper switch between — fulfillment methods BEFORE payment. Resolved from the active zone matching the address country, filtered to rates the subtotal clears. **Populated only on ordinary reprice/bind responses and on a read of an ordinary session that is not yet binding** (#3052): its create response and any read of a BOUND session return `[]` by design (no destination resolved yet, and the picker is a pre-payment surface the confirmation poll must not re-query). Physical-subscription summaries also return `[]`: that flow has no public option preflight (#3482), so this field is not its selection source. An empty array on those responses therefore means \"not offered here\", NOT \"no rates available\" — never let one clear a rendered option set or a confirmed selection. It is also empty when no address, zone, or applicable rate exists, and when a live carrier quote failed with no other applicable rate — a reprice distinguishes that last case with `shippingQuoteFailure`, and reports through `shippingUnavailable` when an empty set for a cart that ships means a bind would be refused. For ordinary checkout, select one and resend its `rateId` as `shippingRateId`: reprice previews the resulting total; bind re-resolves and commits it only if it is still valid. The charged amount is always server-derived (ADR-006). An option is current only for the response it arrived on, not a promise that a later bind will succeed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutShippingOptionDto"
            }
          },
          "discountSnapshot": {
            "description": "Current server-authored discount attribution, persisted verbatim and copied onto the final order for attribution. The property is always present. It is an object for server-repriced cart/subscription sessions (even when no discount applies), and null only for booking, booking-group, or legacy sessions that have no discount snapshot. Within an object, `appliedCoupon: null` is the authoritative proof that no coupon is applied; aggregate discounts or totals can still reflect other rules. Only `appliedCoupon` is modeled by this schema; any additional server-authored attribution keys are intentionally not declared as public identifiers or schema fields.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CheckoutDiscountSnapshotDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "description": "When an unbound session may expire before provider creation. Once a durable provider-create intent exists, this timestamp remains useful for shopper messaging but authoritative reconciliation decides the outcome instead of a token read silently expiring provider-bound work. Null only in the (not-issued-here) no-expiry case.",
            "nullable": true,
            "format": "date-time"
          },
          "reservationExpiresAt": {
            "type": "string",
            "description": "When a Mode-B (reserve-during-checkout) pre-payment inventory hold expires — the secondary countdown source for \"your items are held for N min\". Null under Mode A (reserve-at-confirmation, the only live mode today), where the session carries no hold. #605 Slice 3 ships this as a SEAM: it is populated only once Mode B is wired (no holds are minted in M3).",
            "nullable": true,
            "format": "date-time"
          },
          "orderReference": {
            "type": "string",
            "description": "Stable public order address. Always present as a nullable field: null before finalOrderId exists and the exact non-null Order reference afterward. The locator is never an authentication credential.",
            "nullable": true,
            "pattern": "^or1_[0-9a-f]{32}$",
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "orderNumber": {
            "type": "string",
            "description": "The resulting order number once this session is CONFIRMED (#991) — the in-flow confirmation surface renders it as the post-payment receipt reference. Joined from `CheckoutSession.finalOrderId`; `null` on every non-confirmed read and on create/reprice/bind (no order exists yet). ALWAYS PRESENT (nullable), like `returnToStoreUrl` — every summary path emits it, so it belongs in the schema `required` set. Non-PII: the same `Order.orderNumber` the #818 order-status page and the signed-in account already show. The order-status `o`-token is hash-at-rest (ADR-007) and intentionally NOT reconstructable here, so this is a reference + account next-action, not a regenerated forwardable status link.",
            "nullable": true
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived, customer-safe state of the order-confirmation email. Always present. It never includes the recipient, provider id, policy code, or raw outbox error.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "returnToStoreUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe return-to-store destination for hosted/BYO checkout surfaces. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe post-checkout completion destination. Prefers trusted `checkoutSettings.postCheckoutRedirectUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. Hosted checkout may auto-redirect here only after the server read shows CONFIRMED; never from a client-side processor callback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutRetryUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe retry/start-over checkout destination. Prefers trusted `checkoutSettings.checkoutRetryUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutCancelUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe canceled/expired checkout destination. Prefers trusted `checkoutSettings.checkoutCancelUrl`, then `checkoutRetryUrl`, `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "accountUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer account URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout account origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "accountSignInUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer sign-in URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout sign-in origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "#996 — whether the tenant enabled the hosted-checkout marketing opt-in (`checkoutSettings.marketingOptInEnabled`). When true, the surface shows a DEFAULT-UNCHECKED opt-in checkbox before payment and sends the shopper's choice as the bind `marketingOptIn`. ALWAYS PRESENT (in the schema `required` set); `false` unless the tenant turned it on."
          },
          "marketingOptInCopy": {
            "type": "string",
            "description": "#996 — the label to render beside the opt-in checkbox when `marketingOptInEnabled` is true: the tenant-configured copy, else a safe default. Plain text (no URL). `null` when the opt-in is disabled (no checkbox). ALWAYS PRESENT (nullable).",
            "nullable": true
          },
          "token": {
            "type": "string",
            "description": "Opaque checkout credential (prefix c). First creation returns the original token; an exact creation replay returns a fresh resume token for the SAME session and its current summary. Only hashes are stored. Store the returned token; the original token and the eight most recent resume tokens remain recognized. This token and the secret x-hosted-checkout-create-recovery-key are not customer authentication or payment authorization."
          }
        },
        "required": [
          "purchaseMode",
          "status",
          "isBinding",
          "contextType",
          "booking",
          "subscription",
          "refundInitiated",
          "currency",
          "lines",
          "packages",
          "selections",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "totalInCents",
          "amountDueNowInCents",
          "remainingBalanceInCents",
          "requiresFreeConfirmation",
          "customer",
          "shippingAddress",
          "availableShippingOptions",
          "discountSnapshot",
          "orderReference",
          "orderNumber",
          "orderConfirmationEmail",
          "returnToStoreUrl",
          "postCheckoutRedirectUrl",
          "checkoutRetryUrl",
          "checkoutCancelUrl",
          "accountUrl",
          "accountSignInUrl",
          "marketingOptInEnabled",
          "marketingOptInCopy",
          "token"
        ]
      },
      "CheckoutPurchaseProofDto": {
        "type": "object",
        "properties": {
          "purchaseId": {
            "type": "string",
            "pattern": "^cpi1_[a-f0-9]{64}$",
            "description": "Stable opaque identity of the one winning purchase: the same value on every read of this grant. It is not an order number or reference, reveals no order fact and is accepted by no route. Use it as an additional deduplication key beside the capture and its line generations, never instead of them; the session read reports `orderReference`, not this."
          },
          "captureCorrelation": {
            "type": "string",
            "description": "The `captureCorrelation` supplied at creation, unchanged. Remove nothing unless it matches the capture."
          },
          "selections": {
            "description": "The purchased selections and quantities, projected from the winning Order's own items and pricing snapshot, never from session lines. Equal as a set to the session read's `selections`: a package appears as its parent, never as components. Sorted by `itemId` then `variantId`, so repeated reads are identical. Never empty: an Order with nothing to project answers the neutral `404`. Remove items only when this set exactly equals the capture.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSelectionLineDto"
            }
          }
        },
        "required": [
          "purchaseId",
          "captureCorrelation",
          "selections"
        ]
      },
      "CheckoutAccountSwitchAdmitRequestDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Stable opaque retry key for one account-switch admission. Preserve the original value across reloads and retries of the same in-progress checkout; a new value cannot take over a fenced epoch through admit. Only if the original value is irretrievably lost, use recover.",
            "minLength": 16,
            "maxLength": 128
          }
        },
        "required": [
          "requestId"
        ]
      },
      "CheckoutAccountSwitchAdmissionResponseDto": {
        "type": "object",
        "properties": {
          "epochId": {
            "type": "string",
            "description": "Opaque durable switch epoch identifier."
          },
          "state": {
            "type": "string",
            "enum": [
              "ADMITTED"
            ]
          },
          "branch": {
            "type": "string",
            "enum": [
              "RETURN_TO_A",
              "SWITCH_TO_B"
            ],
            "nullable": true,
            "description": "Exclusive recovery branch. Null means the switch is admitted but no RETURN_TO_A or SWITCH_TO_B branch has been claimed yet."
          }
        },
        "required": [
          "epochId",
          "state",
          "branch"
        ]
      },
      "CheckoutAccountSwitchRecoverRequestDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Fresh opaque retry key that replaces an irretrievably lost admission requestId for this same in-progress checkout. Store it before sending and reuse it across reloads and retries; once its successor epoch supersedes the fenced one it is the key that admit and recover replay with. A value any earlier epoch of this checkout used is refused.",
            "minLength": 16,
            "maxLength": 128
          },
          "expectedEpochId": {
            "type": "string",
            "format": "uuid",
            "description": "The fencing epoch this request takes over, exactly as the details.epochId of a PREPARED_PAYMENT_SWITCH_RECOVERY_TARGET answer named it. Omit it on the first call: the server then writes nothing and answers with that target. A takeover proceeds only while the named epoch is still the latest fencing epoch of this checkout; otherwise the request is stale and changes nothing."
          }
        },
        "required": [
          "requestId"
        ]
      },
      "CheckoutAccountSwitchBranchRequestDto": {
        "type": "object",
        "properties": {
          "branch": {
            "type": "string",
            "enum": [
              "RETURN_TO_A",
              "SWITCH_TO_B"
            ],
            "description": "RETURN_TO_A resumes the same verified Customer after safe release; SWITCH_TO_B requires the frozen A CustomerSession to be stale."
          },
          "email": {
            "type": "string",
            "maxLength": 320,
            "description": "Chosen checkout contact email. The server normalizes trim and lowercase."
          }
        },
        "required": [
          "branch",
          "email"
        ]
      },
      "CheckoutAccountSwitchBranchResponseDto": {
        "type": "object",
        "properties": {
          "epochId": {
            "type": "string"
          },
          "branch": {
            "type": "string",
            "enum": [
              "RETURN_TO_A",
              "SWITCH_TO_B"
            ]
          },
          "nextAction": {
            "type": "string",
            "enum": [
              "proceed",
              "verify"
            ],
            "description": "Neutral, cached identity next action for the claimed branch."
          }
        },
        "required": [
          "epochId",
          "branch",
          "nextAction"
        ]
      },
      "CheckoutAccountSwitchStatusResponseDto": {
        "type": "object",
        "properties": {
          "epochId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "FENCING",
              "ADMITTED"
            ]
          },
          "branch": {
            "type": "string",
            "enum": [
              "RETURN_TO_A",
              "SWITCH_TO_B"
            ],
            "nullable": true,
            "description": "Exclusive recovery branch. Null means no branch is claimed: either old payment fencing is still in progress or admission completed and awaits a branch claim; state distinguishes those cases."
          },
          "isBinding": {
            "type": "boolean",
            "description": "Whether the current branch has a current checkout binding."
          },
          "recoveryRequired": {
            "type": "boolean",
            "description": "True when old payment proof or local lineage needs recovery; never authorizes reuse of an old client secret."
          }
        },
        "required": [
          "epochId",
          "state",
          "branch",
          "isBinding",
          "recoveryRequired"
        ]
      },
      "SubscriptionCheckoutHandoffDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "SETUP",
              "NONE"
            ]
          },
          "clientSecret": {
            "type": "string",
            "nullable": true
          },
          "publishableKey": {
            "type": "string",
            "nullable": true
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "recurringCardExplanation": {
            "type": "string",
            "description": "Customer-facing explanation of whether and why the card is stored for recurring off-session charges."
          },
          "requiresContinuation": {
            "type": "boolean",
            "description": "True when a SETUP handoff must be confirmed before Billing creation continues. Headless clients replay the original start body with its idempotency key; hosted clients POST the opaque-token handoff endpoint again."
          }
        },
        "required": [
          "type",
          "clientSecret",
          "publishableKey",
          "stripeAccountId",
          "amountInCents",
          "currency",
          "recurringCardExplanation",
          "requiresContinuation"
        ]
      },
      "SubscriptionCheckoutHandoffResponseDto": {
        "type": "object",
        "properties": {
          "purchaseMode": {
            "type": "string",
            "enum": [
              "ONE_TIME",
              "SUBSCRIPTION"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ],
            "description": "Lifecycle status. Cart sessions begin OPEN; server-priced booking sessions begin PENDING_PAYMENT; subscription sessions are advanced only by verified Billing outcomes. Confirmation/expiry moves every flow forward."
          },
          "isBinding": {
            "type": "boolean",
            "description": "For cart checkout, false after create/reprice (mutable estimate) and true after bind. Booking checkout is server-priced and true at creation. Subscription checkout becomes true only after its provider subscription and exact first invoice are verified. #604 refuses to create an ordinary payment session unless this is true."
          },
          "contextType": {
            "type": "string",
            "enum": [
              "CART",
              "BOOKING"
            ]
          },
          "booking": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutBookingContextDto"
              }
            ]
          },
          "subscription": {
            "nullable": true,
            "description": "Subscription-specific payment/order/renewal truth. Present only when purchaseMode is SUBSCRIPTION.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSubscriptionSummaryDto"
              }
            ]
          },
          "refundInitiated": {
            "type": "boolean",
            "description": "True only when this session is CANCELLED *and* it was CHARGED then auto-refunded by the webhook-authoritative confirmation path (#871) — a stale-PI reprice amount/currency mismatch or an oversell-after-charge race flipped the session to CANCELLED and enqueued the per-attempt refund (`checkout-refund:${paymentAttemptId}` outbox, idempotent). It lets the hosted/BYO surface tell a charged-then-refunded CANCELLED session apart from a plain cancelled/expired one and render honest \"payment received — your refund is on the way\" copy instead of the generic not-payable block. Scoped to CANCELLED on purpose: the confirmation path also refunds an extra duplicate charge on an already-CONFIRMED session without cancelling it, so a refunded-event check alone is not sufficient. Customer-safe by construction: a single boolean derived from the presence of the internal `checkout_session.refunded` event — it carries NO processor ids, amounts, or failure detail. `false` on every session that is not a charged-then-refunded CANCELLED one (OPEN, EXPIRED, a plain CANCELLED, and CONFIRMED — including a CONFIRMED session whose duplicate charge was refunded)."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code (e.g. `usd`)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSessionLineDto"
            }
          },
          "packages": {
            "description": "Frozen package selections with every component, operational quantity, savings, tax, and total.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "selections": {
            "description": "Top-level server-accepted catalog selections for exact reprice/bind retry. Package components never replace their parent here.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSelectionLineDto"
            }
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Sum of gross line totals. For a trial subscription this still includes the recurring sticker price; the amount deferred by the trial appears in discountInCents so the due-today equation remains exact."
          },
          "discountInCents": {
            "type": "number",
            "description": "Amount subtracted from the gross subtotal. For subscription checkout it can include recurring value deferred from the first invoice by a trial, not only promotional discounts."
          },
          "taxInCents": {
            "type": "number",
            "description": "Computed sales tax folded into the binding total (#449, ADR-008). `0` when no tax provider is enabled (the default) — the reference storefronts read THIS instead of their flat-8% placeholder. Non-zero cart tax is computed at `bind` from the captured address; a booking session may instead carry its persisted tax-preflight posture at creation."
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe tax posture disclosure. Present when the transaction used the audited manual/no-tax escape hatch, so checkout/receipt surfaces can clearly state that cartonium did not calculate tax.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charge folded into the binding total (#854). `0` until `bind` resolves a customer-selected `shippingRateId` against the active zone matching the captured address — the price is re-derived server-side from the rate (never a client amount, ADR-006). Stays `0` when no rate is selected or a FREE_SHIPPING coupon/auto-discount/bundle waives the charge (the chosen method is still recorded on the session). The hosted/BYO surface renders THIS as the shipping line."
          },
          "totalInCents": {
            "type": "number",
            "description": "Commercial transaction total (`subtotal - discount + tax + shipping`). For cart/full-payment checkout this is also charged now; a booking deposit charges amountDueNowInCents instead (ADR-006). For a subscription this is the verified first-invoice total only, never the lifetime value or a future renewal amount."
          },
          "amountDueNowInCents": {
            "type": "number",
            "description": "Amount due now. Equals totalInCents for carts/full payment, may be smaller for a booking deposit, and is the verified first-invoice amount for a subscription (0 for a no-card trial)."
          },
          "remainingBalanceInCents": {
            "type": "number",
            "description": "Commercial balance remaining after the due-now amount for this checkout. Always 0 for subscription checkout; future renewals are described by subscription.nextRenewalAt and are not a checkout balance."
          },
          "requiresFreeConfirmation": {
            "type": "boolean",
            "description": "#3263 — `true` when this bound checkout must be completed through `POST …/sessions/:token/confirm-free` rather than `payment-session`, because its total cannot be charged: either zero, or above zero but below the payment provider's per-currency minimum (which the provider rejects, surfacing as a generic 500). Surfaces are expected to branch on THIS FLAG rather than testing the total themselves — the minimum is a provider fact that varies by currency and changes on the provider schedule, so a client-side comparison duplicates a threshold that will drift. `false` on a non-binding session, since a session that has not bound has no server-authoritative total yet. Also `false` for booking, booking-group, and subscription checkouts: they have no no-charge completion path, so a below-minimum total there is refused rather than routed."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The customer-selected shipping method (#854/#1002), so the hosted/BYO surface can show WHICH option is chosen before payment. Populated on reprice (a preview) AND bind (the commitment) when a resolvable `shippingRateId` is selected; `null` on create, and whenever no rate is selected or the selected rate does not resolve (on reprice it simply clears the estimate; on bind an invalid rate is a `400`). The charged amount is `shippingInCents`; this carries the method label and whether a FREE_SHIPPING rule waived the charge.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingMethodDto"
              }
            ]
          },
          "customer": {
            "nullable": true,
            "description": "#1170 — captured customer contact for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer. This keeps the anonymous session-read projection PII-free; #3231 deliberately exposes only the bound email through the separate payment-session handoff.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionCustomerDto"
              }
            ]
          },
          "shippingAddress": {
            "nullable": true,
            "description": "#1170 — captured shipping address for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionAddressDto"
              }
            ]
          },
          "shippingAddressValidation": {
            "nullable": true,
            "description": "#1563/#4201 — provider verdict on the shipping address, produced by a live-rate quote or configured fulfillment validation. Present ONLY on reprice/bind responses when provider validation was attempted and returned a verdict. PII posture (#1170/#606): echoes a cleaned form of the address the caller submitted on this request and is never present on anonymous session reads. #3231 separately permits that token to obtain only the bound email through the payment-session handoff, never this address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressValidationDto"
              }
            ]
          },
          "shippingQuoteFailure": {
            "description": "#4673 — present ONLY on a reprice response whose live carrier-rate quote for the submitted destination failed: a fresh provider failure, or one the server reused from its short failure cache (an explicit `refreshShippingRates: true` reprice bypasses that cache). Omitted on every other response — create, bind, and session reads (none of which reports a quote outcome), a reprice whose live quote succeeded, and a reprice that attempted no live quote (incomplete destination, live rates not configured for the destination, nothing to ship). Absence therefore never proves rates exist; read `availableShippingOptions`. Present with an EMPTY `availableShippingOptions`: no delivery method is currently usable because the quote failed — not proof the destination is unserviceable. Keep the shopper at delivery, show the category, and offer an explicit refresh when `retryable` is true; do not blame the address unless the category is `invalid_address`. Present beside a NON-EMPTY list: those listed options (for example configured flat rates) remain valid choices while carrier rates are unavailable. A merchant service policy that excludes every quoted service is not a provider failure and is never classified here.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingQuoteFailureDto"
              }
            ]
          },
          "shippingUnavailable": {
            "description": "#4673 — present ONLY on a reprice response for a cart that requires shipping, with a destination country and an EMPTY `availableShippingOptions`, when a bind of that cart to that destination would be refused for lack of a delivery method. Keep the shopper at delivery; it can be combined with `shippingQuoteFailure`, whose retry guidance then applies. Omitted on every other response, including create, bind, and session reads, and whenever the cart ships nothing, no destination country is known, options exist, or the address itself was rejected (see `shippingAddressValidation`). Absence does not prove a bind will succeed: an empty option set without this field can still be valid, for example a served destination whose configured rates do not apply to this cart binds with no shipping charge.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingUnavailableDto"
              }
            ]
          },
          "availableShippingOptions": {
            "description": "For ordinary one-time checkout, server-derived shipping options applicable to the captured destination + cart subtotal (#1002), so the hosted/BYO surface can show — and let the shopper switch between — fulfillment methods BEFORE payment. Resolved from the active zone matching the address country, filtered to rates the subtotal clears. **Populated only on ordinary reprice/bind responses and on a read of an ordinary session that is not yet binding** (#3052): its create response and any read of a BOUND session return `[]` by design (no destination resolved yet, and the picker is a pre-payment surface the confirmation poll must not re-query). Physical-subscription summaries also return `[]`: that flow has no public option preflight (#3482), so this field is not its selection source. An empty array on those responses therefore means \"not offered here\", NOT \"no rates available\" — never let one clear a rendered option set or a confirmed selection. It is also empty when no address, zone, or applicable rate exists, and when a live carrier quote failed with no other applicable rate — a reprice distinguishes that last case with `shippingQuoteFailure`, and reports through `shippingUnavailable` when an empty set for a cart that ships means a bind would be refused. For ordinary checkout, select one and resend its `rateId` as `shippingRateId`: reprice previews the resulting total; bind re-resolves and commits it only if it is still valid. The charged amount is always server-derived (ADR-006). An option is current only for the response it arrived on, not a promise that a later bind will succeed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutShippingOptionDto"
            }
          },
          "discountSnapshot": {
            "description": "Current server-authored discount attribution, persisted verbatim and copied onto the final order for attribution. The property is always present. It is an object for server-repriced cart/subscription sessions (even when no discount applies), and null only for booking, booking-group, or legacy sessions that have no discount snapshot. Within an object, `appliedCoupon: null` is the authoritative proof that no coupon is applied; aggregate discounts or totals can still reflect other rules. Only `appliedCoupon` is modeled by this schema; any additional server-authored attribution keys are intentionally not declared as public identifiers or schema fields.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CheckoutDiscountSnapshotDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "description": "When an unbound session may expire before provider creation. Once a durable provider-create intent exists, this timestamp remains useful for shopper messaging but authoritative reconciliation decides the outcome instead of a token read silently expiring provider-bound work. Null only in the (not-issued-here) no-expiry case.",
            "nullable": true,
            "format": "date-time"
          },
          "reservationExpiresAt": {
            "type": "string",
            "description": "When a Mode-B (reserve-during-checkout) pre-payment inventory hold expires — the secondary countdown source for \"your items are held for N min\". Null under Mode A (reserve-at-confirmation, the only live mode today), where the session carries no hold. #605 Slice 3 ships this as a SEAM: it is populated only once Mode B is wired (no holds are minted in M3).",
            "nullable": true,
            "format": "date-time"
          },
          "orderReference": {
            "type": "string",
            "description": "Stable public order address. Always present as a nullable field: null before finalOrderId exists and the exact non-null Order reference afterward. The locator is never an authentication credential.",
            "nullable": true,
            "pattern": "^or1_[0-9a-f]{32}$",
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "orderNumber": {
            "type": "string",
            "description": "The resulting order number once this session is CONFIRMED (#991) — the in-flow confirmation surface renders it as the post-payment receipt reference. Joined from `CheckoutSession.finalOrderId`; `null` on every non-confirmed read and on create/reprice/bind (no order exists yet). ALWAYS PRESENT (nullable), like `returnToStoreUrl` — every summary path emits it, so it belongs in the schema `required` set. Non-PII: the same `Order.orderNumber` the #818 order-status page and the signed-in account already show. The order-status `o`-token is hash-at-rest (ADR-007) and intentionally NOT reconstructable here, so this is a reference + account next-action, not a regenerated forwardable status link.",
            "nullable": true
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived, customer-safe state of the order-confirmation email. Always present. It never includes the recipient, provider id, policy code, or raw outbox error.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "returnToStoreUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe return-to-store destination for hosted/BYO checkout surfaces. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe post-checkout completion destination. Prefers trusted `checkoutSettings.postCheckoutRedirectUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. Hosted checkout may auto-redirect here only after the server read shows CONFIRMED; never from a client-side processor callback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutRetryUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe retry/start-over checkout destination. Prefers trusted `checkoutSettings.checkoutRetryUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutCancelUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe canceled/expired checkout destination. Prefers trusted `checkoutSettings.checkoutCancelUrl`, then `checkoutRetryUrl`, `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "accountUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer account URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout account origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "accountSignInUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer sign-in URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout sign-in origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "#996 — whether the tenant enabled the hosted-checkout marketing opt-in (`checkoutSettings.marketingOptInEnabled`). When true, the surface shows a DEFAULT-UNCHECKED opt-in checkbox before payment and sends the shopper's choice as the bind `marketingOptIn`. ALWAYS PRESENT (in the schema `required` set); `false` unless the tenant turned it on."
          },
          "marketingOptInCopy": {
            "type": "string",
            "description": "#996 — the label to render beside the opt-in checkbox when `marketingOptInEnabled` is true: the tenant-configured copy, else a safe default. Plain text (no URL). `null` when the opt-in is disabled (no checkbox). ALWAYS PRESENT (nullable).",
            "nullable": true
          },
          "handoff": {
            "$ref": "#/components/schemas/SubscriptionCheckoutHandoffDto"
          }
        },
        "required": [
          "purchaseMode",
          "status",
          "isBinding",
          "contextType",
          "booking",
          "subscription",
          "refundInitiated",
          "currency",
          "lines",
          "packages",
          "selections",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "totalInCents",
          "amountDueNowInCents",
          "remainingBalanceInCents",
          "requiresFreeConfirmation",
          "customer",
          "shippingAddress",
          "availableShippingOptions",
          "discountSnapshot",
          "orderReference",
          "orderNumber",
          "orderConfirmationEmail",
          "returnToStoreUrl",
          "postCheckoutRedirectUrl",
          "checkoutRetryUrl",
          "checkoutCancelUrl",
          "accountUrl",
          "accountSignInUrl",
          "marketingOptInEnabled",
          "marketingOptInCopy",
          "handoff"
        ]
      },
      "SubscriptionCheckoutRecurringLineDto": {
        "type": "object",
        "properties": {
          "planSlug": {
            "type": "string",
            "description": "Public/BYO subscription plan slug.",
            "maxLength": 160
          },
          "priceId": {
            "type": "string",
            "description": "Public local subscription price id returned by the plan read. Stripe ids are never accepted.",
            "format": "uuid"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "planSlug",
          "priceId",
          "quantity"
        ]
      },
      "SubscriptionCheckoutCustomerDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          }
        },
        "required": [
          "email",
          "name"
        ]
      },
      "CreateSubscriptionCheckoutDto": {
        "type": "object",
        "properties": {
          "recurringLines": {
            "minItems": 1,
            "maxItems": 20,
            "description": "Recurring selections. Every line must resolve to the same currency, cadence, connected account, and frozen trial policy.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionCheckoutRecurringLineDto"
            }
          },
          "oneTimeLines": {
            "maxItems": 20,
            "description": "Optional ordinary catalog lines billed once on the first subscription invoice through add_invoice_items. Prices are resolved server-side.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RepriceLineDto"
            }
          },
          "customer": {
            "$ref": "#/components/schemas/SubscriptionCheckoutCustomerDto"
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/CheckoutAddressDto"
          },
          "billingAddress": {
            "$ref": "#/components/schemas/CheckoutAddressDto"
          },
          "shippingRateId": {
            "type": "string",
            "description": "Server-owned flat or live shipping rate id. Required when the physical cart has applicable shipping options.",
            "maxLength": 100
          },
          "marketingOptIn": {
            "type": "boolean",
            "description": "Customer marketing choice. It is stored only when the tenant enabled checkout marketing opt-in."
          }
        },
        "required": [
          "recurringLines",
          "customer"
        ]
      },
      "CreateSubscriptionCheckoutResponseDto": {
        "type": "object",
        "properties": {
          "purchaseMode": {
            "type": "string",
            "enum": [
              "ONE_TIME",
              "SUBSCRIPTION"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "EXPIRED",
              "ABANDONED",
              "CANCELLED"
            ],
            "description": "Lifecycle status. Cart sessions begin OPEN; server-priced booking sessions begin PENDING_PAYMENT; subscription sessions are advanced only by verified Billing outcomes. Confirmation/expiry moves every flow forward."
          },
          "isBinding": {
            "type": "boolean",
            "description": "For cart checkout, false after create/reprice (mutable estimate) and true after bind. Booking checkout is server-priced and true at creation. Subscription checkout becomes true only after its provider subscription and exact first invoice are verified. #604 refuses to create an ordinary payment session unless this is true."
          },
          "contextType": {
            "type": "string",
            "enum": [
              "CART",
              "BOOKING"
            ]
          },
          "booking": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutBookingContextDto"
              }
            ]
          },
          "subscription": {
            "nullable": true,
            "description": "Subscription-specific payment/order/renewal truth. Present only when purchaseMode is SUBSCRIPTION.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSubscriptionSummaryDto"
              }
            ]
          },
          "refundInitiated": {
            "type": "boolean",
            "description": "True only when this session is CANCELLED *and* it was CHARGED then auto-refunded by the webhook-authoritative confirmation path (#871) — a stale-PI reprice amount/currency mismatch or an oversell-after-charge race flipped the session to CANCELLED and enqueued the per-attempt refund (`checkout-refund:${paymentAttemptId}` outbox, idempotent). It lets the hosted/BYO surface tell a charged-then-refunded CANCELLED session apart from a plain cancelled/expired one and render honest \"payment received — your refund is on the way\" copy instead of the generic not-payable block. Scoped to CANCELLED on purpose: the confirmation path also refunds an extra duplicate charge on an already-CONFIRMED session without cancelling it, so a refunded-event check alone is not sufficient. Customer-safe by construction: a single boolean derived from the presence of the internal `checkout_session.refunded` event — it carries NO processor ids, amounts, or failure detail. `false` on every session that is not a charged-then-refunded CANCELLED one (OPEN, EXPIRED, a plain CANCELLED, and CONFIRMED — including a CONFIRMED session whose duplicate charge was refunded)."
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code (e.g. `usd`)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSessionLineDto"
            }
          },
          "packages": {
            "description": "Frozen package selections with every component, operational quantity, savings, tax, and total.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "selections": {
            "description": "Top-level server-accepted catalog selections for exact reprice/bind retry. Package components never replace their parent here.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutSelectionLineDto"
            }
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Sum of gross line totals. For a trial subscription this still includes the recurring sticker price; the amount deferred by the trial appears in discountInCents so the due-today equation remains exact."
          },
          "discountInCents": {
            "type": "number",
            "description": "Amount subtracted from the gross subtotal. For subscription checkout it can include recurring value deferred from the first invoice by a trial, not only promotional discounts."
          },
          "taxInCents": {
            "type": "number",
            "description": "Computed sales tax folded into the binding total (#449, ADR-008). `0` when no tax provider is enabled (the default) — the reference storefronts read THIS instead of their flat-8% placeholder. Non-zero cart tax is computed at `bind` from the captured address; a booking session may instead carry its persisted tax-preflight posture at creation."
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe tax posture disclosure. Present when the transaction used the audited manual/no-tax escape hatch, so checkout/receipt surfaces can clearly state that cartonium did not calculate tax.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charge folded into the binding total (#854). `0` until `bind` resolves a customer-selected `shippingRateId` against the active zone matching the captured address — the price is re-derived server-side from the rate (never a client amount, ADR-006). Stays `0` when no rate is selected or a FREE_SHIPPING coupon/auto-discount/bundle waives the charge (the chosen method is still recorded on the session). The hosted/BYO surface renders THIS as the shipping line."
          },
          "totalInCents": {
            "type": "number",
            "description": "Commercial transaction total (`subtotal - discount + tax + shipping`). For cart/full-payment checkout this is also charged now; a booking deposit charges amountDueNowInCents instead (ADR-006). For a subscription this is the verified first-invoice total only, never the lifetime value or a future renewal amount."
          },
          "amountDueNowInCents": {
            "type": "number",
            "description": "Amount due now. Equals totalInCents for carts/full payment, may be smaller for a booking deposit, and is the verified first-invoice amount for a subscription (0 for a no-card trial)."
          },
          "remainingBalanceInCents": {
            "type": "number",
            "description": "Commercial balance remaining after the due-now amount for this checkout. Always 0 for subscription checkout; future renewals are described by subscription.nextRenewalAt and are not a checkout balance."
          },
          "requiresFreeConfirmation": {
            "type": "boolean",
            "description": "#3263 — `true` when this bound checkout must be completed through `POST …/sessions/:token/confirm-free` rather than `payment-session`, because its total cannot be charged: either zero, or above zero but below the payment provider's per-currency minimum (which the provider rejects, surfacing as a generic 500). Surfaces are expected to branch on THIS FLAG rather than testing the total themselves — the minimum is a provider fact that varies by currency and changes on the provider schedule, so a client-side comparison duplicates a threshold that will drift. `false` on a non-binding session, since a session that has not bound has no server-authoritative total yet. Also `false` for booking, booking-group, and subscription checkouts: they have no no-charge completion path, so a below-minimum total there is refused rather than routed."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The customer-selected shipping method (#854/#1002), so the hosted/BYO surface can show WHICH option is chosen before payment. Populated on reprice (a preview) AND bind (the commitment) when a resolvable `shippingRateId` is selected; `null` on create, and whenever no rate is selected or the selected rate does not resolve (on reprice it simply clears the estimate; on bind an invalid rate is a `400`). The charged amount is `shippingInCents`; this carries the method label and whether a FREE_SHIPPING rule waived the charge.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingMethodDto"
              }
            ]
          },
          "customer": {
            "nullable": true,
            "description": "#1170 — captured customer contact for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer. This keeps the anonymous session-read projection PII-free; #3231 deliberately exposes only the bound email through the separate payment-session handoff.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionCustomerDto"
              }
            ]
          },
          "shippingAddress": {
            "nullable": true,
            "description": "#1170 — captured shipping address for an authenticated matching customer-session read. Always `null` on anonymous public reads and on authenticated reads for a different customer.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSessionAddressDto"
              }
            ]
          },
          "shippingAddressValidation": {
            "nullable": true,
            "description": "#1563/#4201 — provider verdict on the shipping address, produced by a live-rate quote or configured fulfillment validation. Present ONLY on reprice/bind responses when provider validation was attempted and returned a verdict. PII posture (#1170/#606): echoes a cleaned form of the address the caller submitted on this request and is never present on anonymous session reads. #3231 separately permits that token to obtain only the bound email through the payment-session handoff, never this address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAddressValidationDto"
              }
            ]
          },
          "shippingQuoteFailure": {
            "description": "#4673 — present ONLY on a reprice response whose live carrier-rate quote for the submitted destination failed: a fresh provider failure, or one the server reused from its short failure cache (an explicit `refreshShippingRates: true` reprice bypasses that cache). Omitted on every other response — create, bind, and session reads (none of which reports a quote outcome), a reprice whose live quote succeeded, and a reprice that attempted no live quote (incomplete destination, live rates not configured for the destination, nothing to ship). Absence therefore never proves rates exist; read `availableShippingOptions`. Present with an EMPTY `availableShippingOptions`: no delivery method is currently usable because the quote failed — not proof the destination is unserviceable. Keep the shopper at delivery, show the category, and offer an explicit refresh when `retryable` is true; do not blame the address unless the category is `invalid_address`. Present beside a NON-EMPTY list: those listed options (for example configured flat rates) remain valid choices while carrier rates are unavailable. A merchant service policy that excludes every quoted service is not a provider failure and is never classified here.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingQuoteFailureDto"
              }
            ]
          },
          "shippingUnavailable": {
            "description": "#4673 — present ONLY on a reprice response for a cart that requires shipping, with a destination country and an EMPTY `availableShippingOptions`, when a bind of that cart to that destination would be refused for lack of a delivery method. Keep the shopper at delivery; it can be combined with `shippingQuoteFailure`, whose retry guidance then applies. Omitted on every other response, including create, bind, and session reads, and whenever the cart ships nothing, no destination country is known, options exist, or the address itself was rejected (see `shippingAddressValidation`). Absence does not prove a bind will succeed: an empty option set without this field can still be valid, for example a served destination whose configured rates do not apply to this cart binds with no shipping charge.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutShippingUnavailableDto"
              }
            ]
          },
          "availableShippingOptions": {
            "description": "For ordinary one-time checkout, server-derived shipping options applicable to the captured destination + cart subtotal (#1002), so the hosted/BYO surface can show — and let the shopper switch between — fulfillment methods BEFORE payment. Resolved from the active zone matching the address country, filtered to rates the subtotal clears. **Populated only on ordinary reprice/bind responses and on a read of an ordinary session that is not yet binding** (#3052): its create response and any read of a BOUND session return `[]` by design (no destination resolved yet, and the picker is a pre-payment surface the confirmation poll must not re-query). Physical-subscription summaries also return `[]`: that flow has no public option preflight (#3482), so this field is not its selection source. An empty array on those responses therefore means \"not offered here\", NOT \"no rates available\" — never let one clear a rendered option set or a confirmed selection. It is also empty when no address, zone, or applicable rate exists, and when a live carrier quote failed with no other applicable rate — a reprice distinguishes that last case with `shippingQuoteFailure`, and reports through `shippingUnavailable` when an empty set for a cart that ships means a bind would be refused. For ordinary checkout, select one and resend its `rateId` as `shippingRateId`: reprice previews the resulting total; bind re-resolves and commits it only if it is still valid. The charged amount is always server-derived (ADR-006). An option is current only for the response it arrived on, not a promise that a later bind will succeed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutShippingOptionDto"
            }
          },
          "discountSnapshot": {
            "description": "Current server-authored discount attribution, persisted verbatim and copied onto the final order for attribution. The property is always present. It is an object for server-repriced cart/subscription sessions (even when no discount applies), and null only for booking, booking-group, or legacy sessions that have no discount snapshot. Within an object, `appliedCoupon: null` is the authoritative proof that no coupon is applied; aggregate discounts or totals can still reflect other rules. Only `appliedCoupon` is modeled by this schema; any additional server-authored attribution keys are intentionally not declared as public identifiers or schema fields.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CheckoutDiscountSnapshotDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "description": "When an unbound session may expire before provider creation. Once a durable provider-create intent exists, this timestamp remains useful for shopper messaging but authoritative reconciliation decides the outcome instead of a token read silently expiring provider-bound work. Null only in the (not-issued-here) no-expiry case.",
            "nullable": true,
            "format": "date-time"
          },
          "reservationExpiresAt": {
            "type": "string",
            "description": "When a Mode-B (reserve-during-checkout) pre-payment inventory hold expires — the secondary countdown source for \"your items are held for N min\". Null under Mode A (reserve-at-confirmation, the only live mode today), where the session carries no hold. #605 Slice 3 ships this as a SEAM: it is populated only once Mode B is wired (no holds are minted in M3).",
            "nullable": true,
            "format": "date-time"
          },
          "orderReference": {
            "type": "string",
            "description": "Stable public order address. Always present as a nullable field: null before finalOrderId exists and the exact non-null Order reference afterward. The locator is never an authentication credential.",
            "nullable": true,
            "pattern": "^or1_[0-9a-f]{32}$",
            "example": "or1_0123456789abcdef0123456789abcdef"
          },
          "orderNumber": {
            "type": "string",
            "description": "The resulting order number once this session is CONFIRMED (#991) — the in-flow confirmation surface renders it as the post-payment receipt reference. Joined from `CheckoutSession.finalOrderId`; `null` on every non-confirmed read and on create/reprice/bind (no order exists yet). ALWAYS PRESENT (nullable), like `returnToStoreUrl` — every summary path emits it, so it belongs in the schema `required` set. Non-PII: the same `Order.orderNumber` the #818 order-status page and the signed-in account already show. The order-status `o`-token is hash-at-rest (ADR-007) and intentionally NOT reconstructable here, so this is a reference + account next-action, not a regenerated forwardable status link.",
            "nullable": true
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived, customer-safe state of the order-confirmation email. Always present. It never includes the recipient, provider id, policy code, or raw outbox error.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "returnToStoreUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe return-to-store destination for hosted/BYO checkout surfaces. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe post-checkout completion destination. Prefers trusted `checkoutSettings.postCheckoutRedirectUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. Hosted checkout may auto-redirect here only after the server read shows CONFIRMED; never from a client-side processor callback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutRetryUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe retry/start-over checkout destination. Prefers trusted `checkoutSettings.checkoutRetryUrl`, then `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "checkoutCancelUrl": {
            "type": "string",
            "description": "#1116 — the resolved safe canceled/expired checkout destination. Prefers trusted `checkoutSettings.checkoutCancelUrl`, then `checkoutRetryUrl`, `returnToStoreUrl`, then the tenant storefront origin / neutral fallback. `null` only when no safe destination exists.",
            "nullable": true
          },
          "accountUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer account URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout account origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "accountSignInUrl": {
            "type": "string",
            "description": "#1116/#1117 — the resolved customer sign-in URL for post-checkout and terminal-state CTAs. Built from trusted `customerActionBaseUrl` when configured, otherwise the hosted cartonium checkout sign-in origin. `null` only when no customer-action origin can be resolved.",
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "#996 — whether the tenant enabled the hosted-checkout marketing opt-in (`checkoutSettings.marketingOptInEnabled`). When true, the surface shows a DEFAULT-UNCHECKED opt-in checkbox before payment and sends the shopper's choice as the bind `marketingOptIn`. ALWAYS PRESENT (in the schema `required` set); `false` unless the tenant turned it on."
          },
          "marketingOptInCopy": {
            "type": "string",
            "description": "#996 — the label to render beside the opt-in checkbox when `marketingOptInEnabled` is true: the tenant-configured copy, else a safe default. Plain text (no URL). `null` when the opt-in is disabled (no checkbox). ALWAYS PRESENT (nullable).",
            "nullable": true
          },
          "handoff": {
            "$ref": "#/components/schemas/SubscriptionCheckoutHandoffDto"
          },
          "token": {
            "type": "string",
            "description": "Fresh opaque shared checkout token. Only its hash is retained; safe idempotent replays mint a new resume token."
          }
        },
        "required": [
          "purchaseMode",
          "status",
          "isBinding",
          "contextType",
          "booking",
          "subscription",
          "refundInitiated",
          "currency",
          "lines",
          "packages",
          "selections",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "totalInCents",
          "amountDueNowInCents",
          "remainingBalanceInCents",
          "requiresFreeConfirmation",
          "customer",
          "shippingAddress",
          "availableShippingOptions",
          "discountSnapshot",
          "orderReference",
          "orderNumber",
          "orderConfirmationEmail",
          "returnToStoreUrl",
          "postCheckoutRedirectUrl",
          "checkoutRetryUrl",
          "checkoutCancelUrl",
          "accountUrl",
          "accountSignInUrl",
          "marketingOptInEnabled",
          "marketingOptInCopy",
          "handoff",
          "token"
        ]
      },
      "BookingGroupPaymentSessionResponseDto": {
        "type": "object",
        "properties": {
          "group": {
            "$ref": "#/components/schemas/PublicBookingGroupResponseDto"
          },
          "payment": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentSessionResponseDto"
              }
            ]
          }
        },
        "required": [
          "group",
          "payment"
        ]
      },
      "OrderPaymentReceiptDto": {
        "type": "object",
        "properties": {
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "example": 2800
          },
          "currency": {
            "type": "string",
            "pattern": "^[a-z]{3}$",
            "example": "usd"
          },
          "succeededAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "amountInCents",
          "currency",
          "succeededAt"
        ]
      },
      "OrderShippingMethodDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Frozen customer-facing exact-method or delivery-promise name (e.g. \"UPS Ground\" or \"Standard\")."
          },
          "priceInCents": {
            "type": "number",
            "description": "The rate's own price in minor units (cents). The amount actually charged on the order is `shippingInCents` — `0` when a FREE_SHIPPING rule waived it (`freeShipping` is then true while this keeps the rate sticker)."
          },
          "freeShipping": {
            "type": "boolean",
            "description": "True when a FREE_SHIPPING coupon/auto-discount/bundle waived the charge: the method is still recorded but `shippingInCents` is `0`."
          },
          "presentationMode": {
            "type": "string",
            "enum": [
              "exact_services",
              "delivery_promises"
            ],
            "description": "#2000 — frozen checkout presentation mode. Absent on legacy orders."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Frozen customer promise description, when configured."
          },
          "deliveryEstimate": {
            "nullable": true,
            "description": "Absolute customer delivery bounds frozen at checkout bind.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutDeliveryEstimateDto"
              }
            ]
          },
          "estimatedDelivery": {
            "type": "string",
            "description": "#3515 — the human-facing delivery-estimate text committed at checkout bind (e.g. \"2-3 business days\"), from the live carrier quote or the flat rate’s configured estimate. A checkout-time estimate, never a live carrier prediction. Omitted from this customer projection when valid structured `deliveryEstimate` bounds take precedence, even if the internal snapshot also retains the original text; otherwise absent when checkout showed none."
          }
        },
        "required": [
          "name",
          "priceInCents",
          "freeShipping"
        ]
      },
      "OrderShipmentCarrierProgressDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "WEBHOOK",
              "POLL"
            ]
          },
          "statusCode": {
            "type": "string",
            "description": "Bounded carrier status code, not provider free text. AC means accepted, not necessarily physically picked up."
          },
          "statusDetailCode": {
            "type": "string",
            "nullable": true,
            "description": "Bounded detail code, or null when the observation had no detail."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Carrier observation time. This is not the ETA freshness time."
          }
        },
        "required": [
          "source",
          "statusCode",
          "statusDetailCode",
          "observedAt"
        ]
      },
      "OrderShipmentDeliveryEstimateDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "purchased_service",
              "carrier_tracking"
            ],
            "description": "Origin of this post-checkout estimate. Purchased-service and later carrier-tracking facts remain distinct from the checkout commitment."
          },
          "estimatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When this estimate evidence was obtained, by source. For `purchased_service` it is the label-selection instant. For `carrier_tracking` (#4054) it is the tracking receipt's provider snapshot instant — the send time of a signed webhook or the fetch time of a poll — which is the freshness of the ETA, NOT the time of any carrier scan; surfaces label it \"updated from carrier tracking\"."
          },
          "deliveryDate": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "The PROVIDER's own projected delivery date (ISO yyyy-MM-dd). For `purchased_service` it is taken from label-selection evidence whose recommended carrier/service matches the service actually purchased, and is null when the provider supplied no such projection — including every exact-service, manual-rate, and uncaptured-service purchase, where the provider never projects one. For `carrier_tracking` (#4054) it is the carrier's estimated delivery date from the newest natural, evaluated tracking receipt bound to the funded label, published as the calendar date the carrier named (a date-only or midnight-UTC value is that date in every zone; a time-of-day instant is resolved in the tenant zone), and is never null on that source. This field carries provider evidence ONLY and is never populated by a platform computation; see `derivedDeliveryDate` for that. Null here therefore does not mean \"no arrival date is known\"."
          },
          "derivedDeliveryDate": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "#3645 — a tenant-local arrival date (ISO yyyy-MM-dd) the PLATFORM derived: the shipment's proven carrier-handoff timestamp advanced by the carrier's structured transit-day count. It is the carrier's own transit evidence expressed as a calendar date, not a provider prediction, and must be presented with that hedge. Null for three reasons a consumer does NOT need to tell apart: a provider projection is published in `deliveryDate` instead, the carrier supplied no structured transit days, or the shipment has no proven handoff time (label-selection time is never substituted — it precedes handoff and would promise an arrival the parcel cannot meet). At most one of these two date fields is ever non-null, so \"the best known arrival date\" is `deliveryDate ?? derivedDeliveryDate`, and which field carries it is itself the provenance. Always null for `carrier_tracking`, whose `deliveryDate` is provider evidence."
          },
          "expiresOn": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Inclusive tenant-local date through which this evidence can remain current. Null means no trustworthy expiry bound was available, so post-purchase surfaces treat the wording as historical only. This is a presentation rule, not an arrival fact, and it is computed from a different anchor than `derivedDeliveryDate` on purpose: an expiry bound may fall back to label-selection time because expiring evidence EARLY is conservative, while an arrival date may not. A shipment with no proven handoff time therefore carries a bound here and no arrival date in either date field. For `carrier_tracking` it is the projected `deliveryDate` itself: once that day has passed the carrier's projection is historical."
          },
          "estimatedDelivery": {
            "type": "string",
            "nullable": true,
            "description": "Bounded provider delivery wording, or null when only `deliveryDate` is available. Always null for `carrier_tracking`: tracking receipts never carry provider free text (DR-4054-06/-11)."
          }
        },
        "required": [
          "source",
          "estimatedAt",
          "deliveryDate",
          "derivedDeliveryDate",
          "expiresOn",
          "estimatedDelivery"
        ]
      },
      "OrderShipmentDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PLANNED",
              "READY",
              "SHIPPED",
              "DELIVERED",
              "CANCELLED"
            ],
            "example": "SHIPPED"
          },
          "carrier": {
            "type": "string",
            "nullable": true,
            "example": "UPS",
            "description": "Carrier label entered by the merchant, or null when absent."
          },
          "serviceLevel": {
            "type": "string",
            "nullable": true,
            "example": "Ground",
            "description": "Optional merchant-entered service level."
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true,
            "example": "1Z999AA10123456784",
            "description": "Carrier tracking number, or null when absent."
          },
          "trackingUrl": {
            "type": "string",
            "nullable": true,
            "example": "https://www.ups.com/track?tracknum=1Z999AA10123456784",
            "description": "Carrier tracking URL, or null when not supplied."
          },
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the shipment left the merchant/carrier, or null."
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the shipment was delivered, or null."
          },
          "deliverySource": {
            "type": "string",
            "nullable": true,
            "description": "#4049 - how this delivery was established. Open-ended catalog: see x-extensible-enum for the known stable values and treat any unrecognized value as neither merchant- nor carrier-confirmed. MERCHANT_CONFIRMED means the seller asserted receipt; it is NOT carrier confirmation. CARRIER_CONFIRMED means a verified carrier delivery event established receipt (#4054). Null means no provenance was established, which is also not carrier confirmation. The merchant's internal reason and the acting user are deliberately absent from this customer-facing projection.",
            "x-extensible-enum": [
              "MERCHANT_CONFIRMED",
              "CARRIER_CONFIRMED"
            ]
          },
          "carrierProgress": {
            "nullable": true,
            "description": "On order detail and public/customer detail reads, current status only when a retained natural WEBHOOK/POLL receipt was APPLIED to the exact funded outbound label with a proven package binding and still matches this shipment's permanent current-status stamp. Null there means no observation, purged evidence, unknown or synthetic source, conflict, skipped evidence, an unproven package binding, or a superseded label; it does not mean the carrier has never reported. Merchant list and mutation responses do not compute this field and return null.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderShipmentCarrierProgressDto"
              }
            ]
          },
          "carrierConfirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Actual carrier-confirmed delivery time from a verified, applied natural observation, retained on this exact shipment even after receipt retention. Null when the carrier has not established delivery; a merchant-confirmed delivery remains a separate deliveredAt/deliverySource fact."
          },
          "deliveryEstimate": {
            "nullable": true,
            "description": "#3515 — latest post-checkout estimate attached to this shipment. Public order status and customer account reads show only a current date from an eligible natural carrier tracking receipt bound to the current purchased label; null means no such carrier date qualifies, even if a purchased-service estimate exists. Merchant reads may fall back to a qualified purchased-service estimate and may retain an expired carrier date as historical evidence; null there means neither source qualifies. The checkout estimate remains separate on shippingMethod.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderShipmentDeliveryEstimateDto"
              }
            ]
          }
        },
        "required": [
          "status",
          "carrier",
          "serviceLevel",
          "trackingNumber",
          "trackingUrl",
          "shippedAt",
          "deliveredAt",
          "deliverySource",
          "carrierProgress",
          "carrierConfirmedAt",
          "deliveryEstimate"
        ]
      },
      "OrderStatusItemDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Trail Tent 2P"
          },
          "productName": {
            "type": "string",
            "nullable": true,
            "example": "Deodorant",
            "description": "#3972 (UAT F08) — the PRODUCT half of `name`, or `null` when the frozen line name was not segmented. `name` remains the authoritative frozen purchase identity and is unchanged; this field and `variantName` are an additive, lossless view of it — they are non-null TOGETHER or not at all, and when present `productName + \" — \" + variantName` reconstructs `name` exactly. So a non-null value here is always a real product half, never a whole combined name. `null` means render `name` as a single line: a line whose `name` was NOT written by a shared-pricing writer (the legacy public quote route stores a caller-supplied label, which proves nothing about product/variant structure), an item-level line with no variant, a product OR variant renamed or deleted since purchase, or a catalog name that itself contains the \" — \" separator. The server never splits on a hyphen and never parses the stored value: it requires a proven pricing origin, then segments only when BOTH current catalog names are separator-free AND rebuild the stored string exactly, which makes the decomposition unique and therefore the historical one. No frozen product/variant halves are persisted, so any line outside that provable shape reports null rather than a guessed boundary."
          },
          "variantName": {
            "type": "string",
            "nullable": true,
            "example": "Unscented",
            "description": "#3972 (UAT F08) — the VARIANT half of `name`, exactly as the catalog stores it (never trimmed, so the two halves rejoin losslessly). `null` whenever `productName` is `null`; the two are always resolved together."
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "example": "https://cdn.example.com/items/trail-tent.jpg",
            "description": "Catalog thumbnail URL snapshotted on the order line at confirmation (#982). `null` when the item had no image — render a placeholder. A public catalog asset URL: no PII and no database id, consistent with this projection's status-safe whitelist."
          },
          "quantity": {
            "type": "number",
            "example": 2
          },
          "unitPriceInCents": {
            "type": "number",
            "example": 14900
          },
          "totalPriceInCents": {
            "type": "number",
            "example": 29800
          },
          "isPackageComponent": {
            "type": "boolean",
            "description": "True when this compatibility row is represented inside packages[].components."
          }
        },
        "required": [
          "name",
          "productName",
          "variantName",
          "imageUrl",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents",
          "isPackageComponent"
        ]
      },
      "OrderStatusResponseDto": {
        "type": "object",
        "properties": {
          "statusLinkExpiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Expiry of this exact read-only order-status link, not account access."
          },
          "paymentReceipt": {
            "nullable": true,
            "description": "Exact successful payment amount, currency and time. No card details, processor identifiers or billing data. Null when the immutable payment snapshot is unavailable; order status is never used to infer payment.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderPaymentReceiptDto"
              }
            ]
          },
          "orderReference": {
            "type": "string",
            "nullable": true,
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$",
            "description": "Stable public order address. `null` only for a legacy status token whose Order is awaiting the measured reference backfill. This value is a locator, never an authentication credential."
          },
          "orderNumber": {
            "type": "string",
            "example": "ACME-2026-042"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders with no such snapshot.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "example": 0,
            "description": "Shipping charged on the order in minor units (#854) — `0` when the order needed no shipping or a FREE_SHIPPING rule waived it. Already folded into `totalInCents`; exposed here so the status page can itemize it instead of hiding it in the total. Carries no PII."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The immutable exact selection or delivery promise captured on `Order.shippingMethod` at confirmation (#1769/#2415). For orders confirmed before that snapshot was introduced, the original frozen checkout selection is returned when the Order snapshot is absent. `null` when the authoritative source has no valid recorded snapshot. Carries only customer-safe frozen presentation data — no `rateId`, original quote, actual shipment, address, other PII, or database ids — so it is safe on this forwardable token surface.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderShippingMethodDto"
              }
            ]
          },
          "shipments": {
            "description": "#1562 — customer-safe handed-off and delivered shipment history. PLANNED and READY preparation is excluded; tracking fields may be null when the carrier supplied no tracking. Carries no raw database ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          },
          "shipmentDeliveryComplete": {
            "type": "boolean",
            "description": "True only when at least one non-cancelled fulfillment exists and every non-cancelled fulfillment is DELIVERED. This server-derived flag includes PLANNED and READY fulfillments intentionally omitted from `shipments`; an empty or all-delivered visible array alone cannot establish completion."
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "createdAt": {
            "type": "string",
            "example": "2026-06-09T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-09T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderStatusItemDto"
            }
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "returnToStoreUrl": {
            "type": "string",
            "nullable": true,
            "example": "https://shop.example.com",
            "description": "#1116 — the resolved safe return-to-store destination for the hosted order-status surface. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists."
          },
          "customerActionRedirectUrl": {
            "type": "string",
            "nullable": true,
            "example": "https://shop.example.com/order/oabc123abc123abc123abc123a/status",
            "description": "#1656 — the equivalent order-status URL on the tenant's current trusted BYO customer-action origin. Populated only when `checkoutSettings.customerActionBaseUrl` resolves through the shared trusted-origin gate to a BYO origin distinct from this tenant's hosted cartonium checkout origin. `null` for blank, invalid, untrusted, hosted, or self-looping configuration, so hosted cartonium checkout renders normally. Carries only the existing opaque order-status token; no PII or database ids."
          }
        },
        "required": [
          "statusLinkExpiresAt",
          "paymentReceipt",
          "orderReference",
          "orderNumber",
          "status",
          "fulfillmentStatus",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "shippingMethod",
          "shipments",
          "shipmentDeliveryComplete",
          "totalInCents",
          "createdAt",
          "updatedAt",
          "items",
          "packages",
          "returnToStoreUrl",
          "customerActionRedirectUrl"
        ]
      },
      "OrderConfirmationByReferenceDto": {
        "type": "object",
        "properties": {
          "paymentReceipt": {
            "nullable": true,
            "description": "Exact successful payment amount, currency and time. No card details, processor identifiers or billing data. Null when the immutable payment snapshot is unavailable; order status is never used to infer payment.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderPaymentReceiptDto"
              }
            ]
          },
          "orderNumber": {
            "type": "string",
            "example": "ACME-2026-042"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders with no such snapshot.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "example": 0,
            "description": "Shipping charged on the order in minor units (#854) — `0` when the order needed no shipping or a FREE_SHIPPING rule waived it. Already folded into `totalInCents`; exposed here so the status page can itemize it instead of hiding it in the total. Carries no PII."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The immutable exact selection or delivery promise captured on `Order.shippingMethod` at confirmation (#1769/#2415). For orders confirmed before that snapshot was introduced, the original frozen checkout selection is returned when the Order snapshot is absent. `null` when the authoritative source has no valid recorded snapshot. Carries only customer-safe frozen presentation data — no `rateId`, original quote, actual shipment, address, other PII, or database ids — so it is safe on this forwardable token surface.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderShippingMethodDto"
              }
            ]
          },
          "shipments": {
            "description": "#1562 — customer-safe handed-off and delivered shipment history. PLANNED and READY preparation is excluded; tracking fields may be null when the carrier supplied no tracking. Carries no raw database ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          },
          "shipmentDeliveryComplete": {
            "type": "boolean",
            "description": "True only when at least one non-cancelled fulfillment exists and every non-cancelled fulfillment is DELIVERED. This server-derived flag includes PLANNED and READY fulfillments intentionally omitted from `shipments`; an empty or all-delivered visible array alone cannot establish completion."
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "createdAt": {
            "type": "string",
            "example": "2026-06-09T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-09T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderStatusItemDto"
            }
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "returnToStoreUrl": {
            "type": "string",
            "nullable": true,
            "example": "https://shop.example.com",
            "description": "#1116 — the resolved safe return-to-store destination for the hosted order-status surface. Prefers trusted `checkoutSettings.returnToStoreUrl`; when blank or untrusted, falls back to the tenant storefront origin, then the operator neutral fallback. `null` only when no safe destination exists."
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$",
            "description": "The exact active Order reference resolved for this confirmation. This by-reference route is unavailable until the Order has one."
          }
        },
        "required": [
          "paymentReceipt",
          "orderNumber",
          "status",
          "fulfillmentStatus",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "shippingMethod",
          "shipments",
          "shipmentDeliveryComplete",
          "totalInCents",
          "createdAt",
          "updatedAt",
          "items",
          "packages",
          "returnToStoreUrl",
          "orderReference"
        ]
      },
      "OrderAddressSnapshotDto": {
        "type": "object",
        "properties": {
          "company": {
            "type": "string",
            "description": "Company or organization name captured for this destination.",
            "example": "litecommerce QA"
          },
          "line1": {
            "type": "string",
            "example": "500 W Main St"
          },
          "line2": {
            "type": "string",
            "example": "Suite 200"
          },
          "city": {
            "type": "string",
            "example": "Boise"
          },
          "state": {
            "type": "string",
            "description": "State, province, region, or other first-level subdivision.",
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "description": "Postal code captured verbatim, including formats such as ZIP+4 or international spaces.",
            "example": "83702-5920"
          },
          "zip": {
            "type": "string",
            "deprecated": true,
            "description": "Legacy/import compatibility key. New checkout snapshots use `postalCode`.",
            "example": "83702"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code captured at checkout.",
            "example": "US"
          }
        }
      },
      "PublicOrderLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ordered variant, or `null` for item-level lines."
          },
          "name": {
            "type": "string",
            "description": "Display name snapshotted on the line at order time.",
            "example": "Trail Tent 2P"
          },
          "quantity": {
            "type": "number",
            "example": 2
          },
          "unitPriceInCents": {
            "type": "number",
            "example": 14900
          },
          "totalPriceInCents": {
            "type": "number",
            "example": 29800
          },
          "isPackageComponent": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "itemId",
          "variantId",
          "name",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents",
          "isPackageComponent"
        ]
      },
      "PublicOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true,
            "description": "Legacy persistence identifier retained during the measured compatibility window. New consumers use orderReference."
          },
          "orderReference": {
            "type": "string",
            "nullable": true,
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$",
            "description": "Stable public order address. `null` only for a legacy row awaiting the measured reference backfill. Possession does not authenticate or authorize access."
          },
          "orderNumber": {
            "type": "string",
            "description": "Human-facing, tenant-scoped order number.",
            "example": "ACME-2026-042"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          },
          "customerName": {
            "type": "string",
            "description": "Buyer name captured at checkout (the confirmation greeting)."
          },
          "customerEmail": {
            "type": "string",
            "description": "Buyer email captured at checkout. Doubles as the shared-secret match for the by-number read and the account/returns flow.",
            "format": "email"
          },
          "shippingAddress": {
            "nullable": true,
            "description": "The order's immutable shipping address snapshot. `null` when the order had no shipping address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "billingAddress": {
            "nullable": true,
            "description": "The order's immutable billing address snapshot. `null` when the order had no billing address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0,
            "description": "Total discount applied, in minor units (the scalar only — the rule-attribution `discountSnapshot` is merchant-internal)."
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicOrderLineDto"
            }
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          }
        },
        "required": [
          "id",
          "orderReference",
          "orderNumber",
          "status",
          "fulfillmentStatus",
          "customerName",
          "customerEmail",
          "shippingAddress",
          "billingAddress",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "createdAt",
          "updatedAt",
          "items",
          "packages"
        ]
      },
      "CreateOrderItemDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Catalog variant selection. Omit or send `null` for the item-level selection. For SALE items, item-level selection is accepted only when the catalog item has no live or archived variants; otherwise supply a live variant ID. RENTAL and SERVICE items may remain item-level because they do not reserve stock."
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999,
            "description": "Quantity on this submitted raw row. Across all rows with the same `(itemId, variantId)` selection, the combined quantity must not exceed 999 units; omitted and `null` variantId values both identify the item-level selection."
          }
        },
        "required": [
          "itemId",
          "name",
          "quantity"
        ],
        "additionalProperties": false
      },
      "CreateOrderDto": {
        "type": "object",
        "properties": {
          "customerName": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string"
          },
          "customerPhone": {
            "type": "string",
            "nullable": true
          },
          "items": {
            "minItems": 1,
            "maxItems": 100,
            "description": "The submitted quote rows before duplicate selections are grouped. A request accepts at most 100 raw rows.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateOrderItemDto"
            }
          },
          "bookingId": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "customerName",
          "customerEmail",
          "items"
        ],
        "additionalProperties": false
      },
      "MerchantOrderCustomerPromiseDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "exact_service",
              "delivery_promise"
            ]
          },
          "tierId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "chargeInCents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "pricingPolicy": {
            "type": "string",
            "enum": [
              "carrier_cost"
            ]
          },
          "roundingRule": {
            "type": "string",
            "enum": [
              "integer_minor_units"
            ]
          },
          "displayStyle": {
            "type": "string",
            "enum": [
              "ship_by",
              "delivery_window",
              "both"
            ]
          },
          "shipByDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "deliveryStartDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "deliveryEndDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "settingsRevision": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "ruleRevision": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "kind",
          "tierId",
          "name",
          "description",
          "chargeInCents",
          "currency",
          "pricingPolicy",
          "roundingRule",
          "displayStyle",
          "shipByDate",
          "deliveryStartDate",
          "deliveryEndDate",
          "timezone",
          "settingsRevision",
          "ruleRevision"
        ]
      },
      "MerchantOrderQuoteAddressInputDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "addressLine1": {
            "type": "string"
          },
          "addressLine2": {
            "type": "string"
          },
          "cityLocality": {
            "type": "string"
          },
          "stateProvince": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "countryCode": {
            "type": "string",
            "example": "US"
          }
        },
        "required": [
          "name",
          "addressLine1",
          "cityLocality",
          "stateProvince",
          "postalCode",
          "countryCode"
        ]
      },
      "MerchantOrderQuotePackageDimensionsDto": {
        "type": "object",
        "properties": {
          "length": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "width": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "height": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "unit": {
            "type": "string",
            "enum": [
              "inch",
              "centimeter"
            ]
          }
        },
        "required": [
          "length",
          "width",
          "height",
          "unit"
        ]
      },
      "MerchantOrderQuotePackageInputDto": {
        "type": "object",
        "properties": {
          "weightValue": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "weightUnit": {
            "type": "string",
            "enum": [
              "pound",
              "ounce",
              "gram",
              "kilogram"
            ]
          },
          "dimensions": {
            "$ref": "#/components/schemas/MerchantOrderQuotePackageDimensionsDto"
          },
          "packageCode": {
            "type": "string"
          }
        },
        "required": [
          "weightValue",
          "weightUnit"
        ]
      },
      "MerchantOrderQuoteRatingInputsDto": {
        "type": "object",
        "properties": {
          "shipFrom": {
            "$ref": "#/components/schemas/MerchantOrderQuoteAddressInputDto"
          },
          "shipTo": {
            "$ref": "#/components/schemas/MerchantOrderQuoteAddressInputDto"
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderQuotePackageInputDto"
            }
          },
          "carrierIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "serviceCodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "validateAddress": {
            "type": "string",
            "enum": [
              "no_validation",
              "validate_only",
              "validate_and_clean"
            ]
          }
        },
        "required": [
          "shipFrom",
          "shipTo",
          "packages",
          "carrierIds",
          "validateAddress"
        ]
      },
      "MerchantOrderQuoteCostComponentDto": {
        "type": "object",
        "properties": {
          "sourceAmount": {
            "type": "number",
            "minimum": 0,
            "description": "Provider-authored amount in major currency units."
          },
          "amountInMinorUnits": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "sourceAmount",
          "amountInMinorUnits"
        ]
      },
      "MerchantOrderQuoteCostComponentsDto": {
        "type": "object",
        "properties": {
          "shipping": {
            "$ref": "#/components/schemas/MerchantOrderQuoteCostComponentDto"
          },
          "insurance": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderQuoteCostComponentDto"
              }
            ]
          },
          "confirmation": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderQuoteCostComponentDto"
              }
            ]
          },
          "other": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderQuoteCostComponentDto"
              }
            ]
          }
        },
        "required": [
          "shipping",
          "insurance",
          "confirmation",
          "other"
        ]
      },
      "MerchantOrderQuoteCostEvidenceDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "sourceUnit": {
            "type": "string",
            "enum": [
              "major_currency_units"
            ]
          },
          "minorUnitExponent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "roundingRule": {
            "type": "string",
            "enum": [
              "round_half_up_each_component"
            ]
          },
          "components": {
            "$ref": "#/components/schemas/MerchantOrderQuoteCostComponentsDto"
          },
          "totalSourceAmount": {
            "type": "number",
            "minimum": 0
          },
          "totalInMinorUnits": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "currency",
          "sourceUnit",
          "minorUnitExponent",
          "roundingRule",
          "components",
          "totalSourceAmount",
          "totalInMinorUnits"
        ]
      },
      "MerchantOrderOriginalQuoteDto": {
        "type": "object",
        "properties": {
          "rateId": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "serviceCode": {
            "type": "string"
          },
          "carrierId": {
            "type": "string"
          },
          "carrierName": {
            "type": "string"
          },
          "priceInCents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "transitMinDays": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "transitMaxDays": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "estimatedDelivery": {
            "type": "string",
            "nullable": true
          },
          "quotedAt": {
            "type": "string",
            "format": "date-time"
          },
          "zoneId": {
            "type": "string",
            "format": "uuid"
          },
          "settingsRevision": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "ruleRevision": {
            "type": "string",
            "format": "date-time"
          },
          "ratingInputs": {
            "description": "#2000 / ADR-023 — normalized, secret-free request facts needed to reproduce the original carrier quote after settings change.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderQuoteRatingInputsDto"
              }
            ]
          },
          "costEvidence": {
            "description": "#2000 / ADR-023 — immutable provider component values plus the minor-unit conversion and rounding applied at quote time.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderQuoteCostEvidenceDto"
              }
            ]
          }
        },
        "required": [
          "rateId",
          "serviceName",
          "serviceCode",
          "carrierId",
          "carrierName",
          "priceInCents",
          "currency",
          "transitMinDays",
          "transitMaxDays",
          "estimatedDelivery",
          "quotedAt",
          "zoneId",
          "settingsRevision",
          "ruleRevision",
          "ratingInputs",
          "costEvidence"
        ]
      },
      "MerchantOrderShippingMethodDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Customer-facing method/rate name (e.g. \"Standard\")."
          },
          "priceInCents": {
            "type": "number",
            "description": "The rate's own price in minor units (cents). The amount actually charged on the order is `shippingInCents` — `0` when a FREE_SHIPPING rule waived it (`freeShipping` is then true while this keeps the rate sticker)."
          },
          "freeShipping": {
            "type": "boolean",
            "description": "True when a FREE_SHIPPING coupon/auto-discount/bundle waived the charge: the method is still recorded but `shippingInCents` is `0`."
          },
          "serviceCode": {
            "type": "string",
            "description": "Live provider rates only — the carrier's stable service code the customer bought (e.g. `ups_ground`). Absent for merchant-defined flat rates and when the live quote was no longer joinable at confirmation."
          },
          "carrierId": {
            "type": "string",
            "description": "Live provider rates only — the provider's carrier id the service was quoted on. Absent for flat rates."
          },
          "estimatedDelivery": {
            "type": "string",
            "description": "Relative delivery wording recorded at checkout for a live provider service or configured/free method. A configured/free method can carry this text alongside `deliveryEstimate`. When both are present, prefer the validated absolute estimate; use this wording only when it is absent. Absent when no text was recorded. This is not a later carrier tracking prediction."
          },
          "deliveryEstimate": {
            "description": "Validated absolute platform estimate frozen at checkout for configured/free methods, with display style, ship-by date, and inclusive arrival bounds. When present, prefer it over `estimatedDelivery` for purchase guidance. Absent when no valid frozen estimate exists; it does not represent later carrier tracking.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutDeliveryEstimateDto"
              }
            ]
          },
          "presentationMode": {
            "type": "string",
            "enum": [
              "exact_services",
              "delivery_promises"
            ],
            "description": "#2000 — checkout presentation mode frozen on this order."
          },
          "promiseFallback": {
            "type": "boolean",
            "description": "#3266 — `true` when checkout was in `delivery_promises` mode but produced no promise, so the customer was offered — and bought — an ordinary live carrier service as a fallback. Absent otherwise. Fulfil against the carrier service named here: there is no matched delivery promise on this order, and the customer was never shown one. `promiseFallbackReason` carries the frozen cause. Merchant-facing only; the customer-facing order-status and checkout-session projections deliberately omit it."
          },
          "promiseFallbackReason": {
            "type": "string",
            "enum": [
              "no_tier_matched",
              "structured_dates_unavailable"
            ],
            "description": "#3266 — why the fallback fired, frozen at checkout. `no_tier_matched`: the enabled zone promise tiers were evaluated against this quote and none qualified. `structured_dates_unavailable`: promise evaluation never ran, because the store had no structured delivery estimates (or no timezone) at quote time — so no tier-match claim is made. Present only alongside `promiseFallback`; may be absent on a fallback order whose cause was not recorded."
          },
          "customerPromise": {
            "description": "#2000 — immutable customer-facing selection/promise, charge, and absolute delivery bounds. Kept separate from provider quote/purchase.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderCustomerPromiseDto"
              }
            ]
          },
          "originalQuote": {
            "description": "#2000 — immutable original provider quote anchor and rule revisions. The actual purchased label service remains on shipping-label evidence.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderOriginalQuoteDto"
              }
            ]
          }
        },
        "required": [
          "name",
          "priceInCents",
          "freeShipping"
        ]
      },
      "MerchantOrderShippingLabelDto": {
        "type": "object",
        "properties": {
          "labelId": {
            "type": "string",
            "description": "The provider's label id — the void handle (#1803)."
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true,
            "description": "Carrier tracking number, or null (needs-tracking) when absent."
          },
          "labelDownloadUrl": {
            "type": "string",
            "nullable": true,
            "description": "Direct URL to the printable PDF label, or null."
          },
          "shipmentCostInCents": {
            "type": "number",
            "nullable": true,
            "description": "Charged label cost in integer cents, or null."
          },
          "shipmentCostCurrency": {
            "type": "string",
            "nullable": true,
            "minLength": 3,
            "maxLength": 3,
            "description": "Validated lowercase ISO-4217 currency for the charged label cost, or null for legacy rows without monetary evidence.",
            "example": "usd"
          },
          "carrierName": {
            "type": "string",
            "nullable": true,
            "description": "Friendly carrier name the label was bought against."
          },
          "serviceCode": {
            "type": "string",
            "nullable": true,
            "description": "Service code the label was bought against."
          },
          "serviceDecisionClassification": {
            "type": "string",
            "enum": [
              "ORIGINAL_SERVICE",
              "SAME_OR_FASTER",
              "MEETS_PROMISE",
              "OVERRIDE"
            ],
            "nullable": true,
            "description": "Bounded classification of the merchant carrier-service decision, or null for legacy labels."
          },
          "serviceDecisionReason": {
            "type": "string",
            "nullable": true,
            "description": "Merchant justification for a non-recommended service, or null for original/recommended decisions and legacy labels."
          },
          "serviceDecisionActorUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Snapshot of the merchant user who confirmed the service decision, or null for legacy labels."
          },
          "serviceDecisionAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the carrier-service decision was durably claimed, or null for legacy labels."
          },
          "testLabel": {
            "type": "boolean",
            "description": "True for a non-chargeable sandbox test label."
          },
          "needsTracking": {
            "type": "boolean",
            "description": "True when the label carries no tracking number: recorded + voidable, but the order was not stamped shipped and no email was sent."
          }
        },
        "required": [
          "labelId",
          "trackingNumber",
          "labelDownloadUrl",
          "shipmentCostInCents",
          "shipmentCostCurrency",
          "carrierName",
          "serviceCode",
          "serviceDecisionClassification",
          "serviceDecisionReason",
          "serviceDecisionActorUserId",
          "serviceDecisionAt",
          "testLabel",
          "needsTracking"
        ]
      },
      "MerchantOrderShippingLabelFailureDto": {
        "type": "object",
        "properties": {
          "purchaseId": {
            "type": "string",
            "format": "uuid"
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "outcome": {
            "type": "string",
            "enum": [
              "NO_LABEL_CREATED",
              "UNKNOWN"
            ],
            "description": "`NO_LABEL_CREATED` is safe to retry after correction; `UNKNOWN` must be reconciled with ShipEngine before another purchase."
          },
          "retryAllowed": {
            "type": "boolean",
            "description": "True only when the provider authoritatively rejected the request before creating a label."
          },
          "message": {
            "type": "string",
            "description": "Sanitized, actionable provider failure message."
          },
          "httpStatus": {
            "type": "number",
            "nullable": true
          },
          "providerErrorType": {
            "type": "string",
            "nullable": true
          },
          "providerErrorCode": {
            "type": "string",
            "nullable": true
          },
          "providerErrorSource": {
            "type": "string",
            "nullable": true
          },
          "fieldName": {
            "type": "string",
            "nullable": true,
            "description": "Provider field path that needs correction, when supplied. The field value is never retained."
          },
          "requestId": {
            "type": "string",
            "nullable": true,
            "description": "ShipEngine request/correlation id safe to share with support."
          }
        },
        "required": [
          "purchaseId",
          "shipmentPackageId",
          "outcome",
          "retryAllowed",
          "message",
          "httpStatus",
          "providerErrorType",
          "providerErrorCode",
          "providerErrorSource",
          "fieldName",
          "requestId"
        ]
      },
      "ParcelMeasurementSource": {
        "type": "string",
        "enum": [
          "ITEM",
          "VARIANT"
        ],
        "description": "Catalog row that supplied the snapshotted line weight."
      },
      "MerchantOrderLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "commercePricingRef": {
            "type": "string",
            "nullable": true,
            "description": "Stable reference into the order pricing snapshot. Null on ordinary/legacy lines."
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ordered variant, or `null` for item-level lines."
          },
          "name": {
            "type": "string",
            "description": "Display name snapshotted on the line at order time.",
            "example": "Trail Tent 2P"
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "description": "Image URL snapshotted at order time. `null` when none."
          },
          "quantity": {
            "type": "number",
            "example": 2
          },
          "unitPriceInCents": {
            "type": "number",
            "example": 14900
          },
          "totalPriceInCents": {
            "type": "number",
            "example": 29800
          },
          "reservedInventoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Inventory row this line reserved against, or `null` if unreserved."
          },
          "reservedQuantity": {
            "type": "number",
            "example": 0,
            "description": "Quantity held against the reserved inventory row."
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Snapshotted shippable weight, in `weightUnit`. `null` when none."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true
          },
          "width": {
            "type": "number",
            "nullable": true
          },
          "height": {
            "type": "number",
            "nullable": true
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "description": "Resolved item/variant orientation policy frozen on confirmation; old lines are canonical-only.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "weightMeasurementSource": {
            "nullable": true,
            "description": "Catalog row that supplied the snapshotted line weight.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ParcelMeasurementSource"
              }
            ]
          },
          "weightMeasurementReviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dimensionMeasurementSource": {
            "nullable": true,
            "description": "Catalog row that supplied the snapshotted line dimensions.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ParcelMeasurementSource"
              }
            ]
          },
          "dimensionMeasurementReviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "orderId",
          "commercePricingRef",
          "itemId",
          "variantId",
          "name",
          "imageUrl",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents",
          "reservedInventoryId",
          "reservedQuantity",
          "weight",
          "weightUnit",
          "length",
          "width",
          "height",
          "dimensionUnit",
          "orientationPolicy",
          "weightMeasurementSource",
          "weightMeasurementReviewedAt",
          "dimensionMeasurementSource",
          "dimensionMeasurementReviewedAt"
        ]
      },
      "MerchantOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "commerceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Canonical Sales ORDER record linked through CommerceRecord.orderId, or `null` for a legacy-only checkout order. Merchant-only routing field; omitted from public/customer order projections."
          },
          "hasCancelledShipmentHistory": {
            "type": "boolean",
            "description": "Whether this order has any cancelled shipment history. Merchant-only workflow guard; cancelled shipment details remain omitted."
          },
          "orderNumber": {
            "type": "string",
            "description": "Human-facing, tenant-scoped order number.",
            "example": "ACME-2026-042"
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Linked customer account, or `null` for guest orders."
          },
          "customerName": {
            "type": "string",
            "description": "Buyer name captured at checkout."
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "description": "Buyer email captured at checkout."
          },
          "customerPhone": {
            "type": "string",
            "nullable": true,
            "description": "Buyer phone, or `null` when not collected."
          },
          "shippingAddress": {
            "nullable": true,
            "description": "The immutable order-time shipping address snapshot. `null` when the order had no shipping address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "billingAddress": {
            "nullable": true,
            "description": "The immutable order-time billing address snapshot. `null` when the order had no billing address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0,
            "description": "Total discount applied, in minor units."
          },
          "discountSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Merchant-internal discount rule-attribution snapshot (free-form JSON). `null` when no discount was applied."
          },
          "commercePricingSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen shared-pricing snapshot for a composed order. Merchant-only; null on ordinary and legacy orders."
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Merchant-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "example": 0,
            "description": "Shipping charged, in minor units."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "#1769 — the customer's chosen shipping method, snapshotted onto the order at checkout confirmation. `null` for orders without a method (digital-only checkouts, merchant-created orders) AND for orders confirmed before the snapshot existed — legacy orders are not back-projected from their checkout session.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingMethodDto"
              }
            ]
          },
          "shippingLabel": {
            "nullable": true,
            "description": "#1771 — the native ShipEngine label bought for this order (reprint/void summary), or `null` when none has been purchased.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingLabelDto"
              }
            ]
          },
          "shippingLabelFailure": {
            "nullable": true,
            "description": "#1961 — safe diagnostics for the last rejected or ambiguous native label attempt, or `null` when no action is needed.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingLabelFailureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          },
          "bookingId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Originating booking, or `null` for non-booking orders."
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Exact successful payment attempt that confirmed this order."
          },
          "stripePaymentIntentId": {
            "type": "string",
            "nullable": true,
            "description": "Stripe PaymentIntent id, or `null` before payment."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Connected account the charge ran on, or `null`."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-side notes scratchpad, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderLineDto"
            }
          },
          "shipments": {
            "description": "#1562 — merchant/Admin shipment rows projected from active `commerce_fulfillments`. May include PLANNED and READY preparation as well as SHIPPED/DELIVERED physical history; internal row ids and line allocations are omitted. Customer token/account reads use a separate public projection limited to handed-off or delivered history.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "commerceRecordId",
          "hasCancelledShipmentHistory",
          "orderNumber",
          "userId",
          "customerName",
          "customerEmail",
          "customerPhone",
          "shippingAddress",
          "billingAddress",
          "subtotalInCents",
          "discountInCents",
          "discountSnapshot",
          "commercePricingSnapshot",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "shippingMethod",
          "shippingLabel",
          "shippingLabelFailure",
          "totalInCents",
          "status",
          "fulfillmentStatus",
          "bookingId",
          "paymentAttemptId",
          "stripePaymentIntentId",
          "stripeAccountId",
          "notes",
          "createdAt",
          "updatedAt",
          "items",
          "shipments"
        ]
      },
      "MerchantOrderListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor — pass back as `?cursor=` for the next page. `null` when there are no more orders."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "OrderCancellationOperationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "WAITING_FOR_LABEL_VOID",
              "RECONCILIATION_REQUIRED",
              "FINALIZING",
              "COMPLETED",
              "DENIED_OR_INELIGIBLE"
            ]
          },
          "fulfillmentCount": {
            "type": "number",
            "example": 2
          },
          "paidLabelCount": {
            "type": "number",
            "example": 1
          },
          "problemCode": {
            "type": "string",
            "nullable": true
          },
          "requestedAt": {
            "format": "date-time",
            "type": "string"
          },
          "reconciliationRequiredAt": {
            "format": "date-time",
            "type": "string",
            "nullable": true
          },
          "completedAt": {
            "format": "date-time",
            "type": "string",
            "nullable": true
          },
          "deniedAt": {
            "format": "date-time",
            "type": "string",
            "nullable": true
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "fulfillmentCount",
          "paidLabelCount",
          "problemCode",
          "requestedAt",
          "reconciliationRequiredAt",
          "completedAt",
          "deniedAt",
          "updatedAt"
        ]
      },
      "MerchantOrderShippingDestinationAddressDto": {
        "type": "object",
        "properties": {
          "recipientName": {
            "type": "string"
          },
          "recipientPhone": {
            "type": "string",
            "nullable": true
          },
          "company": {
            "type": "string",
            "nullable": true
          },
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "example": "US"
          }
        },
        "required": [
          "recipientName",
          "recipientPhone",
          "company",
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "MerchantOrderShippingDestinationCorrectionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string"
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "destination": {
            "$ref": "#/components/schemas/MerchantOrderShippingDestinationAddressDto"
          }
        },
        "required": [
          "id",
          "revision",
          "reason",
          "actorUserId",
          "createdAt",
          "destination"
        ]
      },
      "MerchantOrderShippingDestinationDto": {
        "type": "object",
        "properties": {
          "capturedAtCheckout": {
            "nullable": true,
            "description": "Immutable destination captured at checkout. Null when the stored checkout capture lacks a non-blank country, address line, city, state, or postal code.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingDestinationAddressDto"
              }
            ]
          },
          "effectiveForFulfillment": {
            "nullable": true,
            "description": "Destination currently used by fulfillment: the latest correction when one exists, otherwise the normalized checkout capture. Null only when no correction exists and the checkout capture cannot produce a complete destination.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingDestinationAddressDto"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "eligible": {
            "type": "boolean"
          },
          "ineligibleReason": {
            "type": "string",
            "enum": [
              "NO_SHIPPING_DESTINATION",
              "VERIFIED_CUSTOMER_REQUIRED",
              "CUSTOMER_IDENTITY_RETIRED",
              "ORDER_CANCELLED",
              "ORDER_CANCELLATION_IN_PROGRESS",
              "FULFILLMENT_ALREADY_PREPARED"
            ],
            "nullable": true,
            "description": "Why a destination correction is unavailable. Null exactly when eligible is true."
          },
          "corrections": {
            "description": "Append-only correction history ordered newest revision first. An empty array means no destination correction has been recorded.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderShippingDestinationCorrectionDto"
            }
          }
        },
        "required": [
          "capturedAtCheckout",
          "effectiveForFulfillment",
          "revision",
          "eligible",
          "ineligibleReason",
          "corrections"
        ]
      },
      "OrderPaymentDisplayDto": {
        "type": "object",
        "properties": {
          "brand": {
            "type": "string",
            "example": "visa",
            "description": "Card brand captured from the exact successful provider Charge."
          },
          "last4": {
            "type": "string",
            "example": "4242",
            "pattern": "^[0-9]{4}$",
            "description": "Last four card digits captured from the exact successful provider Charge."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "example": 1100,
            "description": "Amount charged by the exact successful payment attempt, in minor currency units; this is not inferred from the Order total."
          },
          "currency": {
            "type": "string",
            "example": "usd",
            "pattern": "^[a-z]{3}$",
            "minLength": 3,
            "maxLength": 3,
            "description": "Lowercase ISO-4217 currency of the exact successful payment attempt."
          },
          "succeededAt": {
            "type": "string",
            "format": "date-time",
            "example": "2026-08-30T05:59:58.000Z",
            "description": "Successful PaymentIntent Event instant frozen at confirmation, not the PaymentIntent or Order insert time."
          }
        },
        "required": [
          "brand",
          "last4",
          "amountInCents",
          "currency",
          "succeededAt"
        ]
      },
      "MerchantOrderCorrelationDto": {
        "type": "object",
        "properties": {
          "eligibility": {
            "type": "string",
            "enum": [
              "ineligible",
              "eligible"
            ],
            "description": "Which correlation arm this order is on. `ineligible`: the order is deterministically outside the correlation population (see `reason`). `eligible`: exactly one durable correlation aggregate governs it (see `status`)."
          },
          "reason": {
            "type": "string",
            "enum": [
              "NON_CHECKOUT_SOURCE",
              "SUBSCRIPTION_CHECKOUT",
              "BOOKING_ORIGIN",
              "NO_CHARGE_REQUIRED",
              "NO_PAYMENT_LINEAGE"
            ],
            "nullable": true,
            "description": "Bounded exclusion reason. Present exactly when `eligibility` is `ineligible`; `null` on the eligible arm."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "available",
              "needs_support"
            ],
            "nullable": true,
            "description": "Aggregate state. Present exactly when `eligibility` is `eligible`; `null` on the ineligible arm. `pending`: the provider annotation has not yet been proved (first work and every automatic retry). `available`: a provider read proved the final order description and structured order-number metadata. `needs_support`: terminal contradiction or bounded retry exhaustion — resolved through operator support, never a merchant retry. The order and its payment are complete and unaffected in every state."
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string",
            "nullable": true,
            "description": "Last aggregate transition time. Present exactly when `eligibility` is `eligible`; `null` on the ineligible arm."
          },
          "supportCode": {
            "type": "string",
            "nullable": true,
            "description": "Fixed, secret-free support code for `needs_support` (never a raw provider error). `null` unless the eligible aggregate carries one."
          }
        },
        "required": [
          "eligibility",
          "reason",
          "status",
          "updatedAt",
          "supportCode"
        ]
      },
      "MerchantOrderDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "commerceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Canonical Sales ORDER record linked through CommerceRecord.orderId, or `null` for a legacy-only checkout order. Merchant-only routing field; omitted from public/customer order projections."
          },
          "hasCancelledShipmentHistory": {
            "type": "boolean",
            "description": "Whether this order has any cancelled shipment history. Merchant-only workflow guard; cancelled shipment details remain omitted."
          },
          "orderNumber": {
            "type": "string",
            "description": "Human-facing, tenant-scoped order number.",
            "example": "ACME-2026-042"
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Linked customer account, or `null` for guest orders."
          },
          "customerName": {
            "type": "string",
            "description": "Buyer name captured at checkout."
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "description": "Buyer email captured at checkout."
          },
          "customerPhone": {
            "type": "string",
            "nullable": true,
            "description": "Buyer phone, or `null` when not collected."
          },
          "shippingAddress": {
            "nullable": true,
            "description": "The immutable order-time shipping address snapshot. `null` when the order had no shipping address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "billingAddress": {
            "nullable": true,
            "description": "The immutable order-time billing address snapshot. `null` when the order had no billing address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0,
            "description": "Total discount applied, in minor units."
          },
          "discountSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Merchant-internal discount rule-attribution snapshot (free-form JSON). `null` when no discount was applied."
          },
          "commercePricingSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen shared-pricing snapshot for a composed order. Merchant-only; null on ordinary and legacy orders."
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Merchant-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "example": 0,
            "description": "Shipping charged, in minor units."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "#1769 — the customer's chosen shipping method, snapshotted onto the order at checkout confirmation. `null` for orders without a method (digital-only checkouts, merchant-created orders) AND for orders confirmed before the snapshot existed — legacy orders are not back-projected from their checkout session.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingMethodDto"
              }
            ]
          },
          "shippingLabel": {
            "nullable": true,
            "description": "#1771 — the native ShipEngine label bought for this order (reprint/void summary), or `null` when none has been purchased.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingLabelDto"
              }
            ]
          },
          "shippingLabelFailure": {
            "nullable": true,
            "description": "#1961 — safe diagnostics for the last rejected or ambiguous native label attempt, or `null` when no action is needed.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingLabelFailureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          },
          "bookingId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Originating booking, or `null` for non-booking orders."
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Exact successful payment attempt that confirmed this order."
          },
          "stripePaymentIntentId": {
            "type": "string",
            "nullable": true,
            "description": "Stripe PaymentIntent id, or `null` before payment."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Connected account the charge ran on, or `null`."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-side notes scratchpad, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderLineDto"
            }
          },
          "shipments": {
            "description": "#1562 — merchant/Admin shipment rows projected from active `commerce_fulfillments`. May include PLANNED and READY preparation as well as SHIPPED/DELIVERED physical history; internal row ids and line allocations are omitted. Customer token/account reads use a separate public projection limited to handed-off or delivered history.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived state of the checkout order confirmation email. Contains no recipient, provider id, policy code, or raw outbox error. #4079 retry facts appear on detail reads only; omitted from mutation responses. Legacy state is preserved, while missing structural capture reports retry availability UNAVAILABLE. Other order emails have independent outcomes in GET /merchant/orders/:id/email-history.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "orderCancellation": {
            "nullable": true,
            "description": "#1934 — latest durable whole-order cancellation state. Reload-safe and merchant-safe; provider evidence, request hashes, and actor ids remain private.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderCancellationOperationDto"
              }
            ]
          },
          "shippingDestination": {
            "description": "#4203 — immutable checkout capture, current fulfillment-effective destination, and append-only correction history.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingDestinationDto"
              }
            ]
          },
          "paymentDisplay": {
            "nullable": true,
            "description": "Immutable display-safe facts from the exact successful card Charge. `null` for free orders, paid orders predating snapshot capture, or while a paid order's exact provider display evidence is temporarily unavailable and bounded repair remains pending; it does not mean the order is unpaid. Detail-only: list and mutation responses deliberately omit it.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderPaymentDisplayDto"
              }
            ]
          },
          "correlation": {
            "nullable": true,
            "description": "E28 #3602 — order-number correlation with the payment provider. `null` has exactly one meaning: the order predates correlation activation (the durable activation boundary), so no correlation contract ever applied to it — never \"unknown\" and never a transient state. Post-activation orders always carry an object: `ineligible` with a bounded reason, or `eligible` with the three-state status. Present only on the detail inspection reads — list envelopes, mutation responses (which embed `MerchantOrderMutationDetailDto`), and every public/customer surface omit it.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderCorrelationDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "commerceRecordId",
          "hasCancelledShipmentHistory",
          "orderNumber",
          "userId",
          "customerName",
          "customerEmail",
          "customerPhone",
          "shippingAddress",
          "billingAddress",
          "subtotalInCents",
          "discountInCents",
          "discountSnapshot",
          "commercePricingSnapshot",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "shippingMethod",
          "shippingLabel",
          "shippingLabelFailure",
          "totalInCents",
          "status",
          "fulfillmentStatus",
          "bookingId",
          "paymentAttemptId",
          "stripePaymentIntentId",
          "stripeAccountId",
          "notes",
          "createdAt",
          "updatedAt",
          "items",
          "shipments",
          "orderConfirmationEmail",
          "orderCancellation",
          "shippingDestination",
          "paymentDisplay",
          "correlation"
        ]
      },
      "OrderShippingDestinationInputDto": {
        "type": "object",
        "properties": {
          "recipientName": {
            "type": "string",
            "maxLength": 200,
            "example": "Alex Smith"
          },
          "recipientPhone": {
            "type": "string",
            "maxLength": 50,
            "nullable": true
          },
          "company": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "line1": {
            "type": "string",
            "maxLength": 300
          },
          "line2": {
            "type": "string",
            "maxLength": 300,
            "nullable": true
          },
          "city": {
            "type": "string",
            "maxLength": 200
          },
          "state": {
            "type": "string",
            "maxLength": 100,
            "example": "NV"
          },
          "postalCode": {
            "type": "string",
            "maxLength": 20,
            "example": "89501"
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "example": "US"
          }
        },
        "required": [
          "recipientName",
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "CorrectOrderShippingDestinationDto": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "Current correction revision observed by the caller. Zero means the captured checkout destination is still effective."
          },
          "reason": {
            "type": "string",
            "maxLength": 1000
          },
          "destination": {
            "$ref": "#/components/schemas/OrderShippingDestinationInputDto"
          }
        },
        "required": [
          "expectedRevision",
          "reason",
          "destination"
        ]
      },
      "UpdateOrderStatusDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "description": "Target order status. Must be a legal next state from the order's current status. Ordinary state machine: PENDING → CONFIRMED → PROCESSING → COMPLETED. CANCELLED must use the dedicated Owner/Admin whole-order cancellation command."
          }
        },
        "required": [
          "status"
        ]
      },
      "UpdateOrderNotesDto": {
        "type": "object",
        "properties": {
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 4000,
            "description": "Merchant-side scratchpad. Pass `null` explicitly to clear the existing note. The key MUST be present in the request body."
          }
        },
        "required": [
          "notes"
        ]
      },
      "UpdateOrderFulfillmentStatusDto": {
        "type": "object",
        "properties": {
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "description": "Retired aggregate target retained for wire compatibility. Existing orders return 409 LINE_FULFILLMENT_REQUIRED; use explicit Sales line and quantity fulfillment commands."
          }
        },
        "required": [
          "fulfillmentStatus"
        ]
      },
      "UpdateOrderShipmentTrackingDto": {
        "type": "object",
        "properties": {
          "notify": {
            "type": "boolean",
            "description": "Required for wire compatibility. This edit cannot originate a shipment notification: existing SEND/SUPPRESS evidence remains immutable, while a pre-evidence historical row derives SEND only from an existing shipNotifiedAt anchor and otherwise catches up as SUPPRESS."
          },
          "carrier": {
            "type": "string",
            "example": "UPS",
            "maxLength": 80,
            "description": "Carrier label shown to the customer. Must match the immutable actual carrier when this fulfillment or order has purchased outbound-label evidence."
          },
          "trackingNumber": {
            "type": "string",
            "example": "1Z999AA10123456784",
            "maxLength": 120,
            "description": "Carrier tracking number shown to the customer."
          },
          "serviceLevel": {
            "type": "string",
            "example": "Ground",
            "maxLength": 80,
            "nullable": true,
            "description": "Optional service level shown with the carrier. Omission preserves the purchased-label value; attached and legacy order-scoped purchased labels cannot be rewritten here."
          },
          "trackingUrl": {
            "type": "string",
            "example": "https://www.ups.com/track?tracknum=1Z999AA10123456784",
            "maxLength": 500,
            "nullable": true,
            "description": "Optional http(s) carrier tracking URL."
          },
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the package shipped. Omitted edits preserve the existing value. A historical row without this evidence must supply the known non-null handoff time; cannot clear a recorded timestamp."
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the package was delivered. When supplied, the shipment status becomes DELIVERED. Explicit null is accepted only while unset and cannot clear a recorded timestamp."
          }
        },
        "required": [
          "notify",
          "carrier",
          "trackingNumber"
        ]
      },
      "CancelOrderDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          }
        },
        "required": [
          "reason"
        ]
      },
      "MerchantOrderMutationDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "commerceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Canonical Sales ORDER record linked through CommerceRecord.orderId, or `null` for a legacy-only checkout order. Merchant-only routing field; omitted from public/customer order projections."
          },
          "hasCancelledShipmentHistory": {
            "type": "boolean",
            "description": "Whether this order has any cancelled shipment history. Merchant-only workflow guard; cancelled shipment details remain omitted."
          },
          "orderNumber": {
            "type": "string",
            "description": "Human-facing, tenant-scoped order number.",
            "example": "ACME-2026-042"
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Linked customer account, or `null` for guest orders."
          },
          "customerName": {
            "type": "string",
            "description": "Buyer name captured at checkout."
          },
          "customerEmail": {
            "type": "string",
            "format": "email",
            "description": "Buyer email captured at checkout."
          },
          "customerPhone": {
            "type": "string",
            "nullable": true,
            "description": "Buyer phone, or `null` when not collected."
          },
          "shippingAddress": {
            "nullable": true,
            "description": "The immutable order-time shipping address snapshot. `null` when the order had no shipping address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "billingAddress": {
            "nullable": true,
            "description": "The immutable order-time billing address snapshot. `null` when the order had no billing address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0,
            "description": "Total discount applied, in minor units."
          },
          "discountSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Merchant-internal discount rule-attribution snapshot (free-form JSON). `null` when no discount was applied."
          },
          "commercePricingSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen shared-pricing snapshot for a composed order. Merchant-only; null on ordinary and legacy orders."
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Merchant-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "shippingInCents": {
            "type": "number",
            "example": 0,
            "description": "Shipping charged, in minor units."
          },
          "shippingMethod": {
            "nullable": true,
            "description": "#1769 — the customer's chosen shipping method, snapshotted onto the order at checkout confirmation. `null` for orders without a method (digital-only checkouts, merchant-created orders) AND for orders confirmed before the snapshot existed — legacy orders are not back-projected from their checkout session.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingMethodDto"
              }
            ]
          },
          "shippingLabel": {
            "nullable": true,
            "description": "#1771 — the native ShipEngine label bought for this order (reprint/void summary), or `null` when none has been purchased.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingLabelDto"
              }
            ]
          },
          "shippingLabelFailure": {
            "nullable": true,
            "description": "#1961 — safe diagnostics for the last rejected or ambiguous native label attempt, or `null` when no action is needed.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantOrderShippingLabelFailureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          },
          "bookingId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Originating booking, or `null` for non-booking orders."
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Exact successful payment attempt that confirmed this order."
          },
          "stripePaymentIntentId": {
            "type": "string",
            "nullable": true,
            "description": "Stripe PaymentIntent id, or `null` before payment."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Connected account the charge ran on, or `null`."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-side notes scratchpad, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderLineDto"
            }
          },
          "shipments": {
            "description": "#1562 — merchant/Admin shipment rows projected from active `commerce_fulfillments`. May include PLANNED and READY preparation as well as SHIPPED/DELIVERED physical history; internal row ids and line allocations are omitted. Customer token/account reads use a separate public projection limited to handed-off or delivered history.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          },
          "orderConfirmationEmail": {
            "description": "#1965 — server-derived state of the checkout order confirmation email. Contains no recipient, provider id, policy code, or raw outbox error. #4079 retry facts appear on detail reads only; omitted from mutation responses. Legacy state is preserved, while missing structural capture reports retry availability UNAVAILABLE. Other order emails have independent outcomes in GET /merchant/orders/:id/email-history.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommunicationStatusDto"
              }
            ]
          },
          "orderCancellation": {
            "nullable": true,
            "description": "#1934 — latest durable whole-order cancellation state. Reload-safe and merchant-safe; provider evidence, request hashes, and actor ids remain private.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderCancellationOperationDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "commerceRecordId",
          "hasCancelledShipmentHistory",
          "orderNumber",
          "userId",
          "customerName",
          "customerEmail",
          "customerPhone",
          "shippingAddress",
          "billingAddress",
          "subtotalInCents",
          "discountInCents",
          "discountSnapshot",
          "commercePricingSnapshot",
          "taxInCents",
          "taxDisclosure",
          "shippingInCents",
          "shippingMethod",
          "shippingLabel",
          "shippingLabelFailure",
          "totalInCents",
          "status",
          "fulfillmentStatus",
          "bookingId",
          "paymentAttemptId",
          "stripePaymentIntentId",
          "stripeAccountId",
          "notes",
          "createdAt",
          "updatedAt",
          "items",
          "shipments",
          "orderConfirmationEmail",
          "orderCancellation"
        ]
      },
      "CancelOrderResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "CANCELLED",
              "CANCELLATION_PENDING",
              "CANCELLATION_RECONCILIATION_REQUIRED",
              "CANCELLATION_DENIED"
            ]
          },
          "replayed": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "operation": {
            "$ref": "#/components/schemas/OrderCancellationOperationDto"
          },
          "order": {
            "$ref": "#/components/schemas/MerchantOrderMutationDetailDto"
          }
        },
        "required": [
          "outcome",
          "replayed",
          "message",
          "operation",
          "order"
        ]
      },
      "CreateSetupIntentResponseDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string",
            "description": "Authenticated customer who owns this setup. Compare with the rendered account before presenting payer details."
          },
          "paymentAttemptId": {
            "type": "string",
            "description": "Internal setup PaymentAttempt id."
          },
          "setupHandle": {
            "type": "string",
            "description": "Opaque setup correlation handle for authenticated account routes and redirects."
          },
          "setupIntentId": {
            "type": "string",
            "description": "Stripe SetupIntent id.",
            "example": "seti_123"
          },
          "clientSecret": {
            "type": "string",
            "description": "Stripe SetupIntent client secret for the Payment Element. Returned once; never persisted."
          },
          "status": {
            "type": "string",
            "description": "Raw Stripe SetupIntent status.",
            "example": "requires_payment_method"
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "#932 — the tenant's connected Stripe account (`acct_…`) the SetupIntent was created on. The client MUST initialize Stripe.js with this account so the Payment Element saves the card on the connected account. null on the platform account (test/sandbox).",
            "example": "acct_123"
          }
        },
        "required": [
          "customerId",
          "paymentAttemptId",
          "setupHandle",
          "setupIntentId",
          "clientSecret",
          "status",
          "stripeAccountId"
        ]
      },
      "AccountCardBillingAddressDto": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "example": "US",
            "maxLength": 2
          },
          "line1": {
            "type": "string",
            "example": "123 Main St",
            "maxLength": 300
          },
          "line2": {
            "type": "string",
            "maxLength": 300
          },
          "city": {
            "type": "string",
            "example": "Boise",
            "maxLength": 200
          },
          "region": {
            "type": "string",
            "example": "ID",
            "maxLength": 200
          },
          "postalCode": {
            "type": "string",
            "example": "83702",
            "maxLength": 32
          }
        },
        "required": [
          "country",
          "line1",
          "city",
          "region",
          "postalCode"
        ],
        "additionalProperties": false
      },
      "ReviewAccountCardSetupDto": {
        "type": "object",
        "properties": {
          "setupIntentId": {
            "type": "string",
            "example": "seti_123"
          },
          "billingName": {
            "type": "string",
            "maxLength": 200
          },
          "billingPhone": {
            "type": "string",
            "maxLength": 32
          },
          "billingAddress": {
            "$ref": "#/components/schemas/AccountCardBillingAddressDto"
          },
          "saveAddress": {
            "type": "boolean",
            "description": "Separate, affirmative address-book choice."
          },
          "makeDefaultBilling": {
            "type": "boolean",
            "description": "Only allowed when saveAddress is true."
          },
          "addressLabel": {
            "type": "string",
            "description": "Optional address-book label.",
            "maxLength": 100
          }
        },
        "required": [
          "setupIntentId",
          "billingName",
          "billingAddress",
          "saveAddress",
          "makeDefaultBilling"
        ],
        "additionalProperties": false
      },
      "AccountCardSetupResultDto": {
        "type": "object",
        "properties": {
          "setupHandle": {
            "type": "string",
            "description": "Opaque handle paired with this exact setup."
          },
          "setupIntentId": {
            "type": "string"
          },
          "setupStatus": {
            "type": "string",
            "enum": [
              "requires_payment_method",
              "pending",
              "succeeded",
              "failed",
              "unknown"
            ],
            "description": "Exact server result. requires_payment_method reports the provider state; it is not setup success or consent replay authority."
          },
          "cardProjection": {
            "type": "string",
            "enum": [
              "saved",
              "pending",
              "unknown"
            ]
          },
          "addressSave": {
            "type": "string",
            "enum": [
              "not_requested",
              "pending_setup",
              "not_saved",
              "ready",
              "saved",
              "unknown"
            ],
            "description": "not_requested: no address-save choice was registered. pending_setup: the reviewed choice awaits exact setup success. not_saved: setup failed, so the address cannot be saved. ready: exact setup succeeded and the review is still valid; a one-shot address-save request additionally requires the same authenticated customer/session, organization, frozen connected account and matching reviewed snapshot. ready is not proof of an address write or authority to recover or replay consent. saved: the address write was confirmed. unknown: consent expired or the write was claimed, is in flight or could not be confirmed; review saved addresses and do not blindly repeat the address-save POST."
          },
          "defaultBilling": {
            "type": "string",
            "enum": [
              "not_requested",
              "pending_setup",
              "not_saved",
              "ready",
              "saved",
              "unknown"
            ],
            "description": "Reports the separate explicit makeDefaultBilling choice within the same address-save operation. not_requested: no default choice was registered. pending_setup: awaiting exact setup success. not_saved: setup failed. ready: the still-valid review may make the new address default only through the matching one-shot address-save request; no default change has been confirmed and consent cannot be recovered or replayed. saved: the address write with its default choice was confirmed. unknown: the choice expired or the write was claimed, is in flight or could not be confirmed; review saved addresses and do not blindly repeat the address-save POST. This outcome does not change the default card or shipping address."
          }
        },
        "required": [
          "setupHandle",
          "setupIntentId",
          "setupStatus",
          "cardProjection",
          "addressSave",
          "defaultBilling"
        ]
      },
      "CustomerReturnLineRequestDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Order-item handle from the customer order detail response."
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "description": "Quantity to return."
          }
        },
        "required": [
          "orderItemId",
          "quantity"
        ]
      },
      "CustomerReturnEstimateRequestDto": {
        "type": "object",
        "properties": {
          "items": {
            "maxItems": 50,
            "description": "Exact selected lines. Duplicate item handles are aggregated. An empty array means no selection; it does not mean a zero refund.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnLineRequestDto"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CustomerReturnEstimateBreakdownDto": {
        "type": "object",
        "properties": {
          "itemTotalInCents": {
            "type": "number",
            "description": "Selected original historical item value before allocated discount."
          },
          "discountInCents": {
            "type": "number",
            "description": "Allocated historical discount deducted from item value: the allocation checkout froze into the selected units."
          },
          "taxInCents": {
            "type": "number",
            "description": "Historical attributed tax before remaining-capacity reduction."
          },
          "capacityReductionInCents": {
            "type": "number",
            "description": "Deduction for frozen component, source-payment or Order refund capacity. May include reserved or in-flight money; a reduction does not by itself prove pending money or an issued refund or a tax/fee withholding policy. Items minus discount plus tax minus this deduction equals the estimated total."
          }
        },
        "required": [
          "itemTotalInCents",
          "discountInCents",
          "taxInCents",
          "capacityReductionInCents"
        ]
      },
      "CustomerReturnPaidFactsDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Original purchase facts, independent of the selected refund estimate. UNAVAILABLE means exact historical source/identity/quantity/currency could not be proved; it is never zero."
          },
          "basis": {
            "type": "string",
            "enum": [
              "ORIGINAL_LINE"
            ],
            "description": "Amounts cover the entire original durable line and its original quantities below, not the selected or remaining units. A partial-unit paid amount is not supplied or prorated."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "description": "Original historical ISO currency; null when paid facts are unavailable. Independent of estimate currency."
          },
          "originalCommercialQuantity": {
            "type": "number",
            "nullable": true,
            "description": "Original commercial pricing quantity. Null when unavailable; may differ from physical units."
          },
          "originalPhysicalQuantity": {
            "type": "number",
            "nullable": true,
            "description": "Original physical quantity covered by these whole-line amounts. Null when unavailable; never the currently eligible quantity."
          },
          "grossInCents": {
            "type": "number",
            "nullable": true,
            "description": "Frozen original-line pretax gross in minor units. Null when unavailable; not refund-resolver gross already net of discounts."
          },
          "discountInCents": {
            "type": "number",
            "nullable": true,
            "description": "Frozen discount applied to the original line in minor units, including any recorded order/group promotion share. Null when unavailable; never newly divided or reconstructed from an Order total on read."
          },
          "netInCents": {
            "type": "number",
            "nullable": true,
            "description": "Whole-line pretax net paid: gross minus own discount. Null when unavailable. Genuine zero remains zero."
          },
          "taxInCents": {
            "type": "number",
            "nullable": true,
            "description": "Exact frozen original-line tax supported by retained provider per-line evidence. Null when that evidence is unavailable or the source retains only aggregate tax; does not invalidate the other paid facts."
          }
        },
        "required": [
          "availability",
          "basis",
          "currency",
          "originalCommercialQuantity",
          "originalPhysicalQuantity",
          "grossInCents",
          "discountInCents",
          "netInCents",
          "taxInCents"
        ]
      },
      "CustomerReturnEstimateLineDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "The owned order-item handle supplied in the selection."
          },
          "quantity": {
            "type": "number",
            "description": "Normalized selected quantity; duplicate inputs are summed."
          },
          "eligibleQuantity": {
            "type": "number",
            "nullable": true,
            "description": "Current physical eligible quantity. Null means the handoff evidence is not established; never substitute ordered commercial quantity. A value does not reserve units or replace locked submit validation."
          },
          "paidFacts": {
            "description": "Independent original-line purchase context, even when the selection estimate is unavailable. Unavailable paid facts do not make an otherwise supported estimate unavailable.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPaidFactsDto"
              }
            ]
          }
        },
        "required": [
          "orderItemId",
          "quantity",
          "eligibleQuantity",
          "paidFacts"
        ]
      },
      "CustomerReturnEstimateResponseDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NO_SELECTION",
              "AVAILABLE",
              "UNAVAILABLE",
              "SELECTION_CHANGED"
            ],
            "description": "AVAILABLE includes independently proven zero; UNAVAILABLE is never a known-lines subtotal. SELECTION_CHANGED requires correcting the selection against current eligible quantities before review. No state grants approval."
          },
          "reason": {
            "type": "string",
            "enum": [
              "ZERO_REFUNDABLE_CAPACITY",
              "REFUND_CAPACITY_REDUCED",
              "RETURN_NOT_AVAILABLE",
              "ELIGIBILITY_CHANGED",
              "ELIGIBILITY_UNAVAILABLE",
              "HISTORICAL_MONEY_UNAVAILABLE",
              "HISTORICAL_CURRENCY_UNAVAILABLE",
              "UNSUPPORTED_QUANTITY_MAPPING"
            ],
            "nullable": true,
            "description": "Customer-safe availability explanation code. Null only for an ordinary available estimate or no selection. No internal/provider reconciliation details."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "description": "Coherent historical sale currency. Null when no selection or historical denomination is missing/ambiguous. Never use current store settings as a fallback."
          },
          "amountInCents": {
            "type": "number",
            "nullable": true,
            "description": "Server estimate in currency minor units. Null for no selection, unavailable money or changed eligibility. Zero only with complete independent evidence. Does not reserve money or promise merchant approval."
          },
          "breakdown": {
            "nullable": true,
            "description": "Historical itemized basis reconciling to amountInCents. Null when no estimate is available, or when zero capacity is proven but the physical/commercial mapping cannot establish an itemized positive-value basis. Never fabricate rows.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnEstimateBreakdownDto"
              }
            ]
          },
          "shipping": {
            "type": "string",
            "enum": [
              "NOT_INCLUDED"
            ],
            "description": "Shipping is not included in this return estimate."
          },
          "items": {
            "description": "Exact normalized selection with fresh physical eligibility. Empty only for NO_SELECTION, never a claim that all Order lines are unavailable.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnEstimateLineDto"
            }
          }
        },
        "required": [
          "state",
          "reason",
          "currency",
          "amountInCents",
          "breakdown",
          "shipping",
          "items"
        ]
      },
      "CustomerOrderItemDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Order-item handle used when starting a return. Scoped to this order/customer surface."
          },
          "name": {
            "type": "string",
            "example": "Trail Tent 2P"
          },
          "productName": {
            "type": "string",
            "nullable": true,
            "example": "Deodorant",
            "description": "#3972 (UAT F08) — the PRODUCT half of `name`, or `null` when the frozen line name was not segmented. `name` remains the authoritative frozen purchase identity and is unchanged; this field and `variantName` are an additive, lossless view of it — they are non-null TOGETHER or not at all, and when present `productName + \" — \" + variantName` reconstructs `name` exactly. So a non-null value here is always a real product half, never a whole combined name. `null` means render `name` as a single line: a line whose `name` was NOT written by a shared-pricing writer (the legacy public quote route stores a caller-supplied label, which proves nothing about product/variant structure), an item-level line with no variant, a product OR variant renamed or deleted since purchase, or a catalog name that itself contains the \" — \" separator. The server never splits on a hyphen and never parses the stored value: it requires a proven pricing origin, then segments only when BOTH current catalog names are separator-free AND rebuild the stored string exactly, which makes the decomposition unique and therefore the historical one. No frozen product/variant halves are persisted, so any line outside that provable shape reports null rather than a guessed boundary."
          },
          "variantName": {
            "type": "string",
            "nullable": true,
            "example": "Unscented",
            "description": "#3972 (UAT F08) — the VARIANT half of `name`, exactly as the catalog stores it (never trimmed, so the two halves rejoin losslessly). `null` whenever `productName` is `null`; the two are always resolved together."
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "example": "https://cdn.example.com/items/trail-tent.jpg",
            "description": "Catalog thumbnail URL snapshotted on the order line at confirmation (#982). `null` when the item had no image — render a placeholder."
          },
          "quantity": {
            "type": "number",
            "example": 2
          },
          "unitPriceInCents": {
            "type": "number",
            "description": "Per-unit price in minor units (cents).",
            "example": 12999
          },
          "totalPriceInCents": {
            "type": "number",
            "description": "Line total in minor units (cents).",
            "example": 25998
          },
          "isPackageComponent": {
            "type": "boolean"
          },
          "returnEligibleQuantity": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Units of this line that could still be claimed on a new return when this page was read (#3973 F17): handed-off quantity minus the quantity already claimed by active returns. `0` means the line is exhausted or was never handed off; `null` means eligibility could not be established from the fulfillment ledger and this value must not be used to gate anything. A snapshot, never an authorization: the create endpoint re-evaluates the same rule under a row lock and remains the only authority, so a concurrent or stale client is still rejected."
          }
        },
        "required": [
          "orderItemId",
          "name",
          "productName",
          "variantName",
          "imageUrl",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents",
          "isPackageComponent",
          "returnEligibleQuantity"
        ]
      },
      "CustomerOrderTimeContactDto": {
        "type": "object",
        "properties": {
          "recipientName": {
            "type": "string",
            "nullable": true,
            "description": "Delivery recipient captured when the order was placed. The current Order contract freezes the same checkout name for recipient and contact roles; it is never read from the current profile or saved addresses. `null` when a legacy order has no non-blank captured name.",
            "example": "Alice Buyer"
          },
          "contactName": {
            "type": "string",
            "nullable": true,
            "description": "Checkout contact name captured when the order was placed. `null` when a legacy order has no non-blank captured name. Never replaced by the current customer profile or saved-address recipient.",
            "example": "Alice Buyer"
          },
          "contactEmail": {
            "type": "string",
            "format": "email",
            "nullable": true,
            "description": "Contact email captured when the order was placed. `null` when a legacy order has no non-blank captured email. Never replaced by the current customer profile email.",
            "example": "alice@example.com"
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "Delivery/contact phone captured when the order was placed. `null` when no phone was recorded. Never derived from the current customer profile or saved addresses.",
            "example": "+1 555 010 1234"
          }
        },
        "required": [
          "recipientName",
          "contactName",
          "contactEmail",
          "phone"
        ]
      },
      "CustomerOrderByReferenceDto": {
        "type": "object",
        "properties": {
          "orderNumber": {
            "type": "string",
            "description": "Human-readable public order number. Authenticated order-number routes remain supported alongside the stable order reference.",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "description": "Order lifecycle status.",
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "description": "Fulfillment status.",
            "example": "UNFULFILLED"
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Subtotal in minor units (cents).",
            "example": 25998
          },
          "discountInCents": {
            "type": "number",
            "description": "Discount applied in minor units (cents).",
            "example": 0
          },
          "taxInCents": {
            "type": "number",
            "description": "Tax in minor units (cents).",
            "example": 1560
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number",
            "description": "Grand total in minor units (cents).",
            "example": 27558
          },
          "createdAt": {
            "type": "string",
            "description": "When the order was placed (ISO 8601).",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerOrderItemDto"
            }
          },
          "paymentDisplay": {
            "nullable": true,
            "description": "Immutable display-safe facts from the exact successful card Charge. `null` for free orders, paid orders predating snapshot capture, or while a paid order's exact provider display evidence is temporarily unavailable and bounded repair remains pending. It does not mean the order is unpaid. Available only on authenticated detail reads.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderPaymentDisplayDto"
              }
            ]
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charged on the order in minor units (#854) — `0` when none applied. Already included in `totalInCents`; surfaced so the detail view can itemize the shipping line.",
            "example": 0
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The immutable exact selection or delivery promise captured on `Order.shippingMethod` at confirmation (#1769/#2415). For orders confirmed before that snapshot was introduced, the original frozen checkout selection is returned when the Order snapshot is absent. `null` when the authoritative source has no valid recorded snapshot; original-quote and actual-shipment facts are never substituted.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderShippingMethodDto"
              }
            ]
          },
          "shipments": {
            "description": "#1562 — customer-safe handed-off and delivered shipment history. PLANNED and READY preparation is excluded; tracking fields may be null when the carrier supplied no tracking. Carries no raw order or fulfillment ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          },
          "orderTimeContact": {
            "description": "Immutable order-time recipient/contact facts. The object is always present; nullable members preserve missing legacy values honestly. Available only after authenticated tenant/customer ownership checks.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerOrderTimeContactDto"
              }
            ]
          },
          "shipmentDeliveryComplete": {
            "type": "boolean",
            "description": "True only when at least one non-cancelled fulfillment exists and every non-cancelled fulfillment is DELIVERED. This server-derived flag includes PLANNED and READY fulfillments intentionally omitted from `shipments`; an empty or all-delivered visible array alone cannot establish completion."
          },
          "shippingAddress": {
            "description": "Shipping address captured at checkout (JSON snapshot), or null.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Billing address captured at checkout (JSON snapshot), or null.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "description": "The exact active Order reference resolved for this owned-order read.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          }
        },
        "required": [
          "orderNumber",
          "status",
          "fulfillmentStatus",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "totalInCents",
          "createdAt",
          "items",
          "paymentDisplay",
          "packages",
          "shippingInCents",
          "shippingMethod",
          "shipments",
          "orderTimeContact",
          "shipmentDeliveryComplete",
          "shippingAddress",
          "billingAddress",
          "orderReference"
        ]
      },
      "CustomerReturnItemResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return-item id."
          },
          "orderItemId": {
            "type": "string",
            "description": "Order-item handle this return line came from."
          },
          "name": {
            "type": "string",
            "example": "Trail Tent 2P"
          },
          "quantity": {
            "type": "number",
            "example": 1
          },
          "condition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "example": "PENDING"
          }
        },
        "required": [
          "id",
          "orderItemId",
          "name",
          "quantity",
          "condition"
        ]
      },
      "CustomerReturnByReferenceResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "orderNumber": {
            "type": "string",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "refundAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Refund to the customer for this return, in cents. 0 until the merchant sets an amount.",
            "example": 0
          },
          "refundState": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "PROCESSING",
              "ISSUED",
              "REIMBURSEMENT_PENDING",
              "RECONCILIATION_REQUIRED",
              "REIMBURSEMENT_RECORDED",
              "RESOLVED"
            ],
            "description": "Customer-safe money state of the refund (#3964). Same derivation as the public return surface: ISSUED means the original-method refund completed; REIMBURSEMENT_PENDING means it was later reversed and the merchant still owes an alternative reimbursement; REIMBURSEMENT_RECORDED and RESOLVED mean that reimbursement is recorded."
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Amount still owed after a provider reversed an earlier successful refund; null when no such correction exists."
          },
          "refundCurrency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code the refund amounts are denominated in, taken from the persisted refund records (the refund exception, else the order's payment) rather than the organization's current setting (#3964). Null when the order has no recorded payment currency. #4007 tightened that null: it means the historical denomination is unrecoverable, NOT that the client may substitute the currency it is already displaying. A client receiving null must present the refund without denominating it. Derived by the same shared precedence as the email-gated public return surface, so the two cannot disagree."
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "description": "The exact active reference used to address this return's parent Order.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          }
        },
        "required": [
          "id",
          "orderNumber",
          "status",
          "reason",
          "refundAmountInCents",
          "refundState",
          "amountOwedInCents",
          "refundCurrency",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff",
          "orderReference"
        ]
      },
      "CustomerReturnListByReferenceResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnByReferenceResponseDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "CreateReturnItemDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Order item id this line is returning units from.",
            "minLength": 1
          },
          "quantity": {
            "type": "integer",
            "description": "How many units to return. Must be > 0 and <= the original order line's quantity minus what's already been requested on prior non-cancelled returns.",
            "minimum": 1
          }
        },
        "required": [
          "orderItemId",
          "quantity"
        ],
        "additionalProperties": false
      },
      "ReturnRequestedReviewBreakdownDto": {
        "type": "object",
        "properties": {
          "itemTotalInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "discountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "taxInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "capacityReductionInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "itemTotalInCents",
          "discountInCents",
          "taxInCents",
          "capacityReductionInCents"
        ],
        "additionalProperties": false
      },
      "ReturnRequestedReviewLineDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "The exact reviewed order-item handle.",
            "minLength": 1,
            "maxLength": 64
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Reviewed quantity within the existing Return request range. A normalized selection outside the requested-evidence storage envelope remains NOT_CAPTURED; it is never clamped or partially captured."
          }
        },
        "required": [
          "orderItemId",
          "quantity"
        ],
        "additionalProperties": false
      },
      "ReturnRequestedReviewDto": {
        "type": "object",
        "properties": {
          "items": {
            "minItems": 1,
            "maxItems": 50,
            "description": "Exact reviewed selection. Duplicate identities are normalized before comparison with the submission.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnRequestedReviewLineDto"
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Estimate state the customer deliberately reviewed for this exact submission selection. AVAILABLE requires amount, historical currency and breakdown (null only for a proven zero without itemized basis). UNAVAILABLE carries no monetary values. This acknowledges a view and supplies no calculation authority."
          },
          "amountInCents": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Reviewed estimate total in minor units; required for AVAILABLE, absent/null for UNAVAILABLE."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "pattern": "^[a-zA-Z]{3}$",
            "description": "Reviewed historical ISO currency, required for AVAILABLE; absent/null for UNAVAILABLE. Never current store currency."
          },
          "breakdown": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReturnRequestedReviewBreakdownDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Reviewed estimate components, including any capacity reduction; null for a supported unitemized zero, absent/null for UNAVAILABLE."
          }
        },
        "required": [
          "items",
          "state"
        ],
        "additionalProperties": false
      },
      "CreateReturnByReferenceDto": {
        "type": "object",
        "properties": {
          "customerName": {
            "type": "string",
            "description": "Optional display name for the requester.",
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "description": "Free-text reason for the return.",
            "maxLength": 4000
          },
          "items": {
            "description": "Lines being returned. 1-50 entries; cumulative quantity across non-cancelled returns may not exceed the original order line.",
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateReturnItemDto"
            }
          },
          "reviewedEstimate": {
            "description": "Estimate deliberately reviewed for this selection. Omission leaves requested money uncaptured (NOT_CAPTURED), never an unseen amount. Changed reviewed evidence returns 409 before creation.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRequestedReviewDto"
              }
            ]
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "PublicReturnItemResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return line id."
          },
          "orderItemId": {
            "type": "string",
            "description": "Order line this return line claims."
          },
          "quantity": {
            "type": "number",
            "example": 1
          },
          "condition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "example": "PENDING"
          }
        },
        "required": [
          "id",
          "orderItemId",
          "quantity",
          "condition"
        ]
      },
      "OrderReferenceReturnDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "refundAmountInCents": {
            "type": "number",
            "description": "Refund to the customer for this return, in cents. 0 until the merchant sets an amount.",
            "example": 0
          },
          "refundState": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "PROCESSING",
              "ISSUED",
              "REIMBURSEMENT_PENDING",
              "RECONCILIATION_REQUIRED",
              "REIMBURSEMENT_RECORDED",
              "RESOLVED"
            ]
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Amount still owed after a provider reversed an earlier successful refund; null when no such correction exists."
          },
          "refundCurrency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code that BOTH `refundAmountInCents` and `amountOwedInCents` are denominated in (#4007). Read from immutable history — the refund exception when one exists, else the persisted currency of the exact successful payment attempt that created the parent order — never from the organization's current currency setting, which can change after checkout. `null` means the historical denomination is genuinely unrecoverable for this return; it is NOT a licence to substitute a default. A client that receives `null` must not render these amounts under any assumed currency."
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "description": "The exact active reference used to address this return's parent Order.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          }
        },
        "required": [
          "id",
          "status",
          "reason",
          "refundAmountInCents",
          "refundState",
          "amountOwedInCents",
          "refundCurrency",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff",
          "orderReference"
        ]
      },
      "CustomerReturnArrivedLineDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Exact stable returned-item identity; not a new action capability."
          },
          "orderItemId": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Exact source-supported quantity, never a whole requested-row inference."
          },
          "condition": {
            "type": "string",
            "enum": [
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "description": "Recorded actual arrival condition; independent of cash readiness."
          },
          "inventoryDisposition": {
            "type": "string",
            "enum": [
              "RESTOCKED",
              "NOT_ELIGIBLE",
              "NOT_APPLICABLE"
            ],
            "description": "Original inventory result. Receipt coverage does not itself prove sellable stock credit."
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "quantity",
          "condition",
          "inventoryDisposition"
        ]
      },
      "CustomerReturnPhysicalReceiptDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Physical result version, distinct from lifecycle/publication version 3."
          },
          "returnId": {
            "type": "string"
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "committedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original immutable operation commit time; not inferred from status."
          },
          "allocations": {
            "minItems": 1,
            "description": "Exact actual captured allocations with original condition/stock results. No extra receipt is manufactured by later completion or cancellation.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnArrivedLineDto"
            }
          }
        },
        "required": [
          "version",
          "returnId",
          "approvalRevisionNumber",
          "committedAt",
          "allocations"
        ]
      },
      "CustomerReturnProtectedArrivalDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Physical result version, distinct from lifecycle/publication version 3."
          },
          "returnId": {
            "type": "string"
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "committedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original immutable operation commit time; not inferred from status."
          },
          "allocations": {
            "minItems": 1,
            "description": "Exact actual captured allocations with original condition/stock results. No extra receipt is manufactured by later completion or cancellation.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnArrivedLineDto"
            }
          },
          "arrivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Actual protected parcel arrival time as recorded, separate from financial completion and operation commit time."
          }
        },
        "required": [
          "version",
          "returnId",
          "approvalRevisionNumber",
          "committedAt",
          "allocations",
          "arrivedAt"
        ]
      },
      "CustomerReturnPhysicalLineDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Exact stable returned-item identity; not a new action capability."
          },
          "orderItemId": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Exact source-supported quantity, never a whole requested-row inference."
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "quantity"
        ]
      },
      "CustomerReturnKeepPromiseDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Immutable quantity granted at this revision. Later grants are separate lineage entries; never sum cumulative grants as additional units."
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "Revision that first granted or extended this exact keep quantity; later refusal/reduction/cancellation does not erase it."
          }
        },
        "required": [
          "orderItemId",
          "quantity",
          "approvalRevisionNumber"
        ]
      },
      "CustomerReturnPhysicalFactsDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Safe factual projection version; lifecycle/publication version 3 is a separate boundary."
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "requiredLines": {
            "description": "Exact required-back subset of the current publication. Empty means no current required-back goods, not no prior arrival. Terminal status keeps shipping closed; this list grants no shipping/document access.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnPhysicalLineDto"
            }
          },
          "keepPromises": {
            "description": "Immutable published keep lineage, including earlier grants retained after reduction/refusal/cancellation. Empty means no recorded v3 grant, never an inferred legacy waiver. Does not assert the goods remain with the customer.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnKeepPromiseDto"
            }
          },
          "receiptCoverage": {
            "type": "string",
            "x-extensible-enum": [
              "EXACT",
              "UNAVAILABLE",
              "NOT_CAPTURED"
            ],
            "description": "Ordinary required-goods receipt coverage only. EXACT is immutable exact coverage; UNAVAILABLE means legacy receipt detail is unknown; NOT_CAPTURED means no ordinary receipt captured. Protected arrival is separate. Unknown values mean unavailable."
          },
          "arrivedLines": {
            "description": "Disjoint ordinary/protected actual arrivals. Empty means no exact captured allocations; with UNAVAILABLE coverage it does not establish zero arrival. Never inferred from approval, status or stock markers.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnArrivedLineDto"
            }
          },
          "refundReadiness": {
            "type": "string",
            "x-extensible-enum": [
              "QUALIFIED",
              "WAITING_FOR_REQUIRED_GOODS",
              "UNAVAILABLE",
              "TERMINAL"
            ],
            "description": "Necessary physical/publication/money qualification only; not a promise to refund or a command capability. Financial source ownership, capacity, frozen operations and current authorization still apply. TERMINAL preserves Completed/Cancelled/Rejected and closed shipping. Unknown values mean unavailable."
          },
          "ordinaryReceipt": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPhysicalReceiptDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Original ordinary receipt result, or null when no supported committed ordinary receipt exists. Null never substitutes for unknown legacy quantities or denies a protected arrival."
          },
          "protectedArrival": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnProtectedArrivalDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Original protected actual arrival/result, including after Completed or Cancelled, or null when none was captured. Null does not prove waived goods remain with the customer. Arrival changes no money, status or shipping rights."
          }
        },
        "required": [
          "version",
          "approvalRevisionNumber",
          "requiredLines",
          "keepPromises",
          "receiptCoverage",
          "arrivedLines",
          "refundReadiness",
          "ordinaryReceipt",
          "protectedArrival"
        ]
      },
      "CustomerReturnNonStripeCompletionDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Completion receipt version 1, distinct from lifecycle/publication version 3."
          },
          "returnId": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ZERO_CASH"
            ],
            "description": "Authoritative genuine-zero outcome of the separate deliberate completion command. Does not attribute any owner-level manual ledger movement or claim a cash refund, credit/exchange settlement or provider action."
          },
          "amountInCents": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "Exact admitted current completion amount; approved/requested and issued history remain in money unchanged."
          },
          "currency": {
            "type": "string",
            "description": "Historical currency of the admitted zero completion."
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original atomic completion time; subsequent real arrival preserves it."
          }
        },
        "required": [
          "version",
          "returnId",
          "outcome",
          "amountInCents",
          "currency",
          "approvalRevisionNumber",
          "completedAt"
        ]
      },
      "ReturnMoneyLineDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Order line id."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "orderItemId",
          "quantity"
        ]
      },
      "CustomerReturnRequestedItemComparatorDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Original requested order line."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Original requested quantity; the amount covers exactly this quantity."
          },
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE only when immutable submission evidence proves this item’s requested contribution, including a genuine zero. Independent of whether an approval exists. No current price, allocation or proration is used."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Requested contribution for this exact quantity, in minor units of `requested.currency`; `null` exactly when UNAVAILABLE."
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "`null` when AVAILABLE. REQUEST_UNAVAILABLE: submission has no known amount. ITEM_COMPARISON_UNAVAILABLE: it does not prove this exact item contribution. VERSION_UNSUPPORTED: this reader cannot interpret the stored item evidence version. Open-ended catalog; other values also mean no item amount is available.",
            "x-extensible-enum": [
              "REQUEST_UNAVAILABLE",
              "ITEM_COMPARISON_UNAVAILABLE",
              "VERSION_UNSUPPORTED"
            ]
          }
        },
        "required": [
          "orderItemId",
          "quantity",
          "availability",
          "amountInCents",
          "unavailableReason"
        ]
      },
      "CustomerReturnMoneyComponentDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ITEM",
              "DISCOUNT",
              "TAX",
              "WITHHOLDING",
              "SHIPPING"
            ]
          },
          "effect": {
            "type": "string",
            "enum": [
              "ADD",
              "SUBTRACT",
              "INCLUDED"
            ],
            "description": "How this component contributes to the total. ITEM and SHIPPING ADD; DISCOUNT and WITHHOLDING SUBTRACT; TAX either ADDs or is INCLUDED (disclosed inside item amounts and never added twice)."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Non-negative magnitude in minor units; `effect` gives the sign."
          },
          "orderItemId": {
            "type": "string",
            "nullable": true,
            "description": "Order line this component belongs to; `null` for a return-level component."
          }
        },
        "required": [
          "kind",
          "effect",
          "amountInCents",
          "orderItemId"
        ]
      },
      "CustomerReturnRequestedMoneyDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE when the customer’s deliberate submission captured a requested amount (including a genuine 0). UNAVAILABLE carries no amount and is never a zero."
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "`null` when AVAILABLE. NOT_CAPTURED means no requested evidence exists for this return — every return submitted before capture shipped reads this way, and nothing is backfilled from prices, drafts or settings. The other reasons were recorded at submission. Open-ended catalog: see x-extensible-enum; any other value is still an unavailable request.",
            "x-extensible-enum": [
              "NOT_CAPTURED",
              "UNSUPPORTED_SELECTION",
              "MISSING_HISTORY",
              "MISSING_CURRENCY"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Requested amount in minor units; `null` exactly when UNAVAILABLE."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code of `amountInCents`, recorded at submission; `null` exactly when UNAVAILABLE. Never a substituted default."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "INCOMPLETE",
              "UNAVAILABLE"
            ],
            "description": "COMPLETE components reconcile exactly to the amount; INCOMPLETE is a known amount with only some components (the missing part is not derivable); UNAVAILABLE has none."
          },
          "lines": {
            "description": "Requested order lines and quantities as captured, ascending by order line id. Empty only when NOT_CAPTURED; `items` still lists the return’s lines.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "itemComparators": {
            "description": "One comparator for each immutable requested line, in line-id order. Empty when no requested evidence was captured; missing item money is otherwise explicit on each row. Never rebuilt from current prices or an approval.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnRequestedItemComparatorDto"
            }
          },
          "components": {
            "description": "Components exactly as the estimate source supplied them; empty when the breakdown is UNAVAILABLE. Nothing is derived, prorated or divided.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnMoneyComponentDto"
            }
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the submission was captured; `null` when NOT_CAPTURED."
          }
        },
        "required": [
          "availability",
          "unavailableReason",
          "amountInCents",
          "currency",
          "breakdownStatus",
          "lines",
          "itemComparators",
          "components",
          "capturedAt"
        ]
      },
      "CustomerReturnItemComparisonDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE only for an approved item with an immutable requested contribution in this approval revision’s currency."
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "`null` when AVAILABLE. ITEM_NOT_APPROVED: a refusal has no approved amount to compare. REQUEST_UNAVAILABLE: no requested amount was captured. CURRENCY_NOT_COMPARABLE: the request and this revision use different currencies. ITEM_COMPARISON_UNAVAILABLE: exact item attribution is absent. VERSION_UNSUPPORTED: the requested item evidence version is unsupported. Open-ended catalog; other values also mean no comparison.",
            "x-extensible-enum": [
              "ITEM_NOT_APPROVED",
              "REQUEST_UNAVAILABLE",
              "CURRENCY_NOT_COMPARABLE",
              "ITEM_COMPARISON_UNAVAILABLE",
              "VERSION_UNSUPPORTED"
            ]
          },
          "requestedQuantity": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "Original requested quantity, retained even when money cannot be compared; `null` when no matching immutable requested line was captured."
          },
          "requestedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Requested contribution for the entire original requested quantity; never prorated to approved units. `null` exactly when UNAVAILABLE."
          },
          "differenceInCents": {
            "type": "integer",
            "nullable": true,
            "description": "Approved item amount minus the original requested item contribution; 0 is an evidenced equality. `null` exactly when UNAVAILABLE."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "description": "Shared historical currency of this revision and the immutable request; `null` exactly when UNAVAILABLE. No conversion or current-currency substitution."
          },
          "relation": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "BELOW",
                  "EQUAL",
                  "ABOVE"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Approved amount relative to the original requested contribution; `null` exactly when UNAVAILABLE."
          }
        },
        "required": [
          "availability",
          "unavailableReason",
          "requestedQuantity",
          "requestedAmountInCents",
          "differenceInCents",
          "currency",
          "relation"
        ]
      },
      "CustomerReturnApprovalItemOutcomeDto": {
        "type": "object",
        "properties": {
          "physicalDisposition": {
            "type": "string",
            "nullable": true,
            "description": "Explicit published v3 disposition for all approved units on this line; null for NOT_APPROVED. Omitted on legacy v2 outcomes, whose absence never proves a waiver. Historical revisions retain their own disposition; physical.keepPromises retains irrevocable grants. Unknown values mean unsupported disposition.",
            "x-extensible-enum": [
              "PHYSICAL_RETURN_REQUIRED",
              "NO_PHYSICAL_RETURN_REQUIRED"
            ]
          },
          "orderItemId": {
            "type": "string",
            "description": "Original requested order line covered by this outcome."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVED",
              "NOT_APPROVED"
            ],
            "description": "Explicit published decision for this item; no decision is inferred from absence."
          },
          "approvedQuantity": {
            "type": "integer",
            "minimum": 0,
            "description": "Published approved units: positive for APPROVED and 0 for NOT_APPROVED."
          },
          "approvedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Published approved contribution in this revision’s currency, including a genuine 0; `null` for NOT_APPROVED, which is never a zero-value approval."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "UNAVAILABLE"
            ],
            "description": "Availability of this item’s published breakdown in the revision’s `components`. UNAVAILABLE has no item components and does not hide a known approved amount."
          },
          "customerNote": {
            "type": "string",
            "nullable": true,
            "description": "Stored customer-safe item note exactly as published, including refusal or reduction explanation; `null` when none was published. Never an internal note."
          },
          "requestedComparison": {
            "$ref": "#/components/schemas/CustomerReturnItemComparisonDto"
          }
        },
        "required": [
          "orderItemId",
          "outcome",
          "approvedQuantity",
          "approvedAmountInCents",
          "breakdownStatus",
          "customerNote",
          "requestedComparison"
        ]
      },
      "CustomerReturnMoneyComparisonDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE only when both the requested amount and the selected approval revision are AVAILABLE in the same currency."
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "`null` when AVAILABLE. APPROVAL_UNAVAILABLE and REQUEST_UNAVAILABLE name the missing side (approval is checked first); CURRENCY_NOT_COMPARABLE means the two are in different currencies, which are never converted. Open-ended catalog: see x-extensible-enum; treat any other value as no comparison.",
            "x-extensible-enum": [
              "APPROVAL_UNAVAILABLE",
              "REQUEST_UNAVAILABLE",
              "CURRENCY_NOT_COMPARABLE"
            ]
          },
          "differenceInCents": {
            "type": "integer",
            "nullable": true,
            "description": "Approved minus requested, in minor units: negative when less was approved, 0 when equal. `null` exactly when UNAVAILABLE."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Currency of `differenceInCents`; `null` exactly when UNAVAILABLE."
          }
        },
        "required": [
          "availability",
          "unavailableReason",
          "differenceInCents",
          "currency"
        ]
      },
      "CustomerReturnApprovalRevisionDto": {
        "type": "object",
        "properties": {
          "revisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "Publication sequence number; revision 1 is the first approval."
          },
          "approvedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Approved amount in minor units of `currency`; 0 is a genuine zero. An approval is a commitment, not money: refunds are reported by `refund`."
          },
          "currency": {
            "type": "string",
            "example": "usd",
            "description": "Lowercase ISO 4217 code of the order’s historical denomination."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "UNAVAILABLE"
            ],
            "description": "COMPLETE when the merchant published a reconciled breakdown; UNAVAILABLE when only the total was published."
          },
          "lines": {
            "description": "Approved order lines and quantities, ascending by order line id; never empty. A requested line that is absent here was not approved in this revision.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "itemOutcomes": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CustomerReturnApprovalItemOutcomeDto"
                }
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The complete version-2 or version-3 publication’s outcomes for every originally requested item, including refusals, in line-id order. `null` for legacy or unsupported versions; never an empty array or a reconstructed partial decision."
          },
          "itemOutcomesUnavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "`null` when complete item outcomes are present. LEGACY_NOT_CAPTURED: a version-1 publication did not capture complete item outcomes. VERSION_UNSUPPORTED: this reader does not interpret that publication version. Open-ended catalog; other values also mean outcomes are unavailable.",
            "x-extensible-enum": [
              "LEGACY_NOT_CAPTURED",
              "VERSION_UNSUPPORTED"
            ]
          },
          "comparison": {
            "description": "This revision’s approved total compared with the immutable requested total in this revision’s historical currency. Retained independently for every history entry; a later revision never rewrites it.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnMoneyComparisonDto"
              }
            ]
          },
          "components": {
            "description": "The published breakdown exactly as published; empty when the breakdown is UNAVAILABLE.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnMoneyComponentDto"
            }
          },
          "requestComparison": {
            "type": "string",
            "enum": [
              "MATCHES_REQUEST",
              "DIFFERS_FROM_REQUEST",
              "REQUEST_NOT_CAPTURED",
              "REQUEST_UNAVAILABLE",
              "CURRENCY_NOT_COMPARABLE"
            ],
            "description": "How this revision compared with the requested evidence when published (amount and lines). Only MATCHES_REQUEST and DIFFERS_FROM_REQUEST are comparisons; the other values say why none exists."
          },
          "customerExplanation": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe explanation published with this revision. Always present on a replacement and on a first approval that differs from a known request; `null` when the publication needed none and included none."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When this revision was published."
          }
        },
        "required": [
          "revisionNumber",
          "approvedAmountInCents",
          "currency",
          "breakdownStatus",
          "lines",
          "itemOutcomes",
          "itemOutcomesUnavailableReason",
          "comparison",
          "components",
          "requestComparison",
          "customerExplanation",
          "publishedAt"
        ]
      },
      "CustomerReturnApprovalMoneyDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Whether an approval is in effect now. AVAILABLE only when the return has been approved (APPROVED, IN_TRANSIT, RECEIVED or COMPLETED) and the merchant has published an approval. An APPROVED status or a private refund draft alone never makes it AVAILABLE."
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "`null` when AVAILABLE. AWAITING_APPROVAL: the return is still REQUESTED, so nothing is approved yet, whatever the merchant has prepared. RETURN_CLOSED: the return was rejected or cancelled, so no approval is in effect; a return cancelled after approval keeps its `history`, while a rejected return, or one cancelled before approval, has none because no approval ever took effect. NOT_PUBLISHED: the return is approved but no approved amount has been published — including when money has since moved (see `refund`). Open-ended catalog: see x-extensible-enum; treat any other value as no approval in effect.",
            "x-extensible-enum": [
              "AWAITING_APPROVAL",
              "RETURN_CLOSED",
              "NOT_PUBLISHED"
            ]
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnApprovalRevisionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The approval in effect now; `null` exactly when UNAVAILABLE."
          },
          "history": {
            "description": "Every revision that took effect for the customer, newest first, including `current` when there is one; a single entry means the approval was never replaced. Empty when UNAVAILABLE, except after a cancellation that followed approval: the return then reads UNAVAILABLE (RETURN_CLOSED) with `current` `null`, and this keeps every revision it carried while approved. No revision can be published after cancellation, so that history is final.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnApprovalRevisionDto"
            }
          }
        },
        "required": [
          "availability",
          "unavailableReason",
          "current",
          "history"
        ]
      },
      "CustomerReturnRefundCorrectionDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "Current state of the correction. REIMBURSEMENT_PENDING: the issued refund was returned by the bank or card network and the merchant still owes `amountOwedInCents`. RECONCILIATION_REQUIRED: the merchant is confirming the outcome with the payment provider. REIMBURSEMENT_RECORDED: the merchant recorded paying the full amount another way. RESOLVED: the correction is closed. Open-ended catalog: see x-extensible-enum; treat any other value as a correction whose outcome is still open.",
            "x-extensible-enum": [
              "REIMBURSEMENT_PENDING",
              "RECONCILIATION_REQUIRED",
              "REIMBURSEMENT_RECORDED",
              "RESOLVED"
            ]
          },
          "reversedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Amount of the issued refund that was returned; `null` only when the recorded currency is unusable (amounts are never published without one)."
          },
          "reimbursedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Total the merchant has recorded paying back another way; 0 when none yet. `null` under the same currency condition as `reversedAmountInCents`."
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Still owed: reversed minus reimbursed. 0 only when recorded reimbursements cover the reversal. `null` under the same currency condition as `reversedAmountInCents`."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code of the correction amounts, from the recorded reversal; `null` only when that record’s currency is unusable."
          }
        },
        "required": [
          "state",
          "reversedAmountInCents",
          "reimbursedInCents",
          "amountOwedInCents",
          "currency"
        ]
      },
      "CustomerReturnRefundItemDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "The return item, as in the return’s `items[].id`."
          },
          "orderItemId": {
            "type": "string",
            "description": "The order item the return item refers to."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "This item’s share of the refund, in the refund’s `currency`. One amount: it does not separate price, discount or tax. Zero when the item received no share."
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "amountInCents"
        ]
      },
      "CustomerReturnRefundMoneyDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "Money for this return, from its own refund records only. NONE: no refund has started (a private draft amount is not a refund). PROCESSING: a refund is underway and not yet issued. NOT_ISSUED: the latest refund attempt did not go through and no money moved. RECONCILIATION_REQUIRED: the outcome is being confirmed with the payment provider. ISSUED: the payment provider confirmed the refund (see `correction` for anything that happened afterwards). COMPLETED_WITHOUT_PROVIDER_REFUND: the return was completed without a payment-provider refund — this does not prove that nothing is owed, nor that money was returned another way. UNAVAILABLE: the refund records cannot be presented (see `unavailableReason`). Refunds made from the order itself, outside this return, are not included. Open-ended catalog: see x-extensible-enum; treat any other value as UNAVAILABLE.",
            "x-extensible-enum": [
              "NONE",
              "PROCESSING",
              "NOT_ISSUED",
              "RECONCILIATION_REQUIRED",
              "ISSUED",
              "COMPLETED_WITHOUT_PROVIDER_REFUND",
              "UNAVAILABLE"
            ]
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "description": "Set only when `state` is UNAVAILABLE; `null` for every other state. LEGACY_UNVERIFIED: the return was completed before refunds were tracked per return, so no exact refund record exists. EVIDENCE_INCONSISTENT: the refund records disagree and are under review. Neither means no refund happened. Open-ended catalog: see x-extensible-enum.",
            "x-extensible-enum": [
              "LEGACY_UNVERIFIED",
              "EVIDENCE_INCONSISTENT"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Amount of the refund for PROCESSING (in progress, not yet issued), NOT_ISSUED (attempted; no money moved), RECONCILIATION_REQUIRED (being confirmed) and ISSUED (issued). `null` for every other state, and when the recorded currency is unusable: an amount is never published without its currency."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code of `amountInCents`, from the refund record itself; `null` exactly when `amountInCents` is."
          },
          "issuedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the refund was confirmed issued; `null` unless `state` is ISSUED."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "INCOMPLETE",
              "UNAVAILABLE"
            ],
            "description": "Currently always UNAVAILABLE: a refund records no price, discount or tax components, so none is derived (the per-item split it does record is `itemAmounts`). A later version may publish source-validated components under COMPLETE or INCOMPLETE with the same meanings as `requested`."
          },
          "components": {
            "description": "Always empty while `breakdownStatus` is UNAVAILABLE.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnMoneyComponentDto"
            }
          },
          "itemAmounts": {
            "description": "How `amountInCents` is split across the returned items, as frozen when the refund started; the shares add up exactly to `amountInCents`. Ordered by `returnItemId`. Empty whenever `amountInCents` is `null`, and when no exact split is recorded: a split is never estimated or divided from the total. A later `correction` does not change it.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnRefundItemDto"
            }
          },
          "correction": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnRefundCorrectionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "A later correction of an ISSUED refund, kept separate so the original issue stays on record; `null` when there is none (always `null` unless `state` is ISSUED). When present, it is the current explanation of what is owed."
          }
        },
        "required": [
          "state",
          "unavailableReason",
          "amountInCents",
          "currency",
          "issuedAt",
          "breakdownStatus",
          "components",
          "itemAmounts",
          "correction"
        ]
      },
      "CustomerReturnMoneyFactsDto": {
        "type": "object",
        "properties": {
          "requested": {
            "$ref": "#/components/schemas/CustomerReturnRequestedMoneyDto"
          },
          "approval": {
            "$ref": "#/components/schemas/CustomerReturnApprovalMoneyDto"
          },
          "comparison": {
            "$ref": "#/components/schemas/CustomerReturnMoneyComparisonDto"
          },
          "refund": {
            "$ref": "#/components/schemas/CustomerReturnRefundMoneyDto"
          }
        },
        "required": [
          "requested",
          "approval",
          "comparison",
          "refund"
        ]
      },
      "CustomerReturnFactsByReferenceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "orderNumber": {
            "type": "string",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "description": "The exact active reference used to address this return's parent Order.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "money": {
            "$ref": "#/components/schemas/CustomerReturnMoneyFactsDto"
          },
          "physical": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPhysicalFactsDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe version-3 physical facts, or null for legacy/unsupported/missing exact mapping or a publication withheld before lifecycle approval. Null never proves all-kept, zero arrival or zero settlement. Current instruction/document access remains on the authorized shipping reads."
          },
          "nonStripeCompletion": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnNonStripeCompletionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe deliberate genuine-zero completion receipt, or null when no supported receipt is available or publication is withheld. Null does not deny legacy/Stripe completion and is not proof of zero or positive manual/credit/exchange settlement. Actual issued/refund/correction facts remain in money.refund."
          }
        },
        "required": [
          "id",
          "orderNumber",
          "status",
          "reason",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff",
          "orderReference",
          "money",
          "physical",
          "nonStripeCompletion"
        ]
      },
      "CustomerReturnFactsListByReferenceResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Every return on the order, newest first; empty when it has none.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnFactsByReferenceDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "OrderReferenceReturnFactsDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "description": "The exact active reference used to address this return's parent Order.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "money": {
            "$ref": "#/components/schemas/CustomerReturnMoneyFactsDto"
          },
          "physical": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPhysicalFactsDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe version-3 physical facts, or null for legacy/unsupported/missing exact mapping or a publication withheld before lifecycle approval. Null never proves all-kept, zero arrival or zero settlement. Current instruction/document access remains on the authorized shipping reads."
          },
          "nonStripeCompletion": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnNonStripeCompletionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe deliberate genuine-zero completion receipt, or null when no supported receipt is available or publication is withheld. Null does not deny legacy/Stripe completion and is not proof of zero or positive manual/credit/exchange settlement. Actual issued/refund/correction facts remain in money.refund."
          }
        },
        "required": [
          "id",
          "status",
          "reason",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff",
          "orderReference",
          "money",
          "physical",
          "nonStripeCompletion"
        ]
      },
      "IssueReturnActionDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Optional free-text return reason.",
            "maxLength": 4000
          },
          "items": {
            "description": "Lines to return. Duplicate orderItemId entries are aggregated before validation.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnLineRequestDto"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CustomerReturnLinePreviewDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Order-item handle from the customer order detail response."
          },
          "name": {
            "type": "string",
            "example": "Trail Tent 2P"
          },
          "quantity": {
            "type": "number",
            "example": 1
          }
        },
        "required": [
          "orderItemId",
          "name",
          "quantity"
        ]
      },
      "CustomerActionOrderByReferenceDto": {
        "type": "object",
        "properties": {
          "orderNumber": {
            "type": "string",
            "example": "LC-100423"
          },
          "createdAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "orderReference": {
            "type": "string",
            "nullable": false,
            "description": "The exact active reference used to address this Order.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          }
        },
        "required": [
          "orderNumber",
          "createdAt",
          "orderReference"
        ]
      },
      "CustomerReturnActionByReferencePreviewDto": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "order.return"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnLinePreviewDto"
            }
          },
          "order": {
            "$ref": "#/components/schemas/CustomerActionOrderByReferenceDto"
          }
        },
        "required": [
          "action",
          "reason",
          "items",
          "order"
        ]
      },
      "IssueReturnActionByReferenceResponseDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Raw customer action token. Returned once; use it at /customer/actions/:token.",
            "example": "a1234567890abcdefghijklmnop"
          },
          "expiresAt": {
            "type": "string",
            "example": "2026-06-12T14:36:18.000Z"
          },
          "preview": {
            "$ref": "#/components/schemas/CustomerReturnActionByReferencePreviewDto"
          }
        },
        "required": [
          "token",
          "expiresAt",
          "preview"
        ]
      },
      "ReturnShippingDestinationDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Recipient or facility name."
          },
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "description": "`null` when the destination has no second line."
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "State, province or region."
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "example": "US",
            "description": "Assigned ISO 3166-1 alpha-2 country code, as validated when the instructions were confirmed."
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "`null` when none was confirmed."
          }
        },
        "required": [
          "name",
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country",
          "phone"
        ]
      },
      "ReturnShippingItemDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Exact approved physical-required order line for version 3; historical approved line for version 1/2."
          },
          "name": {
            "type": "string",
            "description": "The order line’s name as it was sold."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Approved units to ship back."
          }
        },
        "required": [
          "orderItemId",
          "name",
          "quantity"
        ]
      },
      "CustomerReturnShippingInstructionDetailDto": {
        "type": "object",
        "properties": {
          "revisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "Revision of the confirmed instructions. It increases whenever the merchant confirms new instructions, so a changed value means changed instructions. Nothing else about the revision is published."
          },
          "payer": {
            "type": "string",
            "enum": [
              "MERCHANT",
              "CUSTOMER"
            ],
            "description": "CUSTOMER: buy postage yourself; the platform offers no purchase. MERCHANT: the merchant pays; wait for the prepaid label."
          },
          "destination": {
            "description": "The confirmed destination.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnShippingDestinationDto"
              }
            ]
          },
          "items": {
            "description": "The approved items and quantities to ship back. Never empty.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnShippingItemDto"
            }
          },
          "customerInstructions": {
            "type": "string",
            "nullable": true,
            "description": "The merchant’s customer-safe instructions; `null` when none were given."
          }
        },
        "required": [
          "revisionNumber",
          "payer",
          "destination",
          "items",
          "customerInstructions"
        ]
      },
      "CustomerReturnShippingInstructionsDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string",
            "description": "The return these instructions belong to."
          },
          "returnStatus": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "description": "The return’s current lifecycle status."
          },
          "state": {
            "type": "string",
            "enum": [
              "UNAPPROVED",
              "INSTRUCTIONS_PENDING",
              "CUSTOMER_PAID_READY",
              "MERCHANT_PAID_LABEL_WAITING",
              "NO_PHYSICAL_RETURN_REQUIRED",
              "SHIPPING_CLOSED"
            ],
            "description": "UNAPPROVED: the return is not approved yet; do not ship. INSTRUCTIONS_PENDING: approved, but shipping instructions are not ready; do not ship or buy postage yet. CUSTOMER_PAID_READY: buy postage yourself and ship the listed items to the destination with the packing slip (an IN_TRANSIT return keeps the instructions it was shipped under). MERCHANT_PAID_LABEL_WAITING: the merchant pays; wait for the prepaid label — do not buy postage. NO_PHYSICAL_RETURN_REQUIRED: all approved merchandise is waived; no further shipment, payer, destination, label or packing slip is required. This does not assert that no goods previously arrived. SHIPPING_CLOSED: the items were received, or the return was rejected, cancelled or completed; nothing is left to ship. This state set is open-ended: accept unknown values conservatively as “do not ship yet” and withhold shipping and printing actions; more values may be added when prepaid-label access ships."
          },
          "instructions": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnShippingInstructionDetailDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The confirmed instructions in CUSTOMER_PAID_READY and MERCHANT_PAID_LABEL_WAITING; `null` in every other state. In MERCHANT_PAID_LABEL_WAITING they say where the return will go, not that it can ship yet."
          }
        },
        "required": [
          "returnId",
          "returnStatus",
          "state",
          "instructions"
        ]
      },
      "CustomerReturnPackingSlipDocumentDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string",
            "description": "The return’s reference, as shown on the customer’s return list. Write it on the package contents if the slip cannot be printed."
          },
          "orderNumber": {
            "type": "string",
            "description": "The order number the items were bought on."
          },
          "instructionRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "Revision of the confirmed instructions this slip was produced from."
          },
          "destination": {
            "description": "Where the package goes.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnShippingDestinationDto"
              }
            ]
          },
          "items": {
            "description": "The approved items and quantities in the package. Never empty.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnShippingItemDto"
            }
          }
        },
        "required": [
          "returnId",
          "orderNumber",
          "instructionRevisionNumber",
          "destination",
          "items"
        ]
      },
      "CustomerReturnPackingSlipDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE only while the customer is told to ship (shipping state CUSTOMER_PAID_READY). The slip lists what goes in the box; it is not a shipping label or postage."
          },
          "unavailableReason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "UNAPPROVED",
                  "INSTRUCTIONS_PENDING",
                  "MERCHANT_PAID_LABEL_WAITING",
                  "NO_PHYSICAL_RETURN_REQUIRED",
                  "SHIPPING_CLOSED"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "`null` when AVAILABLE; otherwise the current shipping state that withholds the slip (same meanings as the shipping-instructions read). This reason set is open-ended: accept unknown values conservatively as unavailable and withhold printing and shipping actions."
          },
          "packingSlip": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPackingSlipDocumentDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The slip when AVAILABLE; `null` otherwise."
          }
        },
        "required": [
          "availability",
          "unavailableReason",
          "packingSlip"
        ]
      },
      "CustomerProfileResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The authenticated customer id."
          },
          "email": {
            "type": "string",
            "description": "Normalized (lower-cased) email — the identity key. Read-only.",
            "example": "alice@example.com"
          },
          "name": {
            "type": "string",
            "description": "Display name.",
            "nullable": true,
            "example": "Alice Buyer"
          },
          "phone": {
            "type": "string",
            "description": "Contact phone.",
            "nullable": true,
            "example": "+1 555 010 1234"
          },
          "emailVerifiedAt": {
            "type": "string",
            "description": "When the email was verified, or null if not yet verified (ISO 8601).",
            "format": "date-time",
            "nullable": true,
            "example": "2026-06-05T14:36:18.000Z"
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "phone",
          "emailVerifiedAt"
        ]
      },
      "UpdateProfileDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Customer display name. Pass null to clear.",
            "nullable": true,
            "maxLength": 200,
            "example": "Alice Buyer"
          },
          "phone": {
            "type": "string",
            "description": "Customer contact phone (free-text). Pass null to clear.",
            "nullable": true,
            "maxLength": 32,
            "example": "+1 555 010 1234"
          }
        }
      },
      "ProfileUpgradeSelectionDto": {
        "type": "object",
        "properties": {
          "sourceOrderNumber": {
            "type": "string",
            "description": "Public order number, never an internal Order id.",
            "maxLength": 120,
            "example": "LC-100423"
          },
          "kind": {
            "type": "string",
            "enum": [
              "NAME",
              "PHONE",
              "SHIPPING_ADDRESS",
              "BILLING_ADDRESS"
            ]
          },
          "fingerprint": {
            "type": "string",
            "description": "SHA-256 fingerprint of the projected historical value. A stale or changed candidate is unavailable; this is not a secret or credential.",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "sourceOrderNumber",
          "kind",
          "fingerprint"
        ]
      },
      "ProfileUpgradeTextCandidateDto": {
        "type": "object",
        "properties": {
          "selection": {
            "$ref": "#/components/schemas/ProfileUpgradeSelectionDto"
          },
          "value": {
            "type": "string",
            "description": "Captured order-time value."
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "selection",
          "value",
          "capturedAt"
        ]
      },
      "ProfileUpgradeAddressValueDto": {
        "type": "object",
        "properties": {
          "recipientName": {
            "type": "string"
          },
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "description": "Null when the historical second line is missing, blank, or not a string. Null does not prove that no value was entered."
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string",
            "nullable": true,
            "description": "Null when the historical state or region is missing, blank, or not a string. Null does not prove that no value was entered."
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "Null when the captured order phone is missing, blank, or longer than 32 characters. These causes cannot be distinguished from this value."
          }
        },
        "required": [
          "recipientName",
          "line1",
          "line2",
          "city",
          "region",
          "postalCode",
          "country",
          "phone"
        ]
      },
      "ProfileUpgradeAddressCandidateDto": {
        "type": "object",
        "properties": {
          "selection": {
            "$ref": "#/components/schemas/ProfileUpgradeSelectionDto"
          },
          "value": {
            "$ref": "#/components/schemas/ProfileUpgradeAddressValueDto"
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "selection",
          "value",
          "capturedAt"
        ]
      },
      "ProfileUpgradeCandidatesResponseDto": {
        "type": "object",
        "properties": {
          "names": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileUpgradeTextCandidateDto"
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileUpgradeTextCandidateDto"
            }
          },
          "shippingAddresses": {
            "description": "Eligible shipping addresses in the bounded owned-order window. Empty does not establish that no historical shipping address exists: older Orders are outside the window, and incomplete, invalid, or company-bearing snapshots are omitted rather than saved with loss.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileUpgradeAddressCandidateDto"
            }
          },
          "billingAddresses": {
            "description": "Eligible billing addresses in the bounded owned-order window. Empty does not establish that no historical billing address exists: older Orders are outside the window, and incomplete, invalid, or company-bearing snapshots are omitted rather than saved with loss.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileUpgradeAddressCandidateDto"
            }
          },
          "orderLimit": {
            "type": "number",
            "description": "Maximum number of newest durably owned Orders examined. Older history is intentionally unavailable through this bounded upgrade surface.",
            "example": 40
          },
          "examinedOrders": {
            "type": "number",
            "description": "Number of owned Orders examined, before invalid values were skipped."
          },
          "truncated": {
            "type": "boolean",
            "description": "True when older owned Orders exist beyond orderLimit; no candidate from those older Orders can be selected through this route."
          }
        },
        "required": [
          "names",
          "phones",
          "shippingAddresses",
          "billingAddresses",
          "orderLimit",
          "examinedOrders",
          "truncated"
        ]
      },
      "SaveProfileUpgradeDto": {
        "type": "object",
        "properties": {
          "selections": {
            "minItems": 1,
            "maxItems": 4,
            "description": "One selection per kind. Omitting a kind leaves that profile/address destination unchanged. Historical address selections add non-default address-book entries; no current checkout address is saved.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileUpgradeSelectionDto"
            }
          }
        },
        "required": [
          "selections"
        ]
      },
      "CustomerAddressResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Address id — the customer-safe handle for this entry."
          },
          "label": {
            "type": "string",
            "nullable": true,
            "example": "Home"
          },
          "recipientName": {
            "type": "string",
            "example": "Alice Buyer"
          },
          "line1": {
            "type": "string",
            "example": "123 Main St"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "example": "Apt 4B"
          },
          "city": {
            "type": "string",
            "example": "Boise"
          },
          "region": {
            "type": "string",
            "nullable": true,
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "example": "83702"
          },
          "country": {
            "type": "string",
            "example": "US"
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "example": "+1 555 010 1234"
          },
          "isDefaultShipping": {
            "type": "boolean",
            "example": false
          },
          "isDefaultBilling": {
            "type": "boolean",
            "example": false
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601.",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601.",
            "example": "2026-06-05T14:36:18.000Z"
          }
        },
        "required": [
          "id",
          "label",
          "recipientName",
          "line1",
          "line2",
          "city",
          "region",
          "postalCode",
          "country",
          "phone",
          "isDefaultShipping",
          "isDefaultBilling",
          "createdAt",
          "updatedAt"
        ]
      },
      "SaveProfileUpgradeResponseDto": {
        "type": "object",
        "properties": {
          "profile": {
            "$ref": "#/components/schemas/CustomerProfileResponseDto"
          },
          "savedAddresses": {
            "description": "New non-default addresses or already-matching saved entries selected from owned history. Existing default flags remain as they were; this action never promotes either flag.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAddressResponseDto"
            }
          }
        },
        "required": [
          "profile",
          "savedAddresses"
        ]
      },
      "CreateAddressDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Optional short label, e.g. \"Home\" or \"Office\".",
            "maxLength": 100,
            "example": "Home"
          },
          "recipientName": {
            "type": "string",
            "description": "Name of the person this address ships to.",
            "maxLength": 200,
            "example": "Alice Buyer"
          },
          "line1": {
            "type": "string",
            "description": "Street address line 1.",
            "maxLength": 300,
            "example": "123 Main St"
          },
          "line2": {
            "type": "string",
            "description": "Street address line 2 (apt, suite, unit).",
            "maxLength": 300,
            "example": "Apt 4B"
          },
          "city": {
            "type": "string",
            "description": "City / locality.",
            "maxLength": 200,
            "example": "Boise"
          },
          "region": {
            "type": "string",
            "description": "State / province / region.",
            "maxLength": 200,
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "description": "Postal / ZIP code.",
            "maxLength": 32,
            "example": "83702"
          },
          "country": {
            "type": "string",
            "description": "Country (ISO code or name).",
            "maxLength": 100,
            "example": "US"
          },
          "phone": {
            "type": "string",
            "description": "Contact phone for this address (free-text).",
            "maxLength": 32,
            "example": "+1 555 010 1234"
          },
          "isDefaultShipping": {
            "type": "boolean",
            "description": "Mark this as the default shipping address. Setting true clears the customer's prior default-shipping address.",
            "default": false
          },
          "isDefaultBilling": {
            "type": "boolean",
            "description": "Mark this as the default billing address. Setting true clears the customer's prior default-billing address.",
            "default": false
          }
        },
        "required": [
          "recipientName",
          "line1",
          "city",
          "postalCode",
          "country"
        ]
      },
      "UpdateAddressDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Optional short label, e.g. \"Home\" or \"Office\". Pass null to clear.",
            "maxLength": 100,
            "example": "Home",
            "nullable": true
          },
          "recipientName": {
            "type": "string",
            "description": "Name of the person this address ships to.",
            "maxLength": 200,
            "example": "Alice Buyer"
          },
          "line1": {
            "type": "string",
            "description": "Street address line 1.",
            "maxLength": 300,
            "example": "123 Main St"
          },
          "line2": {
            "type": "string",
            "description": "Street address line 2 (apt, suite, unit). Pass null to clear.",
            "maxLength": 300,
            "example": "Apt 4B",
            "nullable": true
          },
          "city": {
            "type": "string",
            "description": "City / locality.",
            "maxLength": 200,
            "example": "Boise"
          },
          "region": {
            "type": "string",
            "description": "State / province / region. Pass null to clear.",
            "maxLength": 200,
            "example": "ID",
            "nullable": true
          },
          "postalCode": {
            "type": "string",
            "description": "Postal / ZIP code.",
            "maxLength": 32,
            "example": "83702"
          },
          "country": {
            "type": "string",
            "description": "Country (ISO code or name).",
            "maxLength": 100,
            "example": "US"
          },
          "phone": {
            "type": "string",
            "description": "Contact phone for this address (free-text). Pass null to clear.",
            "maxLength": 32,
            "example": "+1 555 010 1234",
            "nullable": true
          },
          "isDefaultShipping": {
            "type": "boolean",
            "description": "Mark this as the default shipping address. Setting true clears the customer's prior default-shipping address.",
            "default": false
          },
          "isDefaultBilling": {
            "type": "boolean",
            "description": "Mark this as the default billing address. Setting true clears the customer's prior default-billing address.",
            "default": false
          }
        }
      },
      "CustomerOrderSummaryDto": {
        "type": "object",
        "properties": {
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable order reference. This is an address, not an authorization credential. `null` only for a legacy Order awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "orderNumber": {
            "type": "string",
            "description": "Human-readable public order number. Authenticated order-number routes remain supported alongside the stable order reference.",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "description": "Order lifecycle status.",
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "description": "Fulfillment status.",
            "example": "UNFULFILLED"
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Subtotal in minor units (cents).",
            "example": 25998
          },
          "discountInCents": {
            "type": "number",
            "description": "Discount applied in minor units (cents).",
            "example": 0
          },
          "taxInCents": {
            "type": "number",
            "description": "Tax in minor units (cents).",
            "example": 1560
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number",
            "description": "Grand total in minor units (cents).",
            "example": 27558
          },
          "createdAt": {
            "type": "string",
            "description": "When the order was placed (ISO 8601).",
            "example": "2026-06-05T14:36:18.000Z"
          }
        },
        "required": [
          "orderReference",
          "orderNumber",
          "status",
          "fulfillmentStatus",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "totalInCents",
          "createdAt"
        ]
      },
      "CustomerOrderListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerOrderSummaryDto"
            }
          },
          "page": {
            "type": "number",
            "description": "1-based page returned.",
            "example": 1
          },
          "pageSize": {
            "type": "number",
            "description": "Page size used.",
            "example": 20
          },
          "total": {
            "type": "number",
            "description": "Total orders for this customer.",
            "example": 3
          }
        },
        "required": [
          "data",
          "page",
          "pageSize",
          "total"
        ]
      },
      "CustomerOrderDetailDto": {
        "type": "object",
        "properties": {
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable order reference. This is an address, not an authorization credential. `null` only for a legacy Order awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "orderNumber": {
            "type": "string",
            "description": "Human-readable public order number. Authenticated order-number routes remain supported alongside the stable order reference.",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "description": "Order lifecycle status.",
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "description": "Fulfillment status.",
            "example": "UNFULFILLED"
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Subtotal in minor units (cents).",
            "example": 25998
          },
          "discountInCents": {
            "type": "number",
            "description": "Discount applied in minor units (cents).",
            "example": 0
          },
          "taxInCents": {
            "type": "number",
            "description": "Tax in minor units (cents).",
            "example": 1560
          },
          "taxDisclosure": {
            "nullable": true,
            "description": "Customer-safe disclosure when cartonium did not calculate tax for this order (manual/no-tax mode). Null for provider-calculated tax and legacy/merchant-created orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutTaxDisclosureDto"
              }
            ]
          },
          "totalInCents": {
            "type": "number",
            "description": "Grand total in minor units (cents).",
            "example": 27558
          },
          "createdAt": {
            "type": "string",
            "description": "When the order was placed (ISO 8601).",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerOrderItemDto"
            }
          },
          "paymentDisplay": {
            "nullable": true,
            "description": "Immutable display-safe facts from the exact successful card Charge. `null` for free orders, paid orders predating snapshot capture, or while a paid order's exact provider display evidence is temporarily unavailable and bounded repair remains pending. It does not mean the order is unpaid. Available only on authenticated detail reads.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderPaymentDisplayDto"
              }
            ]
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPackageGroupDto"
            }
          },
          "shippingInCents": {
            "type": "number",
            "description": "Shipping charged on the order in minor units (#854) — `0` when none applied. Already included in `totalInCents`; surfaced so the detail view can itemize the shipping line.",
            "example": 0
          },
          "shippingMethod": {
            "nullable": true,
            "description": "The immutable exact selection or delivery promise captured on `Order.shippingMethod` at confirmation (#1769/#2415). For orders confirmed before that snapshot was introduced, the original frozen checkout selection is returned when the Order snapshot is absent. `null` when the authoritative source has no valid recorded snapshot; original-quote and actual-shipment facts are never substituted.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderShippingMethodDto"
              }
            ]
          },
          "shipments": {
            "description": "#1562 — customer-safe handed-off and delivered shipment history. PLANNED and READY preparation is excluded; tracking fields may be null when the carrier supplied no tracking. Carries no raw order or fulfillment ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderShipmentDto"
            }
          },
          "orderTimeContact": {
            "description": "Immutable order-time recipient/contact facts. The object is always present; nullable members preserve missing legacy values honestly. Available only after authenticated tenant/customer ownership checks.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerOrderTimeContactDto"
              }
            ]
          },
          "shipmentDeliveryComplete": {
            "type": "boolean",
            "description": "True only when at least one non-cancelled fulfillment exists and every non-cancelled fulfillment is DELIVERED. This server-derived flag includes PLANNED and READY fulfillments intentionally omitted from `shipments`; an empty or all-delivered visible array alone cannot establish completion."
          },
          "shippingAddress": {
            "description": "Shipping address captured at checkout (JSON snapshot), or null.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          },
          "billingAddress": {
            "description": "Billing address captured at checkout (JSON snapshot), or null.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderAddressSnapshotDto"
              }
            ]
          }
        },
        "required": [
          "orderReference",
          "orderNumber",
          "status",
          "fulfillmentStatus",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "taxDisclosure",
          "totalInCents",
          "createdAt",
          "items",
          "paymentDisplay",
          "packages",
          "shippingInCents",
          "shippingMethod",
          "shipments",
          "orderTimeContact",
          "shipmentDeliveryComplete",
          "shippingAddress",
          "billingAddress"
        ]
      },
      "CustomerReturnResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable reference for the parent order. Possession does not authorize return access. `null` only for a legacy Order awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "orderNumber": {
            "type": "string",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "refundAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Refund to the customer for this return, in cents. 0 until the merchant sets an amount.",
            "example": 0
          },
          "refundState": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "PROCESSING",
              "ISSUED",
              "REIMBURSEMENT_PENDING",
              "RECONCILIATION_REQUIRED",
              "REIMBURSEMENT_RECORDED",
              "RESOLVED"
            ],
            "description": "Customer-safe money state of the refund (#3964). Same derivation as the public return surface: ISSUED means the original-method refund completed; REIMBURSEMENT_PENDING means it was later reversed and the merchant still owes an alternative reimbursement; REIMBURSEMENT_RECORDED and RESOLVED mean that reimbursement is recorded."
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Amount still owed after a provider reversed an earlier successful refund; null when no such correction exists."
          },
          "refundCurrency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code the refund amounts are denominated in, taken from the persisted refund records (the refund exception, else the order's payment) rather than the organization's current setting (#3964). Null when the order has no recorded payment currency. #4007 tightened that null: it means the historical denomination is unrecoverable, NOT that the client may substitute the currency it is already displaying. A client receiving null must present the refund without denominating it. Derived by the same shared precedence as the email-gated public return surface, so the two cannot disagree."
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          }
        },
        "required": [
          "id",
          "orderReference",
          "orderNumber",
          "status",
          "reason",
          "refundAmountInCents",
          "refundState",
          "amountOwedInCents",
          "refundCurrency",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff"
        ]
      },
      "CustomerReturnListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnResponseDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "CustomerReturnFactsDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable reference for the parent order. Possession does not authorize return access. `null` only for a legacy Order awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "orderNumber": {
            "type": "string",
            "example": "LC-100423"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          },
          "money": {
            "$ref": "#/components/schemas/CustomerReturnMoneyFactsDto"
          },
          "physical": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPhysicalFactsDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe version-3 physical facts, or null for legacy/unsupported/missing exact mapping or a publication withheld before lifecycle approval. Null never proves all-kept, zero arrival or zero settlement. Current instruction/document access remains on the authorized shipping reads."
          },
          "nonStripeCompletion": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnNonStripeCompletionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe deliberate genuine-zero completion receipt, or null when no supported receipt is available or publication is withheld. Null does not deny legacy/Stripe completion and is not proof of zero or positive manual/credit/exchange settlement. Actual issued/refund/correction facts remain in money.refund."
          }
        },
        "required": [
          "id",
          "orderReference",
          "orderNumber",
          "status",
          "reason",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff",
          "money",
          "physical",
          "nonStripeCompletion"
        ]
      },
      "CustomerReturnFactsListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Every return on the order, newest first; empty when it has none.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnFactsDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "CustomerActionOrderDto": {
        "type": "object",
        "properties": {
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable order reference. Possession does not authorize this action. `null` only when a legacy action targets an Order still awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "orderNumber": {
            "type": "string",
            "example": "LC-100423"
          },
          "createdAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          }
        },
        "required": [
          "orderReference",
          "orderNumber",
          "createdAt"
        ]
      },
      "CustomerReturnActionPreviewDto": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "order.return"
          },
          "order": {
            "$ref": "#/components/schemas/CustomerActionOrderDto"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerReturnLinePreviewDto"
            }
          }
        },
        "required": [
          "action",
          "order",
          "reason",
          "items"
        ]
      },
      "IssueReturnActionResponseDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Raw customer action token. Returned once; use it at /customer/actions/:token.",
            "example": "a1234567890abcdefghijklmnop"
          },
          "expiresAt": {
            "type": "string",
            "example": "2026-06-12T14:36:18.000Z"
          },
          "preview": {
            "$ref": "#/components/schemas/CustomerReturnActionPreviewDto"
          }
        },
        "required": [
          "token",
          "expiresAt",
          "preview"
        ]
      },
      "ConsumeReturnActionDto": {
        "type": "object",
        "properties": {
          "reviewedEstimate": {
            "description": "Exact estimate deliberately reviewed before this consume. Omission means no monetary acknowledgement; a new Return has no requested-evidence row (NOT_CAPTURED) instead of an unseen total. Changed evidence returns 409 without creating a Return; review again and reuse this same token. A committed token replay always returns its original requested evidence.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRequestedReviewDto"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CustomerActionConsumeResponseDto": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "order.return"
          },
          "status": {
            "type": "string",
            "example": "CONSUMED"
          },
          "returnRequest": {
            "$ref": "#/components/schemas/CustomerReturnResponseDto"
          }
        },
        "required": [
          "action",
          "status",
          "returnRequest"
        ]
      },
      "CustomerActionConsumeFactsResponseDto": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "order.return"
          },
          "status": {
            "type": "string",
            "example": "CONSUMED"
          },
          "returnRequest": {
            "description": "The return this token created. A replay returns the same return: its requested evidence never changes, while its approval and refund show their current state.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnFactsDto"
              }
            ]
          }
        },
        "required": [
          "action",
          "status",
          "returnRequest"
        ]
      },
      "CreateReturnDto": {
        "type": "object",
        "properties": {
          "customerEmail": {
            "type": "string",
            "description": "Customer email. Must match the order's customerEmail (case-folded, trimmed) — slice 1A auth is shared-secret style.",
            "maxLength": 320
          },
          "customerName": {
            "type": "string",
            "description": "Optional display name for the requester.",
            "maxLength": 200
          },
          "reason": {
            "type": "string",
            "description": "Free-text reason for the return.",
            "maxLength": 4000
          },
          "items": {
            "description": "Lines being returned. 1-50 entries; cumulative quantity across non-cancelled returns may not exceed the original order line.",
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateReturnItemDto"
            }
          }
        },
        "required": [
          "customerEmail",
          "items"
        ],
        "additionalProperties": false
      },
      "PublicReturnResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "orderId": {
            "type": "string",
            "description": "Legacy raw Order id retained only for measured compatibility.",
            "deprecated": true
          },
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable reference for the parent order. Possession does not authorize return access. `null` only for a legacy Order awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "refundAmountInCents": {
            "type": "number",
            "description": "Refund to the customer for this return, in cents. 0 until the merchant sets an amount.",
            "example": 0
          },
          "refundState": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "PROCESSING",
              "ISSUED",
              "REIMBURSEMENT_PENDING",
              "RECONCILIATION_REQUIRED",
              "REIMBURSEMENT_RECORDED",
              "RESOLVED"
            ]
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Amount still owed after a provider reversed an earlier successful refund; null when no such correction exists."
          },
          "refundCurrency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code that BOTH `refundAmountInCents` and `amountOwedInCents` are denominated in (#4007). Read from immutable history — the refund exception when one exists, else the persisted currency of the exact successful payment attempt that created the parent order — never from the organization's current currency setting, which can change after checkout. `null` means the historical denomination is genuinely unrecoverable for this return; it is NOT a licence to substitute a default. A client that receives `null` must not render these amounts under any assumed currency."
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          }
        },
        "required": [
          "id",
          "orderId",
          "orderReference",
          "status",
          "reason",
          "refundAmountInCents",
          "refundState",
          "amountOwedInCents",
          "refundCurrency",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff"
        ]
      },
      "CancelReturnDto": {
        "type": "object",
        "properties": {
          "customerEmail": {
            "type": "string",
            "description": "Customer email. Must match the order's customerEmail (case-folded, trimmed) — the same shared-secret check used to file the return.",
            "maxLength": 320
          }
        },
        "required": [
          "customerEmail"
        ],
        "additionalProperties": false
      },
      "PublicReturnFactsDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Return id."
          },
          "orderId": {
            "type": "string",
            "description": "Legacy raw Order id retained only for measured compatibility.",
            "deprecated": true
          },
          "orderReference": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe stable reference for the parent order. Possession does not authorize return access. `null` only for a legacy Order awaiting the measured reference backfill.",
            "example": "or1_0123456789abcdef0123456789abcdef",
            "pattern": "^or1_[0-9a-f]{32}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "requestedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-06-05T14:36:18.000Z"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicReturnItemResponseDto"
            }
          },
          "createdByStoreStaff": {
            "type": "boolean",
            "example": false,
            "description": "`true` when the store's team started this return request for the customer from their admin; `false` when it was requested through a customer channel (the account, an emailed return link or the order-email form). Every return created before the store could start one is `false`."
          },
          "money": {
            "$ref": "#/components/schemas/CustomerReturnMoneyFactsDto"
          },
          "physical": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnPhysicalFactsDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe version-3 physical facts, or null for legacy/unsupported/missing exact mapping or a publication withheld before lifecycle approval. Null never proves all-kept, zero arrival or zero settlement. Current instruction/document access remains on the authorized shipping reads."
          },
          "nonStripeCompletion": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerReturnNonStripeCompletionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Safe deliberate genuine-zero completion receipt, or null when no supported receipt is available or publication is withheld. Null does not deny legacy/Stripe completion and is not proof of zero or positive manual/credit/exchange settlement. Actual issued/refund/correction facts remain in money.refund."
          }
        },
        "required": [
          "id",
          "orderId",
          "orderReference",
          "status",
          "reason",
          "requestedAt",
          "updatedAt",
          "items",
          "createdByStoreStaff",
          "money",
          "physical",
          "nonStripeCompletion"
        ]
      },
      "ReturnRefundIntentMode": {
        "type": "string",
        "enum": [
          "CASH_REFUND",
          "NO_CASH_REFUND"
        ],
        "description": "CASH_REFUND: the merchant reviewed issuing `expectedRefundAmountInCents` (greater than 0) to the original payment method. NO_CASH_REFUND: the merchant reviewed completing the return without a cash refund (`expectedRefundAmountInCents` must be 0)."
      },
      "ReturnRefundIntentDto": {
        "type": "object",
        "properties": {
          "mode": {
            "description": "CASH_REFUND: the merchant reviewed issuing `expectedRefundAmountInCents` (greater than 0) to the original payment method. NO_CASH_REFUND: the merchant reviewed completing the return without a cash refund (`expectedRefundAmountInCents` must be 0).",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRefundIntentMode"
              }
            ]
          },
          "expectedRefundAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The refund amount, in cents, the merchant reviewed: the saved amount shown when they chose to complete the return. Must be greater than 0 for CASH_REFUND and exactly 0 for NO_CASH_REFUND."
          }
        },
        "required": [
          "mode",
          "expectedRefundAmountInCents"
        ]
      },
      "ReturnNonStripeCompletionCandidateDto": {
        "type": "object",
        "properties": {
          "basisFingerprint": {
            "type": "string",
            "description": "Necessary source snapshot fingerprint. Current permission, exact reviewed payload and locked requalification are still required."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ZERO_CASH"
            ]
          },
          "refundIntent": {
            "$ref": "#/components/schemas/ReturnRefundIntentDto"
          },
          "priorGeneration": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED"
            ],
            "description": "Real lifecycle phase; no physical receipt is inferred for an all-waived Return."
          },
          "currency": {
            "type": "string"
          },
          "approvalRevisionNumber": {
            "type": "integer"
          }
        },
        "required": [
          "basisFingerprint",
          "outcome",
          "refundIntent",
          "priorGeneration",
          "status",
          "currency",
          "approvalRevisionNumber"
        ]
      },
      "ReturnNonStripeCompletionReceiptDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "returnId": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ZERO_CASH"
            ],
            "description": "Authoritative exact-zero completion. Does not assert a refund, reimbursement or provider action."
          },
          "amountInCents": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "Exact admitted amount; never inferred from missing or negative evidence."
          },
          "currency": {
            "type": "string",
            "description": "Currency of the preserved approval and exact completion basis."
          },
          "approvalRevisionNumber": {
            "type": "integer"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original atomic completion time, retained on replay and later real arrival."
          },
          "basisFingerprint": {
            "type": "string",
            "description": "Immutable admitted source fingerprint. A historical receipt is not a new action capability."
          }
        },
        "required": [
          "version",
          "returnId",
          "outcome",
          "amountInCents",
          "currency",
          "approvalRevisionNumber",
          "completedAt",
          "basisFingerprint"
        ]
      },
      "ReturnNonStripeCompletionPreparationDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "candidate": {
            "nullable": true,
            "description": "Null when current authoritative zero, physical coverage, publication, financial ownership or phase does not qualify, including unsupported positive manual/credit/exchange evidence. Null never proves zero or settlement. A candidate is necessary, and the command rechecks mutable facts under locks.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnNonStripeCompletionCandidateDto"
              }
            ]
          },
          "receipt": {
            "nullable": true,
            "description": "Original safe immutable deliberate completion result, or null when this command never completed the Return. Null does not deny legacy/Stripe completion or prove missing physical arrival.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnNonStripeCompletionReceiptDto"
              }
            ]
          }
        },
        "required": [
          "version",
          "candidate",
          "receipt"
        ]
      },
      "CompleteReturnNonStripeDto": {
        "type": "object",
        "properties": {
          "basisFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Exact candidate fingerprint from GET non-stripe-completion. Binds current tenant/financial owner, publication and keep lineage, lifecycle, items, quantities, components, amount/currency and rejected-generation evidence. Revalidated under owner locks."
          },
          "refundIntent": {
            "description": "The deliberately reviewed outcome. Only authoritative genuine zero is currently supported by this command; a positive draft or manual method label is not settlement evidence. Compared before qualification.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRefundIntentDto"
              }
            ]
          },
          "priorGeneration": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Exact failed no-money generation from the candidate, or 0 when none exists. Retains immutable historical generation/retry ownership."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Private deliberate completion reason. Approval and outcome recording remain separate actions."
          }
        },
        "required": [
          "basisFingerprint",
          "refundIntent",
          "priorGeneration",
          "reason"
        ]
      },
      "ReturnExactReceiptItemDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Return-item id whose intake outcome is being recorded."
          },
          "condition": {
            "type": "string",
            "enum": [
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "description": "Terminal inspection outcome. PENDING is intentionally excluded: receipt cannot complete until every line has an operator-recorded outcome."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 4000,
            "description": "Merchant intake notes. Pass null or an empty/whitespace-only value to clear the notes; the field must be present so omission cannot silently erase an existing note."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999999,
            "description": "Deliberately confirmed arrived quantity for this stable ReturnItem; must equal the current exact required-back allocation. No unit split or extra arrival is admitted."
          }
        },
        "required": [
          "returnItemId",
          "condition",
          "notes",
          "quantity"
        ]
      },
      "RecordReturnExactReceiptDto": {
        "type": "object",
        "properties": {
          "expectedApprovalRevision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Current version-3 complete physical approval revision reviewed for this ordinary receipt."
          },
          "items": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Exactly the physical-required subset. Empty is not an all-kept receipt; all-kept needs no invented physical intake.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnExactReceiptItemDto"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Merchant reason for deliberately confirming this ordinary physical receipt; retained privately in immutable evidence."
          }
        },
        "required": [
          "expectedApprovalRevision",
          "items",
          "reason"
        ]
      },
      "ReturnExactReceiptAllocationDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Stable ReturnItem identity of the original arrival."
          },
          "orderItemId": {
            "type": "string",
            "description": "Original order-item identity of the arrived merchandise."
          },
          "quantity": {
            "type": "integer",
            "description": "Exact confirmed arrived units, retained through later approval/cancellation."
          },
          "condition": {
            "type": "string",
            "enum": [
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ]
          },
          "inventoryDisposition": {
            "type": "string",
            "enum": [
              "RESTOCKED",
              "NOT_ELIGIBLE",
              "NOT_APPLICABLE"
            ],
            "description": "Arrival and sellable stock are separate facts; NOT_APPLICABLE retains owning Booking allocation."
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "quantity",
          "condition",
          "inventoryDisposition"
        ]
      },
      "ReturnExactReceiptResultDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "returnId": {
            "type": "string"
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "description": "Original receipt approval revision; replay never selects a newer revision."
          },
          "committedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original committed receipt time, preserved on replay after later lifecycle changes."
          },
          "allocations": {
            "description": "Original exact immutable arrival allocations. At least one required-back allocation; waived goods have a separate successor command.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnExactReceiptAllocationDto"
            }
          }
        },
        "required": [
          "version",
          "returnId",
          "approvalRevisionNumber",
          "committedAt",
          "allocations"
        ]
      },
      "ReturnProtectedArrivalItemDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Return-item id whose intake outcome is being recorded."
          },
          "condition": {
            "type": "string",
            "enum": [
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "description": "Terminal inspection outcome. PENDING is intentionally excluded: receipt cannot complete until every line has an operator-recorded outcome."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 4000,
            "description": "Merchant intake notes. Pass null or an empty/whitespace-only value to clear the notes; the field must be present so omission cannot silently erase an existing note."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999999,
            "description": "Deliberately confirmed arrived units for this waived whole line. Must match its exact retained keep grant; no unit split, additional parcel or ordinary required-back credit."
          }
        },
        "required": [
          "returnItemId",
          "condition",
          "notes",
          "quantity"
        ]
      },
      "ReturnArrivalProvenanceDto": {
        "type": "object",
        "properties": {
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Actual shipment time, strictly before the first published keep waiver. No carrier or tracking number is required."
          },
          "arrivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Actual arrival time, no earlier than shipment and no later than inspection."
          },
          "inspectedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Actual inspection time, no earlier than arrival and no later than capture."
          },
          "evidence": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "Private operator evidence for actual shipment, arrival and inspection; never a public explanation."
          }
        },
        "required": [
          "shippedAt",
          "arrivedAt",
          "inspectedAt",
          "evidence"
        ]
      },
      "RecordReturnProtectedArrivalDto": {
        "type": "object",
        "properties": {
          "expectedApprovalRevision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Current version-3 approval revision reviewed for capture; original revision is retained on exact committed replay."
          },
          "items": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Deliberately confirmed whole-line waived merchandise from this parcel. Counts must match exact retained keep grants; ordinary required-back allocations must be disjoint. No per-unit or extra-parcel receiving.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnProtectedArrivalItemDto"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Merchant reason for deliberately recording this protected waived-parcel arrival; retained privately in immutable evidence. This does not establish an ordinary required-back receipt."
          },
          "provenance": {
            "description": "Deliberately confirmed provenance for the bounded shipped-before-waiver parcel. Missing legacy facts cannot be reconstructed from status or stock markers.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnArrivalProvenanceDto"
              }
            ]
          }
        },
        "required": [
          "expectedApprovalRevision",
          "items",
          "reason",
          "provenance"
        ]
      },
      "ReturnProtectedArrivalAllocationDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Stable ReturnItem identity of the original arrival."
          },
          "orderItemId": {
            "type": "string",
            "description": "Original order-item identity of the arrived merchandise."
          },
          "quantity": {
            "type": "integer",
            "description": "Exact confirmed arrived units, retained through later approval/cancellation."
          },
          "condition": {
            "type": "string",
            "enum": [
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ]
          },
          "inventoryDisposition": {
            "type": "string",
            "enum": [
              "RESTOCKED",
              "NOT_ELIGIBLE"
            ],
            "description": "Actual sellable-stock credit or damage/write-off exclusion. Booking allocations are not admitted by the protected-arrival operation."
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "quantity",
          "condition",
          "inventoryDisposition"
        ]
      },
      "ReturnProtectedArrivalResultDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "returnId": {
            "type": "string"
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "description": "Original receipt approval revision; replay never selects a newer revision."
          },
          "committedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original committed receipt time, preserved on replay after later lifecycle changes."
          },
          "allocations": {
            "description": "Original immutable protected waived-arrival allocations and actual inventory outcomes. These never establish required-back completeness.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnProtectedArrivalAllocationDto"
            }
          },
          "arrivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original actual arrival time. This fact does not imply Received, completion, money movement or reopened shipping."
          }
        },
        "required": [
          "version",
          "returnId",
          "approvalRevisionNumber",
          "committedAt",
          "allocations",
          "arrivedAt"
        ]
      },
      "MerchantReturnLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "returnId": {
            "type": "string",
            "format": "uuid"
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid",
            "description": "The order line this return claims."
          },
          "quantity": {
            "type": "number",
            "example": 1
          },
          "condition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "example": "PENDING"
          },
          "lineRefundInCents": {
            "type": "number",
            "example": 0,
            "description": "Refund attributed to this line, in minor units."
          },
          "refundTaxComponentKey": {
            "type": "string",
            "nullable": true,
            "description": "Frozen original Stripe Tax component key used for refund reversal, or `null` when the component was excluded."
          },
          "refundTaxProviderExcluded": {
            "type": "boolean",
            "description": "Whether the frozen component was deliberately excluded from the original Stripe Tax calculation."
          },
          "refundComponentTaxInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Original frozen component tax, in minor units."
          },
          "intakeNotes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant intake notes, or `null`."
          },
          "restockDisposition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESTOCKED",
              "NOT_ELIGIBLE",
              "NOT_APPLICABLE"
            ],
            "description": "Terminal retail-restock outcome. NOT_APPLICABLE means a booking/rental line returned through the booking capacity workflow and did not mutate Inventory."
          },
          "restockedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When this line was restocked, or `null`."
          },
          "restockedInventoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Inventory row this line restocked to, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "returnId",
          "orderItemId",
          "quantity",
          "condition",
          "lineRefundInCents",
          "refundTaxComponentKey",
          "refundTaxProviderExcluded",
          "refundComponentTaxInCents",
          "intakeNotes",
          "restockDisposition",
          "restockedAt",
          "restockedInventoryId",
          "createdAt",
          "updatedAt"
        ]
      },
      "MerchantReturnOrderRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "orderNumber": {
            "type": "string",
            "example": "ACME-2026-042"
          },
          "customerEmail": {
            "type": "string",
            "format": "email"
          },
          "customerName": {
            "type": "string",
            "description": "Buyer name on the order."
          }
        },
        "required": [
          "id",
          "orderNumber",
          "customerEmail",
          "customerName"
        ]
      },
      "MerchantReturnStaffCreatorDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "The team member’s user id."
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "Their profile name, or `null` when their profile has none, they no longer belong to this store, or names cannot be read right now."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "When they started the return."
          }
        },
        "required": [
          "userId",
          "name",
          "createdAt"
        ]
      },
      "MerchantReturnRefundExceptionSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLAIMED",
              "FINANCIALLY_REMEDIATED",
              "CLOSED"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1
          },
          "reimbursedInCents": {
            "type": "integer",
            "minimum": 0
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "providerReconciliationRequiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "status",
          "amountInCents",
          "reimbursedInCents",
          "amountOwedInCents",
          "currency",
          "providerReconciliationRequiredAt"
        ]
      },
      "MerchantReturnListItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "customerEmail": {
            "type": "string",
            "format": "email"
          },
          "customerName": {
            "type": "string",
            "nullable": true,
            "description": "Buyer name, or `null`."
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "internalNotes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-internal notes, or `null`."
          },
          "refundAmountInCents": {
            "type": "number",
            "example": 0,
            "description": "Refund to the customer, in minor units."
          },
          "restockingFeeInCents": {
            "type": "number",
            "example": 0
          },
          "stripeRefundId": {
            "type": "string",
            "nullable": true,
            "description": "Stripe refund id, or `null`."
          },
          "refundedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "refundFailedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "refundError": {
            "type": "string",
            "nullable": true,
            "description": "Last refund failure message, or `null`."
          },
          "requestedAt": {
            "format": "date-time",
            "type": "string"
          },
          "reviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reviewedById": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Reviewer user id, or `null`."
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnLineDto"
            }
          },
          "order": {
            "$ref": "#/components/schemas/MerchantReturnOrderRefDto"
          },
          "origin": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "STAFF"
            ],
            "description": "`STAFF` when a team member started this return from Admin on the customer's behalf. `CUSTOMER` when it was requested through a customer channel (the account, an emailed return link or the order-email form); every return created before team members could start one is `CUSTOMER`."
          },
          "createdByStaff": {
            "nullable": true,
            "description": "Who started the return; `null` exactly when `origin` is `CUSTOMER`.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnStaffCreatorDto"
              }
            ]
          },
          "refundException": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnRefundExceptionSummaryDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "orderId",
          "customerEmail",
          "customerName",
          "status",
          "reason",
          "internalNotes",
          "refundAmountInCents",
          "restockingFeeInCents",
          "stripeRefundId",
          "refundedAt",
          "refundFailedAt",
          "refundError",
          "requestedAt",
          "reviewedAt",
          "reviewedById",
          "receivedAt",
          "completedAt",
          "createdAt",
          "updatedAt",
          "items",
          "order",
          "origin",
          "createdByStaff",
          "refundException"
        ]
      },
      "CreateMerchantReturnDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "description": "The order to start the return on. Must belong to the caller's active organization.",
            "minLength": 1,
            "maxLength": 200
          },
          "items": {
            "description": "Lines to return. 1-50 entries; lines naming the same order item are combined. Each quantity must fit within the units handed off on that line minus units already on active returns, exactly as for a customer request.",
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateReturnItemDto"
            }
          },
          "reason": {
            "type": "string",
            "description": "Optional reason. The customer sees it as noted by the store, in the return-requested email and on their account. Not for internal notes. Surrounding whitespace is trimmed; blank means no reason.",
            "maxLength": 4000
          }
        },
        "required": [
          "orderId",
          "items"
        ]
      },
      "MerchantReturnPhysicalLineDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string"
          },
          "orderItemId": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "quantity"
        ]
      },
      "MerchantReturnKeepPromiseDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "Exact revision that first granted this quantity; later grants do not rewrite earlier promises."
          }
        },
        "required": [
          "orderItemId",
          "quantity",
          "approvalRevisionNumber"
        ]
      },
      "MerchantReturnPhysicalFactsDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "requiredLines": {
            "description": "Exact current required-back allocation; empty means all current approved goods are waived. It does not prove no historical arrivals or keep grants.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnPhysicalLineDto"
            }
          },
          "keepPromises": {
            "description": "Immutable cumulative keep-quantity grants at each granting revision. Use the maximum per item, never the sum. Empty means none were published; untruncated history, not current stock or arrival.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnKeepPromiseDto"
            }
          },
          "receiptCoverage": {
            "type": "string",
            "enum": [
              "EXACT",
              "UNAVAILABLE",
              "NOT_CAPTURED"
            ],
            "description": "Ordinary receipt coverage only. UNAVAILABLE means historical counts cannot be proved; NOT_CAPTURED means no ordinary receipt, not no protected arrival. Open-ended: treat unknown values as unavailable."
          },
          "arrivedLines": {
            "description": "Exact disjoint ordinary/protected actual arrivals. Empty means no captured exact arrivals, not inferred zero for unavailable legacy coverage.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnExactReceiptAllocationDto"
            }
          },
          "ordinaryReceipt": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReturnExactReceiptResultDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Original committed ordinary result; null means no exact committed ordinary receipt, not zero arrival. Private operation material is excluded."
          },
          "protectedArrival": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReturnProtectedArrivalResultDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Original committed protected result; null means no protected capture, never proof goods remain with the customer."
          },
          "refundReadiness": {
            "type": "string",
            "enum": [
              "QUALIFIED",
              "WAITING_FOR_REQUIRED_GOODS",
              "UNAVAILABLE",
              "TERMINAL"
            ],
            "description": "Necessary physical/publication qualification only. Commands still recheck capacity, financial source/ownership, permission and frozen operations; this never proves settlement. Open-ended: treat unknown values as unavailable."
          }
        },
        "required": [
          "version",
          "approvalRevisionNumber",
          "requiredLines",
          "keepPromises",
          "receiptCoverage",
          "arrivedLines",
          "ordinaryReceipt",
          "protectedArrival",
          "refundReadiness"
        ]
      },
      "MerchantReturnLineOrderItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "Trail Tent 2P"
          },
          "quantity": {
            "type": "number",
            "example": 2
          },
          "unitPriceInCents": {
            "type": "number",
            "example": 14900
          },
          "totalPriceInCents": {
            "type": "number",
            "example": 29800
          }
        },
        "required": [
          "id",
          "name",
          "quantity",
          "unitPriceInCents",
          "totalPriceInCents"
        ]
      },
      "MerchantReturnDetailLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "returnId": {
            "type": "string",
            "format": "uuid"
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid",
            "description": "The order line this return claims."
          },
          "quantity": {
            "type": "number",
            "example": 1
          },
          "condition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "example": "PENDING"
          },
          "lineRefundInCents": {
            "type": "number",
            "example": 0,
            "description": "Refund attributed to this line, in minor units."
          },
          "refundTaxComponentKey": {
            "type": "string",
            "nullable": true,
            "description": "Frozen original Stripe Tax component key used for refund reversal, or `null` when the component was excluded."
          },
          "refundTaxProviderExcluded": {
            "type": "boolean",
            "description": "Whether the frozen component was deliberately excluded from the original Stripe Tax calculation."
          },
          "refundComponentTaxInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Original frozen component tax, in minor units."
          },
          "intakeNotes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant intake notes, or `null`."
          },
          "restockDisposition": {
            "type": "string",
            "enum": [
              "PENDING",
              "RESTOCKED",
              "NOT_ELIGIBLE",
              "NOT_APPLICABLE"
            ],
            "description": "Terminal retail-restock outcome. NOT_APPLICABLE means a booking/rental line returned through the booking capacity workflow and did not mutate Inventory."
          },
          "restockedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When this line was restocked, or `null`."
          },
          "restockedInventoryId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Inventory row this line restocked to, or `null`."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "orderItem": {
            "$ref": "#/components/schemas/MerchantReturnLineOrderItemDto"
          }
        },
        "required": [
          "id",
          "returnId",
          "orderItemId",
          "quantity",
          "condition",
          "lineRefundInCents",
          "refundTaxComponentKey",
          "refundTaxProviderExcluded",
          "refundComponentTaxInCents",
          "intakeNotes",
          "restockDisposition",
          "restockedAt",
          "restockedInventoryId",
          "createdAt",
          "updatedAt",
          "orderItem"
        ]
      },
      "MerchantReturnOrderContextDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "orderNumber": {
            "type": "string",
            "example": "ACME-2026-042"
          },
          "customerEmail": {
            "type": "string",
            "format": "email"
          },
          "customerName": {
            "type": "string",
            "description": "Buyer name on the order."
          },
          "subtotalInCents": {
            "type": "number",
            "example": 29800
          },
          "discountInCents": {
            "type": "number",
            "example": 0
          },
          "taxInCents": {
            "type": "number",
            "example": 1788
          },
          "totalInCents": {
            "type": "number",
            "example": 31588
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED",
              "CANCELLED"
            ],
            "example": "CONFIRMED"
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED"
            ],
            "example": "UNFULFILLED"
          }
        },
        "required": [
          "id",
          "orderNumber",
          "customerEmail",
          "customerName",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "status",
          "fulfillmentStatus"
        ]
      },
      "MerchantReturnRefundWorkflowDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "READY",
              "PROCESSING",
              "NEEDS_ATTENTION",
              "SUCCEEDED",
              "REFUND_REVERSED_NEEDS_REIMBURSEMENT",
              "REFUND_REVERSAL_RECONCILIATION_REQUIRED",
              "RESOLUTION_PENDING",
              "RESOLVED"
            ]
          },
          "latestGeneration": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          },
          "retryAvailable": {
            "type": "boolean",
            "description": "True when the Return remains RECEIVED and its latest generation is durably rejected with no-money proof and an acknowledged processing event, so a generation-backed retry command is structurally available. This is not authorization: mutable Return/order, capacity, generation-chain, audit, and ownership facts are revalidated atomically when the command runs."
          },
          "problemCode": {
            "type": "string",
            "enum": [
              "PROCESSING_UNAVAILABLE",
              "PROVIDER_REJECTED",
              "RECONCILIATION_REQUIRED",
              "STATE_INCONSISTENT"
            ],
            "nullable": true,
            "description": "Stable merchant-safe reason when state is NEEDS_ATTENTION; null otherwise."
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Current alternative-reimbursement obligation in minor units, or null when no post-success refund exception exists."
          }
        },
        "required": [
          "state",
          "latestGeneration",
          "retryAvailable",
          "problemCode",
          "amountOwedInCents"
        ]
      },
      "ReturnRefundRemediationMethod": {
        "type": "string",
        "enum": [
          "CASH",
          "CHECK",
          "BANK_TRANSFER",
          "STORE_CREDIT",
          "OTHER"
        ]
      },
      "MerchantReturnRefundRemediationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "method": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRefundRemediationMethod"
              }
            ]
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "occurredAt": {
            "format": "date-time",
            "type": "string"
          },
          "reference": {
            "type": "string",
            "nullable": true
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "ledgerStatus": {
            "type": "string",
            "enum": [
              "COMPLETED",
              "FAILED",
              "VOIDED"
            ],
            "nullable": true
          },
          "taxReversalStatus": {
            "type": "string",
            "nullable": true
          },
          "taxReversalAdmissionStatus": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "method",
          "amountInCents",
          "currency",
          "occurredAt",
          "reference",
          "actorUserId",
          "createdAt",
          "ledgerStatus",
          "taxReversalStatus",
          "taxReversalAdmissionStatus"
        ]
      },
      "MerchantReturnRefundNotificationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "CORRECTION",
              "RESOLUTION",
              "COMBINED"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "BLOCKED",
              "READY",
              "PROVIDER_IN_FLIGHT",
              "PROVIDER_ACCEPTED",
              "DEFINITIVELY_NOT_ACCEPTED",
              "SUPERSEDED"
            ]
          },
          "admittedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "terminalAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "admittedAt",
          "terminalAt",
          "createdAt"
        ]
      },
      "MerchantReturnRefundTaxCorrectionDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUPPRESSION_PENDING",
              "SUPPRESSED",
              "NO_CALL",
              "AWAITING_ORIGINAL_OUTCOME",
              "COMPENSATION_READY",
              "COMPENSATION_IN_FLIGHT",
              "COMPENSATED",
              "RECONCILIATION_REQUIRED"
            ]
          },
          "noCallDisposition": {
            "type": "string",
            "nullable": true
          },
          "providerHandoffStartedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "status",
          "noCallDisposition",
          "providerHandoffStartedAt",
          "completedAt"
        ]
      },
      "ReturnRefundClosureBlocker": {
        "type": "string",
        "enum": [
          "PROVIDER_RECONCILIATION_REQUIRED",
          "REIMBURSEMENT_OUTSTANDING",
          "REIMBURSEMENT_LEDGER_RECONCILIATION_REQUIRED",
          "CUSTOMER_NOTICE_PENDING",
          "CUSTOMER_NOTICE_RECONCILIATION_REQUIRED",
          "TAX_ADJUSTMENT_PENDING",
          "TAX_ADJUSTMENT_RECONCILIATION_REQUIRED"
        ],
        "description": "Why this exception has not closed, derived from its own rows by the same predicate the closer enforces. Empty for a FINANCIALLY_REMEDIATED case exactly when it may close now; empty once CLOSED except PROVIDER_RECONCILIATION_REQUIRED when a later contradictory provider observation was recorded after closure. Stable order; clients own the merchant copy."
      },
      "MerchantReturnRefundExceptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLAIMED",
              "FINANCIALLY_REMEDIATED",
              "CLOSED"
            ]
          },
          "providerStatus": {
            "type": "string",
            "example": "failed"
          },
          "latestProviderStatus": {
            "type": "string",
            "example": "failed"
          },
          "providerReconciliationRequiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failureReason": {
            "type": "string",
            "nullable": true
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1
          },
          "reimbursedInCents": {
            "type": "integer",
            "minimum": 0
          },
          "amountOwedInCents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "claimedByUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "claimedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "financiallyRemediatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "closedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "remediations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnRefundRemediationDto"
            }
          },
          "notifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnRefundNotificationDto"
            }
          },
          "taxCorrection": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnRefundTaxCorrectionDto"
              }
            ]
          },
          "closureBlockers": {
            "type": "array",
            "description": "Why this exception has not closed, derived from its own rows by the same predicate the closer enforces. Empty for a FINANCIALLY_REMEDIATED case exactly when it may close now; empty once CLOSED except PROVIDER_RECONCILIATION_REQUIRED when a later contradictory provider observation was recorded after closure. Stable order; clients own the merchant copy.",
            "items": {
              "$ref": "#/components/schemas/ReturnRefundClosureBlocker"
            }
          }
        },
        "required": [
          "id",
          "status",
          "providerStatus",
          "latestProviderStatus",
          "providerReconciliationRequiredAt",
          "failureReason",
          "amountInCents",
          "reimbursedInCents",
          "amountOwedInCents",
          "currency",
          "claimedByUserId",
          "claimedAt",
          "financiallyRemediatedAt",
          "closedAt",
          "createdAt",
          "remediations",
          "notifications",
          "taxCorrection",
          "closureBlockers"
        ]
      },
      "MerchantReturnRefundableCapAvailabilityDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "description": "AVAILABLE means `refundableCapInCents` is the enforced ceiling. UNAVAILABLE means refund execution would refuse a positive refund for this return today, so `refundableCapInCents` is 0 and is not a ceiling: a zero refund amount can still be saved, and a positive one is refused with 409 and the same reason. Open-ended: treat unknown values as UNAVAILABLE.",
            "x-extensible-enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ]
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "Why the cap is unavailable: refund execution's own refusal code, or `RETURN_REFUND_COMPONENT_LINE_CHARGE_MISSING` for a returned line whose checkout froze no per-line charge (DR-5851-02). Null exactly when availability is AVAILABLE. Open-ended: new codes may be added; use `resolution` to act on one.",
            "x-extensible-enum": [
              "RETURN_REFUND_COMPONENT_MIRROR_PENDING",
              "RETURN_REFUND_COMPONENT_LINE_PENDING",
              "REFUND_COMPONENT_TAX_TRANSACTION_PENDING",
              "REFUND_COMPONENT_TAX_EVIDENCE_RECONCILIATION_REQUIRED",
              "REFUND_COMPONENT_REVISION_MISSING",
              "REFUND_COMPONENT_TOTAL_DRIFT",
              "REFUND_COMPONENT_TAX_EVIDENCE_MISMATCH",
              "REFUND_COMPONENT_TAX_REFERENCE_MISSING",
              "REFUND_COMPONENT_PRICING_SNAPSHOT_INVALID",
              "RETURN_REFUND_COMPONENT_LINE_CHARGE_MISSING"
            ]
          },
          "resolution": {
            "type": "string",
            "nullable": true,
            "description": "What clears the refusal: WAITING for a tax filing that is still recording, RECONCILIATION of the order’s evidence or ownership, or REPAIR of its frozen evidence. Null exactly when availability is AVAILABLE. Open-ended: treat unknown values as REPAIR.",
            "x-extensible-enum": [
              "WAITING",
              "RECONCILIATION",
              "REPAIR"
            ]
          }
        },
        "required": [
          "availability",
          "reason",
          "resolution"
        ]
      },
      "MerchantReturnDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "customerEmail": {
            "type": "string",
            "format": "email"
          },
          "customerName": {
            "type": "string",
            "nullable": true,
            "description": "Buyer name, or `null`."
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "example": "REQUESTED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "example": "Wrong size"
          },
          "internalNotes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-internal notes, or `null`."
          },
          "refundAmountInCents": {
            "type": "number",
            "example": 0,
            "description": "Refund to the customer, in minor units."
          },
          "restockingFeeInCents": {
            "type": "number",
            "example": 0
          },
          "stripeRefundId": {
            "type": "string",
            "nullable": true,
            "description": "Stripe refund id, or `null`."
          },
          "refundedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "refundFailedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "refundError": {
            "type": "string",
            "nullable": true,
            "description": "Last refund failure message, or `null`."
          },
          "requestedAt": {
            "format": "date-time",
            "type": "string"
          },
          "reviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reviewedById": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Reviewer user id, or `null`."
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "physicalFacts": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnPhysicalFactsDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Exact physical source in the lifecycle/workflow snapshot. Null means no version-3 source or its exact physical mapping is unavailable; never infer a waiver, receipt, zero or settlement."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnDetailLineDto"
            }
          },
          "order": {
            "$ref": "#/components/schemas/MerchantReturnOrderContextDto"
          },
          "origin": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "STAFF"
            ],
            "description": "`STAFF` when a team member started this return from Admin on the customer's behalf. `CUSTOMER` when it was requested through a customer channel (the account, an emailed return link or the order-email form); every return created before team members could start one is `CUSTOMER`."
          },
          "createdByStaff": {
            "nullable": true,
            "description": "Who started the return; `null` exactly when `origin` is `CUSTOMER`.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnStaffCreatorDto"
              }
            ]
          },
          "refundWorkflow": {
            "$ref": "#/components/schemas/MerchantReturnRefundWorkflowDto"
          },
          "refundException": {
            "nullable": true,
            "description": "Operator-visible post-success refund exception and its independent money, notification, and tax obligations.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnRefundExceptionDto"
              }
            ]
          },
          "refundableCapInCents": {
            "type": "number",
            "example": 29800,
            "description": "Server-computed refundable ceiling: what refund execution can pay for the returned items, from each line's frozen checkout components (tax included) at the returned quantity and never more than what checkout charged that line (DR-5851-02), less what earlier payments and other returns already allocated, clamped to the order balance after sibling returns. Prefills/bounds the refund-amount input when `refundableCapAvailability.availability` is AVAILABLE. When it is UNAVAILABLE this is 0 and bounds nothing: execution would refuse any positive refund until the stated reason clears."
          },
          "refundableCapAvailability": {
            "$ref": "#/components/schemas/MerchantReturnRefundableCapAvailabilityDto"
          }
        },
        "required": [
          "id",
          "organizationId",
          "orderId",
          "customerEmail",
          "customerName",
          "status",
          "reason",
          "internalNotes",
          "refundAmountInCents",
          "restockingFeeInCents",
          "stripeRefundId",
          "refundedAt",
          "refundFailedAt",
          "refundError",
          "requestedAt",
          "reviewedAt",
          "reviewedById",
          "receivedAt",
          "completedAt",
          "createdAt",
          "updatedAt",
          "physicalFacts",
          "items",
          "order",
          "origin",
          "createdByStaff",
          "refundWorkflow",
          "refundException",
          "refundableCapInCents",
          "refundableCapAvailability"
        ]
      },
      "MerchantOrderReturnLineDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "format": "uuid",
            "description": "The order line."
          },
          "name": {
            "type": "string",
            "example": "Trail Tent 2P",
            "description": "The frozen line name."
          },
          "orderedQuantity": {
            "type": "integer",
            "minimum": 1,
            "example": 2
          },
          "eligibleQuantity": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "example": 1,
            "description": "Units that can still be returned: handed off to a carrier or the customer, minus units already on active returns. `null` means the handoff ledger could not establish it for this order; it never means zero. A snapshot only — `POST /merchant/returns` re-checks under the order lock."
          }
        },
        "required": [
          "orderItemId",
          "name",
          "orderedQuantity",
          "eligibleQuantity"
        ]
      },
      "MerchantOrderReturnsDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "orderNumber": {
            "type": "string",
            "example": "ACME-2026-042"
          },
          "returns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnListItemDto"
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantOrderReturnLineDto"
            }
          }
        },
        "required": [
          "orderId",
          "orderNumber",
          "returns",
          "lines"
        ]
      },
      "MerchantReturnEvidenceLineDto": {
        "type": "object",
        "properties": {
          "sourceLineId": {
            "type": "string",
            "description": "Immutable source-platform line identity."
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid"
          },
          "itemName": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "sourceLineId",
          "orderItemId",
          "itemName",
          "quantity"
        ]
      },
      "MerchantReturnEvidencePackageDto": {
        "type": "object",
        "properties": {
          "sourceShipmentId": {
            "type": "string"
          },
          "sourcePackageId": {
            "type": "string"
          },
          "terminalStatus": {
            "type": "string",
            "enum": [
              "SHIPPED",
              "DELIVERED"
            ]
          },
          "handedOffAt": {
            "type": "string",
            "format": "date-time"
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnEvidenceLineDto"
            }
          }
        },
        "required": [
          "sourceShipmentId",
          "sourcePackageId",
          "terminalStatus",
          "handedOffAt",
          "deliveredAt",
          "lines"
        ]
      },
      "MerchantReturnEvidenceReconciliationDto": {
        "type": "object",
        "properties": {
          "reconciledAt": {
            "format": "date-time",
            "type": "string"
          },
          "evidenceFingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "required": [
          "reconciledAt",
          "evidenceFingerprint"
        ]
      },
      "MerchantReturnEvidenceDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "orderNumber": {
            "type": "string"
          },
          "sourceSystem": {
            "type": "string",
            "nullable": true
          },
          "sourceOrderId": {
            "type": "string",
            "nullable": true
          },
          "posture": {
            "type": "string",
            "enum": [
              "REBUILDABLE",
              "RECONCILIATION_REQUIRED",
              "INSUFFICIENT"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ALREADY_CANONICAL",
                "COMMERCE_RECORD_MISSING",
                "COMMERCE_RECORD_AMBIGUOUS",
                "ORDER_ITEM_LINK_MISSING",
                "ORDER_ITEM_LINK_AMBIGUOUS",
                "LEDGER_MIXED_OR_INVALID",
                "TERMINAL_AGGREGATE_MISSING",
                "EVIDENCE_MISSING",
                "EVIDENCE_MALFORMED",
                "EVIDENCE_VERSION_UNSUPPORTED",
                "SOURCE_IDENTITY_MISMATCH",
                "TERMINAL_STATUS_MISMATCH",
                "TERMINAL_TIMESTAMP_MISMATCH",
                "SOURCE_LINE_UNKNOWN",
                "SOURCE_QUANTITY_EXCEEDS_ORDER",
                "SOURCE_QUANTITY_OVERLAPS_LEDGER",
                "RETURN_ACTIVITY_PRESENT",
                "ORDER_CANCELLATION_ACTIVE"
              ]
            }
          },
          "canReconcile": {
            "type": "boolean",
            "description": "True only when exact machine evidence can be normalized by an Owner/Admin."
          },
          "evidenceFingerprint": {
            "type": "string",
            "nullable": true,
            "pattern": "^[0-9a-f]{64}$",
            "description": "Present only for a currently reconcilable exact evidence snapshot."
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnEvidencePackageDto"
            }
          },
          "latestReconciliation": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnEvidenceReconciliationDto"
              }
            ]
          }
        },
        "required": [
          "orderId",
          "orderNumber",
          "sourceSystem",
          "sourceOrderId",
          "posture",
          "reasons",
          "canReconcile",
          "evidenceFingerprint",
          "packages",
          "latestReconciliation"
        ]
      },
      "ReconcileMerchantReturnEvidenceDto": {
        "type": "object",
        "properties": {
          "confirmation": {
            "type": "string",
            "example": "RECONCILE_IMPORTED_HANDOFF_EVIDENCE",
            "enum": [
              "RECONCILE_IMPORTED_HANDOFF_EVIDENCE"
            ]
          },
          "evidenceFingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Exact fingerprint returned by the latest evidence classification."
          }
        },
        "required": [
          "confirmation",
          "evidenceFingerprint"
        ]
      },
      "ReturnIntakeItemDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "description": "Return-item id whose intake outcome is being recorded."
          },
          "condition": {
            "type": "string",
            "enum": [
              "RESELLABLE",
              "DAMAGED",
              "WRITE_OFF"
            ],
            "description": "Terminal inspection outcome. PENDING is intentionally excluded: receipt cannot complete until every line has an operator-recorded outcome."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 4000,
            "description": "Merchant intake notes. Pass null or an empty/whitespace-only value to clear the notes; the field must be present so omission cannot silently erase an existing note."
          }
        },
        "required": [
          "returnItemId",
          "condition",
          "notes"
        ]
      },
      "UpdateReturnStatusDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ],
            "description": "Target return status. APPROVED requests return 409 RESOURCE_CONFLICT with details.reason RETURN_FIRST_APPROVAL_COMMAND_REQUIRED and change nothing. Use POST /merchant/returns/:id/first-approval with a complete publication or explicit confirmation of the current complete revision. Allowed status-only transitions: REQUESTED → {REJECTED, CANCELLED}, APPROVED → {IN_TRANSIT, CANCELLED}, IN_TRANSIT → {RECEIVED, CANCELLED}, RECEIVED → COMPLETED. COMPLETED, REJECTED, CANCELLED are terminal."
          },
          "items": {
            "minItems": 1,
            "maxItems": 50,
            "description": "Optional intake outcomes applied atomically with an IN_TRANSIT → RECEIVED transition. Rejected for every other target status. Existing durable outcomes may be omitted; every line must be non-PENDING after the supplied updates are applied.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnIntakeItemDto"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Required for RECEIVED. Captured with condition and restock audit evidence."
          },
          "refundIntent": {
            "description": "Optional; accepted only with status COMPLETED. The refund amount and mode the merchant reviewed. The server compares them with the amount it would act on — the saved refund draft or, once a refund generation exists, its frozen amount — under the same lock that draft edits take. A mismatch returns 409 `RESOURCE_CONFLICT` with `details.reason` `RETURN_REFUND_INTENT_STALE` (plus `details.expected` and `details.current`) and starts no refund, retry or completion. A request that matches, including an identical replay or retry, behaves exactly as without this field. When omitted, the command runs without this check and acts on the saved draft as it stands at that moment. `null` is rejected rather than treated as omitted.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRefundIntentDto"
              }
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "UpdateReturnIntakeDto": {
        "type": "object",
        "properties": {
          "items": {
            "minItems": 1,
            "maxItems": 50,
            "description": "One or more return-item outcomes. Item ids must be unique and belong to the return.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnIntakeItemDto"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Operator reason captured in audit metadata for the condition decision."
          }
        },
        "required": [
          "items",
          "reason"
        ]
      },
      "ReturnRefundItemCapDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "format": "uuid"
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Frozen order-item name, for operator display."
          },
          "componentKey": {
            "type": "string",
            "description": "Frozen Sales component backing this item. Echoed in capacity errors."
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "description": "Quantity being returned on this item."
          },
          "orderItemQuantity": {
            "type": "integer",
            "format": "int32",
            "description": "Quantity originally ordered, used to prorate the cap."
          },
          "grossAmountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total gross cents of the frozen Sales line."
          },
          "allocatedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross cents already consumed by active refund allocations and sibling returns against the same order item."
          },
          "capInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Maximum cents allocatable to this item: the quantity-prorated line total, capped by what remains after prior allocations, and never more than the same share of what checkout charged the line (DR-5851-02). An `allocations[]` entry above this is rejected with RETURN_REFUND_COMPONENT_CAPACITY_EXCEEDED."
          }
        },
        "required": [
          "returnItemId",
          "orderItemId",
          "name",
          "componentKey",
          "quantity",
          "orderItemQuantity",
          "grossAmountInCents",
          "allocatedInCents",
          "capInCents"
        ]
      },
      "ReturnRefundAllocationPreparationDto": {
        "type": "object",
        "properties": {
          "items": {
            "description": "Return items that can receive refund cents, including any whose cap is currently 0 so the operator can see where capacity went.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnRefundItemCapDto"
            }
          },
          "pendingReturnItemIds": {
            "description": "Return items whose frozen Sales line has not reconciled yet. They cannot be allocated against; allocating to one is rejected with RETURN_REFUND_COMPONENT_LINE_PENDING. Retry after order reconciliation.",
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "items",
          "pendingReturnItemIds"
        ]
      },
      "ReturnRefundItemAllocationDto": {
        "type": "object",
        "properties": {
          "returnItemId": {
            "type": "string",
            "format": "uuid",
            "description": "ReturnItem receiving this exact gross refund amount."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Gross cents returned against this item, including its attributed tax."
          }
        },
        "required": [
          "returnItemId",
          "amountInCents"
        ]
      },
      "UpdateReturnRefundAmountDto": {
        "type": "object",
        "properties": {
          "refundAmountInCents": {
            "type": "integer",
            "description": "Refund amount in cents. Non-negative integer; validated server-side to be <= the return's refundable cap (returned line totals + attributed order tax). This endpoint only records the amount — 0 means no cash refund will be issued when the return is later marked COMPLETED.",
            "format": "int32",
            "minimum": 0,
            "example": 2599
          },
          "allocations": {
            "minItems": 0,
            "maxItems": 50,
            "description": "Operator-specified per-item allocation. Required and non-empty when refundAmountInCents is positive; amounts must sum exactly. Use [] when the refund amount is 0.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnRefundItemAllocationDto"
            }
          }
        },
        "required": [
          "refundAmountInCents",
          "allocations"
        ]
      },
      "ReturnApprovalItemOutcomeDto": {
        "type": "object",
        "properties": {
          "physicalDisposition": {
            "type": "string",
            "nullable": true,
            "enum": [
              "PHYSICAL_RETURN_REQUIRED",
              "NO_PHYSICAL_RETURN_REQUIRED",
              null
            ],
            "description": "Version-3 physical disposition. If supplied on any line, every approved line must choose one disposition and refused lines must carry null. Omission retains version 2 and proves no keep promise. A published keep promise is immutable."
          },
          "orderItemId": {
            "type": "string",
            "description": "One original requested order line. Every requested line must appear exactly once."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVED",
              "NOT_APPROVED"
            ]
          },
          "approvedQuantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 999999,
            "description": "Positive approved units, or exactly zero for NOT_APPROVED. Never more than requested."
          },
          "approvedAmountInCents": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Explicit approved refund in minor units, including genuine zero. Exactly null for NOT_APPROVED; never historical paid value."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "UNAVAILABLE"
            ],
            "description": "COMPLETE requires the item-scoped components to reconcile to this amount. UNAVAILABLE has none; always UNAVAILABLE for NOT_APPROVED."
          },
          "customerNote": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000,
            "description": "Customer-safe item explanation. Required for refusal, reduced quantity, a below-comparator amount or unavailable comparison; null otherwise. Internal notes are never substituted."
          }
        },
        "required": [
          "orderItemId",
          "outcome",
          "approvedQuantity",
          "approvedAmountInCents",
          "breakdownStatus"
        ]
      },
      "MerchantReturnMoneyComponentDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ITEM",
              "DISCOUNT",
              "TAX",
              "WITHHOLDING",
              "SHIPPING"
            ]
          },
          "effect": {
            "type": "string",
            "enum": [
              "ADD",
              "SUBTRACT",
              "INCLUDED"
            ],
            "description": "How this component contributes to the total. ITEM and SHIPPING ADD; DISCOUNT and WITHHOLDING SUBTRACT; TAX either ADDs or is INCLUDED (disclosed inside item amounts and never added twice)."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Non-negative magnitude in minor units; `effect` gives the sign."
          },
          "orderItemId": {
            "type": "string",
            "nullable": true,
            "description": "Order line this component belongs to; `null` for a return-level component."
          }
        },
        "required": [
          "kind",
          "effect",
          "amountInCents",
          "orderItemId"
        ]
      },
      "MerchantReturnApprovalRevisionDto": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "type": "integer",
            "enum": [
              1,
              2,
              3
            ],
            "description": "1 is immutable aggregate-only history. 2 records complete item outcomes. 3 also records per-line physical dispositions and immutable keep lineage."
          },
          "itemOutcomes": {
            "nullable": true,
            "description": "Complete item decisions for versions 2 and 3; null for legacy aggregate-only revisions. Legacy history is never enriched or divided into invented amounts.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalItemOutcomeDto"
            }
          },
          "id": {
            "type": "string",
            "description": "Revision id (internal identity)."
          },
          "revisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "predecessorRevisionId": {
            "type": "string",
            "nullable": true,
            "description": "The revision this one replaced; `null` only for revision 1."
          },
          "approvedAmountInCents": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "example": "usd",
            "description": "Lowercase ISO 4217 code of the order’s historical denomination."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "INCOMPLETE",
              "UNAVAILABLE"
            ],
            "description": "COMPLETE when the publication carried a reconciled breakdown; INCOMPLETE when only some item detail is supported; UNAVAILABLE when it has no components."
          },
          "lines": {
            "description": "Approved order lines and quantities, ascending by order line id.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnMoneyComponentDto"
            }
          },
          "requestComparison": {
            "type": "string",
            "enum": [
              "MATCHES_REQUEST",
              "DIFFERS_FROM_REQUEST",
              "REQUEST_NOT_CAPTURED",
              "REQUEST_UNAVAILABLE",
              "CURRENCY_NOT_COMPARABLE"
            ],
            "description": "How this revision compared with the requested evidence when published. Only MATCHES_REQUEST and DIFFERS_FROM_REQUEST are comparisons; the other values say why none exists (not captured, unavailable, or a different currency — never converted)."
          },
          "customerExplanation": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe explanation published with this revision; `null` when the publication did not need or include one."
          },
          "publishedByUserId": {
            "type": "string",
            "description": "Merchant user who published this revision."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Database publication time."
          }
        },
        "required": [
          "contractVersion",
          "itemOutcomes",
          "id",
          "revisionNumber",
          "predecessorRevisionId",
          "approvedAmountInCents",
          "currency",
          "breakdownStatus",
          "lines",
          "components",
          "requestComparison",
          "customerExplanation",
          "publishedByUserId",
          "publishedAt"
        ]
      },
      "MerchantReturnRequestedItemComparatorDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Captured requested order line being compared."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Captured requested quantity; the comparator covers these units together."
          },
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Whether the server can compare this requested line in approvalCurrency. UNAVAILABLE is never a zero."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Exact requested line comparison in minor units, including genuine zero; null when UNAVAILABLE. Never divided from an aggregate amount."
          },
          "unavailableReason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "REQUEST_UNAVAILABLE",
                  "APPROVAL_CURRENCY_UNAVAILABLE",
                  "CURRENCY_NOT_COMPARABLE",
                  "ITEM_COMPARISON_UNAVAILABLE"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Null when AVAILABLE. Otherwise identifies unavailable requested evidence, approval currency, comparable currency, or exact item comparison."
          }
        },
        "required": [
          "orderItemId",
          "quantity",
          "availability",
          "amountInCents",
          "unavailableReason"
        ]
      },
      "MerchantReturnRequestedMoneyDto": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "AVAILABLE when the customer’s deliberate submission captured a requested amount (including a genuine 0). UNAVAILABLE carries no amount and is never a zero."
          },
          "unavailableReason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "NOT_CAPTURED",
                  "UNSUPPORTED_SELECTION",
                  "MISSING_HISTORY",
                  "MISSING_CURRENCY"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "`null` when AVAILABLE. NOT_CAPTURED means no requested evidence was captured for this return (for example a return submitted before capture existed); it is never backfilled. The other reasons were captured at submission."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Requested amount in minor units; `null` exactly when UNAVAILABLE."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Lowercase ISO 4217 code of `amountInCents`, from immutable history; `null` exactly when UNAVAILABLE. Never a substituted default."
          },
          "breakdownStatus": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "INCOMPLETE",
              "UNAVAILABLE"
            ],
            "description": "COMPLETE components reconcile exactly to the amount; INCOMPLETE is a known amount with only some components; UNAVAILABLE has none."
          },
          "lines": {
            "description": "Normalized requested order lines, ascending by order line id. Empty only when NOT_CAPTURED.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "itemComparators": {
            "description": "Server-owned comparisons for each captured requested line, using the same evidence rules as complete approval. Empty when NOT_CAPTURED; unavailable rows never imply zero. These are comparisons, not refund capacity or a reservation.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnRequestedItemComparatorDto"
            }
          },
          "components": {
            "description": "Source-supported components; empty when the breakdown is UNAVAILABLE.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnMoneyComponentDto"
            }
          },
          "source": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "RETURN_REFUND_ESTIMATE"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Authoritative projection that produced the evidence; `null` when NOT_CAPTURED."
          },
          "sourceVersion": {
            "type": "integer",
            "nullable": true,
            "description": "Contract version of `source`; `null` when NOT_CAPTURED."
          },
          "sourceRevisionRef": {
            "type": "string",
            "nullable": true,
            "description": "Internal reference to the source revision the evidence was computed from. Merchant-only; `null` when the source records none or NOT_CAPTURED."
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Database capture time; `null` when NOT_CAPTURED."
          }
        },
        "required": [
          "availability",
          "unavailableReason",
          "amountInCents",
          "currency",
          "breakdownStatus",
          "lines",
          "itemComparators",
          "components",
          "source",
          "sourceVersion",
          "sourceRevisionRef",
          "capturedAt"
        ]
      },
      "MerchantReturnApprovalPublicationDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string"
          },
          "approvalCurrency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Immutable currency of the qualified Commerce order owner used by complete approval. Null when ownership or currency cannot be established; never a store, payment, or default fallback. This read does not establish refund support or reserve capacity; commands revalidate."
          },
          "currentRevisionNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Current published revision number; 0 when nothing has been published. Send it as `expectedCurrentRevision` to publish the next revision."
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnApprovalRevisionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The customer-visible approval, or `null` when none has been published. A private refund draft or an APPROVED status never populates it."
          },
          "revisions": {
            "description": "Every published revision, newest first. Predecessors are never rewritten or removed; empty when nothing has been published.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnApprovalRevisionDto"
            }
          },
          "requested": {
            "$ref": "#/components/schemas/MerchantReturnRequestedMoneyDto"
          }
        },
        "required": [
          "returnId",
          "approvalCurrency",
          "currentRevisionNumber",
          "current",
          "revisions",
          "requested"
        ]
      },
      "ReturnApprovalLineDto": {
        "type": "object",
        "properties": {
          "orderItemId": {
            "type": "string",
            "description": "Order line being approved. Must be one of this return’s requested order lines; each order line may appear once.",
            "maxLength": 64
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999999,
            "description": "Approved units of that order line: at least 1 and no more than the return requested for it."
          }
        },
        "required": [
          "orderItemId",
          "quantity"
        ]
      },
      "ReturnApprovalComponentDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ITEM",
              "DISCOUNT",
              "TAX",
              "WITHHOLDING",
              "SHIPPING"
            ]
          },
          "effect": {
            "type": "string",
            "enum": [
              "ADD",
              "SUBTRACT",
              "INCLUDED"
            ],
            "description": "How this component contributes to the total. ITEM and SHIPPING ADD; DISCOUNT and WITHHOLDING SUBTRACT; TAX either ADDs or is INCLUDED (disclosed inside item amounts and never added twice)."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Non-negative magnitude in minor units; `effect` gives the sign."
          },
          "orderItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional order line this component belongs to; it must be one of the approved lines. Never set on SHIPPING. Omit for a return-level component."
          }
        },
        "required": [
          "kind",
          "effect",
          "amountInCents"
        ]
      },
      "PublishReturnApprovalRevisionDto": {
        "type": "object",
        "properties": {
          "expectedCurrentRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `currentRevisionNumber` this publication replaces — 0 when none has been published. A different current revision is rejected with 409 `RETURN_APPROVAL_REVISION_STALE`; nothing is overwritten."
          },
          "approvedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Approved refund the customer will see, in minor units of the order’s historical currency. 0 is a genuine zero. Validated against the same whole-return cap; version 2 also checks exact selected-item support. Publishing never reserves, issues, or schedules money."
          },
          "items": {
            "minItems": 1,
            "maxItems": 200,
            "description": "The approved order lines and quantities that later return instructions and packing slips bind to. Required explicitly: the server never infers approved items from the original request.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalLineDto"
            }
          },
          "components": {
            "nullable": true,
            "maxItems": 100,
            "description": "Optional attributed breakdown. Version 1 reconciles to the aggregate approved amount. Version 2 reconciles each COMPLETE item separately and is INCOMPLETE when another approved item lacks detail. Omitted or empty publishes an UNAVAILABLE breakdown; the server never derives components.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalComponentDto"
            }
          },
          "customerExplanation": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000,
            "description": "Customer-safe reason shown with this approval. Required when a first approval differs from the customer’s known requested evidence and for every replacement (400 `RETURN_APPROVAL_EXPLANATION_REQUIRED`); optional otherwise. Internal and intake notes are never used in its place."
          }
        },
        "required": [
          "expectedCurrentRevision",
          "approvedAmountInCents",
          "items"
        ]
      },
      "MerchantReturnApprovalPublishResultDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string"
          },
          "approvalCurrency": {
            "type": "string",
            "nullable": true,
            "example": "usd",
            "description": "Immutable currency of the qualified Commerce order owner used by complete approval. Null when ownership or currency cannot be established; never a store, payment, or default fallback. This read does not establish refund support or reserve capacity; commands revalidate."
          },
          "currentRevisionNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Current published revision number; 0 when nothing has been published. Send it as `expectedCurrentRevision` to publish the next revision."
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnApprovalRevisionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The customer-visible approval, or `null` when none has been published. A private refund draft or an APPROVED status never populates it."
          },
          "revisions": {
            "description": "Every published revision, newest first. Predecessors are never rewritten or removed; empty when nothing has been published.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnApprovalRevisionDto"
            }
          },
          "requested": {
            "$ref": "#/components/schemas/MerchantReturnRequestedMoneyDto"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "PUBLISHED",
              "REPLAYED"
            ],
            "description": "PUBLISHED appended a new revision. REPLAYED means this idempotency key already published the identical intent: nothing was written, and the body reflects the current state, which may include later revisions."
          },
          "publishedRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "The revision this command published (or originally published, on replay)."
          }
        },
        "required": [
          "returnId",
          "approvalCurrency",
          "currentRevisionNumber",
          "current",
          "revisions",
          "requested",
          "outcome",
          "publishedRevisionNumber"
        ]
      },
      "PublishCompleteReturnApprovalRevisionDto": {
        "type": "object",
        "properties": {
          "expectedCurrentRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `currentRevisionNumber` this publication replaces — 0 when none has been published. A different current revision is rejected with 409 `RETURN_APPROVAL_REVISION_STALE`; nothing is overwritten."
          },
          "approvedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Approved refund the customer will see, in minor units of the order’s historical currency. 0 is a genuine zero. Validated against the same whole-return cap; version 2 also checks exact selected-item support. Publishing never reserves, issues, or schedules money."
          },
          "items": {
            "minItems": 1,
            "maxItems": 200,
            "description": "The approved order lines and quantities that later return instructions and packing slips bind to. Required explicitly: the server never infers approved items from the original request.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalLineDto"
            }
          },
          "components": {
            "nullable": true,
            "maxItems": 100,
            "description": "Optional attributed breakdown. Version 1 reconciles to the aggregate approved amount. Version 2 reconciles each COMPLETE item separately and is INCOMPLETE when another approved item lacks detail. Omitted or empty publishes an UNAVAILABLE breakdown; the server never derives components.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalComponentDto"
            }
          },
          "customerExplanation": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000,
            "description": "Customer-safe reason shown with this approval. Required when a first approval differs from the customer’s known requested evidence and for every replacement (400 `RETURN_APPROVAL_EXPLANATION_REQUIRED`); optional otherwise. Internal and intake notes are never used in its place."
          },
          "itemOutcomes": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Complete decisions for every original requested line, including explicit refusals. At least one item must be approved; use REJECTED when all are refused.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalItemOutcomeDto"
            }
          }
        },
        "required": [
          "expectedCurrentRevision",
          "approvedAmountInCents",
          "items",
          "itemOutcomes"
        ]
      },
      "FirstReturnApprovalPublicationDto": {
        "type": "object",
        "properties": {
          "approvedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Approved refund the customer will see, in minor units of the order’s historical currency. 0 is a genuine zero. Validated against the same whole-return cap; version 2 also checks exact selected-item support. Publishing never reserves, issues, or schedules money."
          },
          "components": {
            "nullable": true,
            "maxItems": 100,
            "description": "Optional attributed breakdown. Version 1 reconciles to the aggregate approved amount. Version 2 reconciles each COMPLETE item separately and is INCOMPLETE when another approved item lacks detail. Omitted or empty publishes an UNAVAILABLE breakdown; the server never derives components.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalComponentDto"
            }
          },
          "customerExplanation": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000,
            "description": "Customer-safe reason shown with this approval. Required when a first approval differs from the customer’s known requested evidence and for every replacement (400 `RETURN_APPROVAL_EXPLANATION_REQUIRED`); optional otherwise. Internal and intake notes are never used in its place."
          },
          "itemOutcomes": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Complete decisions for every original requested line, including explicit refusals. At least one item must be approved; use REJECTED when all are refused.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnApprovalItemOutcomeDto"
            }
          }
        },
        "required": [
          "approvedAmountInCents",
          "itemOutcomes"
        ]
      },
      "FirstReturnApprovalDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "PUBLISH_COMPLETE",
              "CONFIRM_CURRENT"
            ],
            "description": "Publish complete decisions while first approving, or deliberately reuse the exact current complete publication. Neither action issues money or confirms shipping instructions."
          },
          "expectedCurrentRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "Exact current approval revision reviewed by the merchant. 0 is allowed only with PUBLISH_COMPLETE."
          },
          "publication": {
            "description": "Required for PUBLISH_COMPLETE; omit for CONFIRM_CURRENT. No missing publication is inferred.",
            "allOf": [
              {
                "$ref": "#/components/schemas/FirstReturnApprovalPublicationDto"
              }
            ]
          }
        },
        "required": [
          "kind",
          "expectedCurrentRevision"
        ]
      },
      "FirstReturnApprovalResultDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "APPROVED",
              "REPLAYED"
            ],
            "description": "APPROVED committed publication/reuse, lifecycle, one notification intent and receipt together. REPLAYED reports that historical success without creating effects, even after later revisions or cancellation."
          },
          "returnId": {
            "type": "string"
          },
          "approvedRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "Publication bound to the first approval receipt; may differ from a later current revision."
          },
          "committedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Database commit receipt time of the original first approval."
          }
        },
        "required": [
          "outcome",
          "returnId",
          "approvedRevisionNumber",
          "committedAt"
        ]
      },
      "MerchantReturnShippingInstructionRevisionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Revision id (internal identity)."
          },
          "revisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "predecessorRevisionId": {
            "type": "string",
            "nullable": true,
            "description": "The revision this one replaced; `null` only for revision 1."
          },
          "approvalRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "The published approval revision these instructions were confirmed against."
          },
          "lines": {
            "description": "The shipment lines copied from that approval: approved order lines and quantities for versions 1/2, or only the exact positive physical-required subset for version 3, excluding waived/refused units. Ascending by order line id. Historical revisions retain their original lines.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "payer": {
            "type": "string",
            "enum": [
              "MERCHANT",
              "CUSTOMER"
            ]
          },
          "destination": {
            "$ref": "#/components/schemas/ReturnShippingDestinationDto"
          },
          "customerInstructions": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe instructions confirmed with this revision; `null` when none."
          },
          "confirmedByUserId": {
            "type": "string",
            "description": "Merchant user who confirmed this revision. Never shown to customers."
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Database confirmation time. Never shown to customers."
          }
        },
        "required": [
          "id",
          "revisionNumber",
          "predecessorRevisionId",
          "approvalRevisionNumber",
          "lines",
          "payer",
          "destination",
          "customerInstructions",
          "confirmedByUserId",
          "confirmedAt"
        ]
      },
      "MerchantReturnShippingInstructionsDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string"
          },
          "returnStatus": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ]
          },
          "currentRevisionNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Current confirmed revision number; 0 when nothing has been confirmed. Send it as `expectedCurrentRevision` to confirm the next revision."
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnShippingInstructionRevisionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The current confirmed instructions, or `null` when none have been confirmed. Being current does not make them customer-visible: see `customerState`."
          },
          "revisions": {
            "description": "Every confirmed revision, newest first. Predecessors are never rewritten or removed; empty when nothing has been confirmed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnShippingInstructionRevisionDto"
            }
          },
          "currentApprovalRevisionNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Current published approval revision number; 0 when no approval is published (confirmation is then refused). Send it as `expectedApprovalRevision`."
          },
          "approvedLines": {
            "description": "The approved order lines of the current published approval — exactly what a confirmation now would bind. Version 3 includes only exact positive APPROVED physical-required quantities; waived/refused units are excluded. Empty when no approval is published, an unknown version is unadmitted, or all approved merchandise is waived. While APPROVED/IN_TRANSIT, customerState and pendingReason distinguish these cases. REQUESTED is always UNAPPROVED and terminal returns are always SHIPPING_CLOSED, so those states do not distinguish the empty cases; inspect GET /merchant/returns/{id}/approval-publication and its contractVersion/itemOutcomes. Empty alone does not establish a shipment obligation.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "customerState": {
            "type": "string",
            "enum": [
              "UNAPPROVED",
              "INSTRUCTIONS_PENDING",
              "CUSTOMER_PAID_READY",
              "MERCHANT_PAID_LABEL_WAITING",
              "NO_PHYSICAL_RETURN_REQUIRED",
              "SHIPPING_CLOSED"
            ],
            "description": "What the customer is told now, derived from the Return status, the current approval and the current instructions (see the customer shipping-instructions read for each value). There is no merchant-paid \"label ready\" value: no source of usable return-label evidence exists yet, so merchant-paid instructions always wait for the label. This state set is open-ended: accept unknown values conservatively as “do not ship yet” and withhold shipping and printing actions."
          },
          "pendingReason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "APPROVAL_NOT_PUBLISHED",
                  "NOT_CONFIRMED",
                  "APPROVED_ITEMS_CHANGED",
                  "APPROVAL_VERSION_UNADMITTED"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Set exactly when `customerState` is INSTRUCTIONS_PENDING: APPROVAL_NOT_PUBLISHED (publish an approval first), NOT_CONFIRMED (confirm instructions), or APPROVED_ITEMS_CHANGED (the current instructions differ in approved items, exact physical identities, quantities or physical dispositions, or legacy instructions lack the version-3 exact binding; confirm again). A replacement approval that changes only money keeps instructions current. APPROVAL_VERSION_UNADMITTED means the approval version has no admitted shipping consumer; no shipment obligation is inferred. `null` in every other state."
          }
        },
        "required": [
          "returnId",
          "returnStatus",
          "currentRevisionNumber",
          "current",
          "revisions",
          "currentApprovalRevisionNumber",
          "approvedLines",
          "customerState",
          "pendingReason"
        ]
      },
      "ReturnShippingDestinationInputDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Recipient or facility name the customer ships to.",
            "minLength": 1,
            "maxLength": 120
          },
          "line1": {
            "type": "string",
            "description": "Street address line 1.",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Street address line 2 (suite, unit). Omitted, `null` or blank means none."
          },
          "city": {
            "type": "string",
            "description": "City or town.",
            "minLength": 1,
            "maxLength": 120
          },
          "state": {
            "type": "string",
            "description": "State, province or region — an ISO 3166-2 subdivision code when possible.",
            "minLength": 1,
            "maxLength": 120
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP or postal code.",
            "minLength": 1,
            "maxLength": 20
          },
          "country": {
            "type": "string",
            "description": "ASSIGNED ISO 3166-1 alpha-2 country code (e.g. `US`), stored uppercase. User-assigned ranges such as `ZZ` are rejected.",
            "minLength": 2,
            "maxLength": 2,
            "enum": [
              "AD",
              "AE",
              "AF",
              "AG",
              "AI",
              "AL",
              "AM",
              "AO",
              "AQ",
              "AR",
              "AS",
              "AT",
              "AU",
              "AW",
              "AX",
              "AZ",
              "BA",
              "BB",
              "BD",
              "BE",
              "BF",
              "BG",
              "BH",
              "BI",
              "BJ",
              "BL",
              "BM",
              "BN",
              "BO",
              "BQ",
              "BR",
              "BS",
              "BT",
              "BV",
              "BW",
              "BY",
              "BZ",
              "CA",
              "CC",
              "CD",
              "CF",
              "CG",
              "CH",
              "CI",
              "CK",
              "CL",
              "CM",
              "CN",
              "CO",
              "CR",
              "CU",
              "CV",
              "CW",
              "CX",
              "CY",
              "CZ",
              "DE",
              "DJ",
              "DK",
              "DM",
              "DO",
              "DZ",
              "EC",
              "EE",
              "EG",
              "EH",
              "ER",
              "ES",
              "ET",
              "FI",
              "FJ",
              "FK",
              "FM",
              "FO",
              "FR",
              "GA",
              "GB",
              "GD",
              "GE",
              "GF",
              "GG",
              "GH",
              "GI",
              "GL",
              "GM",
              "GN",
              "GP",
              "GQ",
              "GR",
              "GS",
              "GT",
              "GU",
              "GW",
              "GY",
              "HK",
              "HM",
              "HN",
              "HR",
              "HT",
              "HU",
              "ID",
              "IE",
              "IL",
              "IM",
              "IN",
              "IO",
              "IQ",
              "IR",
              "IS",
              "IT",
              "JE",
              "JM",
              "JO",
              "JP",
              "KE",
              "KG",
              "KH",
              "KI",
              "KM",
              "KN",
              "KP",
              "KR",
              "KW",
              "KY",
              "KZ",
              "LA",
              "LB",
              "LC",
              "LI",
              "LK",
              "LR",
              "LS",
              "LT",
              "LU",
              "LV",
              "LY",
              "MA",
              "MC",
              "MD",
              "ME",
              "MF",
              "MG",
              "MH",
              "MK",
              "ML",
              "MM",
              "MN",
              "MO",
              "MP",
              "MQ",
              "MR",
              "MS",
              "MT",
              "MU",
              "MV",
              "MW",
              "MX",
              "MY",
              "MZ",
              "NA",
              "NC",
              "NE",
              "NF",
              "NG",
              "NI",
              "NL",
              "NO",
              "NP",
              "NR",
              "NU",
              "NZ",
              "OM",
              "PA",
              "PE",
              "PF",
              "PG",
              "PH",
              "PK",
              "PL",
              "PM",
              "PN",
              "PR",
              "PS",
              "PT",
              "PW",
              "PY",
              "QA",
              "RE",
              "RO",
              "RS",
              "RU",
              "RW",
              "SA",
              "SB",
              "SC",
              "SD",
              "SE",
              "SG",
              "SH",
              "SI",
              "SJ",
              "SK",
              "SL",
              "SM",
              "SN",
              "SO",
              "SR",
              "SS",
              "ST",
              "SV",
              "SX",
              "SY",
              "SZ",
              "TC",
              "TD",
              "TF",
              "TG",
              "TH",
              "TJ",
              "TK",
              "TL",
              "TM",
              "TN",
              "TO",
              "TR",
              "TT",
              "TV",
              "TW",
              "TZ",
              "UA",
              "UG",
              "UM",
              "US",
              "UY",
              "UZ",
              "VA",
              "VC",
              "VE",
              "VG",
              "VI",
              "VN",
              "VU",
              "WF",
              "WS",
              "YE",
              "YT",
              "ZA",
              "ZM",
              "ZW"
            ],
            "example": "US"
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "maxLength": 40,
            "description": "Optional contact phone printed with the destination. Omitted, `null` or blank means none. Customers see it with the confirmed destination."
          }
        },
        "required": [
          "name",
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "ConfirmReturnShippingInstructionsDto": {
        "type": "object",
        "properties": {
          "expectedCurrentRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `currentRevisionNumber` these instructions replace — 0 when none have been confirmed. A different current revision is rejected with 409 `RETURN_SHIPPING_INSTRUCTIONS_REVISION_STALE`; nothing is overwritten."
          },
          "expectedApprovalRevision": {
            "type": "integer",
            "minimum": 1,
            "description": "The published approval revision whose approved items the merchant reviewed (`currentApprovalRevisionNumber` from the read). The instructions copy exactly its approved order lines and quantities for versions 1/2, or only its exact positive physical-required subset for version 3, excluding waived/refused units. A different current approval is rejected with 409 `RETURN_SHIPPING_INSTRUCTIONS_APPROVAL_STALE`; with none published, 409 `RETURN_SHIPPING_INSTRUCTIONS_APPROVAL_REQUIRED`. An empty version-3 physical-required subset is rejected with 409 `RETURN_SHIPPING_INSTRUCTIONS_NOT_REQUIRED`."
          },
          "payer": {
            "type": "string",
            "enum": [
              "MERCHANT",
              "CUSTOMER"
            ],
            "description": "Who pays to ship the return back. CUSTOMER: the customer buys postage independently — the platform offers no purchase. MERCHANT: the customer waits for a prepaid label, and a missing label never makes the customer pay. Always explicit; there is no default."
          },
          "destination": {
            "description": "The complete return destination, exactly as confirmed. The server never fills it in from the order’s delivery address, an organization address or the ship-from origin.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnShippingDestinationInputDto"
              }
            ]
          },
          "customerInstructions": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000,
            "description": "Optional customer-safe packing or shipping instructions shown with the confirmed destination. Newlines are kept. Internal and intake notes are never used in its place."
          }
        },
        "required": [
          "expectedCurrentRevision",
          "expectedApprovalRevision",
          "payer",
          "destination"
        ]
      },
      "MerchantReturnShippingInstructionsConfirmResultDto": {
        "type": "object",
        "properties": {
          "returnId": {
            "type": "string"
          },
          "returnStatus": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "APPROVED",
              "IN_TRANSIT",
              "RECEIVED",
              "COMPLETED",
              "REJECTED",
              "CANCELLED"
            ]
          },
          "currentRevisionNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Current confirmed revision number; 0 when nothing has been confirmed. Send it as `expectedCurrentRevision` to confirm the next revision."
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MerchantReturnShippingInstructionRevisionDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The current confirmed instructions, or `null` when none have been confirmed. Being current does not make them customer-visible: see `customerState`."
          },
          "revisions": {
            "description": "Every confirmed revision, newest first. Predecessors are never rewritten or removed; empty when nothing has been confirmed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantReturnShippingInstructionRevisionDto"
            }
          },
          "currentApprovalRevisionNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Current published approval revision number; 0 when no approval is published (confirmation is then refused). Send it as `expectedApprovalRevision`."
          },
          "approvedLines": {
            "description": "The approved order lines of the current published approval — exactly what a confirmation now would bind. Version 3 includes only exact positive APPROVED physical-required quantities; waived/refused units are excluded. Empty when no approval is published, an unknown version is unadmitted, or all approved merchandise is waived. While APPROVED/IN_TRANSIT, customerState and pendingReason distinguish these cases. REQUESTED is always UNAPPROVED and terminal returns are always SHIPPING_CLOSED, so those states do not distinguish the empty cases; inspect GET /merchant/returns/{id}/approval-publication and its contractVersion/itemOutcomes. Empty alone does not establish a shipment obligation.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnMoneyLineDto"
            }
          },
          "customerState": {
            "type": "string",
            "enum": [
              "UNAPPROVED",
              "INSTRUCTIONS_PENDING",
              "CUSTOMER_PAID_READY",
              "MERCHANT_PAID_LABEL_WAITING",
              "NO_PHYSICAL_RETURN_REQUIRED",
              "SHIPPING_CLOSED"
            ],
            "description": "What the customer is told now, derived from the Return status, the current approval and the current instructions (see the customer shipping-instructions read for each value). There is no merchant-paid \"label ready\" value: no source of usable return-label evidence exists yet, so merchant-paid instructions always wait for the label. This state set is open-ended: accept unknown values conservatively as “do not ship yet” and withhold shipping and printing actions."
          },
          "pendingReason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "APPROVAL_NOT_PUBLISHED",
                  "NOT_CONFIRMED",
                  "APPROVED_ITEMS_CHANGED",
                  "APPROVAL_VERSION_UNADMITTED"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Set exactly when `customerState` is INSTRUCTIONS_PENDING: APPROVAL_NOT_PUBLISHED (publish an approval first), NOT_CONFIRMED (confirm instructions), or APPROVED_ITEMS_CHANGED (the current instructions differ in approved items, exact physical identities, quantities or physical dispositions, or legacy instructions lack the version-3 exact binding; confirm again). A replacement approval that changes only money keeps instructions current. APPROVAL_VERSION_UNADMITTED means the approval version has no admitted shipping consumer; no shipment obligation is inferred. `null` in every other state."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "CONFIRMED",
              "REPLAYED"
            ],
            "description": "CONFIRMED appended a new revision. REPLAYED means this idempotency key already confirmed the identical intent: nothing was written, and the body reflects the current state, which may include later revisions."
          },
          "confirmedRevisionNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "The revision this command confirmed (or originally confirmed, on replay)."
          }
        },
        "required": [
          "returnId",
          "returnStatus",
          "currentRevisionNumber",
          "current",
          "revisions",
          "currentApprovalRevisionNumber",
          "approvedLines",
          "customerState",
          "pendingReason",
          "outcome",
          "confirmedRevisionNumber"
        ]
      },
      "RecordReturnRefundRemediationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the action — required for high-risk actions that mandate one (#651); recorded on the audit/activity timeline.",
            "maxLength": 500
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Amount already reimbursed to the customer, in minor units."
          },
          "method": {
            "description": "Observed non-card reimbursement method. This command records completed money movement; it never initiates it.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ReturnRefundRemediationMethod"
              }
            ]
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Za-z]{3}$",
            "example": "usd"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the alternative reimbursement actually occurred. Future timestamps are rejected."
          },
          "reference": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "amountInCents",
          "method",
          "currency",
          "occurredAt"
        ]
      },
      "UpdateReturnNotesDto": {
        "type": "object",
        "properties": {
          "notes": {
            "type": "string",
            "description": "Merchant-only internal notes. Pass `null` to clear; pass a string up to 4000 chars to set.",
            "nullable": true,
            "maxLength": 4000
          }
        },
        "required": [
          "notes"
        ]
      },
      "BuyGetTargetResponseDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ITEM",
              "VARIANT",
              "COLLECTION"
            ],
            "description": "What this side names. ITEM: a product, any of its variants. VARIANT: one exact variant. COLLECTION: every product in the collection, by product membership."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The product's, variant's or collection's id, as `kind` says. It names the catalog row as stored; it does not say the row is still active."
          }
        },
        "required": [
          "kind",
          "id"
        ]
      },
      "BuyGetSideResponseDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Whole units of the target in each set."
          },
          "target": {
            "$ref": "#/components/schemas/BuyGetTargetResponseDto"
          }
        },
        "required": [
          "quantity",
          "target"
        ]
      },
      "BuyGetRewardSideResponseDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Whole units of the target in each set."
          },
          "target": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BuyGetTargetResponseDto"
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "SAME_ITEM_AS_BOUGHT"
                    ]
                  }
                },
                "description": "Eligible units of the same product. Buy a product or collection to allow other variants. An exact variant only rewards that variant."
              }
            ]
          }
        },
        "required": [
          "quantity",
          "target"
        ]
      },
      "BuyGetDefinitionResponseDto": {
        "type": "object",
        "properties": {
          "buy": {
            "description": "What the shopper buys.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyGetSideResponseDto"
              }
            ]
          },
          "get": {
            "description": "What the shopper gets: the reward units.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyGetRewardSideResponseDto"
              }
            ]
          },
          "rewardPercentOffBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 10000,
            "description": "The percentage off the reward units only, in basis points."
          },
          "repeats": {
            "type": "boolean",
            "description": "false: one set per order. true: every complete set, each on its own units."
          }
        },
        "required": [
          "buy",
          "get",
          "rewardPercentOffBasisPoints",
          "repeats"
        ]
      },
      "CouponResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string",
            "description": "Coupon code, stored upper-cased. Tenant-scoped unique (two orgs may share a code, one org may not)."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type. Drives how `value` is interpreted (PERCENTAGE / FIXED_AMOUNT / FREE_SHIPPING). A Buy X, Get Y coupon (`buyGet` not null) is always PERCENTAGE, and its discount is described by `buyGet`, not by `type` and `value`."
          },
          "value": {
            "type": "number",
            "description": "Raw discount value: basis points for PERCENTAGE (1-10000), cents off for FIXED_AMOUNT, 0/ignored for FREE_SHIPPING. Always 0 on a Buy X, Get Y coupon, which is not a 0% coupon: its reward is `buyGet.rewardPercentOffBasisPoints`, off the reward units only."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Subtotal floor in cents before the coupon applies. 0 = none."
          },
          "maxUses": {
            "type": "number",
            "nullable": true,
            "description": "Usage cap. `null` = unlimited."
          },
          "usesPerCustomer": {
            "type": "integer",
            "nullable": true,
            "description": "Uses per customer: the stored limit on finalized orders per normalized checkout email, guests included. `null` = no per-customer limit; that is also every coupon while the setting is still rolling out. Every finalized order that used the coupon counts once its use is recorded, whether or not a limit was set at the time. An order with no recorded use does not count. No count of an email's uses is published. While this store cannot digest checkout emails (no digest key), no use is recorded and checkout treats a code that has a limit as unavailable."
          },
          "usageCount": {
            "type": "number",
            "description": "At-least-once redemption counter; incremented at apply time."
          },
          "startsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Activation start. `null` = active immediately."
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Expiry. `null` = runs until disabled / `maxUses` exhausted."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED",
              "EXPIRED"
            ],
            "description": "Lifecycle status (ACTIVE / DISABLED / EXPIRED)."
          },
          "internalNotes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-only note; never shown to the customer."
          },
          "excludeOnSaleItems": {
            "type": "boolean",
            "description": "Whether this coupon stays off cart lines that are already on sale (an active sale window, or a price below the compare-at price). This is the effective value, always present: `false` for FREE_SHIPPING, and `false` while the setting is still rolling out. It governs checkout pricing, and the anonymous `POST /public/cart/apply-coupon` preview honors it when sent as `lines`; the client-priced `subtotalInCents` shape carries no line detail, so it cannot."
          },
          "buyGet": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BuyGetDefinitionResponseDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The Buy X, Get Y terms. Null means this is not a Buy X, Get Y coupon; it is never null on one. Checkout, and the coupon preview sent the cart as `lines`, discount the cheapest feasible rewards for independent targets. With SAME_ITEM_AS_BOUGHT, sets form within each product, dearest units first. The first units in each set are bought and the rest are rewarded. An order limited to one set takes the product with the highest reward base. The code is skipped, and reads as unavailable, when the cart completes no set, or when an automatic discount or a bundle takes money off the cart. Checkout also skips it once the selected shipping rate has a charge that an automatic discount or a bundle waives; the `lines` preview prices the cart before any rate is selected, so it cannot see that. The client-priced `subtotalInCents` preview has no lines, so it always reads as unavailable there."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "code",
          "type",
          "value",
          "minimumSubtotalInCents",
          "maxUses",
          "usesPerCustomer",
          "usageCount",
          "startsAt",
          "expiresAt",
          "status",
          "internalNotes",
          "excludeOnSaleItems",
          "buyGet",
          "createdAt",
          "updatedAt"
        ]
      },
      "BuyGetTargetDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ITEM",
              "VARIANT",
              "COLLECTION"
            ],
            "description": "What this side names. ITEM: a product, any of its variants. VARIANT: one exact variant. COLLECTION: every product in the collection, by product membership."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The product's, variant's or collection's id, as `kind` says. It must belong to the active organization; another organization's id is refused exactly like an id that does not exist."
          }
        },
        "required": [
          "kind",
          "id"
        ]
      },
      "BuyGetSideDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Whole units of the target in each set, at least 1. Only a JSON integer is accepted."
          },
          "target": {
            "$ref": "#/components/schemas/BuyGetTargetDto"
          }
        },
        "required": [
          "quantity",
          "target"
        ]
      },
      "BuyGetRewardSideDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Whole units of the target in each set, at least 1. Only a JSON integer is accepted."
          },
          "target": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BuyGetTargetDto"
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "SAME_ITEM_AS_BOUGHT"
                    ]
                  }
                },
                "description": "Eligible units of the same product. Buy a product or collection to allow other variants. An exact variant only rewards that variant."
              }
            ]
          }
        },
        "required": [
          "quantity",
          "target"
        ]
      },
      "BuyGetDefinitionDto": {
        "type": "object",
        "properties": {
          "buy": {
            "description": "What the shopper buys: the units that qualify a set.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyGetSideDto"
              }
            ]
          },
          "get": {
            "description": "What the shopper gets: the reward units. The shopper adds them to the cart; the offer never adds an item.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyGetRewardSideDto"
              }
            ]
          },
          "rewardPercentOffBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 10000,
            "description": "The percentage off the reward (Get) units only, in basis points: 10000 is 100% off, so the reward units are free. Only a JSON integer is accepted."
          },
          "repeats": {
            "type": "boolean",
            "default": false,
            "description": "false (or omitted): one set per order. true: every complete set the cart forms, each on its own units. Only literal JSON booleans are accepted; strings such as `\"false\"` and an explicit `null` are rejected."
          }
        },
        "required": [
          "buy",
          "get",
          "rewardPercentOffBasisPoints"
        ]
      },
      "CreateCouponDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Coupon code. Trimmed + upper-cased server-side before write. Allowed: ASCII alphanumerics + dash + underscore. Tenant-scoped unique — two different orgs may share a code, the same org may not.",
            "minLength": 1,
            "maxLength": 50
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount discriminator. PERCENTAGE: value is basis points (1-10000). FIXED_AMOUNT: value is cents off subtotal (>=0). FREE_SHIPPING: value is ignored. A Buy X, Get Y coupon (`buyGet` set) must be PERCENTAGE."
          },
          "value": {
            "type": "number",
            "description": "PERCENTAGE: basis points (1-10000). FIXED_AMOUNT: cents off subtotal (>=0). FREE_SHIPPING: optional, defaults to 0 and is ignored. The service enforces per-type ranges with clearer error messages than the DTO can. A Buy X, Get Y coupon takes no value: omit it or send 0, and set the reward in `buyGet.rewardPercentOffBasisPoints`.",
            "minimum": 0
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Floor on cart subtotal before the coupon is applicable. 0 = no minimum. Defaults to 0.",
            "minimum": 0
          },
          "maxUses": {
            "type": "number",
            "description": "Max total redemptions across all customers. `null` (or omitted) = unlimited. Must be >= 1 when provided.",
            "minimum": 1,
            "nullable": true
          },
          "usesPerCustomer": {
            "type": "integer",
            "description": "Uses per customer: how many finalized orders each normalized checkout email, guests included, may place with this code. `null` (or omitted) = no per-customer limit. Must be >= 1 when provided. Every finalized order that used the coupon counts once its use is recorded, whether or not a limit was set at the time. An order with no recorded use does not count. A shopper whose email has reached the limit sees the code as unavailable, exactly like any other unavailable code. Saving a limit is refused with 409 `RESOURCE_CONFLICT` while this store cannot count it: `details.reason` is `USES_PER_CUSTOMER_NOT_READY` while the setting is still rolling out (retry later), or `USES_PER_CUSTOMER_UNAVAILABLE` where it is not available yet. Clearing a limit is always accepted. Only JSON integers are accepted; strings such as `\"2\"`, booleans and fractions are rejected.",
            "minimum": 1,
            "maximum": 2147483647,
            "nullable": true
          },
          "startsAt": {
            "type": "string",
            "description": "ISO-8601 timestamp before which the coupon is not yet active. Null/omitted = active immediately.",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO-8601 timestamp after which the coupon is no longer redeemable. Null/omitted = runs until manually disabled. Must be strictly after startsAt when both are provided.",
            "format": "date-time",
            "nullable": true
          },
          "internalNotes": {
            "type": "string",
            "description": "Merchant-only scratchpad. Never surfaced to the customer. Up to 4000 chars.",
            "maxLength": 4000
          },
          "excludeOnSaleItems": {
            "type": "boolean",
            "default": false,
            "description": "Keep this coupon off every cart line that is already on sale: a line priced by an active sale window, or whose price is below its compare-at price. The coupon then discounts only the remaining lines, while `minimumSubtotalInCents` still counts the whole cart, and a cart whose every line is on sale skips the coupon. Checkout pricing honors it, and so does the anonymous `POST /public/cart/apply-coupon` preview when sent as `lines`; the client-priced `subtotalInCents` shape carries no line detail, so it cannot. Omitted or `false` keeps the coupon applying to sale items too. Always stored `false` for FREE_SHIPPING. Only literal JSON booleans are accepted; strings such as `\"false\"` and an explicit `null` are rejected."
          },
          "buyGet": {
            "description": "Makes this a Buy X, Get Y coupon: buy `buy.quantity` of `buy.target`, get `get.quantity` of `get.target` at `rewardPercentOffBasisPoints` off. Omit it for any other coupon. A Buy X, Get Y coupon is created with `type` PERCENTAGE and no `value`, and never changes kind. An automatic discount or a bundle that takes money off the cart, or waives the charge of the selected shipping rate, wins: the code is then skipped and reads as unavailable, as it does when the cart completes no set. With `excludeOnSaleItems`, a unit already on sale neither qualifies a set nor is rewarded, and a package with any component on sale is such a unit. The create is refused with 409 `RESOURCE_CONFLICT` while this store cannot have one: `details.reason` is `BUY_GET_NOT_READY` while the offer is still rolling out (retry later), or `BUY_GET_UNAVAILABLE` where it is not available yet. An explicit `null` is rejected.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyGetDefinitionDto"
              }
            ]
          }
        },
        "required": [
          "code",
          "type"
        ]
      },
      "UpdateCouponDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Changing the type re-validates `value` against it. A Buy X, Get Y coupon refuses any other type than the PERCENTAGE it has."
          },
          "value": {
            "type": "number",
            "minimum": 0,
            "description": "Interpreted by the resulting `type`. A Buy X, Get Y coupon refuses any other value than the 0 it has; change its reward through `buyGet`."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "minimum": 0
          },
          "maxUses": {
            "type": "number",
            "description": "Max total redemptions; null clears the cap (unlimited). >= 1 when set to a number.",
            "minimum": 1,
            "nullable": true
          },
          "usesPerCustomer": {
            "type": "integer",
            "description": "Uses per customer; `null` removes the limit. >= 1 when set to a number. Every finalized order that used the coupon counts once its use is recorded, whether or not a limit was set at the time. An order with no recorded use, such as one from before the store recorded them, does not count. Adding or lowering a limit applies from then on: an email already at or over it cannot use the code again, and nothing past is revoked. Removing it stops the check, and re-adding it does not start the count over. Saving a limit is refused with 409 `RESOURCE_CONFLICT` while this store cannot count it: `details.reason` is `USES_PER_CUSTOMER_NOT_READY` while the setting is still rolling out (retry later), or `USES_PER_CUSTOMER_UNAVAILABLE` where it is not available yet. Clearing a limit is always accepted. Only JSON integers are accepted; strings such as `\"2\"`, booleans and fractions are rejected.",
            "minimum": 1,
            "maximum": 2147483647,
            "nullable": true
          },
          "startsAt": {
            "type": "string",
            "description": "ISO-8601 timestamp; pass `null` to clear.",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO-8601 timestamp; pass `null` to clear. Must be > startsAt when both are set on the resulting row.",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED",
              "EXPIRED"
            ],
            "description": "Lifecycle status. PATCH cannot move an active or expired coupon to DISABLED; use DELETE /merchant/coupons/:id with a reason for that high-risk action. EXPIRED is a label for past-window coupons the operator wants to keep in the list."
          },
          "internalNotes": {
            "type": "string",
            "description": "Pass `null` to clear; pass a string up to 4000 chars to set.",
            "nullable": true,
            "maxLength": 4000
          },
          "excludeOnSaleItems": {
            "type": "boolean",
            "description": "Keep this coupon off cart lines that are already on sale (see `POST /merchant/coupons`). Omit to leave it unchanged. The resulting value is always `false` for FREE_SHIPPING: changing the type to FREE_SHIPPING clears it, and changing back does not restore it. Only literal JSON booleans are accepted; strings such as `\"false\"` and an explicit `null` are rejected."
          },
          "buyGet": {
            "description": "A Buy X, Get Y coupon's new terms, replacing the old ones whole: an omitted `repeats` turns repeats off. Omit to leave them unchanged. Refused on any other coupon, since a coupon never changes kind. An explicit `null` is rejected.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyGetDefinitionDto"
              }
            ]
          }
        }
      },
      "AutoDiscountResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing label (no customer-visible code)."
          },
          "scope": {
            "type": "string",
            "enum": [
              "ALL_ITEMS",
              "ITEMS_BY_COLLECTION",
              "ORDER_TOTAL"
            ],
            "description": "What the discount applies to (ALL_ITEMS / ITEMS_BY_COLLECTION / ORDER_TOTAL)."
          },
          "scopeCollectionId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Target collection. Required when `scope` = ITEMS_BY_COLLECTION, `null` otherwise. Also `null` under ITEMS_BY_COLLECTION once the collection is deleted outside the API: the foreign key clears it, and `scopeCollectionName` is then `null` too."
          },
          "scopeCollectionName": {
            "type": "string",
            "nullable": true,
            "description": "Name of the target collection, read from the collection itself on every merchant auto-discount route. A name says nothing about the collection's status: an archived collection keeps its id and name. `null` in two cases, told apart by `scope`: `scope` is not ITEMS_BY_COLLECTION; or `scope` is ITEMS_BY_COLLECTION and the collection no longer exists. No API route deletes a collection, so the second case follows only a deletion made outside the API, which also clears `scopeCollectionId`, in this response too; the discount then matches no cart line."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type (PERCENTAGE / FIXED_AMOUNT / FREE_SHIPPING) — same value semantics as coupons."
          },
          "value": {
            "type": "number",
            "description": "Raw discount value: basis points for PERCENTAGE (1-10000), cents off for FIXED_AMOUNT, 0/ignored for FREE_SHIPPING."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Subtotal floor in cents before the discount applies. 0 = none."
          },
          "startsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Activation start. `null` = active immediately."
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Expiry. `null` = runs until disabled."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED",
              "EXPIRED"
            ],
            "description": "Lifecycle status (ACTIVE / DISABLED / EXPIRED)."
          },
          "priority": {
            "type": "number",
            "description": "Tie-breaker when multiple auto-discounts could apply; higher wins. Default 0."
          },
          "internalNotes": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-only note; never shown to the customer."
          },
          "excludeOnSaleItems": {
            "type": "boolean",
            "description": "Whether this auto-discount stays off cart lines that are already on sale (an active sale window, or a price below the compare-at price). This is the effective value, always present: `false` for FREE_SHIPPING, and `false` while the setting is still rolling out. It governs checkout and point-of-sale pricing, and the anonymous `POST /public/auto-discounts/calculate` preview honors it when sent as `lines`; the client-priced `items` + `subtotalInCents` shape carries no sale state, so it cannot."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "scope",
          "scopeCollectionId",
          "scopeCollectionName",
          "type",
          "value",
          "minimumSubtotalInCents",
          "startsAt",
          "expiresAt",
          "status",
          "priority",
          "internalNotes",
          "excludeOnSaleItems",
          "createdAt",
          "updatedAt"
        ]
      },
      "CreateAutoDiscountDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Merchant-facing label. Identifies the auto-discount in the admin list and audit rows. Never surfaced to the customer (storefront badge text comes from a separate field in slice 3B). Non-empty, up to 200 chars.",
            "minLength": 1,
            "maxLength": 200
          },
          "scope": {
            "type": "string",
            "enum": [
              "ALL_ITEMS",
              "ITEMS_BY_COLLECTION",
              "ORDER_TOTAL"
            ],
            "description": "Which cart contents the discount touches. ALL_ITEMS: every line. ITEMS_BY_COLLECTION: only lines in the named collection — scopeCollectionId is required. ORDER_TOTAL: the cart subtotal as a whole (differs from ALL_ITEMS for FIXED_AMOUNT discounts)."
          },
          "scopeCollectionId": {
            "type": "string",
            "format": "uuid",
            "description": "Required when scope=ITEMS_BY_COLLECTION; must be null/omitted for ALL_ITEMS or ORDER_TOTAL. The collection must belong to the same organization — the service surfaces a structured 400 if not. A hard-deleted collection later flips this column to NULL via the FK SET NULL, which the apply path (slice 3B) treats as a no-op.",
            "nullable": true
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount discriminator (reuses the coupon enum). PERCENTAGE: value is basis points (1-10000). FIXED_AMOUNT: value is cents off subtotal (>=0). FREE_SHIPPING: value is ignored."
          },
          "value": {
            "type": "number",
            "description": "PERCENTAGE: basis points (1-10000). FIXED_AMOUNT: cents off (>=0). FREE_SHIPPING: optional, defaults to 0 and is ignored. The service enforces per-type ranges with clearer error messages than the DTO can.",
            "minimum": 0
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Floor on cart subtotal before the discount is applicable. 0 = no minimum. Defaults to 0.",
            "minimum": 0
          },
          "startsAt": {
            "type": "string",
            "description": "ISO-8601 timestamp before which the auto-discount is not yet active. Null/omitted = active immediately.",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO-8601 timestamp after which the auto-discount stops applying. Null/omitted = runs until manually disabled. Must be strictly after startsAt when both are provided.",
            "format": "date-time",
            "nullable": true
          },
          "priority": {
            "type": "number",
            "description": "Tie-breaker when multiple auto-discounts could apply to the same cart. Higher wins. Any integer; defaults to 0. Slice 3B does the resolution; slice 3A merely stores the value."
          },
          "internalNotes": {
            "type": "string",
            "description": "Merchant-only scratchpad. Never surfaced to the customer. Up to 4000 chars.",
            "maxLength": 4000
          },
          "excludeOnSaleItems": {
            "type": "boolean",
            "default": false,
            "description": "Keep this auto-discount off every cart line that is already on sale: a line priced by an active sale window, or whose price is below its compare-at price. The discount then applies to the remaining lines only (for every scope, including ALL_ITEMS and ORDER_TOTAL), while `minimumSubtotalInCents` still counts the whole cart. With nothing left to discount it does not apply, and a lower-priority discount in the same scope can apply instead. Checkout and point-of-sale pricing honor it, and so does the anonymous `POST /public/auto-discounts/calculate` preview when sent as `lines`; the client-priced `items` + `subtotalInCents` shape carries no sale state, so it cannot. Omitted or `false` keeps the discount applying to sale items too. Always stored `false` for FREE_SHIPPING. Only literal JSON booleans are accepted; strings such as `\"false\"` and an explicit `null` are rejected."
          }
        },
        "required": [
          "name",
          "scope",
          "type"
        ]
      },
      "UpdateAutoDiscountDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "scope": {
            "type": "string",
            "enum": [
              "ALL_ITEMS",
              "ITEMS_BY_COLLECTION",
              "ORDER_TOTAL"
            ]
          },
          "scopeCollectionId": {
            "type": "string",
            "format": "uuid",
            "description": "Required when scope=ITEMS_BY_COLLECTION on the resulting row. Pass `null` to clear. The service re-validates the (scope, scopeCollectionId) pair against the merged state.",
            "nullable": true
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ]
          },
          "value": {
            "type": "number",
            "minimum": 0
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "minimum": 0
          },
          "startsAt": {
            "type": "string",
            "description": "ISO-8601 timestamp; pass `null` to clear.",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO-8601 timestamp; pass `null` to clear. Must be > startsAt when both are set on the resulting row.",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED",
              "EXPIRED"
            ],
            "description": "Lifecycle status. PATCH cannot move an active or expired auto-discount to DISABLED; use DELETE /merchant/auto-discounts/:id with a reason for that high-risk action. EXPIRED is a label for past-window discounts the operator wants to keep in the list."
          },
          "priority": {
            "type": "number",
            "description": "Tie-breaker priority. Any integer. Higher wins among ACTIVE auto-discounts that could otherwise apply to the same cart."
          },
          "internalNotes": {
            "type": "string",
            "description": "Pass `null` to clear; pass a string up to 4000 chars to set.",
            "nullable": true,
            "maxLength": 4000
          },
          "excludeOnSaleItems": {
            "type": "boolean",
            "description": "Keep this auto-discount off cart lines that are already on sale (see `POST /merchant/auto-discounts`). Omit to leave it unchanged. The resulting value is always `false` for FREE_SHIPPING: changing the type to FREE_SHIPPING clears it, and changing back does not restore it. Only literal JSON booleans are accepted; strings such as `\"false\"` and an explicit `null` are rejected."
          }
        }
      },
      "BundleItemResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bundleId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "The item this slot requires."
          },
          "variantId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Optional variant scope for the slot. `null` = any variant."
          },
          "minQuantity": {
            "type": "number",
            "description": "Required count of this item for the slot to be satisfied."
          }
        },
        "required": [
          "id",
          "bundleId",
          "itemId",
          "variantId",
          "minQuantity"
        ]
      },
      "BundleResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing bundle name."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type the bundle applies (PERCENTAGE / FIXED_AMOUNT / FREE_SHIPPING)."
          },
          "value": {
            "type": "number",
            "description": "Raw discount value: basis points for PERCENTAGE (1-10000), cents off for FIXED_AMOUNT, 0/ignored for FREE_SHIPPING."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED",
              "EXPIRED"
            ],
            "description": "Lifecycle status (ACTIVE / DISABLED / EXPIRED)."
          },
          "startsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Activation start. `null` = active immediately."
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Expiry. `null` = runs until disabled."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "items": {
            "description": "The item slots that make up the bundle.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BundleItemResponseDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "type",
          "value",
          "status",
          "startsAt",
          "expiresAt",
          "createdAt",
          "updatedAt",
          "items"
        ]
      },
      "CreateBundleItemDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "description": "UUID of the catalog item that satisfies this slot. Must belong to the active organization.",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "description": "Optional variant UUID. Must belong to itemId. Null or omission lets any variant of the item satisfy the slot.",
            "format": "uuid",
            "nullable": true
          },
          "minQuantity": {
            "type": "number",
            "description": "How many of this item the cart needs for the slot to be satisfied. Defaults to 1. Must be a positive integer (>= 1) — the service rejects 0 because a zero-quantity slot is meaningless.",
            "minimum": 1,
            "default": 1
          }
        },
        "required": [
          "itemId"
        ]
      },
      "CreateBundleDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Merchant-facing label. Identifies the bundle in the admin list and audit rows. Non-empty, up to 100 chars.",
            "minLength": 1,
            "maxLength": 100
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount discriminator (reuses the coupon enum). PERCENTAGE: value is basis points (1-10000). FIXED_AMOUNT: value is cents off subtotal (>=0). FREE_SHIPPING: value is ignored."
          },
          "value": {
            "type": "number",
            "description": "PERCENTAGE: basis points (1-10000). FIXED_AMOUNT: cents off (>=0). FREE_SHIPPING: optional, defaults to 0 and is ignored. The service enforces per-type ranges with clearer error messages than the DTO can.",
            "minimum": 0
          },
          "startsAt": {
            "type": "string",
            "description": "ISO-8601 timestamp before which the bundle is not yet active. Null/omitted = active immediately.",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO-8601 timestamp after which the bundle stops applying. Null/omitted = runs until manually disabled. Must be strictly after startsAt when both are provided.",
            "format": "date-time",
            "nullable": true
          },
          "items": {
            "description": "Component items. A bundle requires at least 2 distinct items — a \"bundle\" of 1 isn't a bundle. Each row pins an item (and optionally a variant) plus the minQuantity required in the cart.",
            "minItems": 2,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateBundleItemDto"
            }
          }
        },
        "required": [
          "name",
          "type",
          "items"
        ]
      },
      "UpdateBundleDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ]
          },
          "value": {
            "type": "number",
            "minimum": 0
          },
          "startsAt": {
            "type": "string",
            "description": "ISO-8601 timestamp; pass `null` to clear.",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO-8601 timestamp; pass `null` to clear. Must be > startsAt when both are set on the resulting row.",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED",
              "EXPIRED"
            ],
            "description": "Lifecycle status (TEXT column on the DB side, TS union here). PATCH cannot move an active or expired bundle to DISABLED; use DELETE /merchant/bundles/:id with a reason for that high-risk action. EXPIRED is a label for past-window bundles the operator wants to keep in the list."
          },
          "items": {
            "description": "When supplied, REPLACES the bundle's component items wholesale. Still must contain at least 2 entries — the service does not permit shrinking below the minimum-bundle threshold.",
            "minItems": 2,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateBundleItemDto"
            }
          }
        }
      },
      "CheckBundlesItemDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Catalog item id for the cart line.",
            "minLength": 1
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "description": "Variant id when the line targets a specific variant of the item. Optional — lines without a variant default-select the item. The bundle matcher treats a slot with variantId=null as matching any variant of the item, and a slot with a specific variant as requiring that variant in the cart.",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "description": "Number of units on this line. Lines with quantity <= 0 should be omitted from the request rather than included with a zero."
          },
          "unitPriceInCents": {
            "type": "number",
            "minimum": 0,
            "description": "Per-unit price in cents at check-time. The matched-bundle discount math runs against `sum(quantity * unitPriceInCents)` of the lines that satisfied the bundle."
          }
        },
        "required": [
          "itemId",
          "quantity",
          "unitPriceInCents"
        ],
        "additionalProperties": false
      },
      "CheckBundlesDto": {
        "type": "object",
        "properties": {
          "cartLines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Current cart contents. Bundle matching is purely composition-based, so the endpoint accepts only the structural fields (itemId, optional variantId, quantity, unit price). No subtotal is required because bundles do not have a minimum-spend gate.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckBundlesItemDto"
            }
          }
        },
        "required": [
          "cartLines"
        ],
        "additionalProperties": false
      },
      "MatchedBundleDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "#3402 — the bundle's stable public identity, returned here for a bundle these cart lines satisfy. Resolve it anonymously with `GET /api/v1/public/bundles/{id}` for the full component slot list. A bundle belongs to many items and has no canonical parent item, so this id is its only public address. This endpoint RETURNS ids and does not accept one — it matches on `cartLines`.\n\nAn id returned here is NOT guaranteed to resolve, and the two gates differ deliberately. This match checks only the bundle's own lifecycle (tenant, `ACTIVE`, inside its window) and its slot ITEM IDS; it does not check whether those items are themselves published, because it returns no catalog detail and so leaks nothing by matching. The by-id read DOES return each slot's name, slug and price, so it drops the whole bundle when any slot references a draft or archived row. A stale cart containing an archived component therefore still matches here and 404s there. Treat that 404 as an ordinary outcome rather than an error.\n\nThis response is a PREVIEW computed from the `cartLines` you supplied, and it is not a promise about checkout. Checkout revalidates catalog availability and reprices server-side, so a match here can change or disappear. In particular, a line referencing a draft or archived item is REJECTED at repricing with a 400 before bundle resolution runs — so for the stale-cart case above checkout does not merely omit the discount, it refuses the line. Do not present a match here as a confirmed saving."
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing bundle name."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type the bundle applies (PERCENTAGE / FIXED_AMOUNT / FREE_SHIPPING)."
          },
          "value": {
            "type": "number",
            "description": "Raw discount value: basis points for PERCENTAGE (1-10000), cents off for FIXED_AMOUNT, ignored for FREE_SHIPPING."
          },
          "discountInCents": {
            "type": "number",
            "description": "Estimated cents saved if the order-placement path honors the bundle. A preview — the order-create path re-runs the match against the server-priced cart."
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "value",
          "discountInCents"
        ]
      },
      "CheckBundlesResponseDto": {
        "type": "object",
        "properties": {
          "matchedBundles": {
            "description": "One entry per ACTIVE bundle the supplied cart satisfies; additively stacked. Empty array when nothing matches.\n\n#3648 — entries carry NO stock signal, and that silence is not an availability claim. This match is deliberately catalog-detail-free (slot item ids only), which is also why it can match a stale cart whose component is archived. The stock-eligibility verdict lives on the reads that already return catalog detail — `GET /api/v1/public/bundles/{id}` and `GET /api/v1/public/items/{slug}/bundles`, both of which publish `availability` per bundle and per slot. Use those before presenting a bundle as something to ADD; a match here describes a cart the shopper already holds, and checkout revalidates it either way.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatchedBundleDto"
            }
          }
        },
        "required": [
          "matchedBundles"
        ]
      },
      "ItemBundleSlotVariantDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Variant display name."
          },
          "options": {
            "type": "object",
            "additionalProperties": true,
            "description": "Variant option map (e.g. `{ \"Size\": \"L\", \"Color\": \"Red\" }`)."
          },
          "priceInCents": {
            "type": "number",
            "description": "Variant price in cents."
          }
        },
        "required": [
          "name",
          "options",
          "priceInCents"
        ]
      },
      "ItemBundleSlotDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "description": "Catalog item id for this slot."
          },
          "slug": {
            "type": "string",
            "description": "Slot item slug."
          },
          "name": {
            "type": "string",
            "description": "Slot item name."
          },
          "priceInCents": {
            "type": "number",
            "description": "Slot item base price in cents."
          },
          "minQuantity": {
            "type": "number",
            "description": "Minimum quantity of this slot the bundle requires."
          },
          "variantId": {
            "type": "string",
            "nullable": true,
            "description": "Variant id when the slot is variant-narrowed; null for an item-only slot (any variant of the item satisfies it)."
          },
          "variant": {
            "nullable": true,
            "description": "Variant detail when the slot is variant-narrowed; null for an item-only slot.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ItemBundleSlotVariantDto"
              }
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "IN_STOCK",
              "OUT_OF_STOCK",
              "AVAILABLE",
              "CHECK_REQUIRED"
            ],
            "description": "#3648 — whether a shopper can obtain THIS SLOT'S `minQuantity` right now. Slot-scoped, not item-scoped: a slot needing 2 of an item with 1 unit left reads `OUT_OF_STOCK` even though the item's own product page is correctly purchasable, because the bundle is what cannot be completed. For an item-only slot (`variantId: null`) the units of every non-archived variant are summed, matching how the cart matcher counts them; for an item with no variants the item-level row is used instead. Stock a shopper of THIS slot cannot draw on is never counted, so a product whose every live variant is sold out cannot read as available: an archived variant keeps its inventory row internally, and once ANY variant exists the item's variant-less row is retired under DR-3694-01 = A. That retired row is never queried, counted, or allowed to veto a verdict. If every variant is archived, the slot has no eligible target and reads `CHECK_REQUIRED`; it never falls back to item-level stock. `AVAILABLE` is a SERVICE slot (no stock concept). PRESENTATION ELIGIBILITY, NOT A GUARANTEE. This is a snapshot taken while building this response so a surface can stop RECOMMENDING what checkout would refuse; stock moves between this read and the shopper's click, and the order path re-checks every line under a row lock. Never treat `IN_STOCK` as proof a purchase will succeed, and never use it to skip a checkout error path. Quantities, thresholds and reservations stay private here (as on the support-provider catalog summary this vocabulary mirrors) — `GET /api/v1/public/inventory/{itemId}` is the endpoint that publishes counts. `CHECK_REQUIRED` means availability could not be answered from stock rows at all (a RENTAL slot, whose capacity is booking-range governed; a composed product, whose own stock row is retired under ADR-038; an item whose variants are all archived, leaving no eligible target; or a governing stock target with no inventory row, for which the order path is deliberately LENIENT and reserves nothing) — it is NOT a synonym for out of stock, and it is never downgraded to an availability claim: `IN_STOCK` is only ever returned on the evidence of a stock row. That rule is symmetric, and PARTIAL evidence keeps it: `OUT_OF_STOCK` is published only when EVERY stock target governing the slot actually reported. Where a slot spans several targets (an item-only slot over multiple live variants), one target reporting zero while another has no row at all yields `CHECK_REQUIRED`, not `OUT_OF_STOCK` — the missing row is unbounded at checkout, so the shopper may well be able to complete the bundle through it. Evidence that is already sufficient still wins: rows covering `minQuantity` read `IN_STOCK` whatever a missing sibling target might have added. Stock that is AMBIGUOUS is likewise never aggregated: where one stock target holds more than one row, checkout reserves against a single one of them, so the rows are alternatives rather than a total and the slot reads `CHECK_REQUIRED` however large their sum. DR-3694-01 = A (catalog wins) makes variant existence decisive: an item-level `variantId: null` row governs only an item with NO variants at all. Once any variant exists — including an archived one — that row is retired and is never queried, counted, or allowed to veto a verdict. Live variants remain the governing stock targets. A covered shortfall across all of them therefore reads `OUT_OF_STOCK` regardless of stale or absent item-level data; if any governing live target has no row, the existing leniency keeps the result `CHECK_REQUIRED`. When every variant is archived there is no eligible target, so the result is also `CHECK_REQUIRED`, never a fallback to item-level stock."
          }
        },
        "required": [
          "itemId",
          "slug",
          "name",
          "priceInCents",
          "minQuantity",
          "variantId",
          "variant",
          "availability"
        ]
      },
      "ItemBundleDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "#3402 — the bundle's stable public identity, and the ONLY public address a bundle has: a bundle belongs to many items, so it has no canonical parent item and cannot be addressed through any single item's slug. Resolve it anonymously with `GET /api/v1/public/bundles/{id}`, which returns this same shape. `POST /api/v1/public/cart/check-bundles` RETURNS ids but does not accept one — it takes `cartLines` and reports which bundles those lines satisfy, so sending an id there is a validation error. And an id is not permanently resolvable: archiving ANY component item removes the bundle from THIS read and from the by-id read, so treat 404 as a normal state rather than assuming a published id resolves forever. `check-bundles` is the deliberate exception — it carries no catalog detail, so it keeps matching a stale cart whose component was archived, and the id it returns can therefore already be unresolvable here."
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing bundle name."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type the bundle applies (PERCENTAGE / FIXED_AMOUNT / FREE_SHIPPING)."
          },
          "value": {
            "type": "number",
            "description": "Raw discount value: basis points for PERCENTAGE (1-10000), cents off for FIXED_AMOUNT, ignored for FREE_SHIPPING."
          },
          "discountInCents": {
            "type": "number",
            "description": "Minimum qualifying saving in cents at current catalog prices (times minQuantity). Actual cart savings scale with quantity and come from POST /public/cart/check-bundles."
          },
          "slots": {
            "description": "Full component slot list for the bundle.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemBundleSlotDto"
            }
          },
          "availability": {
            "type": "string",
            "enum": [
              "IN_STOCK",
              "OUT_OF_STOCK",
              "AVAILABLE",
              "CHECK_REQUIRED"
            ],
            "description": "#3648 — the bundle rollup: it is exactly as available as its LEAST available slot, since every slot must be satisfiable for the saving to be reachable. Precedence, first match wins: any `OUT_OF_STOCK` slot → `OUT_OF_STOCK`; else any `CHECK_REQUIRED` → `CHECK_REQUIRED`; else any `IN_STOCK` → `IN_STOCK`; else `AVAILABLE` (every slot stockless). A known dead end deliberately outranks an unknown — one unobtainable component makes the whole recommendation unactionable. Intended use: suppress `OUT_OF_STOCK` bundles from upsell surfaces and de-prioritize (do not hide) `CHECK_REQUIRED` ones. Read `slots[].availability` to name the component that is holding the bundle back. PRESENTATION ELIGIBILITY, NOT A GUARANTEE. This is a snapshot taken while building this response so a surface can stop RECOMMENDING what checkout would refuse; stock moves between this read and the shopper's click, and the order path re-checks every line under a row lock. Never treat `IN_STOCK` as proof a purchase will succeed, and never use it to skip a checkout error path. Quantities, thresholds and reservations stay private here (as on the support-provider catalog summary this vocabulary mirrors) — `GET /api/v1/public/inventory/{itemId}` is the endpoint that publishes counts. `CHECK_REQUIRED` means availability could not be answered from stock rows at all (a RENTAL slot, whose capacity is booking-range governed; a composed product, whose own stock row is retired under ADR-038; an item whose variants are all archived, leaving no eligible target; or a governing stock target with no inventory row, for which the order path is deliberately LENIENT and reserves nothing) — it is NOT a synonym for out of stock, and it is never downgraded to an availability claim: `IN_STOCK` is only ever returned on the evidence of a stock row. That rule is symmetric, and PARTIAL evidence keeps it: `OUT_OF_STOCK` is published only when EVERY stock target governing the slot actually reported. Where a slot spans several targets (an item-only slot over multiple live variants), one target reporting zero while another has no row at all yields `CHECK_REQUIRED`, not `OUT_OF_STOCK` — the missing row is unbounded at checkout, so the shopper may well be able to complete the bundle through it. Evidence that is already sufficient still wins: rows covering `minQuantity` read `IN_STOCK` whatever a missing sibling target might have added. Stock that is AMBIGUOUS is likewise never aggregated: where one stock target holds more than one row, checkout reserves against a single one of them, so the rows are alternatives rather than a total and the slot reads `CHECK_REQUIRED` however large their sum. DR-3694-01 = A (catalog wins) makes variant existence decisive: an item-level `variantId: null` row governs only an item with NO variants at all. Once any variant exists — including an archived one — that row is retired and is never queried, counted, or allowed to veto a verdict. Live variants remain the governing stock targets. A covered shortfall across all of them therefore reads `OUT_OF_STOCK` regardless of stale or absent item-level data; if any governing live target has no row, the existing leniency keeps the result `CHECK_REQUIRED`. When every variant is archived there is no eligible target, so the result is also `CHECK_REQUIRED`, never a fallback to item-level stock."
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "value",
          "discountInCents",
          "slots",
          "availability"
        ]
      },
      "ItemBundlesResponseDto": {
        "type": "object",
        "properties": {
          "bundles": {
            "description": "ACTIVE bundles (lifecycle-window-gated, tenant-scoped) that contain the item. Empty array when none. Bundles referencing draft/archived catalog rows are omitted. Stock does NOT omit anything: a bundle a shopper cannot currently complete is still returned and labelled by its `availability` — `OUT_OF_STOCK` when a component is known to be short of what its slot needs, `CHECK_REQUIRED` when stock cannot answer — because suppressing versus annotating it is the consuming surface's decision and a silent omission would be indistinguishable from the bundle not existing.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemBundleDto"
            }
          }
        },
        "required": [
          "bundles"
        ]
      },
      "PublicShippingRateDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Configured flat-rate id. Checkout inputs that accept a flat `shippingRateId` use this value."
          },
          "name": {
            "type": "string",
            "description": "Customer-facing rate name (e.g. \"Standard\")."
          },
          "priceInCents": {
            "type": "number",
            "description": "Rate price in minor units (cents)."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Minimum order subtotal (cents) for this rate to apply. `0` when there is no floor. This read publishes the configured rate and floor; it does not evaluate a cart. A published rate therefore need not appear among the options resolved for a cart whose subtotal is below the floor."
          },
          "sortOrder": {
            "type": "number",
            "description": "Display order — rates are listed ascending."
          },
          "estimatedDelivery": {
            "type": "string",
            "description": "Free-text delivery estimate (e.g. \"3–5 business days\").",
            "nullable": true
          },
          "transitMinDays": {
            "type": "number",
            "description": "#1103 — shortest calendar-day transit for this rate (null when unset). A BYO client combines this with the tenant delivery-estimate settings to render a structured ship-by / delivery-window date.",
            "nullable": true
          },
          "transitMaxDays": {
            "type": "number",
            "description": "#1103 — longest calendar-day transit for this rate (null when unset).",
            "nullable": true
          }
        },
        "required": [
          "id",
          "name",
          "priceInCents",
          "minimumSubtotalInCents",
          "sortOrder",
          "estimatedDelivery",
          "transitMinDays",
          "transitMaxDays"
        ]
      },
      "PublicShippingZoneDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Zone id."
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing zone name."
          },
          "countries": {
            "description": "ISO 3166-1 alpha-2 country codes (uppercase) this zone matches. An EMPTY array matches NO destination, so this zone's flat-rate configuration and live-rate eligibility apply nowhere.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "number",
            "description": "Display order — zones are listed ascending."
          },
          "liveRatesEnabled": {
            "type": "boolean",
            "description": "#3272 — ZONE-LEVEL ELIGIBILITY for live carrier rates: whether this zone is configured to permit carrier quoting. This is CONFIGURATION, NOT current availability. Read it with `rates` as four configuration states:\n\n- empty `rates` + `false`: no active flat rate; live eligibility paused.\n- empty `rates` + `true`: no active flat rate; live-rate eligible.\n- non-empty `rates` + `false`: active flat-rate configuration only.\n- non-empty `rates` + `true`: active flat-rate configuration and live-rate eligibility.\n\nBoth flat-rate configuration and live-rate eligibility apply only when the destination matches `countries`; an empty `countries` array matches nothing. `true` is NECESSARY but NOT SUFFICIENT for a carrier option: address, cart, tenant/platform, origin/carrier, and quote conditions that are not represented on this read still apply. For an ordinary checkout, resolve the current option set with `POST /api/v1/public/checkout/sessions/{token}/reprice` and read `availableShippingOptions`. Physical subscription checkout has no public equivalent for resolving its current shipping options."
          },
          "rates": {
            "description": "This zone's active FLAT-rate configurations, ascending by `sortOrder` then name. Empty establishes ONLY that no active flat rate is published; read `liveRatesEnabled` to distinguish live-rate eligibility from a zone with neither configuration (#3272). A non-empty list does not mean every rate applies to the current cart, because each rate has its own `minimumSubtotalInCents` floor. This read does not resolve cart-specific options. For an ordinary checkout, use `POST /api/v1/public/checkout/sessions/{token}/reprice` and read `availableShippingOptions`; physical subscription checkout has no public equivalent for resolving its current shipping options.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicShippingRateDto"
            }
          }
        },
        "required": [
          "id",
          "name",
          "countries",
          "sortOrder",
          "liveRatesEnabled",
          "rates"
        ]
      },
      "DeliveryPromiseRuleDto": {
        "type": "object",
        "properties": {
          "tierId": {
            "type": "string",
            "format": "uuid",
            "description": "Organization-global promise tier id enabled/configured in this zone."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether this zone currently offers the tier. Disabled rules remain saved."
          },
          "serviceCodes": {
            "minItems": 1,
            "maxItems": 50,
            "description": "Explicit ShipEngine service-code allowlist. Tier names or carrier marketing labels never infer eligibility.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "maxTransitDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "description": "Maximum quoted transit days accepted for this promise in this zone."
          },
          "pricingPolicy": {
            "type": "string",
            "enum": [
              "carrier_cost"
            ],
            "description": "MVP supports raw `carrier_cost` only. Fixed/free/markup policies remain #1903."
          }
        },
        "required": [
          "tierId",
          "enabled",
          "serviceCodes",
          "maxTransitDays",
          "pricingPolicy"
        ]
      },
      "ShippingRateResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "zoneId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing rate name shown at checkout."
          },
          "priceInCents": {
            "type": "number",
            "description": "Flat per-shipment fee in cents. Non-negative."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "description": "Minimum cart subtotal in cents to qualify for this rate. 0 = none."
          },
          "estimatedDelivery": {
            "type": "string",
            "nullable": true,
            "description": "Optional delivery-estimate copy shown at checkout, e.g. \"Arrives in 3-5 business days.\" `null` when unset."
          },
          "transitMinDays": {
            "type": "number",
            "nullable": true,
            "description": "#1103 — shortest calendar-day transit for the structured delivery estimate. `null` when unset."
          },
          "transitMaxDays": {
            "type": "number",
            "nullable": true,
            "description": "#1103 — longest calendar-day transit. `null` when unset."
          },
          "sortOrder": {
            "type": "number",
            "description": "Display order in checkout selectors."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-archive timestamp. `null` = active."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "zoneId",
          "name",
          "priceInCents",
          "minimumSubtotalInCents",
          "estimatedDelivery",
          "transitMinDays",
          "transitMaxDays",
          "sortOrder",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "ShippingZoneResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing zone name."
          },
          "countries": {
            "description": "ISO 3166-1 alpha-2 country codes, uppercase (e.g. [\"US\", \"CA\"]). Empty = matches no orders.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "number",
            "description": "Display order in admin lists / checkout."
          },
          "liveRatesEnabled": {
            "type": "boolean",
            "description": "#1718 — offer live carrier rates for destinations this zone serves. Only has effect once the org connects a shipping provider in Settings → Shipping; off = flat rates only, provider key untouched."
          },
          "deliveryPromiseRules": {
            "description": "#2000 — normalized zone-owned promise rules. Each rule references an organization-global tier id and carries explicit services/target/pricing.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryPromiseRuleDto"
            }
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-archive timestamp. `null` = active."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "rates": {
            "description": "Rates in this zone, ordered by `sortOrder` then name.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShippingRateResponseDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "countries",
          "sortOrder",
          "liveRatesEnabled",
          "deliveryPromiseRules",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "rates"
        ]
      },
      "UpsertShippingZoneDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "countries": {
            "description": "ISO-3166-1 alpha-2 country codes, uppercase (e.g. [\"US\", \"CA\"]). Empty array is permitted for a zone that is still being configured.",
            "maxItems": 300,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Display order — zones are listed ascending. Defaults to 0."
          },
          "liveRatesEnabled": {
            "type": "boolean",
            "description": "#1718 — offer live carrier rates for destinations this zone serves. Defaults to true; only has effect once the org connects a shipping provider in Settings → Shipping (identity lives there, usage here). Turning it off pauses live quoting for the zone without touching the stored provider key."
          },
          "deliveryPromiseRules": {
            "maxItems": 20,
            "description": "#2000 — zone-owned delivery-promise eligibility, target, and MVP pricing rules. Replaces the complete rule set when provided.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryPromiseRuleDto"
            }
          }
        },
        "required": [
          "name",
          "countries"
        ]
      },
      "UpdateShippingZoneDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "countries": {
            "description": "ISO-3166-1 alpha-2 country codes, uppercase. When supplied this replaces the current list — there is no append/merge mode.",
            "maxItems": 300,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0
          },
          "liveRatesEnabled": {
            "type": "boolean",
            "description": "#1718 — offer live carrier rates for destinations this zone serves. Only has effect once the org connects a shipping provider in Settings → Shipping."
          },
          "deliveryPromiseRules": {
            "maxItems": 20,
            "description": "#2000 — complete replacement of this zone’s promise rules.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryPromiseRuleDto"
            }
          },
          "deliveryPromiseRulesExpectedRevision": {
            "type": "string",
            "format": "date-time",
            "description": "#2413 — required whenever `deliveryPromiseRules` is supplied. Echo the zone `updatedAt` value returned by the latest read; stale rule writes are rejected with HTTP 409."
          }
        }
      },
      "UpsertShippingRateDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Flat per-shipment fee in cents. Must be >= 0."
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Minimum cart subtotal (in cents) for this rate to qualify. Defaults to 0 (no minimum). The storefront cost calc skips rates whose `minimumSubtotalInCents` exceeds the cart subtotal."
          },
          "estimatedDelivery": {
            "type": "string",
            "maxLength": 200,
            "nullable": true,
            "description": "Optional checkout copy, e.g. \"Arrives in 3–5 business days.\" Stays on the rate so the merchant owns the per-rate messaging. Also the honest fallback shown when a structured delivery estimate cannot be computed (#1103)."
          },
          "transitMinDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 365,
            "nullable": true,
            "description": "#1103 — shortest CALENDAR-day transit for this rate. Combined with transitMaxDays and the tenant processing/cutoff settings to render a structured delivery estimate; omit (or null) to keep the free-text estimate only."
          },
          "transitMaxDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 365,
            "nullable": true,
            "description": "#1103 — longest CALENDAR-day transit for this rate. Must be >= transitMinDays (enforced server-side)."
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Display order — rates are listed ascending. Defaults to 0."
          }
        },
        "required": [
          "name",
          "priceInCents"
        ]
      },
      "UpdateShippingRateDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "minimumSubtotalInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "estimatedDelivery": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "transitMinDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 365,
            "nullable": true
          },
          "transitMaxDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 365,
            "nullable": true
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "ShippingBoxPresetType": {
        "type": "string",
        "enum": [
          "CUSTOM",
          "CARRIER_FLAT_RATE"
        ]
      },
      "ShippingBoxPresetResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable logical preset id shared by every revision."
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "name": {
            "type": "string"
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingBoxPresetType"
              }
            ]
          },
          "insideLength": {
            "type": "number"
          },
          "insideWidth": {
            "type": "number"
          },
          "insideHeight": {
            "type": "number"
          },
          "insideDimensionUnit": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "outsideLength": {
            "type": "number"
          },
          "outsideWidth": {
            "type": "number"
          },
          "outsideHeight": {
            "type": "number"
          },
          "outsideDimensionUnit": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "tareWeight": {
            "type": "number"
          },
          "tareWeightUnit": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "maxLoadedWeight": {
            "type": "number",
            "nullable": true
          },
          "maxLoadedWeightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "providerPackageCode": {
            "type": "string",
            "nullable": true
          },
          "active": {
            "type": "boolean"
          },
          "isDefault": {
            "type": "boolean"
          },
          "preferenceOrder": {
            "type": "integer",
            "minimum": 0
          },
          "insideSameAsOutsideConfirmed": {
            "type": "boolean"
          },
          "deactivatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "revision",
          "name",
          "type",
          "insideLength",
          "insideWidth",
          "insideHeight",
          "insideDimensionUnit",
          "outsideLength",
          "outsideWidth",
          "outsideHeight",
          "outsideDimensionUnit",
          "tareWeight",
          "tareWeightUnit",
          "maxLoadedWeight",
          "maxLoadedWeightUnit",
          "providerPackageCode",
          "active",
          "isDefault",
          "preferenceOrder",
          "insideSameAsOutsideConfirmed",
          "deactivatedAt",
          "createdAt"
        ]
      },
      "CreateShippingBoxPresetDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "example": "12 × 9 × 6 mailer"
          },
          "type": {
            "description": "Authoring kind only. Carrier flat-rate behavior remains inactive until its dedicated provider slice.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingBoxPresetType"
              }
            ]
          },
          "insideLength": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Usable inside length: what contents can fit."
          },
          "insideWidth": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Usable inside width: what contents can fit."
          },
          "insideHeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Usable inside height: what contents can fit."
          },
          "insideDimensionUnit": {
            "description": "Unit shared by the complete inside-dimension group.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "outsideLength": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Outside parcel length sent to carrier rating."
          },
          "outsideWidth": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Outside parcel width sent to carrier rating."
          },
          "outsideHeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Outside parcel height sent to carrier rating."
          },
          "outsideDimensionUnit": {
            "description": "Unit shared by the complete outside-dimension group.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "tareWeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Empty-carton packaging weight."
          },
          "tareWeightUnit": {
            "description": "Unit for the empty-carton tare.",
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "maxLoadedWeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Optional maximum total loaded package weight. Send together with maxLoadedWeightUnit.",
            "nullable": true
          },
          "maxLoadedWeightUnit": {
            "nullable": true,
            "description": "Unit for maxLoadedWeight. Both maximum-weight fields must be set or null.",
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "providerPackageCode": {
            "type": "string",
            "maxLength": 100,
            "nullable": true,
            "description": "Optional carrier package code. Saving it does not enable provider flat-rate behavior."
          },
          "insideSameAsOutsideConfirmed": {
            "type": "boolean",
            "description": "Explicit merchant confirmation that inside dimensions are being approximated as exactly equal to outside dimensions."
          }
        },
        "required": [
          "name",
          "type",
          "insideLength",
          "insideWidth",
          "insideHeight",
          "insideDimensionUnit",
          "outsideLength",
          "outsideWidth",
          "outsideHeight",
          "outsideDimensionUnit",
          "tareWeight",
          "tareWeightUnit",
          "insideSameAsOutsideConfirmed"
        ]
      },
      "ShippingBoxPresetOrderEntryDto": {
        "type": "object",
        "properties": {
          "presetId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "presetId",
          "expectedRevision"
        ]
      },
      "ReorderShippingBoxPresetsDto": {
        "type": "object",
        "properties": {
          "presets": {
            "maxItems": 100,
            "description": "Every current preset exactly once, in the desired deterministic order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShippingBoxPresetOrderEntryDto"
            }
          }
        },
        "required": [
          "presets"
        ]
      },
      "ReplaceShippingBoxPresetDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "example": "12 × 9 × 6 mailer"
          },
          "type": {
            "description": "Authoring kind only. Carrier flat-rate behavior remains inactive until its dedicated provider slice.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingBoxPresetType"
              }
            ]
          },
          "insideLength": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Usable inside length: what contents can fit."
          },
          "insideWidth": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Usable inside width: what contents can fit."
          },
          "insideHeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Usable inside height: what contents can fit."
          },
          "insideDimensionUnit": {
            "description": "Unit shared by the complete inside-dimension group.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "outsideLength": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Outside parcel length sent to carrier rating."
          },
          "outsideWidth": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Outside parcel width sent to carrier rating."
          },
          "outsideHeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Outside parcel height sent to carrier rating."
          },
          "outsideDimensionUnit": {
            "description": "Unit shared by the complete outside-dimension group.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "tareWeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Empty-carton packaging weight."
          },
          "tareWeightUnit": {
            "description": "Unit for the empty-carton tare.",
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "maxLoadedWeight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 1000000000,
            "exclusiveMaximum": true,
            "description": "Optional maximum total loaded package weight. Send together with maxLoadedWeightUnit.",
            "nullable": true
          },
          "maxLoadedWeightUnit": {
            "nullable": true,
            "description": "Unit for maxLoadedWeight. Both maximum-weight fields must be set or null.",
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "providerPackageCode": {
            "type": "string",
            "maxLength": 100,
            "nullable": true,
            "description": "Optional carrier package code. Saving it does not enable provider flat-rate behavior."
          },
          "insideSameAsOutsideConfirmed": {
            "type": "boolean",
            "description": "Explicit merchant confirmation that inside dimensions are being approximated as exactly equal to outside dimensions."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 1,
            "description": "Current revision observed by the editor. Stale writes fail with 409."
          }
        },
        "required": [
          "name",
          "type",
          "insideLength",
          "insideWidth",
          "insideHeight",
          "insideDimensionUnit",
          "outsideLength",
          "outsideWidth",
          "outsideHeight",
          "outsideDimensionUnit",
          "tareWeight",
          "tareWeightUnit",
          "insideSameAsOutsideConfirmed",
          "expectedRevision"
        ]
      },
      "ShippingBoxPresetRevisionCommandDto": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 1,
            "description": "Current revision observed by the caller. Stale lifecycle/default writes fail with 409."
          }
        },
        "required": [
          "expectedRevision"
        ]
      },
      "ShippingProviderCarrierDto": {
        "type": "object",
        "properties": {
          "carrierId": {
            "type": "string",
            "description": "Provider-assigned carrier id (`se-…`). Account-specific — required input on every rate call, never shared across tenants.",
            "example": "se-1234567"
          },
          "carrierCode": {
            "type": "string",
            "description": "Provider carrier code, e.g. `usps` or `ups`.",
            "example": "usps"
          },
          "friendlyName": {
            "type": "string",
            "description": "Carrier display name from the provider.",
            "example": "USPS"
          },
          "nickname": {
            "type": "string",
            "nullable": true,
            "description": "The tenant's own nickname for the carrier account, or null."
          },
          "requiresFundedAmount": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether ShipEngine requires this carrier account to be pre-funded. Null when the provider did not return a trustworthy flag."
          },
          "balanceInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true,
            "description": "Last refreshed ShipEngine scalar balance normalized to hundredths under its documented USD/GBP funding contract. List Carriers does not return the account currency. Null when the scalar is unavailable or invalid."
          }
        },
        "required": [
          "carrierId",
          "carrierCode",
          "friendlyName",
          "nickname",
          "requiresFundedAmount",
          "balanceInMinorUnits"
        ]
      },
      "ShippingProviderStatusDto": {
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean",
            "description": "Whether a provider connection exists for this org."
          },
          "provider": {
            "type": "string",
            "description": "Shipping provider discriminator. Always `shipengine` today.",
            "example": "shipengine"
          },
          "sandbox": {
            "type": "boolean",
            "nullable": true,
            "description": "True when the stored key is a `TEST_`-prefixed sandbox key; null when no connection exists."
          },
          "keyMask": {
            "type": "string",
            "nullable": true,
            "description": "Masked key fingerprint (e.g. `TEST_••••ab12`), or null when no connection exists. The full key is never returned.",
            "example": "TEST_••••ab12"
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the provider was first connected (ISO 8601), or null."
          },
          "lastVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the stored key last passed a live provider check (ISO 8601), or null."
          },
          "disabled": {
            "type": "boolean",
            "description": "True when the connection has been parked (soft kill switch) — live quoting skips disabled connections."
          },
          "historicalLabelAccessVerified": {
            "type": "boolean",
            "description": "True when the current key was verified against an existing label in the same provider account. An enabled connection may access purchases from older key generations. False also covers a first connection; an unverified replacement leaves historical operations fenced."
          },
          "carriers": {
            "description": "Cached snapshot of the tenant's connected carriers, refreshed at connect/test time. Empty when no connection exists.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShippingProviderCarrierDto"
            }
          },
          "carriersRefreshedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the carrier snapshot was last refreshed (ISO 8601), or null."
          },
          "cipherConfigured": {
            "type": "boolean",
            "description": "Whether credential encryption is configured on this environment. When false, connect/test are unavailable (503) and the admin should show a configuration warning."
          }
        },
        "required": [
          "connected",
          "provider",
          "sandbox",
          "keyMask",
          "connectedAt",
          "lastVerifiedAt",
          "disabled",
          "historicalLabelAccessVerified",
          "carriers",
          "carriersRefreshedAt",
          "cipherConfigured"
        ]
      },
      "ShippingProviderServiceDto": {
        "type": "object",
        "properties": {
          "serviceCode": {
            "type": "string",
            "description": "Provider service code, e.g. `usps_priority_mail`.",
            "example": "usps_priority_mail"
          },
          "name": {
            "type": "string",
            "description": "Human-readable service name from the provider.",
            "example": "USPS Priority Mail"
          },
          "carrierId": {
            "type": "string",
            "description": "Provider-assigned carrier id this service belongs to (`se-…`).",
            "example": "se-1234567"
          },
          "carrierCode": {
            "type": "string",
            "description": "Provider carrier code, e.g. `usps`.",
            "example": "usps"
          },
          "carrierFriendlyName": {
            "type": "string",
            "description": "Carrier display name from the provider.",
            "example": "USPS"
          },
          "domestic": {
            "type": "boolean",
            "description": "Whether the service can carry domestic (same-country) shipments."
          },
          "international": {
            "type": "boolean",
            "description": "Whether the service can carry international shipments."
          }
        },
        "required": [
          "serviceCode",
          "name",
          "carrierId",
          "carrierCode",
          "carrierFriendlyName",
          "domestic",
          "international"
        ]
      },
      "ShippingProviderServicesDto": {
        "type": "object",
        "properties": {
          "services": {
            "description": "The tenant's connected carriers' rateable services, deduped by service code. Empty only when the live provider read succeeded but returned no catalog services.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShippingProviderServiceDto"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "live",
              "snapshot"
            ],
            "description": "`live` when this request refreshed the provider successfully; `snapshot` when a provider failure was served from the stored carrier cache.",
            "example": "live"
          },
          "refreshedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the returned catalog was last observed from the provider. Null is possible only for a legacy snapshot without refresh metadata.",
            "example": "2026-08-20T18:42:15.000Z"
          }
        },
        "required": [
          "services",
          "source",
          "refreshedAt"
        ]
      },
      "ConnectShippingProviderDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "apiKey": {
            "type": "string",
            "minLength": 10,
            "maxLength": 200,
            "description": "The tenant's ShipEngine API key. Write-only: stored encrypted at rest and never returned by any read — status responses carry only a masked fingerprint. `TEST_`-prefixed keys connect in sandbox mode.",
            "example": "TEST_x2f9urMEQZ0…"
          }
        },
        "required": [
          "reason",
          "apiKey"
        ]
      },
      "TestShippingProviderConnectionResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "True when the stored key passed a live carrier listing against the provider."
          },
          "code": {
            "type": "string",
            "nullable": true,
            "description": "Coarse failure code on `ok: false` (e.g. `unauthorized`, `timeout`, `cipher_unavailable`), omitted/null on success."
          },
          "message": {
            "type": "string",
            "nullable": true,
            "description": "Safe display message for the failure, omitted/null on success."
          },
          "carriers": {
            "description": "The freshly fetched carrier list on success (also persisted to the connection snapshot).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShippingProviderCarrierDto"
            }
          }
        },
        "required": [
          "ok"
        ]
      },
      "DisconnectShippingProviderDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "acknowledgeUnremovedWebhooks": {
            "type": "boolean",
            "default": false,
            "description": "Explicitly acknowledge that remote webhooks may remain and require provider-side cleanup. Deletes the local credential and revokes carrier admission while retaining registration history. Does not bypass an in-flight label purchase."
          }
        },
        "required": [
          "reason"
        ]
      },
      "CarrierDeliverySettingsDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "x-extensible-enum": [
              "NOT_ENABLED",
              "REGISTRATION_PENDING",
              "REGISTERED",
              "SLOT_TAKEN",
              "REGISTRATION_FAILED",
              "DISABLED",
              "REREGISTRATION_REQUIRED",
              "UNAVAILABLE"
            ],
            "description": "Carrier-delivery registration state. Unknown values must remain visible as unavailable controls."
          },
          "desiredEnabled": {
            "type": "boolean",
            "nullable": true,
            "description": "Intent recorded for the current connection generation; false during pending disable. Null means no intent is available for this generation, including unavailable settings or no connection."
          },
          "changedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp of the registration state recorded on the current connection. Null means no recorded timestamp is available in this response, including unavailable settings or no connection."
          },
          "reasonCode": {
            "type": "string",
            "nullable": true,
            "x-extensible-enum": [
              "LIMITED",
              "SLOT_TAKEN",
              "CREDENTIAL_REJECTED",
              "PROVIDER_UNAVAILABLE",
              "INVALID_RESPONSE",
              "CREDENTIAL_UNAVAILABLE",
              "OUTCOME_UNKNOWN",
              "OUTCOME_UNRESOLVED",
              "GENERATION_UNVERIFIED",
              "ORGANIZATION_INACTIVE"
            ],
            "description": "Bounded local failure reason, never a provider error message."
          },
          "occupiedHost": {
            "type": "string",
            "nullable": true,
            "description": "Host-only evidence for an occupied provider slot. Null means no trustworthy host was observed."
          },
          "available": {
            "type": "boolean",
            "description": "Whether a connected, enabled provider and registration schema are available."
          }
        },
        "required": [
          "state",
          "desiredEnabled",
          "changedAt",
          "reasonCode",
          "occupiedHost",
          "available"
        ]
      },
      "BuyShippingLabelLineDto": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued original-order commerce line id. The API verifies that it belongs to this tenant and order before allocating it."
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Positive quantity from this order line to prepare.",
            "example": 1
          }
        },
        "required": [
          "lineId",
          "quantity"
        ]
      },
      "BuyShippingLabelPackageDto": {
        "type": "object",
        "properties": {
          "weight": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Confirmed loaded package weight, expressed in `weightUnit`.",
            "example": 3.25
          },
          "weightUnit": {
            "description": "Unit for the confirmed loaded package weight.",
            "example": "LB",
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Confirmed outside parcel length. If any dimension is supplied, length, width, height, and `dimensionUnit` are all required.",
            "example": 12
          },
          "width": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Confirmed outside parcel width. Part of the all-or-none dimensions group.",
            "example": 9
          },
          "height": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Confirmed outside parcel height. Part of the all-or-none dimensions group.",
            "example": 6
          },
          "dimensionUnit": {
            "description": "Unit shared by all three outside dimensions. Required with any dimension.",
            "example": "IN",
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "providerPackageCode": {
            "type": "string",
            "maxLength": 100,
            "description": "Optional provider package code compatible with the selected carrier (for example `package`). It does not replace physical measurements.",
            "example": "package"
          },
          "recommendationSignature": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque server-authored package recommendation signature. Omit after editing any suggested package fact to proceed as a manual package."
          }
        },
        "required": [
          "weight",
          "weightUnit"
        ]
      },
      "DeliveryPromiseRecommendationRequestDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Exact original-order line quantities being considered for this package. The API tenant-validates them but does not allocate or mutate them.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyShippingLabelLineDto"
            }
          },
          "package": {
            "description": "Merchant-confirmed loaded package facts. The exact normalized package is used for the fresh reference and every candidate without being persisted.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyShippingLabelPackageDto"
              }
            ]
          }
        },
        "required": [
          "lines",
          "package"
        ]
      },
      "DeliveryPromiseRecommendationPromiseDto": {
        "type": "object",
        "properties": {
          "tierId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "shipByDate": {
            "type": "string",
            "format": "date"
          },
          "deliveryEndDate": {
            "type": "string",
            "format": "date"
          },
          "timezone": {
            "type": "string"
          },
          "settingsRevision": {
            "type": "string"
          },
          "ruleRevision": {
            "type": "string"
          }
        },
        "required": [
          "tierId",
          "name",
          "shipByDate",
          "deliveryEndDate",
          "timezone",
          "settingsRevision",
          "ruleRevision"
        ]
      },
      "DeliveryPromiseRecommendationAddressEvidenceDto": {
        "type": "object",
        "properties": {
          "countryCode": {
            "type": "string",
            "example": "US"
          },
          "stateProvince": {
            "type": "string",
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "example": "83702"
          }
        },
        "required": [
          "countryCode",
          "stateProvince",
          "postalCode"
        ]
      },
      "DeliveryPromiseRecommendationPackageEvidenceDto": {
        "type": "object",
        "properties": {
          "weightValue": {
            "type": "number",
            "example": 3.25
          },
          "weightUnit": {
            "type": "string",
            "enum": [
              "pound",
              "ounce",
              "gram",
              "kilogram"
            ]
          },
          "packageCode": {
            "type": "string",
            "example": "package"
          },
          "length": {
            "type": "number",
            "nullable": true,
            "example": 12
          },
          "width": {
            "type": "number",
            "nullable": true,
            "example": 9
          },
          "height": {
            "type": "number",
            "nullable": true,
            "example": 6
          },
          "dimensionUnit": {
            "type": "string",
            "nullable": true,
            "enum": [
              "inch",
              "centimeter"
            ],
            "example": "inch"
          }
        },
        "required": [
          "weightValue",
          "weightUnit",
          "packageCode",
          "length",
          "width",
          "height",
          "dimensionUnit"
        ]
      },
      "DeliveryPromiseRecommendationCapabilityEvidenceDto": {
        "type": "object",
        "properties": {
          "route": {
            "type": "string",
            "enum": [
              "domestic",
              "international"
            ]
          },
          "routeCatalogVerified": {
            "type": "boolean",
            "description": "True only when the fresh carrier catalog explicitly supports this route."
          },
          "exactPackageRated": {
            "type": "boolean",
            "description": "True because the provider returned this rate for the exact normalized package."
          },
          "customsRequired": {
            "type": "boolean",
            "description": "International/customs comparisons fail closed in this MVP, so every returned candidate has this set to false."
          },
          "insuranceRequired": {
            "type": "boolean",
            "description": "Insurance-bearing frozen quotes fail closed until requirements are representable."
          },
          "confirmationOrSignatureRequired": {
            "type": "boolean",
            "description": "Confirmation/signature-bearing frozen quotes fail closed until requirements are representable."
          }
        },
        "required": [
          "route",
          "routeCatalogVerified",
          "exactPackageRated",
          "customsRequired",
          "insuranceRequired",
          "confirmationOrSignatureRequired"
        ]
      },
      "DeliveryPromiseRecommendationInputsDto": {
        "type": "object",
        "properties": {
          "shipDate": {
            "type": "string",
            "format": "date",
            "description": "Server-derived ship date sent identically for the reference and candidates."
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "route": {
            "type": "string",
            "enum": [
              "domestic",
              "international"
            ]
          },
          "origin": {
            "$ref": "#/components/schemas/DeliveryPromiseRecommendationAddressEvidenceDto"
          },
          "destination": {
            "$ref": "#/components/schemas/DeliveryPromiseRecommendationAddressEvidenceDto"
          },
          "package": {
            "$ref": "#/components/schemas/DeliveryPromiseRecommendationPackageEvidenceDto"
          },
          "serviceCodes": {
            "description": "Normalized service codes submitted together in the single fresh rate request.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "requiredCapabilities": {
            "$ref": "#/components/schemas/DeliveryPromiseRecommendationCapabilityEvidenceDto"
          }
        },
        "required": [
          "shipDate",
          "currency",
          "route",
          "origin",
          "destination",
          "package",
          "serviceCodes",
          "requiredCapabilities"
        ]
      },
      "DeliveryPromiseRecommendationReferenceDto": {
        "type": "object",
        "properties": {
          "rateId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "shipengine"
            ]
          },
          "carrierId": {
            "type": "string"
          },
          "carrierName": {
            "type": "string"
          },
          "serviceCode": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "carrierCostInMinorUnits": {
            "type": "number",
            "minimum": 1
          },
          "currency": {
            "type": "string"
          },
          "deliveryDays": {
            "type": "number",
            "minimum": 0
          },
          "projectedDeliveryDate": {
            "type": "string",
            "format": "date"
          },
          "quotedAt": {
            "type": "string",
            "format": "date-time"
          },
          "capabilityEvidence": {
            "$ref": "#/components/schemas/DeliveryPromiseRecommendationCapabilityEvidenceDto"
          }
        },
        "required": [
          "rateId",
          "provider",
          "carrierId",
          "carrierName",
          "serviceCode",
          "serviceName",
          "carrierCostInMinorUnits",
          "currency",
          "deliveryDays",
          "projectedDeliveryDate",
          "quotedAt",
          "capabilityEvidence"
        ]
      },
      "DeliveryPromiseRecommendationCandidateDto": {
        "type": "object",
        "properties": {
          "rateId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "shipengine"
            ]
          },
          "carrierId": {
            "type": "string"
          },
          "carrierName": {
            "type": "string"
          },
          "serviceCode": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "carrierCostInMinorUnits": {
            "type": "number",
            "minimum": 1
          },
          "currency": {
            "type": "string"
          },
          "deliveryDays": {
            "type": "number",
            "minimum": 0
          },
          "projectedDeliveryDate": {
            "type": "string",
            "format": "date"
          },
          "quotedAt": {
            "type": "string",
            "format": "date-time"
          },
          "capabilityEvidence": {
            "$ref": "#/components/schemas/DeliveryPromiseRecommendationCapabilityEvidenceDto"
          },
          "classification": {
            "type": "string",
            "enum": [
              "same_or_faster",
              "meets_promise"
            ]
          },
          "savingsInMinorUnits": {
            "type": "number",
            "minimum": 50
          }
        },
        "required": [
          "rateId",
          "provider",
          "carrierId",
          "carrierName",
          "serviceCode",
          "serviceName",
          "carrierCostInMinorUnits",
          "currency",
          "deliveryDays",
          "projectedDeliveryDate",
          "quotedAt",
          "capabilityEvidence",
          "classification",
          "savingsInMinorUnits"
        ]
      },
      "DeliveryPromiseRecommendationResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "quoted",
              "unavailable"
            ]
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "not_promise_mode",
              "incomplete_promise_evidence",
              "promise_missed",
              "settings_changed",
              "zone_changed",
              "route_changed",
              "unsupported_capabilities",
              "provider_unavailable",
              "reference_unavailable"
            ]
          },
          "minimumSavingsInMinorUnits": {
            "type": "number",
            "description": "Inclusive MVP savings floor. Only two-decimal currencies are supported.",
            "example": 50
          },
          "promise": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPromiseRecommendationPromiseDto"
              }
            ]
          },
          "inputs": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPromiseRecommendationInputsDto"
              }
            ]
          },
          "reference": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPromiseRecommendationReferenceDto"
              }
            ]
          },
          "candidates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryPromiseRecommendationCandidateDto"
            }
          }
        },
        "required": [
          "status",
          "unavailableReason",
          "minimumSavingsInMinorUnits",
          "promise",
          "inputs",
          "reference",
          "candidates"
        ]
      },
      "ShippingLabelRateRequirementsDto": {
        "type": "object",
        "properties": {
          "plannedShipDate": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Planned carrier ship date. Omission or null leaves the date to the server/provider; a fresh quote and funded command must use the same explicit date when selected.",
            "example": "2026-09-15"
          },
          "confirmation": {
            "type": "string",
            "enum": [
              "none",
              "signature",
              "adult_signature"
            ],
            "description": "Requested delivery confirmation, applied to every compared rate and the funded label."
          },
          "insuredValueInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Additional carrier insurance coverage in accepted order-currency minor units; zero requests none."
          }
        }
      },
      "ShopShippingRatesDto": {
        "type": "object",
        "properties": {
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-owned FAILED prepared package for a read-only recovery comparison; its lines and physical facts must match."
          },
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyShippingLabelLineDto"
            }
          },
          "package": {
            "$ref": "#/components/schemas/BuyShippingLabelPackageDto"
          },
          "requirements": {
            "$ref": "#/components/schemas/ShippingLabelRateRequirementsDto"
          },
          "recipientPhone": {
            "type": "string",
            "maxLength": 50,
            "description": "Optional label-only recipient phone correction used for this comparison and the later exact quote. Does not change the accepted order address."
          }
        },
        "required": [
          "lines",
          "package"
        ]
      },
      "ShippingLabelRateRequirementsResponseDto": {
        "type": "object",
        "properties": {
          "plannedShipDate": {
            "type": "string",
            "nullable": true,
            "format": "date",
            "description": "Carrier ship-date basis. Null means no date was selected for the exact quote, or Shop stopped before it could select a comparison date; a successful Shop comparison returns the server-selected date."
          },
          "confirmation": {
            "type": "string",
            "enum": [
              "none",
              "signature",
              "adult_signature"
            ]
          },
          "insuredValueInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Additional carrier insurance coverage in accepted order-currency minor units; zero requests none."
          }
        },
        "required": [
          "plannedShipDate",
          "confirmation",
          "insuredValueInMinorUnits"
        ]
      },
      "ShopShippingRateCostComponentsDto": {
        "type": "object",
        "properties": {
          "basePostageInMinorUnits": {
            "type": "integer",
            "minimum": 0,
            "description": "Provider-returned base shipping amount, before separately returned charges."
          },
          "deliveryConfirmationFeeInMinorUnits": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Provider-returned delivery-confirmation charge, including a requested signature when separately itemized. Null means the provider did not return this component; it does not prove a zero fee or confirm the requested signature type."
          },
          "insuranceFeeInMinorUnits": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Provider-returned insurance charge. Null means the provider did not separately itemize it, not that coverage was proven free."
          },
          "otherFeeInMinorUnits": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Provider-returned aggregate other charge. Null means the provider did not separately itemize other charges."
          }
        },
        "required": [
          "basePostageInMinorUnits",
          "deliveryConfirmationFeeInMinorUnits",
          "insuranceFeeInMinorUnits",
          "otherFeeInMinorUnits"
        ]
      },
      "ShopShippingRateDto": {
        "type": "object",
        "properties": {
          "carrierId": {
            "type": "string"
          },
          "carrierName": {
            "type": "string"
          },
          "serviceCode": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "merchantPostageInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "costComponents": {
            "description": "The provider-returned base and separately itemized charges summed into merchantPostageInMinorUnits. A nullable component means it was not separately returned, not a proven zero charge.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShopShippingRateCostComponentsDto"
              }
            ]
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "estimatedDeliveryDate": {
            "type": "string",
            "nullable": true,
            "format": "date",
            "description": "Provider-authored estimated arrival date for the matching ship date; null means unknown."
          },
          "guaranteedService": {
            "type": "boolean",
            "nullable": true,
            "description": "Provider guarantee flag, if known. An estimated date is never represented as a delivery guarantee."
          },
          "originalService": {
            "type": "boolean",
            "description": "True for the immutable checkout carrier/service when captured. It does not rewrite customer guidance or charge."
          }
        },
        "required": [
          "carrierId",
          "carrierName",
          "serviceCode",
          "serviceName",
          "merchantPostageInMinorUnits",
          "costComponents",
          "currency",
          "estimatedDeliveryDate",
          "guaranteedService",
          "originalService"
        ]
      },
      "ShopShippingCarrierCoverageDto": {
        "type": "object",
        "properties": {
          "carrierId": {
            "type": "string"
          },
          "carrierName": {
            "type": "string"
          },
          "returnedEligibleRate": {
            "type": "boolean",
            "description": "At least one eligible rate was returned for this carrier in this request."
          }
        },
        "required": [
          "carrierId",
          "carrierName",
          "returnedEligibleRate"
        ]
      },
      "ShopShippingRatesResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "RATES",
              "NO_RATES",
              "UNAVAILABLE"
            ]
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "Safe reason for no eligible rates or a non-funded provider failure; null when rates are returned."
          },
          "requirements": {
            "$ref": "#/components/schemas/ShippingLabelRateRequirementsResponseDto"
          },
          "rates": {
            "description": "Eligible services returned for this request. Empty means status/reason reports no eligible service or an unavailable comparison; it does not by itself prove that no carrier is connected. Partial results can omit services.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShopShippingRateDto"
            }
          },
          "carriers": {
            "description": "Connected-carrier coverage available to this request. Empty can mean promise evidence was unavailable or manual international shopping stopped before carrier access; it does not by itself prove the tenant has no connected carriers. Use status/reason and partial to interpret coverage.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShopShippingCarrierCoverageDto"
            }
          },
          "partial": {
            "type": "boolean",
            "description": "The provider reported partial errors, invalid rates, or unusable rows. Returned services are not asserted to cover every connected carrier."
          },
          "quotedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "UI comparison freshness limit; selecting a rate always requires a separate exact quote."
          }
        },
        "required": [
          "status",
          "reason",
          "requirements",
          "rates",
          "carriers",
          "partial",
          "quotedAt",
          "expiresAt"
        ]
      },
      "PackageRecommendationRequestDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Exact original-order line quantities the merchant intends to place in one package.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyShippingLabelLineDto"
            }
          }
        },
        "required": [
          "lines"
        ]
      },
      "PackageRecommendationResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "RECOMMENDED",
              "NO_RECOMMENDATION"
            ],
            "description": "RECOMMENDED only when a bounded placement witness proves every selected unit fits."
          },
          "signature": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Stable signature over the package decision and all measurement/preset evidence."
          },
          "plan": {
            "type": "object",
            "additionalProperties": true,
            "description": "Server-owned signed plan, including the selected preset and placement witness, or an explicit no-recommendation reason."
          }
        },
        "required": [
          "status",
          "signature",
          "plan"
        ]
      },
      "CancelPreparedShipmentDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          }
        },
        "required": [
          "reason"
        ]
      },
      "ShippingLabelVoidOperationSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "PREPARED_SHIPMENT_CANCELLATION",
              "PARKED_LABEL_VOID",
              "POST_HANDOFF_POSTAGE_RETIREMENT"
            ],
            "description": "#4050 — what this void operation is FOR, and therefore what a confirmed void does besides retiring postage. PREPARED_SHIPMENT_CANCELLATION cancels the READY shipment; PARKED_LABEL_VOID cancels the PLANNED package; POST_HANDOFF_POSTAGE_RETIREMENT changes nothing but the postage. Read this field rather than inferring purpose from any other value."
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "PROCESSING",
              "RECONCILIATION_REQUIRED",
              "VOID_CONFIRMED_CANCEL_PENDING",
              "VOID_CONFIRMED_PARENT_ABORTED",
              "COMPLETED",
              "DENIED_OR_INELIGIBLE"
            ]
          },
          "carrierRefundDisposition": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "PENDING",
              "SETTLED",
              "DENIED",
              "NOT_APPLICABLE"
            ]
          },
          "providerMessage": {
            "type": "string",
            "nullable": true
          },
          "requestedAt": {
            "format": "date-time",
            "type": "string"
          },
          "reconciliationRequiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "automaticRetryExhaustedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "voidConfirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deniedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "purpose",
          "status",
          "carrierRefundDisposition",
          "providerMessage",
          "requestedAt",
          "reconciliationRequiredAt",
          "automaticRetryExhaustedAt",
          "voidConfirmedAt",
          "completedAt",
          "deniedAt",
          "updatedAt"
        ]
      },
      "CommerceRecordRevisionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "integer",
            "format": "int32",
            "description": "Monotonic per-record revision counter (1-based). A revise op supersedes the current sent revision and clones its content into a new DRAFT at max+1; the customer-visible number is the highest non-superseded revision."
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "SUPERSEDED",
              "ACCEPTED",
              "VOIDED",
              "EXPIRED"
            ],
            "description": "Revision lifecycle. Only a DRAFT revision is mutable; DRAFT→SENT freezes its content + pricing snapshots immutably, and a later revise flips the prior SENT/ACCEPTED revision to SUPERSEDED."
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "contentSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "description": "Immutable content snapshot (lines, groups, customer/company block) frozen at send. The frozen record of what the customer was shown."
          },
          "pricingSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Immutable priced-snapshot rationale (ADR-012): the per-line + document pricing breakdown captured at send, so the amounts never re-derive from live catalog/tax config. Null on DRAFT revisions not yet repriced."
          },
          "paymentTermsSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen payment-terms snapshot (net-days / deposit schedule) resolved from the record's payment-term preset at send. Null when no terms apply."
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "shippingInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxExempt": {
            "type": "boolean"
          },
          "taxExemptionReason": {
            "type": "string",
            "nullable": true
          },
          "customerVisibleAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "supersededAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "recordId",
          "revisionNumber",
          "status",
          "title",
          "notes",
          "contentSnapshot",
          "pricingSnapshot",
          "paymentTermsSnapshot",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents",
          "taxExempt",
          "taxExemptionReason",
          "customerVisibleAt",
          "sentAt",
          "acceptedAt",
          "supersededAt",
          "expiresAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceLineGroupDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "pricingRef": {
            "type": "string",
            "nullable": true,
            "description": "Stable reference into the revision pricing snapshot. Null on legacy/manual groups."
          },
          "kind": {
            "type": "string",
            "enum": [
              "BUNDLE",
              "PACKAGE",
              "KIT",
              "PROPOSAL_SECTION",
              "CUSTOM"
            ]
          },
          "compositionItemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "compositionRevision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "compositionSelectedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "recordId",
          "revisionId",
          "pricingRef",
          "kind",
          "compositionItemId",
          "compositionRevision",
          "compositionSelectedQuantity",
          "title",
          "description",
          "sortOrder",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "groupId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "pricingRef": {
            "type": "string",
            "nullable": true,
            "description": "Stable reference into the revision pricing snapshot. Null on legacy/manual lines."
          },
          "compositionComponentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "compositionPosition": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "compositionDefinitionQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "compositionEffectiveQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "compositionDiscountBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 10000,
            "nullable": true
          },
          "compositionIntrinsicSavingsInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "compositionPriceAuthorityKind": {
            "type": "string",
            "enum": [
              "CATALOG",
              "BOOKING_SERVICE"
            ],
            "nullable": true,
            "description": "Frozen authority used to resolve this composed component price."
          },
          "compositionBookingServiceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "compositionBookingPricingMode": {
            "type": "string",
            "enum": [
              "FIXED_PRICE",
              "FLAT_TIME",
              "PRICING_STRUCTURE"
            ],
            "nullable": true
          },
          "compositionBookingPricingBasis": {
            "type": "string",
            "enum": [
              "FIXED_PRICE",
              "RESERVED_WINDOW"
            ],
            "nullable": true
          },
          "compositionPricingIntervalMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "compositionPricingIntervalCount": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "compositionPricingUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "appliedPricingPolicyId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "appliedPricingPolicyRevisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "appliedPricingPolicyRevisionNumber": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "appliedPricingPolicyBandId": {
            "type": "string",
            "maxLength": 128,
            "nullable": true
          },
          "appliedPricingPolicyBandUpperBoundMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 527040,
            "nullable": true
          },
          "appliedPricingPolicyFactorBasisPoints": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000,
            "nullable": true
          },
          "appliedPricingPolicyElapsedMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "appliedPricingPolicyMinimumDurationMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 527040,
            "nullable": true
          },
          "appliedPricingPolicyGraceMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 1440,
            "nullable": true
          },
          "appliedPricingPolicyEffectiveMinutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 527040,
            "nullable": true
          },
          "appliedPricingPolicyDerivedUnitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true
          },
          "category": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "SERVICE",
              "FEE",
              "DEPOSIT",
              "ADJUSTMENT",
              "CUSTOM"
            ]
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Reservation-owning legacy OrderItem for checkout-mirrored lines; null for manual orders and pre-activation aggregate-only history."
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "unitPriceInCents": {
            "type": "integer",
            "format": "int32"
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalPriceInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxExempt": {
            "type": "boolean"
          },
          "taxExemptionReason": {
            "type": "string",
            "nullable": true
          },
          "servicePeriodStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "servicePeriodEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "recordId",
          "revisionId",
          "groupId",
          "pricingRef",
          "compositionComponentId",
          "compositionPosition",
          "compositionDefinitionQuantity",
          "compositionEffectiveQuantity",
          "compositionDiscountBasisPoints",
          "compositionIntrinsicSavingsInCents",
          "compositionPriceAuthorityKind",
          "compositionBookingServiceId",
          "compositionBookingPricingMode",
          "compositionBookingPricingBasis",
          "compositionPricingIntervalMinutes",
          "compositionPricingIntervalCount",
          "compositionPricingUnits",
          "appliedPricingPolicyId",
          "appliedPricingPolicyRevisionId",
          "appliedPricingPolicyRevisionNumber",
          "appliedPricingPolicyBandId",
          "appliedPricingPolicyBandUpperBoundMinutes",
          "appliedPricingPolicyFactorBasisPoints",
          "appliedPricingPolicyElapsedMinutes",
          "appliedPricingPolicyMinimumDurationMinutes",
          "appliedPricingPolicyGraceMinutes",
          "appliedPricingPolicyEffectiveMinutes",
          "appliedPricingPolicyDerivedUnitPriceInCents",
          "category",
          "itemId",
          "variantId",
          "orderItemId",
          "sku",
          "name",
          "description",
          "quantity",
          "unitPriceInCents",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalPriceInCents",
          "taxExempt",
          "taxExemptionReason",
          "servicePeriodStartsAt",
          "servicePeriodEndsAt",
          "tags",
          "metadata",
          "sortOrder",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceFulfillmentLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "fulfillmentId": {
            "type": "string",
            "format": "uuid"
          },
          "lineId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "replacementReturnItemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "replacesFulfillmentLineId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "fulfillmentId",
          "lineId",
          "quantity",
          "replacementReturnItemId",
          "replacesFulfillmentLineId",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceCarrierTrackingConflictReceiptDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "description": "Where the receipt came from. Open-ended catalog: see x-extensible-enum for the known stable values and treat an unrecognized value as generic carrier evidence. WEBHOOK and POLL are natural carrier evidence. SYNTHETIC is Preview-only platform-gated injection that cannot exist on production and is never natural proof.",
            "x-extensible-enum": [
              "WEBHOOK",
              "POLL",
              "SYNTHETIC"
            ]
          },
          "statusCode": {
            "type": "string",
            "nullable": true,
            "description": "The provider's top-level tracking status code as observed in this receipt, under the bounded grammar `^[A-Z0-9_]{1,64}$` (UNRECOGNIZED when the provider value fell outside it). Null when the snapshot carried none."
          },
          "statusDetailCode": {
            "type": "string",
            "nullable": true,
            "description": "The provider status detail code under the same bounded grammar, or null when absent. Beside a DE status, any value outside the DR-4054-13 allowlist is exactly why a delivery was not applied."
          },
          "actualDeliveryDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The carrier's stated delivery instant, when the receipt carried one. Null does not mean the parcel was not delivered; see `deliveryEventOccurredAt`."
          },
          "deliveryEventOccurredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The DR-4054-13 fallback delivery instant: the newest qualifying delivery event in the same signed payload. Null when none qualified."
          },
          "latestEventOccurredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The newest carrier event instant in the receipt, whatever its status. Null when the payload carried no dated event."
          },
          "receivedAt": {
            "format": "date-time",
            "type": "string",
            "description": "When cartonium durably recorded the verified receipt."
          },
          "applyStatus": {
            "type": "string",
            "enum": [
              "CONFLICT"
            ],
            "description": "Always CONFLICT on this projection; published so the object is self-describing. Other application states are never listed here."
          },
          "applyReasonCode": {
            "type": "string",
            "nullable": true,
            "description": "Bounded cartonium reason the receipt was not applied, e.g. DELIVERY_BEFORE_HANDOFF (carrier delivery dated before the recorded handoff; no current command repairs it, see #4086), HANDOFF_REQUIRED (delivery observed while the unit was still READY; record the handoff to continue), RETIRED_POSTAGE_CONFLICT (observation on VOIDED postage; never advances or regresses state), DELIVERY_DETAIL_CONFLICT (DE with a detail outside the allowlist). Treat an unrecognized value as \"recorded, not applied\". Null only for rows finalized before reason codes existed."
          },
          "finalizedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the apply path finalized the CONFLICT. Null while the decision is still being re-evaluated."
          }
        },
        "required": [
          "source",
          "statusCode",
          "statusDetailCode",
          "actualDeliveryDate",
          "deliveryEventOccurredAt",
          "latestEventOccurredAt",
          "receivedAt",
          "applyStatus",
          "applyReasonCode",
          "finalizedAt"
        ]
      },
      "CommerceShipmentLabelPurchaseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "labelKind": {
            "type": "string",
            "enum": [
              "OUTBOUND",
              "RETURN"
            ]
          },
          "packageOrdinal": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "fulfillmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "PURCHASING",
              "PURCHASED",
              "FAILED",
              "RECONCILIATION_REQUIRED",
              "VOIDED"
            ]
          },
          "provider": {
            "type": "string"
          },
          "labelId": {
            "type": "string",
            "nullable": true
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true
          },
          "labelDownloadUrl": {
            "type": "string",
            "nullable": true
          },
          "shipmentCostInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "shipmentCostCurrency": {
            "type": "string",
            "nullable": true,
            "minLength": 3,
            "maxLength": 3
          },
          "approvedCostInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "#3956 — the merchant-approved fresh quote this attempt was funded against, in minor units. Null on attempts recorded before approved-cost tracking existed."
          },
          "approvedCostCurrency": {
            "type": "string",
            "nullable": true,
            "minLength": 3,
            "maxLength": 3,
            "description": "Lowercase ISO currency of approvedCostInCents. Null exactly when approvedCostInCents is null (historical absence on attempts recorded before approved-cost tracking); it never signals incomplete provider evidence, which is carried by the reconciliation events."
          },
          "costVarianceInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Signed difference between the actual provider charge and the approved quote (actual − approved) in minor units. Null when either amount is missing or the currencies differ."
          },
          "providerStatus": {
            "type": "string",
            "nullable": true
          },
          "carrierCode": {
            "type": "string",
            "nullable": true
          },
          "carrierId": {
            "type": "string",
            "nullable": true
          },
          "carrierName": {
            "type": "string",
            "nullable": true
          },
          "serviceCode": {
            "type": "string",
            "nullable": true
          },
          "serviceDecisionClassification": {
            "type": "string",
            "enum": [
              "ORIGINAL_SERVICE",
              "SAME_OR_FASTER",
              "MEETS_PROMISE",
              "OVERRIDE"
            ],
            "nullable": true
          },
          "serviceDecisionReason": {
            "type": "string",
            "nullable": true
          },
          "serviceDecisionActorUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "serviceDecisionAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "testLabel": {
            "type": "boolean"
          },
          "needsTracking": {
            "type": "boolean"
          },
          "claimedAt": {
            "format": "date-time",
            "type": "string"
          },
          "failureHttpStatus": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "failureErrorType": {
            "type": "string",
            "nullable": true
          },
          "failureErrorCode": {
            "type": "string",
            "nullable": true
          },
          "failureErrorSource": {
            "type": "string",
            "nullable": true
          },
          "failureFieldName": {
            "type": "string",
            "nullable": true
          },
          "failureRequestId": {
            "type": "string",
            "nullable": true
          },
          "failureMessage": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "carrierTrackingReceipts": {
            "maxItems": 1,
            "description": "#4054 — at most ONE item: the newest verified carrier receipt bound to this exact label that the apply path recorded as CONFLICT and that has not been resolved. Empty means no unresolved conflict receipt is retained: it was resolved, it was purged under the DR-4054-14 retention clocks, or the label never conflicted. Empty never means the carrier reported nothing; the parent fulfillment's `lastCarrierStatus*` fields hold the last carrier state permanently. This is not a timeline (deferred to #4085).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceCarrierTrackingConflictReceiptDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "orderId",
          "labelKind",
          "packageOrdinal",
          "version",
          "fulfillmentId",
          "shipmentPackageId",
          "status",
          "provider",
          "labelId",
          "trackingNumber",
          "labelDownloadUrl",
          "shipmentCostInCents",
          "shipmentCostCurrency",
          "approvedCostInCents",
          "approvedCostCurrency",
          "costVarianceInCents",
          "providerStatus",
          "carrierCode",
          "carrierId",
          "carrierName",
          "serviceCode",
          "serviceDecisionClassification",
          "serviceDecisionReason",
          "serviceDecisionActorUserId",
          "serviceDecisionAt",
          "testLabel",
          "needsTracking",
          "claimedAt",
          "failureHttpStatus",
          "failureErrorType",
          "failureErrorCode",
          "failureErrorSource",
          "failureFieldName",
          "failureRequestId",
          "failureMessage",
          "createdAt",
          "updatedAt",
          "carrierTrackingReceipts"
        ]
      },
      "CommerceShippingLabelVoidOperationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "PREPARED_SHIPMENT_CANCELLATION",
              "PARKED_LABEL_VOID",
              "POST_HANDOFF_POSTAGE_RETIREMENT"
            ],
            "description": "#4050 — what this void operation is FOR, and therefore what a confirmed void does besides retiring postage. PREPARED_SHIPMENT_CANCELLATION cancels the READY shipment and releases its allocation; PARKED_LABEL_VOID cancels the PLANNED package; POST_HANDOFF_POSTAGE_RETIREMENT changes nothing but the postage on an already handed-off shipment. Branch on this field: purchaseStatusAtRequest cannot distinguish the first from the third."
          },
          "status": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "PROCESSING",
              "RECONCILIATION_REQUIRED",
              "VOID_CONFIRMED_CANCEL_PENDING",
              "VOID_CONFIRMED_PARENT_ABORTED",
              "COMPLETED",
              "DENIED_OR_INELIGIBLE"
            ]
          },
          "purchaseStatusAtRequest": {
            "type": "string",
            "enum": [
              "PURCHASING",
              "PURCHASED",
              "FAILED",
              "RECONCILIATION_REQUIRED",
              "VOIDED"
            ],
            "description": "#3956 — the purchase state this operation snapshotted at request time: PURCHASED for a prepared-shipment cancellation, RECONCILIATION_REQUIRED for a parked cost-mismatch label voided directly. Immutable for the life of the operation."
          },
          "carrierRefundDisposition": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "PENDING",
              "SETTLED",
              "DENIED",
              "NOT_APPLICABLE"
            ]
          },
          "lastProviderMessage": {
            "type": "string",
            "nullable": true
          },
          "requestedAt": {
            "format": "date-time",
            "type": "string"
          },
          "reconciliationRequiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "automaticRetryExhaustedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "voidConfirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deniedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "purpose",
          "status",
          "purchaseStatusAtRequest",
          "carrierRefundDisposition",
          "lastProviderMessage",
          "requestedAt",
          "reconciliationRequiredAt",
          "automaticRetryExhaustedAt",
          "voidConfirmedAt",
          "completedAt",
          "deniedAt",
          "updatedAt"
        ]
      },
      "CommerceExternalLabelRetirementAcknowledgementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "fulfillmentId": {
            "type": "string",
            "format": "uuid"
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          },
          "carrierResponsibilityAccepted": {
            "type": "boolean",
            "description": "Always true: the merchant accepted responsibility for any external carrier void and carrier-account refund."
          },
          "evidenceSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "description": "Immutable package-local snapshot of the tracking, label artifact, and cost evidence retained at acknowledgement time."
          },
          "acknowledgedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "orderId",
          "recordId",
          "fulfillmentId",
          "shipmentPackageId",
          "actorUserId",
          "reason",
          "carrierResponsibilityAccepted",
          "evidenceSnapshot",
          "acknowledgedAt"
        ]
      },
      "CommerceShipmentPackageContentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "packageId": {
            "type": "string",
            "format": "uuid"
          },
          "lineId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "packageId",
          "lineId",
          "quantity",
          "createdAt"
        ]
      },
      "CommerceShipmentPackageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "packageOrdinal": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "source": {
            "type": "string",
            "enum": [
              "MANUAL_CUSTOM",
              "CHECKOUT_PLAN",
              "BOX_PRESET"
            ]
          },
          "sourceSnapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "shipToSnapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "loadedWeight": {
            "type": "string",
            "description": "Loaded package weight serialized from Decimal as a base-10 JSON string."
          },
          "loadedWeightUnit": {
            "type": "string",
            "enum": [
              "OZ",
              "LB",
              "G",
              "KG"
            ]
          },
          "outsideLength": {
            "type": "string",
            "nullable": true,
            "description": "Outside length serialized from Decimal as a base-10 JSON string."
          },
          "outsideWidth": {
            "type": "string",
            "nullable": true,
            "description": "Outside width serialized from Decimal as a base-10 JSON string."
          },
          "outsideHeight": {
            "type": "string",
            "nullable": true,
            "description": "Outside height serialized from Decimal as a base-10 JSON string."
          },
          "outsideDimensionUnit": {
            "type": "string",
            "enum": [
              "IN",
              "CM"
            ],
            "nullable": true
          },
          "providerPackageCode": {
            "type": "string",
            "nullable": true
          },
          "ratingProvider": {
            "type": "string"
          },
          "ratingCarrierId": {
            "type": "string"
          },
          "ratingServiceCode": {
            "type": "string"
          },
          "ratingAmountInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "ratingCurrency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "ratingSnapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "ratedAt": {
            "format": "date-time",
            "type": "string"
          },
          "confirmedByUserId": {
            "type": "string",
            "format": "uuid"
          },
          "confirmedAt": {
            "format": "date-time",
            "type": "string"
          },
          "supersedesPackageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "contents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceShipmentPackageContentDto"
            }
          },
          "labelPurchases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceShipmentLabelPurchaseDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "orderId",
          "recordId",
          "packageOrdinal",
          "source",
          "sourceSnapshot",
          "shipToSnapshot",
          "loadedWeight",
          "loadedWeightUnit",
          "outsideLength",
          "outsideWidth",
          "outsideHeight",
          "outsideDimensionUnit",
          "providerPackageCode",
          "ratingProvider",
          "ratingCarrierId",
          "ratingServiceCode",
          "ratingAmountInCents",
          "ratingCurrency",
          "ratingSnapshot",
          "ratedAt",
          "confirmedByUserId",
          "confirmedAt",
          "supersedesPackageId",
          "createdAt",
          "updatedAt",
          "contents",
          "labelPurchases"
        ]
      },
      "CommerceFulfillmentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "goodsKind": {
            "type": "string",
            "enum": [
              "ORIGINAL_ORDER",
              "REPLACEMENT_GOODS"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PLANNED",
              "READY",
              "SHIPPED",
              "DELIVERED",
              "CANCELLED"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ]
          },
          "carrier": {
            "type": "string",
            "nullable": true
          },
          "serviceLevel": {
            "type": "string",
            "nullable": true
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true
          },
          "trackingUrl": {
            "type": "string",
            "nullable": true
          },
          "externalSource": {
            "type": "string",
            "nullable": true
          },
          "externalId": {
            "type": "string",
            "nullable": true
          },
          "shipStationOrderId": {
            "type": "string",
            "nullable": true
          },
          "shipStationShipmentId": {
            "type": "string",
            "nullable": true
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "readyAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "shipNotifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "#1770 — when the \"your order shipped\" customer email was first enqueued for this fulfillment (its first SHIPPED transition). Null until then; the idempotency anchor that stops repeated tracking saves from re-sending."
          },
          "handoffNotificationDecision": {
            "type": "string",
            "enum": [
              "SEND",
              "SUPPRESS"
            ],
            "nullable": true
          },
          "handoffRecordedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "handoffSource": {
            "type": "string",
            "enum": [
              "MERCHANT",
              "TRUSTED_CARRIER_EVENT",
              "SYSTEM_CATCH_UP",
              "POS",
              "IMPORTED_SOURCE"
            ],
            "nullable": true
          },
          "handoffActorId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deliveryRecordedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "#4049/#4054 - when the server recorded the delivery transition, from either a merchant assertion or verified carrier evidence. Distinct from `deliveredAt`, which is the asserted or carrier-observed receipt instant."
          },
          "deliverySource": {
            "type": "string",
            "nullable": true,
            "description": "#4049 - how this delivery was established. Open-ended catalog: see x-extensible-enum for the known stable values and treat any unrecognized value as neither merchant- nor carrier-confirmed. MERCHANT_CONFIRMED is the merchant's own assertion and is never carrier confirmation. CARRIER_CONFIRMED means a verified carrier delivery event established receipt (#4054). Null beside a non-null `deliveredAt` means provenance was never established by the native delivery command (a historical tracking edit, POS in-person completion, or imported handoff evidence); that must not be rendered as carrier proof either.",
            "x-extensible-enum": [
              "MERCHANT_CONFIRMED",
              "CARRIER_CONFIRMED"
            ]
          },
          "deliveryActorId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "deliveryReason": {
            "type": "string",
            "nullable": true,
            "description": "#4049 - the required merchant justification captured with the assertion. Merchant-internal; never projected to a customer surface."
          },
          "carrierDeliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "#4054 - the carrier's delivery instant from a verified, tenant-bound qualifying delivery observation (DR-4054-13). When `deliverySource` is CARRIER_CONFIRMED this equals `deliveredAt`. When the merchant confirmed first (`deliverySource` MERCHANT_CONFIRMED) it is CORROBORATION: the carrier date sits beside the merchant assertion and never rewrites `deliveredAt` or provenance (DR-4054-05). Null means no qualifying carrier delivery has been recorded for this shipment; it does not mean the carrier never reported (see `lastCarrierStatusCode`)."
          },
          "carrierDeliverySource": {
            "type": "string",
            "nullable": true,
            "description": "#4054 - which receipt channel established `carrierDeliveredAt`. Open-ended catalog: see x-extensible-enum for the known stable values and treat an unrecognized value as generic carrier evidence. WEBHOOK or POLL are natural carrier evidence; SYNTHETIC is Preview-only injection that cannot exist on production and is never natural proof. A natural value is never overwritten by a later synthetic one. Null exactly when `carrierDeliveredAt` is null.",
            "x-extensible-enum": [
              "WEBHOOK",
              "POLL",
              "SYNTHETIC"
            ]
          },
          "carrierDeliveryRecordedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "#4054 - when cartonium received the receipt that established `carrierDeliveredAt` (the freshness of that fact). Null exactly when `carrierDeliveredAt` is null."
          },
          "lastCarrierStatusCode": {
            "type": "string",
            "nullable": true,
            "description": "#4054 - the top-level tracking status code of the CURRENT bound observation, under the bounded grammar `^[A-Z0-9_]{1,64}$` (UNRECOGNIZED when a value fell outside it). This is tracking state, NOT lifecycle state: a DE here beside a SHIPPED `status` is a recorded delivery-class tracking observation that did not advance the lifecycle, and the top-level code alone does not say why — the detail may sit outside the DR-4054-13 allowlist (`lastCarrierStatusDetailCode`, a DELIVERY_DETAIL_CONFLICT), a qualifying natural (WEBHOOK/POLL) receipt may have been recorded as a conflict (see `shippingLabelPurchases[].carrierTrackingReceipts`), or it may be Preview-only SYNTHETIC evidence, which is applied to these columns and to `carrierDelivered*` but never to the lifecycle. Only `carrierDeliveredAt` evidences an allowlisted delivery. Read the exact channel from `lastCarrierStatusSource`; its null means unknown provenance, never an assumed natural carrier report. Updated only by a newer observation, except that qualifying delivery evidence outranks an older non-terminal scan. Null when no bound tracking observation has ever been recorded for this shipment."
          },
          "lastCarrierStatusDetailCode": {
            "type": "string",
            "nullable": true,
            "description": "#4054 - the status detail code of the current tracking state under the same bounded grammar, or null when the observation carried none. Null beside a non-null `lastCarrierStatusCode` is an ordinary absent detail, not missing data."
          },
          "lastCarrierStatusObservedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "#4054 - the observation instant for the current tracking state: the delivery instant for a qualifying delivery, otherwise the newest event time in the receipt, falling back to the provider send time. Null exactly when `lastCarrierStatusCode` is null."
          },
          "lastCarrierStatusRecordedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "#4054 - when cartonium received the receipt behind the current tracking state; the freshness of `lastCarrierStatusCode`. Null exactly when `lastCarrierStatusCode` is null. A reached polling horizon is deliberately NOT published here (#4209, routed to #4085)."
          },
          "lastCarrierStatusSource": {
            "type": "string",
            "nullable": true,
            "description": "#4227 - receipt channel that wrote the current `lastCarrierStatus*` fields. WEBHOOK and POLL are natural carrier observations; SYNTHETIC is Preview-only test evidence, not carrier proof. The catalog is open-ended: treat an unrecognized value as unknown provenance. Null means either no current status or a historical status recorded before this source was persisted; it never establishes a natural channel.",
            "x-extensible-enum": [
              "WEBHOOK",
              "POLL",
              "SYNTHETIC"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceFulfillmentLineDto"
            }
          },
          "shippingLabelPurchases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceShipmentLabelPurchaseDto"
            }
          },
          "shippingLabelVoidOperations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceShippingLabelVoidOperationDto"
            }
          },
          "externalLabelRetirementAcknowledgement": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceExternalLabelRetirementAcknowledgementDto"
              }
            ]
          },
          "shipmentPackage": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceShipmentPackageDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "organizationId",
          "recordId",
          "goodsKind",
          "status",
          "mode",
          "carrier",
          "serviceLevel",
          "trackingNumber",
          "trackingUrl",
          "externalSource",
          "externalId",
          "shipStationOrderId",
          "shipStationShipmentId",
          "shipmentPackageId",
          "readyAt",
          "shippedAt",
          "deliveredAt",
          "shipNotifiedAt",
          "handoffNotificationDecision",
          "handoffRecordedAt",
          "handoffSource",
          "handoffActorId",
          "deliveryRecordedAt",
          "deliverySource",
          "deliveryActorId",
          "deliveryReason",
          "carrierDeliveredAt",
          "carrierDeliverySource",
          "carrierDeliveryRecordedAt",
          "lastCarrierStatusCode",
          "lastCarrierStatusDetailCode",
          "lastCarrierStatusObservedAt",
          "lastCarrierStatusRecordedAt",
          "lastCarrierStatusSource",
          "metadata",
          "createdAt",
          "updatedAt",
          "lines",
          "shippingLabelPurchases",
          "shippingLabelVoidOperations",
          "externalLabelRetirementAcknowledgement",
          "shipmentPackage"
        ]
      },
      "CommerceContractPacketDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "VOIDED"
            ]
          },
          "title": {
            "type": "string"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Human-facing contract number (e.g. C-1001), allocated at send. Null while DRAFT."
          },
          "contentSnapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "provider": {
            "type": "string",
            "nullable": true,
            "description": "External e-signature provider, when the packet is fulfilled off-platform. Null for first-party (in-app) signing, the only mode shipped in M3.5."
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "description": "Provider-side packet id when provider is set."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "declinedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "recordId",
          "revisionId",
          "status",
          "title",
          "displayNumber",
          "contentSnapshot",
          "provider",
          "externalId",
          "sentAt",
          "signedAt",
          "declinedAt",
          "expiresAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceRecordDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ],
            "description": "Commercial lifecycle axis (DRAFT→SENT→ACCEPTED/DECLINED/EXPIRED→CONVERTED, plus terminal VOIDED/CANCELLED). Forward-only; drives which lifecycle actions are permitted. Independent of the payment/fulfillment/signature axes."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "description": "Payment axis, derived from the payment/refund ledger. Full value space: NOT_REQUIRED, UNPAID, PARTIALLY_PAID, PAID, PARTIALLY_REFUNDED, REFUNDED, FAILED, CANCELLED. Moves independently of the commercial status."
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ],
            "description": "Shipment fulfillment axis. Committed orders with positive PRODUCT quantity start UNFULFILLED; orders without shippable PRODUCT quantity remain NOT_REQUIRED. Booking/service and subscription entitlement work stays on its operational projection."
          },
          "outboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true,
            "description": "Canonical outbound physical handoff mode; null when not planned."
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true,
            "description": "Canonical inbound return handoff mode; null when not planned."
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Deprecated display-only compatibility summary derived from authoritative agreement requirements/satisfactions, with a legacy execution fallback. Full value space: NOT_REQUIRED, PENDING, SIGNED, DECLINED, EXPIRED, CANCELLED. Never use it to authorize or gate a command."
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Human-facing document number (e.g. Q-1001, INV-1001, C-1001), allocated once at send/issue and stable for the life of the record. Null while DRAFT. Customers address account documents by this number."
          },
          "displayNumberKind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ],
            "nullable": true,
            "description": "Which numbering series allocated displayNumber (QUOTE/INVOICE/…)."
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "customerPhone": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The source quote this order was converted from (#1333)."
          },
          "orderRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Authoritative shared-commerce order linked to this invoice, when present."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "paymentTermPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Payment-term preset applied to this record; its terms are frozen into paymentTermsSnapshot at send. Null when no terms apply."
          },
          "paymentTermsSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen payment-terms snapshot (net-days / deposit schedule) captured at send from paymentTermPresetId. Null when no terms apply."
          },
          "taxExempt": {
            "type": "boolean"
          },
          "taxExemptionReason": {
            "type": "string",
            "nullable": true
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "shippingInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Document total in minor units (cents). Commerce money amounts are 32-bit integer cents by design: document totals are capped at 2,147,483,647 cents (~$21.47M), and per-amount line inputs at ±1,000,000,000 cents ($10M). Pricing writes that would exceed these bounds are rejected with 400."
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross recorded payments (minor units), derived from the payment ledger. Net paid = amountPaidInCents − refundedInCents."
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total refunded (minor units), derived from the payment ledger."
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Outstanding balance (minor units): max(0, totalInCents − amountPaidInCents), i.e. based on GROSS payments. A refund does NOT re-open the balance (ADR-013); the refund dimension lives on refundedInCents + paymentStatus. Zero once gross payments cover the total. An Order with linked invoices (E11, once activated) mirrors its sale once one has been issued: the issued-invoice projection sets this balance and paymentStatus from its live issued invoices whenever a linked invoice is issued, takes money, or ends after it was issued, and amountPaidInCents and refundedInCents report only the Order's own ledger. A never-sent draft, created or cancelled, leaves this balance and paymentStatus as they were. The sale's paid and refunded totals are its invoice-capacity position. When an issued linked invoice ends and no issued one remains live, the projection sets 0 and NOT_REQUIRED. Once every linked invoice has ended, a direct Order payment is accepted and sets all four values from the Order's own ledger."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "declinedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "voidedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "convertedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "externalSource": {
            "type": "string",
            "nullable": true,
            "description": "System of record for an externally-originated document (e.g. a wholesale ERP). Together with externalId it forms the external identity; the list filter requires externalSource whenever externalId is supplied."
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "description": "Opaque id of this document in the externalSource system. The triple (organization, externalSource, externalId) is unique — many externalIds may exist per source, each unique within its (organization, externalSource) pair — which enables idempotent external imports."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "revisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceRecordRevisionDto"
            }
          },
          "lineGroups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceLineGroupDto"
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceLineDto"
            }
          },
          "fulfillments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceFulfillmentDto"
            }
          },
          "contractPackets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceContractPacketDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "type",
          "source",
          "commercialStatus",
          "paymentStatus",
          "fulfillmentStatus",
          "outboundFulfillmentMode",
          "outboundDueAt",
          "inboundFulfillmentMode",
          "inboundDueAt",
          "signatureStatus",
          "displayNumber",
          "displayNumberKind",
          "customerId",
          "customerName",
          "customerEmail",
          "customerPhone",
          "companyName",
          "orderId",
          "sourceRecordId",
          "orderRecordId",
          "currency",
          "paymentTermPresetId",
          "paymentTermsSnapshot",
          "taxExempt",
          "taxExemptionReason",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "expiresAt",
          "sentAt",
          "acceptedAt",
          "declinedAt",
          "cancelledAt",
          "voidedAt",
          "convertedAt",
          "externalSource",
          "externalId",
          "metadata",
          "createdAt",
          "updatedAt",
          "revisions",
          "lineGroups",
          "lines",
          "fulfillments",
          "contractPackets"
        ]
      },
      "CancelPreparedShipmentResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "CANCELLED",
              "CANCELLATION_PENDING",
              "CANCELLATION_RECONCILIATION_REQUIRED",
              "CANCELLATION_DENIED"
            ]
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this request returned an already-recorded target state or cancellation intent."
          },
          "message": {
            "type": "string",
            "description": "Server-authored merchant guidance; never a raw provider response."
          },
          "operation": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingLabelVoidOperationSummaryDto"
              }
            ]
          },
          "record": {
            "$ref": "#/components/schemas/CommerceRecordDetailDto"
          }
        },
        "required": [
          "outcome",
          "replayed",
          "message",
          "operation",
          "record"
        ]
      },
      "RetryPreparedShipmentCancellationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          }
        },
        "required": [
          "reason"
        ]
      },
      "ShippingLabelReconciliationEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid"
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Null only for legacy attempts recorded before per-package label purchases existed; every current attempt is bound to one exact package."
          },
          "fulfillmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Null only for legacy attempts that predate prepared-shipment binding; every current attempt is bound to one exact fulfillment."
          },
          "action": {
            "type": "string",
            "enum": [
              "LOOKUP",
              "LEGACY_DISPOSITION"
            ],
            "description": "Original closed action catalog, kept stable for readers generated before #3956. LOOKUP is a safe provider read of the exact label (an acceptance at actual cost is projected here as LOOKUP because it is exactly that read plus adoption); LEGACY_DISPOSITION is attributable operator testimony for pre-package rows. The precise action is actionDetail."
          },
          "actionDetail": {
            "type": "string",
            "description": "Precise reconciliation action from the open-ended catalog; see x-extensible-enum for the known stable values and tolerate an unknown value by rendering it by name. Equals action except where the precise value postdates the original closed catalog: ACCEPT_ACTUAL_COST (explicit provider-re-verified acceptance of a completed label at its actual cost) is published as action LOOKUP.",
            "example": "LOOKUP",
            "x-extensible-enum": [
              "LOOKUP",
              "LEGACY_DISPOSITION",
              "ACCEPT_ACTUAL_COST"
            ]
          },
          "result": {
            "type": "string",
            "enum": [
              "FOUND_ADOPTED_READY",
              "NOT_FOUND_PENDING",
              "NOT_FOUND_BLOCKED",
              "NOT_FOUND_RELEASED",
              "LOOKUP_FAILED",
              "EVIDENCE_MISMATCH",
              "CONNECTION_GENERATION_MISMATCH",
              "NO_PROVIDER_REFERENCE",
              "LEGACY_LABEL_FOUND_RECORDED",
              "LEGACY_NO_LABEL_RECORDED",
              "LEGACY_UNRESOLVED"
            ],
            "description": "Original closed outcome catalog, kept stable for readers generated before #3956. FOUND_ADOPTED_READY is the only outcome that moves a package to READY (an acceptance at actual cost is projected here as FOUND_ADOPTED_READY because the exact label was found and adopted); every other outcome leaves the attempt blocked, pending, or released for retry as documented on the message. The precise outcome is resultDetail."
          },
          "resultDetail": {
            "type": "string",
            "description": "Precise reconciliation outcome from the open-ended catalog; see x-extensible-enum for the known stable values and tolerate an unknown value by rendering it by name. Equals result except where the precise value postdates the original closed catalog: COST_ACCEPTED_READY (the exact completed label was re-verified and adopted at its actual cost) is published as result FOUND_ADOPTED_READY.",
            "example": "EVIDENCE_MISMATCH",
            "x-extensible-enum": [
              "FOUND_ADOPTED_READY",
              "NOT_FOUND_PENDING",
              "NOT_FOUND_BLOCKED",
              "NOT_FOUND_RELEASED",
              "LOOKUP_FAILED",
              "EVIDENCE_MISMATCH",
              "CONNECTION_GENERATION_MISMATCH",
              "NO_PROVIDER_REFERENCE",
              "LEGACY_LABEL_FOUND_RECORDED",
              "LEGACY_NO_LABEL_RECORDED",
              "LEGACY_UNRESOLVED",
              "COST_ACCEPTED_READY"
            ]
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string"
          },
          "lookupIdentity": {
            "type": "string",
            "enum": [
              "PROVIDER_LABEL_ID",
              "PROVIDER_EXTERNAL_SHIPMENT_ID",
              "NONE"
            ]
          },
          "lookupIdentityValue": {
            "type": "string",
            "nullable": true,
            "description": "Exact bounded label id or server-minted external shipment reference used for the lookup; null for legacy dispositions."
          },
          "providerHttpStatus": {
            "type": "number",
            "nullable": true
          },
          "providerErrorType": {
            "type": "string",
            "nullable": true
          },
          "providerErrorCode": {
            "type": "string",
            "nullable": true
          },
          "providerErrorSource": {
            "type": "string",
            "nullable": true
          },
          "providerFieldName": {
            "type": "string",
            "nullable": true
          },
          "providerRequestId": {
            "type": "string",
            "nullable": true
          },
          "providerMessage": {
            "type": "string",
            "nullable": true
          },
          "originalFailureHttpStatus": {
            "type": "number",
            "nullable": true
          },
          "originalFailureErrorType": {
            "type": "string",
            "nullable": true
          },
          "originalFailureErrorCode": {
            "type": "string",
            "nullable": true
          },
          "originalFailureErrorSource": {
            "type": "string",
            "nullable": true
          },
          "originalFailureFieldName": {
            "type": "string",
            "nullable": true
          },
          "originalFailureRequestId": {
            "type": "string",
            "nullable": true
          },
          "originalFailureMessage": {
            "type": "string",
            "nullable": true
          },
          "operatorEvidenceNote": {
            "type": "string",
            "nullable": true
          },
          "evidenceLabelId": {
            "type": "string",
            "nullable": true
          },
          "evidenceProviderStatus": {
            "type": "string",
            "nullable": true
          },
          "evidenceIsReturnLabel": {
            "type": "boolean",
            "nullable": true
          },
          "evidenceVoided": {
            "type": "boolean",
            "nullable": true
          },
          "evidenceTrackingPresent": {
            "type": "boolean",
            "nullable": true
          },
          "evidenceArtifactPresent": {
            "type": "boolean",
            "nullable": true
          },
          "evidenceCostInCents": {
            "type": "number",
            "nullable": true
          },
          "evidenceCostCurrency": {
            "type": "string",
            "nullable": true
          },
          "evidenceCarrierCode": {
            "type": "string",
            "nullable": true
          },
          "evidenceCarrierId": {
            "type": "string",
            "nullable": true
          },
          "evidenceServiceCode": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "purchaseId",
          "shipmentPackageId",
          "fulfillmentId",
          "action",
          "actionDetail",
          "result",
          "resultDetail",
          "actorUserId",
          "reason",
          "lookupIdentity",
          "lookupIdentityValue",
          "providerHttpStatus",
          "providerErrorType",
          "providerErrorCode",
          "providerErrorSource",
          "providerFieldName",
          "providerRequestId",
          "providerMessage",
          "originalFailureHttpStatus",
          "originalFailureErrorType",
          "originalFailureErrorCode",
          "originalFailureErrorSource",
          "originalFailureFieldName",
          "originalFailureRequestId",
          "originalFailureMessage",
          "operatorEvidenceNote",
          "evidenceLabelId",
          "evidenceProviderStatus",
          "evidenceIsReturnLabel",
          "evidenceVoided",
          "evidenceTrackingPresent",
          "evidenceArtifactPresent",
          "evidenceCostInCents",
          "evidenceCostCurrency",
          "evidenceCarrierCode",
          "evidenceCarrierId",
          "evidenceServiceCode",
          "createdAt"
        ]
      },
      "ShippingLabelReconciliationStatusDto": {
        "type": "object",
        "properties": {
          "purchaseId": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "AUTOMATIC_LOOKUP",
              "STALE_PURCHASE_RECOVERY",
              "LEGACY_DISPOSITION",
              "NONE"
            ]
          },
          "automaticLookupAllowed": {
            "type": "boolean"
          },
          "stalePurchaseRecoveryAllowed": {
            "type": "boolean",
            "description": "True only when an exact package-bound PURCHASING claim is stale enough for the explicit command to park it before safe reconciliation."
          },
          "legacyDispositionAllowed": {
            "type": "boolean"
          },
          "costAcceptanceAllowed": {
            "type": "boolean",
            "description": "#3956 — true only when the parked attempt is a known completed, printable outbound label on a planned package whose valid same-currency provider cost differs from the merchant-approved fresh quote. Acceptance re-verifies the label at the provider before adopting it."
          },
          "parkedVoidAllowed": {
            "type": "boolean",
            "description": "#3956 — true only when the parked cost-mismatch label may be voided directly at the provider as the alternative to acceptance: exactly the acceptance eligibility (package-bound completed label whose valid same-currency cost differs from the approved quote, on a PLANNED fulfillment) and no void of this label requested yet. One void operation exists per label, so once a void has been requested this stays false for the life of the attempt; a denied void leaves acceptance available. A confirmed void cancels the planned package and releases its items."
          },
          "parkedVoidRetryAllowed": {
            "type": "boolean",
            "description": "#3956 — true only when a parked-label void has exhausted automatic reconciliation and an Owner/Admin may retry one exact read-only carrier check."
          },
          "voidOperationStatus": {
            "type": "string",
            "enum": [
              "REQUESTED",
              "PROCESSING",
              "RECONCILIATION_REQUIRED",
              "VOID_CONFIRMED_CANCEL_PENDING",
              "VOID_CONFIRMED_PARENT_ABORTED",
              "COMPLETED",
              "DENIED_OR_INELIGIBLE"
            ],
            "nullable": true,
            "description": "Status of the void operation bound to this attempt. Null means no void of this label has ever been requested (the common case), never an unknown state."
          },
          "fulfillmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The prepared fulfillment this attempt is bound to. Null only for legacy attempts that predate prepared-shipment binding; such attempts are never eligible for acceptance."
          },
          "approvedCostInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Merchant-approved fresh quote in minor units, from the purchase row or, for attempts claimed before approved-cost tracking, the package rating stapled to the same claim. Null only when neither exists (legacy attempt with no package rating); this is historical absence, not incomplete provider evidence."
          },
          "approvedCostCurrency": {
            "type": "string",
            "nullable": true,
            "minLength": 3,
            "maxLength": 3,
            "description": "Lowercase ISO currency of approvedCostInCents. Null exactly when approvedCostInCents is null."
          },
          "actualCostInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Actual provider charge in minor units as last recorded for this attempt. Null when the provider has not yet confirmed a label (attempt still ambiguous) or returned no valid amount; the two cases are distinguished by the event evidence, not by this field."
          },
          "actualCostCurrency": {
            "type": "string",
            "nullable": true,
            "minLength": 3,
            "maxLength": 3,
            "description": "Lowercase ISO currency of actualCostInCents. Null exactly when actualCostInCents is null, or when the provider returned an amount without a recognizable currency (that attempt is never acceptable)."
          },
          "costVarianceInCents": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Signed difference actual − approved in minor units. Null when either amount is absent or the currencies differ; consumers must not read null as \"no difference\"."
          },
          "certainty": {
            "type": "string",
            "enum": [
              "FOUND_ADOPTED_READY",
              "NOT_FOUND_PENDING",
              "NOT_FOUND_BLOCKED",
              "NOT_FOUND_RELEASED",
              "LOOKUP_FAILED",
              "EVIDENCE_MISMATCH",
              "CONNECTION_GENERATION_MISMATCH",
              "NO_PROVIDER_REFERENCE",
              "LEGACY_LABEL_FOUND_RECORDED",
              "LEGACY_NO_LABEL_RECORDED",
              "LEGACY_UNRESOLVED"
            ],
            "description": "Latest recorded outcome for the current attempt in the original closed catalog (kept stable for readers generated before #3956), or null when no reconciliation event exists yet for this attempt. The precise value is certaintyDetail.",
            "nullable": true
          },
          "certaintyDetail": {
            "type": "string",
            "description": "Precise latest outcome for the current attempt from the open-ended catalog (see x-extensible-enum; tolerate unknown values), or null exactly when certainty is null. Differs from certainty only where the precise value postdates the original closed catalog (COST_ACCEPTED_READY is published as certainty FOUND_ADOPTED_READY).",
            "example": "EVIDENCE_MISMATCH",
            "x-extensible-enum": [
              "FOUND_ADOPTED_READY",
              "NOT_FOUND_PENDING",
              "NOT_FOUND_BLOCKED",
              "NOT_FOUND_RELEASED",
              "LOOKUP_FAILED",
              "EVIDENCE_MISMATCH",
              "CONNECTION_GENERATION_MISMATCH",
              "NO_PROVIDER_REFERENCE",
              "LEGACY_LABEL_FOUND_RECORDED",
              "LEGACY_NO_LABEL_RECORDED",
              "LEGACY_UNRESOLVED",
              "COST_ACCEPTED_READY"
            ],
            "nullable": true
          },
          "message": {
            "type": "string",
            "description": "Safe operator guidance derived by the server from current identity, credential generation, and immutable history."
          },
          "nextLookupAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastEvent": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingLabelReconciliationEventDto"
              }
            ]
          }
        },
        "required": [
          "purchaseId",
          "mode",
          "automaticLookupAllowed",
          "stalePurchaseRecoveryAllowed",
          "legacyDispositionAllowed",
          "costAcceptanceAllowed",
          "parkedVoidAllowed",
          "parkedVoidRetryAllowed",
          "voidOperationStatus",
          "fulfillmentId",
          "approvedCostInCents",
          "approvedCostCurrency",
          "actualCostInCents",
          "actualCostCurrency",
          "costVarianceInCents",
          "certainty",
          "certaintyDetail",
          "message",
          "nextLookupAt",
          "lastEvent"
        ]
      },
      "QuoteShippingLabelSelectionDto": {
        "type": "object",
        "properties": {
          "requirements": {
            "description": "Optional planned ship date, signature and carrier-insurance basis shared with comparison and purchase.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingLabelRateRequirementsDto"
              }
            ]
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-owned prepared-package id when refreshing a definitive FAILED attempt. Its locked lines/package facts must match this quote."
          },
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyShippingLabelLineDto"
            }
          },
          "package": {
            "$ref": "#/components/schemas/BuyShippingLabelPackageDto"
          },
          "carrierId": {
            "type": "string",
            "maxLength": 100,
            "description": "Exact connected ShipEngine carrier selected by the merchant.",
            "example": "se-123456"
          },
          "serviceCode": {
            "type": "string",
            "maxLength": 100,
            "description": "Exact carrier service selected by the merchant.",
            "example": "usps_priority_mail"
          },
          "recipientPhone": {
            "type": "string",
            "maxLength": 50,
            "description": "Optional label-only recipient phone correction, rated as part of the same exact contract that the funded command later confirms.",
            "example": "+1 208-555-1234"
          }
        },
        "required": [
          "lines",
          "package",
          "carrierId",
          "serviceCode"
        ]
      },
      "ShippingLabelFundingPreflightDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SANDBOX",
              "NOT_REQUIRED",
              "SUFFICIENT",
              "INSUFFICIENT",
              "UNAVAILABLE"
            ]
          },
          "unavailableReason": {
            "type": "string",
            "enum": [
              "FUNDING_REQUIREMENT_UNAVAILABLE",
              "BALANCE_UNAVAILABLE",
              "BALANCE_CURRENCY_UNSUPPORTED"
            ],
            "nullable": true,
            "description": "Actionable reason for an `UNAVAILABLE` preflight; null for every other status."
          },
          "requiresFundedAmount": {
            "type": "boolean",
            "nullable": true,
            "description": "ShipEngine carrier funding requirement, or null when it could not be proven."
          },
          "balanceInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "nullable": true,
            "description": "Current ShipEngine Balance scalar normalized to hundredths for comparison with the exact USD/GBP provider rate. List Carriers does not declare the balance currency. Null for sandbox or unavailable evidence."
          },
          "requiredInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "example": "usd"
          },
          "canPurchase": {
            "type": "boolean",
            "description": "Whether the current preflight permits the separate funded label command."
          }
        },
        "required": [
          "status",
          "unavailableReason",
          "requiresFundedAmount",
          "balanceInMinorUnits",
          "requiredInMinorUnits",
          "currency",
          "canPurchase"
        ]
      },
      "QuoteShippingLabelSelectionResponseDto": {
        "type": "object",
        "properties": {
          "requirements": {
            "$ref": "#/components/schemas/ShippingLabelRateRequirementsResponseDto"
          },
          "selectionQuoteFingerprint": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "description": "Opaque fingerprint of the normalized server-authoritative decision evidence. The funded command must echo it and fails closed if any evidence changed."
          },
          "classification": {
            "type": "string",
            "enum": [
              "ORIGINAL_SERVICE",
              "SAME_OR_FASTER",
              "MEETS_PROMISE",
              "OVERRIDE"
            ]
          },
          "serviceSelectionBasis": {
            "type": "string",
            "enum": [
              "CAPTURED_CARRIER_SERVICE",
              "DELIVERY_PROMISE",
              "MANUAL_SHIPPING_METHOD",
              "NO_CAPTURED_CARRIER_SERVICE"
            ],
            "description": "The immutable customer-facing shipping basis against which the merchant is selecting actual postage. Manual/free and no-capture orders never imply carrier equivalence or a customer delivery promise."
          },
          "recommended": {
            "type": "boolean",
            "description": "True only for a same-or-faster promise-preserving savings candidate."
          },
          "requiresNonRecommendedConfirmation": {
            "type": "boolean",
            "description": "True when the Admin must collect a separate selection acknowledgement. Captured/promise substitutions acknowledge a non-recommended choice; manual/free and no-capture orders instead confirm the actual postage choice without making a recommendation, equivalence, or promise claim."
          },
          "requiresOverrideReason": {
            "type": "boolean",
            "description": "True when the funded command must include a separate concise reason for either a non-recommended captured-service choice or the actual postage choice on a manual/free or no-capture order."
          },
          "carrierId": {
            "type": "string"
          },
          "carrierName": {
            "type": "string"
          },
          "serviceCode": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "carrierCostInMinorUnits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "fundingPreflight": {
            "$ref": "#/components/schemas/ShippingLabelFundingPreflightDto"
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "example": "usd"
          },
          "deliveryDays": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "estimatedDeliveryDate": {
            "type": "string",
            "nullable": true,
            "format": "date",
            "description": "Provider-authored estimated arrival date for the matching planned ship date; null means timing unknown."
          },
          "guaranteedService": {
            "type": "boolean",
            "nullable": true,
            "description": "Provider rate guarantee flag; null means the provider did not supply one. This does not guarantee the customer delivery promise."
          },
          "quotedAt": {
            "type": "string",
            "format": "date-time"
          },
          "recommendation": {
            "nullable": true,
            "description": "Fresh original reference plus same-or-faster and meets-promise candidates. Null for exact-service checkout orders.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPromiseRecommendationResponseDto"
              }
            ]
          }
        },
        "required": [
          "requirements",
          "selectionQuoteFingerprint",
          "classification",
          "serviceSelectionBasis",
          "recommended",
          "requiresNonRecommendedConfirmation",
          "requiresOverrideReason",
          "carrierId",
          "carrierName",
          "serviceCode",
          "serviceName",
          "carrierCostInMinorUnits",
          "fundingPreflight",
          "currency",
          "deliveryDays",
          "estimatedDeliveryDate",
          "guaranteedService",
          "quotedAt",
          "recommendation"
        ]
      },
      "PrepareExternalShippingLabelDto": {
        "type": "object",
        "properties": {
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Exact remaining original-order line quantities assigned to this package.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyShippingLabelLineDto"
            }
          },
          "package": {
            "description": "Merchant-confirmed loaded package facts. These facts bind the external label to the same immutable package model as native postage.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyShippingLabelPackageDto"
              }
            ]
          },
          "carrier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "Merchant-entered carrier name shown with this external shipment.",
            "example": "UPS"
          },
          "serviceLevel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "Optional merchant-entered carrier service name. Blank input is normalized as omitted.",
            "example": "Ground"
          },
          "trackingNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Trustworthy carrier tracking number from the externally acquired label. Untracked shipment preparation is not supported by this endpoint.",
            "example": "1Z999AA10123456784"
          },
          "trackingUrl": {
            "type": "string",
            "maxLength": 500,
            "description": "Optional http(s) carrier tracking URL. Blank input is normalized as omitted. A supplied URL is recorded as merchant-supplied evidence, not provider confirmation.",
            "example": "https://www.ups.com/track?tracknum=1Z999AA10123456784"
          }
        },
        "required": [
          "lines",
          "package",
          "carrier",
          "trackingNumber"
        ]
      },
      "PreparedExternalShippingLabelDto": {
        "type": "object",
        "properties": {
          "carrier": {
            "type": "string",
            "description": "Merchant-entered external carrier name."
          },
          "serviceLevel": {
            "type": "string",
            "nullable": true,
            "description": "Optional merchant-entered service name from the external label, or null when none was supplied."
          },
          "trackingNumber": {
            "type": "string",
            "description": "Merchant-supplied carrier tracking number. This is not provider-confirmed evidence."
          },
          "trackingUrl": {
            "type": "string",
            "nullable": true,
            "description": "Optional merchant-entered http(s) carrier tracking URL, or null when none was supplied."
          },
          "source": {
            "type": "string",
            "enum": [
              "MERCHANT_EXTERNAL"
            ],
            "description": "Explicit source classification: cartonium did not rate, buy, or fund this label."
          }
        },
        "required": [
          "carrier",
          "serviceLevel",
          "trackingNumber",
          "trackingUrl",
          "source"
        ]
      },
      "PreparedShippingLabelShipmentDto": {
        "type": "object",
        "properties": {
          "fulfillmentId": {
            "type": "string",
            "format": "uuid",
            "description": "Prepared CommerceFulfillment id for the selected line quantities."
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-owned immutable order shipment package id bound to this label."
          },
          "packageOrdinal": {
            "type": "number",
            "minimum": 1,
            "description": "Server-assigned order-scoped physical package ordinal.",
            "example": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "READY"
            ],
            "description": "Always READY: postage is prepared, but carrier handoff has not occurred.",
            "example": "READY"
          }
        },
        "required": [
          "fulfillmentId",
          "shipmentPackageId",
          "packageOrdinal",
          "status"
        ]
      },
      "PrepareExternalShippingLabelResponseDto": {
        "type": "object",
        "properties": {
          "externalLabel": {
            "$ref": "#/components/schemas/PreparedExternalShippingLabelDto"
          },
          "order": {
            "$ref": "#/components/schemas/MerchantOrderDto"
          },
          "preparedShipment": {
            "$ref": "#/components/schemas/PreparedShippingLabelShipmentDto"
          }
        },
        "required": [
          "externalLabel",
          "order",
          "preparedShipment"
        ]
      },
      "BuyShippingLabelDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "requirements": {
            "description": "Shipment requirements from the matching exact read-only quote; a mismatch fails before spend.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingLabelRateRequirementsDto"
              }
            ]
          },
          "shipmentPackageId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-owned prepared-package id used to recover or retry an existing authoritative FAILED label attempt after a reload. It must belong to this tenant and order; immutable lines/package facts must match. Omit when creating a new prepared package."
          },
          "lines": {
            "minItems": 1,
            "maxItems": 200,
            "description": "Exact original-order line quantities to allocate to this prepared package.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyShippingLabelLineDto"
            }
          },
          "package": {
            "description": "Confirmed loaded package facts used identically for the fresh rate preflight and funded label request.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BuyShippingLabelPackageDto"
              }
            ]
          },
          "serviceCode": {
            "type": "string",
            "maxLength": 100,
            "description": "Exact service code from the matching reviewed selection quote. Omit only to use the customer's captured original service; an exceptional cross-service choice must survive server classification, fresh preflight, fingerprint validation, and any required justification.",
            "example": "usps_priority_mail"
          },
          "carrierId": {
            "type": "string",
            "maxLength": 100,
            "description": "Exact connected ShipEngine carrier id from the matching reviewed selection quote. Omit only with the customer's captured original carrier; it is never a free-form substitution at funded spend.",
            "example": "se-123456"
          },
          "recipientPhone": {
            "type": "string",
            "maxLength": 50,
            "description": "Explicit recipient-phone correction for this label purchase only. Used when the selected carrier/service preflight requires a phone that was not captured (or rejects the captured value). Does not mutate the immutable order-time shipping snapshot and is not globally required.",
            "example": "+1 208-555-1234"
          },
          "selectionQuoteFingerprint": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$",
            "description": "#2447 — opaque fingerprint returned by a matching reviewed exact selection quote. The server freshly recomputes all evidence and rejects stale or mismatched confirmation before provider spend."
          },
          "overrideReason": {
            "type": "string",
            "minLength": 5,
            "maxLength": 500,
            "description": "Separate concise justification required for a meets-promise or outside-recommendation service, or for the actual postage choice on a manual/free or no-capture order. It is not the high-risk spend reason.",
            "example": "Use the less expensive service; the customer promise is preserved."
          }
        },
        "required": [
          "reason",
          "lines",
          "package",
          "selectionQuoteFingerprint"
        ]
      },
      "PurchasedShippingLabelDto": {
        "type": "object",
        "properties": {
          "labelId": {
            "type": "string",
            "description": "ShipEngine's label id (`se-…`) — the void/refund handle.",
            "example": "se-987654"
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true,
            "description": "Carrier tracking number, or null when the provider omitted it.",
            "example": "9400111899223197428490"
          },
          "labelDownloadUrl": {
            "type": "string",
            "nullable": true,
            "description": "Direct URL to the printable PDF label, or null when absent.",
            "example": "https://api.shipengine.com/v1/downloads/10/…/label.pdf"
          },
          "shipmentCostInCents": {
            "type": "number",
            "description": "Charged label cost in integer cents (shipping + insurance).",
            "example": 790
          },
          "shipmentCostCurrency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "description": "Validated lowercase ISO-4217 currency for the charged cost.",
            "example": "usd"
          },
          "carrierCode": {
            "type": "string",
            "description": "Carrier code the label was bought against (e.g. `usps`).",
            "example": "usps"
          },
          "serviceCode": {
            "type": "string",
            "nullable": true,
            "description": "Service code the label was bought against.",
            "example": "usps_priority_mail"
          },
          "testLabel": {
            "type": "boolean",
            "description": "True when a non-chargeable sandbox test label was produced (TEST_ key).",
            "example": false
          }
        },
        "required": [
          "labelId",
          "trackingNumber",
          "labelDownloadUrl",
          "shipmentCostInCents",
          "shipmentCostCurrency",
          "carrierCode",
          "serviceCode",
          "testLabel"
        ]
      },
      "BuyShippingLabelResponseDto": {
        "type": "object",
        "properties": {
          "label": {
            "$ref": "#/components/schemas/PurchasedShippingLabelDto"
          },
          "order": {
            "$ref": "#/components/schemas/MerchantOrderDto"
          },
          "needsTracking": {
            "type": "boolean",
            "description": "#1809 — true when the provider returned NO tracking number: the label was purchased and recorded (voidable), but its prepared shipment remains READY. Add tracking before handoff when the carrier requires it. A labelId is never used as a tracking number.",
            "example": false
          },
          "preparedShipment": {
            "$ref": "#/components/schemas/PreparedShippingLabelShipmentDto"
          }
        },
        "required": [
          "label",
          "order",
          "needsTracking",
          "preparedShipment"
        ]
      },
      "ReconcileShippingLabelDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued label-purchase id. The API re-verifies tenant, order, logical label, package, and fulfillment ownership."
          }
        },
        "required": [
          "reason",
          "purchaseId"
        ]
      },
      "ReconcileShippingLabelResponseDto": {
        "type": "object",
        "properties": {
          "result": {
            "type": "string",
            "enum": [
              "FOUND_ADOPTED_READY",
              "NOT_FOUND_PENDING",
              "NOT_FOUND_BLOCKED",
              "NOT_FOUND_RELEASED",
              "LOOKUP_FAILED",
              "EVIDENCE_MISMATCH",
              "CONNECTION_GENERATION_MISMATCH",
              "NO_PROVIDER_REFERENCE",
              "LEGACY_LABEL_FOUND_RECORDED",
              "LEGACY_NO_LABEL_RECORDED",
              "LEGACY_UNRESOLVED"
            ],
            "description": "Original closed outcome catalog, kept stable for readers generated before #3956. FOUND_ADOPTED_READY is the only outcome that moves a package to READY (an acceptance at actual cost is projected here as FOUND_ADOPTED_READY because the exact label was found and adopted); every other outcome leaves the attempt blocked, pending, or released for retry as documented on the message. The precise outcome is resultDetail."
          },
          "resultDetail": {
            "type": "string",
            "description": "Precise reconciliation outcome from the open-ended catalog; see x-extensible-enum for the known stable values and tolerate an unknown value by rendering it by name. Equals result except where the precise value postdates the original closed catalog: COST_ACCEPTED_READY (the exact completed label was re-verified and adopted at its actual cost) is published as result FOUND_ADOPTED_READY.",
            "example": "EVIDENCE_MISMATCH",
            "x-extensible-enum": [
              "FOUND_ADOPTED_READY",
              "NOT_FOUND_PENDING",
              "NOT_FOUND_BLOCKED",
              "NOT_FOUND_RELEASED",
              "LOOKUP_FAILED",
              "EVIDENCE_MISMATCH",
              "CONNECTION_GENERATION_MISMATCH",
              "NO_PROVIDER_REFERENCE",
              "LEGACY_LABEL_FOUND_RECORDED",
              "LEGACY_NO_LABEL_RECORDED",
              "LEGACY_UNRESOLVED",
              "COST_ACCEPTED_READY"
            ]
          },
          "message": {
            "type": "string",
            "description": "Operator-facing next state. It never includes provider secrets or raw response data."
          },
          "retryAllowed": {
            "type": "boolean",
            "description": "True only after the conservative repeated-404 policy released this exact package claim to FAILED."
          },
          "nextLookupAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "event": {
            "$ref": "#/components/schemas/ShippingLabelReconciliationEventDto"
          }
        },
        "required": [
          "result",
          "resultDetail",
          "message",
          "retryAllowed",
          "nextLookupAt",
          "event"
        ]
      },
      "AcceptShippingLabelActualCostDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued label-purchase id of the parked completed label. The API re-verifies tenant, order, logical label, package, fulfillment, and provider identity before adopting it at the actual cost."
          }
        },
        "required": [
          "reason",
          "purchaseId"
        ]
      },
      "RetirePostHandoffPostageDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued label-purchase id of the exact outbound postage to retire. The API re-verifies tenant, order, fulfillment, package, provider connection generation and exact label identity under lock before recording any intent, and rejects the request if this is no longer the current postage on that shipment."
          }
        },
        "required": [
          "reason",
          "purchaseId"
        ]
      },
      "RetirePostHandoffPostageResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "POSTAGE_RETIRED",
              "RETIREMENT_PENDING",
              "RETIREMENT_UNRESOLVED",
              "RETIREMENT_DENIED"
            ],
            "description": "POSTAGE_RETIRED: the carrier confirmed the void and the exact label is retired; the shipment stays shipped and nothing else changed. RETIREMENT_PENDING: the request is durably recorded and the exact carrier void is queued or in progress. RETIREMENT_UNRESOLVED: the carrier outcome is not yet known and exact-label checks are reconciling it; the label is not assumed retired or usable. RETIREMENT_DENIED: the carrier refused the void, so the postage remains live and usable. No outcome implies a carrier-account credit, a customer refund, or anything about whether the goods were delivered."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this request returned an already-recorded retirement for the same idempotency key or the same exact label."
          },
          "message": {
            "type": "string",
            "description": "Server-authored merchant guidance; never a raw provider response."
          },
          "operation": {
            "$ref": "#/components/schemas/ShippingLabelVoidOperationSummaryDto"
          },
          "record": {
            "$ref": "#/components/schemas/CommerceRecordDetailDto"
          }
        },
        "required": [
          "outcome",
          "replayed",
          "message",
          "operation",
          "record"
        ]
      },
      "RetryPostHandoffPostageRetirementCheckDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued label-purchase id whose postage retirement is awaiting recovery."
          }
        },
        "required": [
          "reason",
          "purchaseId"
        ]
      },
      "VoidParkedShippingLabelDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued label-purchase id of the parked completed label. The API re-verifies tenant, order, package, fulfillment, provider generation and exact label identity before recording the void intent."
          }
        },
        "required": [
          "reason",
          "purchaseId"
        ]
      },
      "VoidParkedShippingLabelResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "LABEL_VOIDED",
              "VOID_PENDING",
              "VOID_RECONCILIATION_REQUIRED",
              "VOID_DENIED"
            ],
            "description": "LABEL_VOIDED: the carrier confirmed the void, the purchase is VOIDED and the planned package is CANCELLED with its allocation released for a fresh preparation. VOID_PENDING: the intent is recorded and the exact provider void is queued or in progress. VOID_RECONCILIATION_REQUIRED: the provider result is ambiguous and exact-label lookups are reconciling it. VOID_DENIED: the carrier refused; the label stays parked and can still be accepted at its actual cost."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this request returned an already-recorded void intent for the same idempotency key or the same parked label."
          },
          "message": {
            "type": "string",
            "description": "Server-authored merchant guidance; never a raw provider response."
          },
          "operation": {
            "$ref": "#/components/schemas/ShippingLabelVoidOperationSummaryDto"
          },
          "record": {
            "$ref": "#/components/schemas/CommerceRecordDetailDto"
          }
        },
        "required": [
          "outcome",
          "replayed",
          "message",
          "operation",
          "record"
        ]
      },
      "RetryParkedShippingLabelVoidCheckDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Server-issued label-purchase id whose parked-label void is awaiting recovery."
          }
        },
        "required": [
          "reason",
          "purchaseId"
        ]
      },
      "RecordLegacyShippingLabelDispositionDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid"
          },
          "disposition": {
            "type": "string",
            "enum": [
              "LABEL_FOUND",
              "NO_LABEL_CONFIRMED",
              "UNRESOLVED"
            ]
          },
          "evidence": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500,
            "description": "Non-secret evidence note, such as the provider label id or support case. Never include an API key, raw response, or customer data."
          }
        },
        "required": [
          "reason",
          "purchaseId",
          "disposition",
          "evidence"
        ]
      },
      "WarehouseOutputAddressDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "company": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "addressLine1": {
            "type": "string",
            "nullable": true
          },
          "addressLine2": {
            "type": "string",
            "nullable": true
          },
          "cityLocality": {
            "type": "string",
            "nullable": true
          },
          "stateProvince": {
            "type": "string",
            "nullable": true
          },
          "postalCode": {
            "type": "string",
            "nullable": true
          },
          "countryCode": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "name",
          "company",
          "phone",
          "addressLine1",
          "addressLine2",
          "cityLocality",
          "stateProvince",
          "postalCode",
          "countryCode"
        ]
      },
      "WarehouseOutputLineDto": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "format": "uuid"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          }
        },
        "required": [
          "lineId",
          "sku",
          "name",
          "quantity"
        ]
      },
      "WarehouseOutputLabelDto": {
        "type": "object",
        "properties": {
          "purchaseId": {
            "type": "string",
            "format": "uuid"
          },
          "labelId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "minimum": 1
          },
          "testLabel": {
            "type": "boolean"
          }
        },
        "required": [
          "purchaseId",
          "labelId",
          "version",
          "testLabel"
        ]
      },
      "WarehouseOutputRowDto": {
        "type": "object",
        "properties": {
          "fulfillmentId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "orderNumber": {
            "type": "string",
            "nullable": true
          },
          "organizationName": {
            "type": "string"
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "goodsKind": {
            "type": "string",
            "enum": [
              "ORIGINAL_ORDER",
              "REPLACEMENT_GOODS"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PLANNED",
              "READY",
              "SHIPPED",
              "DELIVERED"
            ]
          },
          "readyAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "packageOrdinal": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true
          },
          "carrier": {
            "type": "string",
            "nullable": true
          },
          "serviceLevel": {
            "type": "string",
            "nullable": true
          },
          "trackingNumber": {
            "type": "string",
            "nullable": true
          },
          "shipTo": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/WarehouseOutputAddressDto"
              }
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WarehouseOutputLineDto"
            }
          },
          "labelEligibility": {
            "type": "string",
            "enum": [
              "ELIGIBLE",
              "NO_CURRENT_PURCHASED_OUTBOUND_LABEL",
              "LABEL_VOID_IN_PROGRESS",
              "LABEL_ARTIFACT_UNAVAILABLE"
            ]
          },
          "label": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/WarehouseOutputLabelDto"
              }
            ]
          }
        },
        "required": [
          "fulfillmentId",
          "recordId",
          "orderId",
          "displayNumber",
          "orderNumber",
          "organizationName",
          "customerName",
          "customerEmail",
          "companyName",
          "goodsKind",
          "status",
          "readyAt",
          "shippedAt",
          "deliveredAt",
          "createdAt",
          "packageOrdinal",
          "carrier",
          "serviceLevel",
          "trackingNumber",
          "shipTo",
          "lines",
          "labelEligibility",
          "label"
        ]
      },
      "WarehouseOutputListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WarehouseOutputRowDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "WarehouseOutputSelectionDto": {
        "type": "object",
        "properties": {
          "fulfillmentIds": {
            "minItems": 1,
            "maxItems": 50,
            "uniqueItems": true,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "fulfillmentIds"
        ]
      },
      "PublicSubscriptionPlanVisibility": {
        "type": "string",
        "enum": [
          "PUBLIC_STOREFRONT",
          "API_BYO_ONLY"
        ],
        "description": "Where the plan is offered. API_BYO_ONLY plans are never returned by the list endpoint and require a known-slug detail lookup."
      },
      "SubscriptionPlanType": {
        "type": "string",
        "enum": [
          "PRODUCT",
          "MEMBERSHIP",
          "SERVICE_ACCESS"
        ]
      },
      "SubscriptionTrialMode": {
        "type": "string",
        "enum": [
          "NONE",
          "CARD_UPFRONT",
          "NO_CARD"
        ]
      },
      "SubscriptionTrialEndBehavior": {
        "type": "string",
        "enum": [
          "CANCEL",
          "CREATE_INVOICE",
          "PAUSE"
        ],
        "description": "NO_CARD trial behavior when no payment method exists at trial end; null for other trial modes."
      },
      "PublicSubscriptionSellMode": {
        "type": "string",
        "enum": [
          "SUBSCRIPTION",
          "ONE_TIME_AND_SUBSCRIPTION"
        ],
        "description": "The catalog target's effective purchase mode after applying a variant override to the parent item's default. Public plans are returned only when this permits subscriptions."
      },
      "PublicSubscriptionCatalogTargetDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "itemSlug": {
            "type": "string",
            "description": "Public catalog slug for the attached item."
          },
          "itemName": {
            "type": "string",
            "description": "Customer-facing item name."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantName": {
            "type": "string",
            "nullable": true
          },
          "variantSku": {
            "type": "string",
            "nullable": true
          },
          "effectiveSellMode": {
            "description": "The catalog target's effective purchase mode after applying a variant override to the parent item's default. Public plans are returned only when this permits subscriptions.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicSubscriptionSellMode"
              }
            ]
          }
        },
        "required": [
          "itemId",
          "itemSlug",
          "itemName",
          "variantId",
          "variantName",
          "variantSku",
          "effectiveSellMode"
        ]
      },
      "SubscriptionPriceInterval": {
        "type": "string",
        "enum": [
          "DAY",
          "WEEK",
          "MONTH",
          "YEAR"
        ]
      },
      "PublicSubscriptionPriceUsageType": {
        "type": "string",
        "enum": [
          "LICENSED"
        ],
        "description": "Licensed recurring usage. Metered subscription checkout is not part of the public contract."
      },
      "PublicSubscriptionPriceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "description": "Lowercase ISO 4217 currency code."
          },
          "unitAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Recurring unit amount in the currency minor unit."
          },
          "interval": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPriceInterval"
              }
            ]
          },
          "intervalCount": {
            "type": "integer",
            "minimum": 1
          },
          "usageType": {
            "description": "Licensed recurring usage. Metered subscription checkout is not part of the public contract.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicSubscriptionPriceUsageType"
              }
            ]
          },
          "isDefault": {
            "type": "boolean",
            "description": "True when this is the merchant-selected default price."
          }
        },
        "required": [
          "id",
          "currency",
          "unitAmountInCents",
          "interval",
          "intervalCount",
          "usageType",
          "isDefault"
        ]
      },
      "PublicSubscriptionPlanDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped public plan slug."
          },
          "name": {
            "type": "string",
            "description": "Customer-facing plan name."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "channelVisibility": {
            "description": "Where the plan is offered. API_BYO_ONLY plans are never returned by the list endpoint and require a known-slug detail lookup.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicSubscriptionPlanVisibility"
              }
            ]
          },
          "planType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanType"
              }
            ]
          },
          "trialMode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialMode"
              }
            ]
          },
          "trialDays": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1
          },
          "trialEndBehavior": {
            "nullable": true,
            "description": "NO_CARD trial behavior when no payment method exists at trial end; null for other trial modes.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialEndBehavior"
              }
            ]
          },
          "requiresShipping": {
            "type": "boolean",
            "description": "Whether fulfillment requires a shipping destination."
          },
          "catalogTarget": {
            "nullable": true,
            "description": "Attached public catalog item/variant for a product-backed plan; null for membership or service-access plans without a catalog target.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicSubscriptionCatalogTargetDto"
              }
            ]
          },
          "prices": {
            "maxItems": 100,
            "description": "Eligible recurring prices in this page. A continuation request can return an empty final page when prices change between requests.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicSubscriptionPriceDto"
            }
          },
          "nextPriceCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next recurring-price page. Fetch the same plan by slug with `priceCursor`; null when this page is complete."
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "description",
          "channelVisibility",
          "planType",
          "trialMode",
          "trialDays",
          "trialEndBehavior",
          "requiresShipping",
          "catalogTarget",
          "prices",
          "nextPriceCursor"
        ]
      },
      "PublicSubscriptionPlanListDto": {
        "type": "object",
        "properties": {
          "data": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicSubscriptionPlanDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next plan page; null when there are no more plans."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "SubscriptionPlanStatus": {
        "type": "string",
        "enum": [
          "DRAFT",
          "ACTIVE",
          "ARCHIVED"
        ]
      },
      "SubscriptionPlanVisibility": {
        "type": "string",
        "enum": [
          "PUBLIC_STOREFRONT",
          "API_BYO_ONLY",
          "MERCHANT_CREATED_ONLY"
        ]
      },
      "SubscriptionAudience": {
        "type": "string",
        "enum": [
          "CUSTOMER",
          "BUSINESS_ACCOUNT"
        ]
      },
      "SubscriptionPlanResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanStatus"
              }
            ]
          },
          "channelVisibility": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanVisibility"
              }
            ]
          },
          "planType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanType"
              }
            ]
          },
          "audience": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionAudience"
              }
            ]
          },
          "trialMode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialMode"
              }
            ]
          },
          "trialDays": {
            "type": "number",
            "nullable": true
          },
          "trialEndBehavior": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialEndBehavior"
              }
            ]
          },
          "requiresShipping": {
            "type": "boolean"
          },
          "requiresEntitlementProjection": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "slug",
          "name",
          "description",
          "status",
          "channelVisibility",
          "planType",
          "audience",
          "trialMode",
          "trialDays",
          "trialEndBehavior",
          "requiresShipping",
          "requiresEntitlementProjection",
          "metadata",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "SubscriptionPriceUsageType": {
        "type": "string",
        "enum": [
          "LICENSED",
          "METERED"
        ]
      },
      "SubscriptionPriceStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "ARCHIVED"
        ]
      },
      "SubscriptionPriceResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "planId": {
            "type": "string",
            "format": "uuid"
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true
          },
          "stripeProductId": {
            "type": "string",
            "nullable": true
          },
          "stripePriceId": {
            "type": "string",
            "nullable": true
          },
          "currency": {
            "type": "string"
          },
          "unitAmountInCents": {
            "type": "number"
          },
          "interval": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPriceInterval"
              }
            ]
          },
          "intervalCount": {
            "type": "number"
          },
          "usageType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPriceUsageType"
              }
            ]
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPriceStatus"
              }
            ]
          },
          "isDefault": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "planId",
          "stripeAccountId",
          "stripeProductId",
          "stripePriceId",
          "currency",
          "unitAmountInCents",
          "interval",
          "intervalCount",
          "usageType",
          "status",
          "isDefault",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "SubscriptionEntitlementType": {
        "type": "string",
        "enum": [
          "ACCESS",
          "DISCOUNT",
          "ALLOWANCE",
          "SERVICE_CREDIT",
          "LIMIT_OVERRIDE"
        ]
      },
      "SubscriptionEntitlementResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "planId": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "entitlementType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionEntitlementType"
              }
            ]
          },
          "value": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "planId",
          "key",
          "entitlementType",
          "value",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "SubscriptionPlanDetailResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanStatus"
              }
            ]
          },
          "channelVisibility": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanVisibility"
              }
            ]
          },
          "planType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanType"
              }
            ]
          },
          "audience": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionAudience"
              }
            ]
          },
          "trialMode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialMode"
              }
            ]
          },
          "trialDays": {
            "type": "number",
            "nullable": true
          },
          "trialEndBehavior": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialEndBehavior"
              }
            ]
          },
          "requiresShipping": {
            "type": "boolean"
          },
          "requiresEntitlementProjection": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionPriceResponseDto"
            }
          },
          "entitlementRules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionEntitlementResponseDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "variantId",
          "slug",
          "name",
          "description",
          "status",
          "channelVisibility",
          "planType",
          "audience",
          "trialMode",
          "trialDays",
          "trialEndBehavior",
          "requiresShipping",
          "requiresEntitlementProjection",
          "metadata",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "prices",
          "entitlementRules"
        ]
      },
      "CreateSubscriptionPlanDto": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "URL-safe unique key within the org. Lower-case letters, digits, and dashes."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "nullable": true
          },
          "planType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanType"
              }
            ]
          },
          "channelVisibility": {
            "description": "Offering channel; defaults to MERCHANT_CREATED_ONLY. Orthogonal to lifecycle status. Storefront/BYO filtering that consumes it is #629.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanVisibility"
              }
            ]
          },
          "audience": {
            "description": "Defaults to CUSTOMER.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionAudience"
              }
            ]
          },
          "trialMode": {
            "description": "Defaults to NONE.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialMode"
              }
            ]
          },
          "trialDays": {
            "type": "number",
            "minimum": 1,
            "maximum": 3650,
            "nullable": true,
            "description": "Trial length in days; required when trialMode !== NONE."
          },
          "trialEndBehavior": {
            "nullable": true,
            "description": "For NO_CARD trials, what happens if the trial ends without a saved payment method (ADR-024 Decision 6).",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialEndBehavior"
              }
            ]
          },
          "requiresShipping": {
            "type": "boolean",
            "description": "Defaults to false."
          },
          "requiresEntitlementProjection": {
            "type": "boolean",
            "description": "Defaults to false."
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Optional catalog item this plan replenishes. Must belong to the same org; validated at the service layer."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Optional catalog variant override (same-org, under `itemId`)."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          }
        },
        "required": [
          "slug",
          "name",
          "planType"
        ]
      },
      "UpdateSubscriptionPlanDto": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "URL-safe unique key within the org. Lower-case letters, digits, and dashes."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "nullable": true
          },
          "planType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanType"
              }
            ]
          },
          "channelVisibility": {
            "description": "Offering channel; defaults to MERCHANT_CREATED_ONLY. Orthogonal to lifecycle status. Storefront/BYO filtering that consumes it is #629.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPlanVisibility"
              }
            ]
          },
          "audience": {
            "description": "Defaults to CUSTOMER.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionAudience"
              }
            ]
          },
          "trialMode": {
            "description": "Defaults to NONE.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialMode"
              }
            ]
          },
          "trialDays": {
            "type": "number",
            "minimum": 1,
            "maximum": 3650,
            "nullable": true,
            "description": "Trial length in days; required when trialMode !== NONE."
          },
          "trialEndBehavior": {
            "nullable": true,
            "description": "For NO_CARD trials, what happens if the trial ends without a saved payment method (ADR-024 Decision 6).",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionTrialEndBehavior"
              }
            ]
          },
          "requiresShipping": {
            "type": "boolean",
            "description": "Defaults to false."
          },
          "requiresEntitlementProjection": {
            "type": "boolean",
            "description": "Defaults to false."
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Optional catalog item this plan replenishes. Must belong to the same org; validated at the service layer."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Optional catalog variant override (same-org, under `itemId`)."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          }
        }
      },
      "CreateSubscriptionPriceDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "description": "ISO-4217 currency code (lower-case), e.g. `usd`."
          },
          "unitAmountInCents": {
            "type": "number",
            "minimum": 0,
            "description": "Recurring amount per interval, in the currency minor unit."
          },
          "interval": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPriceInterval"
              }
            ]
          },
          "intervalCount": {
            "type": "number",
            "minimum": 1,
            "maximum": 52,
            "description": "Intervals between charges (default 1)."
          },
          "usageType": {
            "description": "Defaults to LICENSED.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionPriceUsageType"
              }
            ]
          },
          "isDefault": {
            "type": "boolean",
            "description": "Mark as the plan's default price. Setting true demotes the plan's previous default (one default per plan, enforced at the service layer)."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          }
        },
        "required": [
          "currency",
          "unitAmountInCents",
          "interval"
        ]
      },
      "UpdateSubscriptionPriceDto": {
        "type": "object",
        "properties": {
          "isDefault": {
            "type": "boolean",
            "description": "Promote this price to the plan's default (demotes the previous default). Cannot be set on an archived price."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          }
        }
      },
      "CreateSubscriptionEntitlementDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Stable machine key unique within the plan (e.g. `priority-support`)."
          },
          "entitlementType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SubscriptionEntitlementType"
              }
            ]
          },
          "value": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Type-specific payload (e.g. `{ \"percentOff\": 1000 }` for DISCOUNT). Shape is validated by the consuming projection (#631), not here."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          }
        },
        "required": [
          "key",
          "entitlementType"
        ]
      },
      "UpdateSubscriptionEntitlementDto": {
        "type": "object",
        "properties": {
          "value": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          }
        }
      },
      "CheckoutAnalyticsConsentHandoffDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "The shopper choice this storefront collected. `unknown` is a valid assertion meaning \"no usable choice was obtained\" — send it rather than omitting the handoff, so the platform records that the question was asked. It never becomes `granted` later through a default.",
            "enum": [
              "granted",
              "denied",
              "unknown"
            ],
            "example": "granted"
          },
          "updateCapability": {
            "type": "string",
            "description": "A secret YOU generate, which becomes the capability authorizing later updates to this consent. Format: the literal prefix `n` — this credential's ADR-007 token family — followed by at least 32 bytes of CSPRNG randomness in a URL-safe encoding (base64url gives 43 characters, hex gives 64; both are accepted). Generate the random part with `crypto.getRandomValues` in a browser or `crypto.randomBytes` on a server. **Persist it before sending this request, not after the response:** the platform stores only its hash, never returns it, and cannot help you recover it. Retry this handoff with the identical secret; a different one under the same idempotency key is refused 409. The platform checks the prefix and the length, and **cannot check that the value is random** — padding a character to 43 passes this validation. Supplying real randomness is your obligation and is verified at Preview conformance, not here.",
            "minLength": 44,
            "pattern": "^n[A-Za-z0-9_-]{43,}$",
            "example": "nM8n2QcVxK1pLzR7wY4tH6sB0dF3jA9gE5uN1iO2rC7k"
          },
          "assertedAt": {
            "type": "string",
            "description": "When the shopper made this choice, as an ISO-8601 instant. This is the storefront clock, used only for ordering against later choices for the same checkout; it never extends the grant, whose ceiling the server freezes at acceptance.",
            "format": "date-time",
            "example": "2026-09-22T12:00:00.000Z"
          },
          "inheritedDenial": {
            "type": "boolean",
            "description": "Set true only when carrying a KNOWN prior refusal onto a successor checkout. It may accompany `denied` and nothing else: a successor can inherit a denial but never a grant, which always needs its own fresh explicit choice. Omitted means this is an original assertion.",
            "example": false
          }
        },
        "required": [
          "state",
          "updateCapability",
          "assertedAt"
        ]
      },
      "CheckoutAnalyticsConsentHandoffResponseDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "The effective state recorded for this checkout, projected as of `handoffAt` — NOT a timeless fact. A stored grant reports `unknown` once `originalCutoffAt` has passed, exactly as the read route does, so the two never disagree when asked about the same instant.",
            "enum": [
              "granted",
              "denied",
              "unknown"
            ],
            "example": "granted"
          },
          "handoffAt": {
            "type": "string",
            "description": "When `state` above was EVALUATED — not when the grant was accepted. Read after this handoff committed, so it is strictly later than the acceptance instant the platform decided on, later than the request arrival, and unrelated to the shopper choice time you sent as `assertedAt`. Do not treat it as an acceptance or audit timestamp. Its one job is to date `state`: the two are computed together against this instant, so a handoff whose work crossed `originalCutoffAt` while in flight already reports `unknown` here — the same answer an immediate read of the state route returns — even though the grant itself was accepted and durably stored. The read route publishes `readAt` for the same purpose.",
            "format": "date-time",
            "example": "2026-09-22T12:00:00.000Z"
          },
          "revision": {
            "type": "number",
            "description": "Ordered revision of the consent summary. Send it back as `expectedRevision` on the next update.",
            "minimum": 1,
            "example": 1
          },
          "grantGeneration": {
            "type": "number",
            "description": "Increments on every transition INTO a granted state. A hosted reader fences its own work to the generation it observed, so a later regrant can never revive work authorized under an earlier one.",
            "minimum": 0,
            "example": 1
          },
          "originalCutoffAt": {
            "type": "string",
            "description": "The immutable ceiling on grant use for this checkout, frozen at acceptance. Commerce activity renews the checkout itself; it never moves this value, and no retry or update extends it.",
            "format": "date-time",
            "example": "2026-09-22T12:30:00.000Z"
          },
          "updateCapabilityExpiresAt": {
            "type": "string",
            "description": "When the capability you supplied stops authorizing NEW updates, as an ISO-8601 instant. Measured from this first acceptance and never extended — retrying the handoff does not move it. It runs on its own clock, independent of `originalCutoffAt`: a withdrawal asserted after the cutoff but before this instant is still accepted, because the cutoff fences grants rather than withdrawals. **After this instant a new withdrawal on this authority is not possible**; the reads keep answering, so the state remains visible without being changeable here. `null` means the capability has been RETIRED and no further update is possible at all — it never means \"no expiry\". You can still reach this response by replaying an accepted handoff after retirement, which is why the field is nullable rather than absent.",
            "format": "date-time",
            "nullable": true,
            "example": "2026-09-25T12:00:00.000Z"
          }
        },
        "required": [
          "state",
          "handoffAt",
          "revision",
          "grantGeneration",
          "originalCutoffAt",
          "updateCapabilityExpiresAt"
        ]
      },
      "CheckoutAnalyticsConsentUpdateDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "The shopper choice now in force. A withdrawal is `denied`; a restored choice is `granted` and is accepted only when demonstrably newer than the accepted withdrawal AND still before the original cutoff.",
            "enum": [
              "granted",
              "denied",
              "unknown"
            ],
            "example": "denied"
          },
          "assertedAt": {
            "type": "string",
            "description": "When the shopper made this choice, as an ISO-8601 instant. An assertion not strictly newer than the accepted choice is refused rather than applied, so a delayed retry cannot rebase over a later refusal.",
            "format": "date-time",
            "example": "2026-09-22T12:11:00.000Z"
          },
          "expectedRevision": {
            "type": "number",
            "description": "The revision this update expects to advance, from the most recent handoff, UPDATE or timestamped state response. A mismatch is refused as `rejected_stale_revision`: no consent transition was accepted, though the refusal can have a retry receipt. An exact ambiguous-delivery retry retains the original revision; changing it changes the request. Read current state before deciding whether a separate, still-current choice should be sent with a fresh key and revision. Never rebase an older grant automatically over a newer refusal.",
            "minimum": 1,
            "example": 1
          }
        },
        "required": [
          "state",
          "assertedAt",
          "expectedRevision"
        ]
      },
      "CheckoutAnalyticsConsentUpdateResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "description": "The decision for this exact request. Only `accepted` acknowledges a consent transition; on replay it acknowledges the historical decision, without applying it again. HTTP 200 also carries refusals, which do not acknowledge a withdrawal. Non-capability refusals can have retry receipts even though they changed no consent state. `superseded` specifically means a newer accepted choice — typically a withdrawal — outranks this assertion.",
            "enum": [
              "accepted",
              "superseded",
              "rejected_stale_revision",
              "rejected_after_cutoff",
              "rejected_not_newer",
              "rejected_unknown_never_grants",
              "rejected_capability_unavailable"
            ],
            "example": "accepted"
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this response replays a decision the platform already made for this `x-idempotency-key` and identical request under the same checkout/capability. Only outcome is historical; state and revision describe the authority observed by this attempt. Replay neither extends receipt/capability lifetimes nor restores a historical grant.",
            "example": false
          },
          "state": {
            "type": "string",
            "description": "The effective state after this attempt, on every outcome EXCEPT `rejected_capability_unavailable`. On that one outcome `unknown` is a non-disclosing sentinel rather than the authority state: the caller failed proof of possession, so a durable `granted` or `denied` is deliberately withheld and reported as `unknown` exactly as an absent authority would be. This refusal discloses no authority state. An expired capability can still replay its own unexpired receipt, while a retired one cannot. On every other outcome, including refusals and replays, this projects the authority observed during the transaction, narrowed for cutoff/lifecycle at response evaluation. It does not re-read later writers or establish current intent at response arrival. This UPDATE reply contains no evaluation timestamp or cutoff; use the timestamped state GET for current enforcement and fence delayed replies against newer choices.",
            "enum": [
              "granted",
              "denied",
              "unknown"
            ],
            "example": "denied"
          },
          "revision": {
            "type": "number",
            "description": "The authority revision observed by this attempt, including on replay; it is not a promise of currentness when the response arrives. Null means no authority revision is disclosed because the capability was unusable, not that no authority exists and not revision zero.",
            "nullable": true,
            "minimum": 1,
            "example": 2
          }
        },
        "required": [
          "outcome",
          "replayed",
          "state",
          "revision"
        ]
      },
      "CheckoutAnalyticsConsentConfigurationDto": {
        "type": "object",
        "properties": {
          "policy": {
            "type": "string",
            "description": "`legacy` means the store has never enrolled in this environment. Newly loaded hosted checkout pages send no GA4 events until the store completes GA4 setup and the applicable consent permits collection. `adopted`: the consent-driven policy governs, permanently; analytics may run only when `permitted` is true AND `state` is `granted`.",
            "enum": [
              "legacy",
              "adopted"
            ],
            "example": "adopted"
          },
          "permitted": {
            "type": "boolean",
            "description": "Whether the tenant configuration currently permits adopted analytics. NECESSARY, NOT SUFFICIENT: a usable `granted` state within `originalCutoffAt`, the eligible checkout surface and the exact tenant host still apply. Always `false` when `policy` is `legacy`. When `permitted` is `false`, newly loaded checkout pages keep analytics off.",
            "example": true
          }
        },
        "required": [
          "policy",
          "permitted"
        ]
      },
      "CheckoutAnalyticsConsentStateResponseDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "description": "The state as evaluated at `readAt`, which is read after the lookup this response is built from — not a timeless fact. A stored grant reports `unknown` once `originalCutoffAt` has passed. **This field alone is not sufficient to stop on time:** it is evaluated server-side, and a response delayed in transit or held by a client can still carry `granted` after the cutoff has passed. Honour `originalCutoffAt` regardless of response timing rather than relying on this field by itself. Absent or out-of-scope authority also reports `unknown`: every failure direction suppresses.",
            "enum": [
              "granted",
              "denied",
              "unknown"
            ],
            "example": "granted"
          },
          "readAt": {
            "type": "string",
            "description": "Server time at which `state` was EVALUATED, read after the lookup behind this response rather than when the request arrived. Use it, not local arrival time, as the base for any bounded freshness window — a delayed response must not earn a full fresh lifetime on arrival. It bounds what the platform can tell you: time passing after this instant is yours to account for against `originalCutoffAt`.",
            "format": "date-time",
            "example": "2026-09-22T12:11:00.000Z"
          },
          "revision": {
            "type": "number",
            "description": "Ordered revision of the consent summary, or `null` when no authority exists for this checkout. Null means \"no consent was ever handed off\", which is not the same as a recorded `unknown` choice.",
            "nullable": true,
            "minimum": 1,
            "example": 1
          },
          "grantGeneration": {
            "type": "number",
            "description": "The grant generation this state belongs to, or `null` when no authority exists. Fence local work to this value.",
            "nullable": true,
            "minimum": 0,
            "example": 1
          },
          "originalCutoffAt": {
            "type": "string",
            "description": "The immutable grant ceiling, or `null` when no authority exists. A reader must stop at this instant regardless of any other signal.",
            "format": "date-time",
            "nullable": true,
            "example": "2026-09-22T12:30:00.000Z"
          },
          "configurationRevision": {
            "type": "string",
            "description": "Opaque marker for the tenant analytics configuration current at `readAt` — the one `analyticsConfiguration` was evaluated from. Any change to adoption, its acknowledgement, the platform availability gate or the tenant analytics settings changes it, so treat any change as invalidating cached or in-flight work, and never carry work across it. Equality is the only meaningful comparison; it encodes nothing readable. `null` exactly when `analyticsConfiguration` is `null`.",
            "nullable": true,
            "example": "cfg1:5d0f4a6c9e1b2a7d3c8f0e4b6a2d9c1e"
          },
          "analyticsConfiguration": {
            "description": "The tenant configuration this state is governed by, evaluated at `readAt` for this tenant and environment. `null` whenever no consent authority exists for this checkout — the same empty answer an unknown token gets, so this field never reveals whether a checkout exists — and whenever the configuration could not be read. A null here always means: do not run adopted analytics on the strength of this response.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentConfigurationDto"
              }
            ]
          }
        },
        "required": [
          "state",
          "readAt",
          "revision",
          "grantGeneration",
          "originalCutoffAt",
          "configurationRevision",
          "analyticsConfiguration"
        ]
      },
      "CheckoutAnalyticsConsentCleanupResponseDto": {
        "type": "object",
        "properties": {
          "cleanupRequired": {
            "type": "boolean",
            "description": "True only when an accepted withdrawal left an outstanding owned-cookie cleanup obligation for this checkout. Expiry of the checkout does NOT clear it — a shopper returning to a long-expired checkout still gets the attempt — and a lapse to `unknown` never creates one. False means no authorized instruction was returned: it also covers unusable scope or authority, and never proves successful cleanup.",
            "example": false
          },
          "cleanupRequiredAt": {
            "type": "string",
            "description": "When the obligation arose, or `null` when no authorized instruction is available (including no withdrawal or unusable scope/authority). Stamped at the FIRST accepted withdrawal and never re-dated, so it may legitimately predate the most recent withdrawal. One browser completing cleanup does not clear it for others: the platform records no per-browser completion.",
            "format": "date-time",
            "nullable": true,
            "example": null
          }
        },
        "required": [
          "cleanupRequired",
          "cleanupRequiredAt"
        ]
      },
      "CheckoutAnalyticsConsentHostedReadResponseDto": {
        "type": "object",
        "properties": {
          "state": {
            "description": "Required current enforcement projection. Missing, unusable or failed authority returns the same unknown state with null authority and configuration fields. Outstanding cleanup also suppresses this state without reading configuration. A null configuration never grants. Current configuration and post-read cutoff narrowing still apply; the client must spend round-trip time and honor the immutable cutoff.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentStateResponseDto"
              }
            ]
          },
          "cleanup": {
            "description": "Required two-field cleanup projection from the same authority row as state. Cleanup takes precedence and cannot accompany a usable grant. False with a null timestamp means no authorized instruction was returned, including neutral failure; it never proves completed cleanup.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentCleanupResponseDto"
              }
            ]
          }
        },
        "required": [
          "state",
          "cleanup"
        ]
      },
      "CheckoutAnalyticsAdoptionAcknowledgementDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "description": "Statement version this acknowledgement accepted.",
            "example": "e32_adoption_v1"
          },
          "acknowledgedAt": {
            "type": "string",
            "description": "When the Owner/Admin gave it.",
            "format": "date-time"
          },
          "measurementId": {
            "type": "string",
            "description": "The GA4 measurement ID this acknowledgement covers. It covers ONLY this ID, under the disclosure attestation current when it was given.",
            "example": "G-ABC123XYZ9"
          },
          "current": {
            "type": "boolean",
            "description": "Whether it still covers the current configuration: the current statement version, the stored measurement ID and the current disclosure attestation. `false` after any change to the ID or a re-attestation — then `reason` is `acknowledgement_required` (or a more specific fault) and analytics stays off until an Owner/Admin renews it."
          }
        },
        "required": [
          "version",
          "acknowledgedAt",
          "measurementId",
          "current"
        ]
      },
      "CheckoutAnalyticsAdoptionRecordDto": {
        "type": "object",
        "properties": {
          "everAdoptedAt": {
            "type": "string",
            "description": "When this environment first adopted. Permanent: an adopted environment never returns to the legacy notice-based defaults, whether it is later disabled or misconfigured.",
            "format": "date-time"
          },
          "enabled": {
            "type": "boolean",
            "description": "The tenant switch. `false` means analytics is off here; it never means the legacy defaults apply."
          },
          "configurationRevision": {
            "type": "number",
            "description": "Advances by exactly one on every applied enable, re-enable, acknowledgement renewal or disable.",
            "minimum": 1,
            "example": 1
          },
          "acknowledgement": {
            "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionAcknowledgementDto"
          }
        },
        "required": [
          "everAdoptedAt",
          "enabled",
          "configurationRevision",
          "acknowledgement"
        ]
      },
      "CheckoutAnalyticsAdoptionStatementDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "description": "Current disclosure version for enrollment and renewal through PATCH /merchant/settings.",
            "example": "e32_ga4_consent_v2"
          },
          "statement": {
            "type": "string",
            "description": "The disclosure for the saved consent mode. When no replacement mode is saved, the replacement statement shows the common wording. Present the full replacement disclosure for the selected ID, mode and regions on the GA4 settings save."
          }
        },
        "required": [
          "version",
          "statement"
        ]
      },
      "CheckoutAnalyticsConsentDailyCountsDto": {
        "type": "object",
        "properties": {
          "handoffGranted": {
            "type": "number",
            "minimum": 0,
            "description": "Handoffs accepted as `granted`."
          },
          "handoffDenied": {
            "type": "number",
            "minimum": 0,
            "description": "Handoffs accepted as `denied`."
          },
          "handoffUnknown": {
            "type": "number",
            "minimum": 0,
            "description": "Handoffs accepted as `unknown`."
          },
          "handoffRefused": {
            "type": "number",
            "minimum": 0,
            "description": "Handoffs for a resolvable checkout that were refused (a second handoff, a reused idempotency key, a choice asserted too late). Requests that never resolved a checkout are not counted anywhere."
          },
          "updateGranted": {
            "type": "number",
            "minimum": 0,
            "description": "Updates accepted as a grant."
          },
          "updateWithdrawn": {
            "type": "number",
            "minimum": 0,
            "description": "Updates accepted as a withdrawal of an earlier grant."
          },
          "updateDenied": {
            "type": "number",
            "minimum": 0,
            "description": "Updates accepted as a denial that withdrew no grant."
          },
          "updateUnknown": {
            "type": "number",
            "minimum": 0,
            "description": "Updates accepted as `unknown`."
          },
          "updateRefused": {
            "type": "number",
            "minimum": 0,
            "description": "Updates that were decided and refused: stale or not-newer revisions, a grant after the cutoff, an unusable capability, a reused idempotency key carrying a different request."
          }
        },
        "required": [
          "handoffGranted",
          "handoffDenied",
          "handoffUnknown",
          "handoffRefused",
          "updateGranted",
          "updateWithdrawn",
          "updateDenied",
          "updateUnknown",
          "updateRefused"
        ]
      },
      "CheckoutAnalyticsConsentTrendDayDto": {
        "type": "object",
        "properties": {
          "day": {
            "type": "string",
            "description": "UTC calendar day, `YYYY-MM-DD`.",
            "example": "2026-09-25"
          },
          "counts": {
            "$ref": "#/components/schemas/CheckoutAnalyticsConsentDailyCountsDto"
          }
        },
        "required": [
          "day",
          "counts"
        ]
      },
      "CheckoutAnalyticsConsentTrendsDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "description": "Always `platform_observation`: outcomes of the public consent handoff and update routes as this platform decided them. Never a Google receipt, a DebugView result or any claim that analytics data arrived.",
            "enum": [
              "platform_observation"
            ]
          },
          "windowStartDay": {
            "type": "string",
            "description": "First UTC day in `days`.",
            "example": "2026-08-28"
          },
          "windowEndDay": {
            "type": "string",
            "description": "Last UTC day in `days` — today, and still accumulating.",
            "example": "2026-09-25"
          },
          "days": {
            "description": "Exactly 29 consecutive UTC days, oldest first, zero-filled — never truncated, never sparse. Counts are LOWER BOUNDS: each is recorded after its consent decision commits, so a failure in between can lose one, and nothing can count one twice. Retained at most 30 days; older days are not available at all. No shopper, session, order, amount or address is behind any of these numbers.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutAnalyticsConsentTrendDayDto"
            }
          }
        },
        "required": [
          "source",
          "windowStartDay",
          "windowEndDay",
          "days"
        ]
      },
      "CheckoutAnalyticsAdoptionDiagnosticsDto": {
        "type": "object",
        "properties": {
          "environment": {
            "type": "string",
            "description": "The plane this answer is for — the deployment serving the request, never a request parameter.",
            "enum": [
              "production",
              "preview",
              "development"
            ]
          },
          "evaluatedAt": {
            "type": "string",
            "description": "When this answer was evaluated. Status and trends describe the configuration and counts at this instant; nothing here is cached.",
            "format": "date-time"
          },
          "adoptionAvailable": {
            "type": "boolean",
            "description": "Whether this store and environment can manage an existing adoption or start one on persistent staging with the tenant database connection configured. False when the status cannot be verified. An explicit Owner or Admin acknowledgement is required for first enrollment."
          },
          "policy": {
            "type": "string",
            "description": "Which policy governs hosted-checkout analytics here. `legacy` means the store has never enrolled in this environment. Newly loaded hosted checkout pages send no GA4 events until the store completes GA4 setup and the applicable consent permits collection. `adopted`: the consent-driven policy applies, permanently. `unknown`: the configuration could not be read for this answer — treat it as not permitted.",
            "enum": [
              "legacy",
              "adopted",
              "unknown"
            ]
          },
          "permitted": {
            "type": "boolean",
            "description": "Whether the adopted configuration currently permits hosted analytics. NECESSARY, NOT SUFFICIENT: even when `true`, analytics runs only for a checkout whose storefront handed off a usable affirmative choice, on the eligible checkout surface and exact tenant host. Always `false` unless `policy` is `adopted`."
          },
          "reason": {
            "type": "string",
            "description": "The single most specific reason for `permitted`, as a safe category. `status_unavailable` pairs only with `policy: unknown`.",
            "enum": [
              "not_adopted",
              "active",
              "disabled",
              "adoption_unavailable",
              "measurement_id_missing",
              "disclosure_attestation_missing",
              "acknowledgement_required",
              "status_unavailable"
            ]
          },
          "source": {
            "type": "string",
            "description": "`current_configuration` when the answer was derived from the current adoption record and GA4 settings; `unavailable` when they could not be read.",
            "enum": [
              "current_configuration",
              "unavailable"
            ]
          },
          "adoption": {
            "description": "The adoption record, or `null` when this environment has never adopted (`policy: legacy`) or the configuration could not be read (`policy: unknown`). `policy` tells the two apart.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionRecordDto"
              }
            ]
          },
          "requiredAcknowledgement": {
            "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionStatementDto"
          },
          "trends": {
            "description": "Coarse daily trends, or `null` only when the counts could not be read for this answer. An environment with nothing recorded returns zero-filled days, never `null`.",
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAnalyticsConsentTrendsDto"
              }
            ]
          }
        },
        "required": [
          "environment",
          "evaluatedAt",
          "adoptionAvailable",
          "policy",
          "permitted",
          "reason",
          "source",
          "adoption",
          "requiredAcknowledgement",
          "trends"
        ]
      },
      "EnableCheckoutAnalyticsAdoptionDto": {
        "type": "object",
        "properties": {
          "acknowledgementVersion": {
            "type": "string",
            "description": "Historical statement version. Valid requests receive a conflict directing the caller to PATCH /merchant/settings.",
            "example": "e32_adoption_v1",
            "maxLength": 64,
            "pattern": "^[a-z0-9_]{1,64}$"
          }
        },
        "required": [
          "acknowledgementVersion"
        ]
      },
      "CheckoutAnalyticsAdoptionControlResponseDto": {
        "type": "object",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "`true` when this request changed the adoption and recorded control evidence. `false` when the environment was already in the requested state: nothing was written and no evidence was recorded."
          },
          "outcome": {
            "type": "string",
            "description": "What the request changed, or `null` exactly when `applied` is `false`.",
            "enum": [
              "adopted",
              "enabled",
              "acknowledgement_renewed",
              "disabled"
            ],
            "nullable": true
          },
          "diagnostics": {
            "description": "The diagnostics answer evaluated after the request.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionDiagnosticsDto"
              }
            ]
          }
        },
        "required": [
          "applied",
          "outcome",
          "diagnostics"
        ]
      },
      "CheckoutAnalyticsAdoptionEvidenceItemDto": {
        "type": "object",
        "properties": {
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "actorUserId": {
            "type": "string",
            "description": "The acting merchant user, by existing user id."
          },
          "action": {
            "type": "string",
            "enum": [
              "enable",
              "disable"
            ]
          },
          "outcome": {
            "type": "string",
            "description": "What the control changed. Requests that changed nothing are not recorded.",
            "enum": [
              "adopted",
              "enabled",
              "acknowledgement_renewed",
              "disabled"
            ]
          },
          "configurationRevision": {
            "type": "number",
            "description": "The adoption revision this control produced.",
            "minimum": 1
          },
          "acknowledgementVersion": {
            "type": "string",
            "description": "The acknowledgement statement version in force after this control."
          }
        },
        "required": [
          "occurredAt",
          "actorUserId",
          "action",
          "outcome",
          "configurationRevision",
          "acknowledgementVersion"
        ]
      },
      "CheckoutAnalyticsAdoptionEvidencePageDto": {
        "type": "object",
        "properties": {
          "items": {
            "description": "Newest first. Evidence is retained at most 365 days from the event and older evidence is never returned. An empty list means no applied control is retained for this environment.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutAnalyticsAdoptionEvidenceItemDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "description": "Pass as `cursor` for the next, older page; `null` when this page is the last.",
            "nullable": true
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "Ga4ConsentConfigurationDto": {
        "type": "object",
        "properties": {
          "replacementInForce": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether this environment accepted replacement adoption. Remains true after disable or invalidation. Null means the current latch could not be read."
          },
          "active": {
            "type": "boolean",
            "description": "Whether replacement configuration is current, acknowledged and active. Starting analytics still requires the applicable shopper or merchant-policy basis."
          },
          "configurationRevision": {
            "type": "string",
            "nullable": true,
            "description": "Opaque current marker shared with hosted checkout. Null when configuration is unavailable. A marker alone gives no analytics permission."
          },
          "measurementId": {
            "type": "string",
            "nullable": true,
            "description": "Current GA4 measurement ID for active replacement configuration. Null when inactive or unavailable."
          },
          "mode": {
            "type": "string",
            "enum": [
              "opt_in",
              "opt_out"
            ],
            "nullable": true,
            "description": "Effective merchant mode. Null when replacement configuration is inactive or unavailable."
          },
          "checkOnReturn": {
            "type": "boolean",
            "description": "Merchant enabled checks on eligible returns to a storefront tab. Defaults to false and schedules no periodic reads."
          },
          "regionEligibility": {
            "type": "string",
            "enum": [
              "match",
              "no_match",
              "unknown"
            ],
            "nullable": true,
            "description": "Match against the merchant list using only this request’s trusted country or territory. Unknown means missing or unsupported region. Null means opt-out matching does not apply. The merchant list and visitor region are never returned."
          }
        },
        "required": [
          "replacementInForce",
          "active",
          "configurationRevision",
          "measurementId",
          "mode",
          "checkOnReturn",
          "regionEligibility"
        ]
      },
      "CheckoutAnalyticsConsentMerchantPolicyHandoffDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "description": "Handoff contract version. Only `1` is accepted.",
            "enum": [
              1
            ],
            "example": 1
          },
          "storefrontOrigin": {
            "type": "string",
            "description": "The storefront origin this server integration is installed for. It must equal the verified `x-storefront-origin` of this request.",
            "example": "https://store.example"
          },
          "tenant": {
            "type": "string",
            "description": "The organization id of the authenticated server key. Any other value is refused.",
            "example": "8f0c2f0e-3f0a-4a52-9d2b-6f1c3b7a9e10"
          },
          "environment": {
            "type": "string",
            "description": "The commerce environment of the checkout. It must equal the environment this request is verified for. Hosted merchant-policy collection is available to `production` commerce only; a `sandbox` handoff is refused and that checkout stays off.",
            "enum": [
              "production",
              "sandbox"
            ],
            "example": "production"
          },
          "originalReference": {
            "type": "string",
            "description": "The original checkout reference this storefront itself created. A resumed, replayed or successor reference is not an original.",
            "pattern": "^c[A-Za-z0-9_-]{20,255}$",
            "example": "cQ7mT2vK9pL4xR8wY1bH6sD3"
          },
          "updateCapability": {
            "type": "string",
            "description": "The update capability held in the storefront server custody for this checkout, with the same format and rules as a shopper handoff. It is what lets a later Decline withdraw this checkout. The platform stores only its hash and never returns it.",
            "minLength": 44,
            "maxLength": 512,
            "pattern": "^n[A-Za-z0-9_-]{43,}$",
            "example": "nM8n2QcVxK1pLzR7wY4tH6sB0dF3jA9gE5uN1iO2rC7k"
          },
          "idempotencyKey": {
            "type": "string",
            "description": "Caller-generated key for this handoff. An exact retry with the same key reports the acceptance already recorded and writes nothing. The same key with a different request is refused `409`.",
            "minLength": 1,
            "maxLength": 200,
            "example": "3f9c2b7a1e5d4c8b6a0f"
          },
          "configurationRevision": {
            "type": "string",
            "description": "The configuration marker the storefront qualified against on its own check. A marker that is no longer current is refused, and a handoff recorded under an earlier marker gives hosted checkout no basis.",
            "pattern": "^cfg1:[0-9a-f]{32}$",
            "example": "cfg1:0123456789abcdef0123456789abcdef"
          },
          "basis": {
            "type": "string",
            "description": "The collection basis. `merchant_policy` states that the storefront page was running on the merchant policy: no sign of a saved record, no Decline, and eligible on its own check. It is not a shopper choice.",
            "enum": [
              "merchant_policy"
            ],
            "example": "merchant_policy"
          },
          "shopperState": {
            "type": "string",
            "description": "The shopper choice, which a merchant-policy handoff leaves `unknown`.",
            "enum": [
              "unknown"
            ],
            "example": "unknown"
          },
          "assertedAt": {
            "type": "string",
            "description": "Always `null`. No shopper has chosen, so there is no shopper assertion time, and a time here is refused rather than ignored.",
            "format": "date-time",
            "nullable": true,
            "enum": [
              null
            ],
            "example": null
          },
          "optOutUrl": {
            "type": "string",
            "description": "The address of the storefront opt-out control that hosted checkout links to. Accepted only as an HTTPS URL on exactly the verified storefront origin, with no user name or password, at the path `/analytics-choices`. Any other address is refused and gives hosted checkout no merchant basis.",
            "maxLength": 2048,
            "example": "https://store.example/analytics-choices"
          }
        },
        "required": [
          "version",
          "storefrontOrigin",
          "tenant",
          "environment",
          "originalReference",
          "updateCapability",
          "idempotencyKey",
          "configurationRevision",
          "basis",
          "shopperState",
          "assertedAt",
          "optOutUrl"
        ]
      },
      "MerchantCustomPlanDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "description": "Exact catalog revision accepted for the active plan."
          },
          "revisionVersion": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "revisionId",
          "revisionVersion"
        ]
      },
      "AdditionalPlanLimitDto": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number",
            "nullable": true,
            "description": "Saved Custom allowance. Null means no configured standard allowance; it does not mean unlimited."
          },
          "status": {
            "type": "string",
            "enum": [
              "UNAVAILABLE"
            ],
            "description": "This allowance is not yet enforced. A configured value does not prove feature availability."
          }
        },
        "required": [
          "value",
          "status"
        ]
      },
      "AdditionalPlanLimitsDto": {
        "type": "object",
        "properties": {
          "storefronts": {
            "$ref": "#/components/schemas/AdditionalPlanLimitDto"
          },
          "webhooksPerDay": {
            "$ref": "#/components/schemas/AdditionalPlanLimitDto"
          },
          "emailSendsPerDay": {
            "$ref": "#/components/schemas/AdditionalPlanLimitDto"
          }
        },
        "required": [
          "storefronts",
          "webhooksPerDay",
          "emailSendsPerDay"
        ]
      },
      "PlanLimitsDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "number",
            "nullable": true,
            "description": "Max catalog items; `null` = unlimited."
          },
          "apiCallsPerDay": {
            "type": "number",
            "nullable": true,
            "description": "Max public API calls per UTC day; `null` = unlimited."
          },
          "hostedApiCallsPerDay": {
            "type": "number",
            "nullable": true,
            "description": "Max API calls from cartonium-hosted pages per UTC day, included in apiCallsPerDay; null means unlimited, not inapplicable. See hostedApiApplicable for applicability."
          },
          "storageBytes": {
            "type": "number",
            "nullable": true,
            "description": "Max total image storage bytes; `null` = unlimited."
          },
          "staffSeats": {
            "type": "number",
            "nullable": true,
            "description": "Max active staff memberships; `null` = unlimited."
          },
          "storefronts": {
            "type": "number",
            "nullable": true,
            "description": "Saved storefront capacity, currently Soon and not an active allowance. A value does not enable multiple storefronts."
          }
        },
        "required": [
          "items",
          "apiCallsPerDay",
          "hostedApiCallsPerDay",
          "storageBytes",
          "staffSeats",
          "storefronts"
        ]
      },
      "LimitsUsageDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "number",
            "example": 12,
            "description": "Current non-archived item count."
          },
          "apiCallsToday": {
            "type": "number",
            "example": 340,
            "description": "Public API calls so far today (UTC)."
          },
          "hostedApiCallsToday": {
            "type": "number",
            "example": 42,
            "description": "Hosted-page API calls so far today (UTC), included in apiCallsToday. Zero means no recorded hosted calls in this window, not that hosted pages are disabled."
          },
          "storageBytes": {
            "type": "number",
            "example": 1048576,
            "description": "Total image storage bytes in use."
          },
          "staffSeats": {
            "type": "number",
            "example": 3,
            "description": "Current active staff membership count."
          }
        },
        "required": [
          "items",
          "apiCallsToday",
          "hostedApiCallsToday",
          "storageBytes",
          "staffSeats"
        ]
      },
      "MerchantLimitsDto": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ],
            "example": "FREE_TRIAL"
          },
          "customPlan": {
            "nullable": true,
            "description": "Exact active Custom plan label; null for a standard or legacy plan.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantCustomPlanDto"
              }
            ]
          },
          "additionalLimits": {
            "$ref": "#/components/schemas/AdditionalPlanLimitsDto"
          },
          "limits": {
            "$ref": "#/components/schemas/PlanLimitsDto"
          },
          "hostedApiApplicable": {
            "type": "boolean",
            "description": "Whether hosted-page usage and alerts apply to the current checkout mode: true for hosted_litecheckout and hybrid, false for byo. This does not grant checkout or payment authority."
          },
          "usage": {
            "$ref": "#/components/schemas/LimitsUsageDto"
          }
        },
        "required": [
          "plan",
          "customPlan",
          "additionalLimits",
          "limits",
          "hostedApiApplicable",
          "usage"
        ]
      },
      "UsageAlertSettingsDto": {
        "type": "object",
        "properties": {
          "thresholds": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "minItems": 3,
            "maxItems": 3,
            "example": [
              50,
              80,
              100
            ],
            "description": "Three strictly increasing integer percentages from 1 through 100, shared by both daily API allowances. Defaults to [50,80,100] until configured. Each numbered band sends at most once per metric and UTC day, even if edited later that day. Saving does not send email; future admitted calls evaluate the new values. Current Owners and Admins receive alerts automatically; unlimited metrics and hosted usage in BYO mode do not generate alerts."
          }
        },
        "required": [
          "thresholds"
        ]
      },
      "PublicPageSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug (e.g. `about`, `faq`)."
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "Full page body (Markdown/HTML per the storefront renderer)."
          },
          "excerpt": {
            "type": "string",
            "nullable": true,
            "description": "Optional short summary for listings/SEO. `null` when unset."
          },
          "status": {
            "type": "string",
            "enum": [
              "PUBLISHED",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. The public read only ever returns `PUBLISHED` rows."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp. Always `null` on the public read (archived pages are filtered out)."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "title",
          "content",
          "excerpt",
          "status",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "MerchantPageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Tenant-scoped unique URL slug (e.g. `about`, `faq`)."
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "Full page body (Markdown/HTML per the storefront renderer)."
          },
          "excerpt": {
            "type": "string",
            "nullable": true,
            "description": "Optional short summary for listings/SEO. `null` when unset."
          },
          "status": {
            "type": "string",
            "enum": [
              "PUBLISHED",
              "DRAFT",
              "ARCHIVED"
            ],
            "description": "Lifecycle status. The merchant surface returns DRAFT, PUBLISHED, and ARCHIVED rows (unlike the published-only public read)."
          },
          "archivedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Soft-delete timestamp. Non-null on archived pages (the merchant read surfaces them); `null` for live pages."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "slug",
          "title",
          "content",
          "excerpt",
          "status",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "CreatePageDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "PUBLISHED",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "content": {
            "type": "string",
            "maxLength": 1000000,
            "description": "Page body. Stored as TEXT in Postgres so there is no schema-level length cap; the 1 MB DTO limit is a runtime safety guard."
          },
          "excerpt": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          }
        },
        "required": [
          "title",
          "slug",
          "status",
          "content"
        ]
      },
      "UpdatePageDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "PUBLISHED",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "content": {
            "type": "string",
            "maxLength": 1000000,
            "description": "Page body. Stored as TEXT in Postgres so there is no schema-level length cap; the 1 MB DTO limit is a runtime safety guard."
          },
          "excerpt": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          }
        }
      },
      "StorefrontDestinationOriginsDto": {
        "type": "object",
        "properties": {
          "returnToStoreUrl": {
            "type": "string",
            "nullable": true
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "nullable": true
          },
          "checkoutRetryUrl": {
            "type": "string",
            "nullable": true
          },
          "checkoutCancelUrl": {
            "type": "string",
            "nullable": true
          },
          "customerActionBaseUrl": {
            "type": "string",
            "nullable": true
          },
          "postActionRedirectUrl": {
            "type": "string",
            "nullable": true
          },
          "newsletterUnsubscribeRedirectUrl": {
            "type": "string",
            "nullable": true
          },
          "newsletterInactiveRedirectUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "returnToStoreUrl",
          "postCheckoutRedirectUrl",
          "checkoutRetryUrl",
          "checkoutCancelUrl",
          "customerActionBaseUrl",
          "postActionRedirectUrl",
          "newsletterUnsubscribeRedirectUrl",
          "newsletterInactiveRedirectUrl"
        ]
      },
      "StorefrontOrderProcessingDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "description",
              "structured"
            ],
            "description": "The tenant's configured delivery-estimate mode. `structured` means the tenant has ENABLED structured delivery estimation, which is what drives the `shipByDate` / delivery window on a checkout session. It does NOT guarantee that either timing field below is non-null: a merchant may enable structured estimates and configure no cutoff, and both fields are suppressed when `timezone` is `null`. Read each field for its own state rather than inferring it from this one. `description` means they are NOT configured — read it as \"no processing policy is published\", never as zero processing days or no cutoff. In `description` mode the only timing the platform publishes is the per-rate free-text `estimatedDelivery` on `GET /api/v1/public/shipping/zones`, and a policy surface must not state a processing time from this object."
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "example": "America/Denver",
            "description": "Timezone the cutoff and the processing business days are evaluated in. Almost always an IANA name (`America/Denver`), but the gate is what `Intl.DateTimeFormat` accepts as a `timeZone`, which is a SUPERSET of the IANA database — a tenant storing a fixed ISO offset such as `+05:00` or `-03:00` has that published verbatim. Treat this as \"a string you can pass to `Intl`\", not as \"a zone name you can look up in the IANA database\". Published alongside the cutoff deliberately: a bare `HH:mm` with no zone is not actionable for a consumer rendering a policy page. `null` means the stored zone is not one this read will publish, for one of THREE distinct reasons — they are not interchangeable, and which one applies changes what checkout is doing: (1) the platform cannot resolve it at all (blank, or not a zone), so checkout computes no dates either; (2) it is PROCESS-RELATIVE (`local`, `system`) — accepted by the date engine, but it means \"whatever machine evaluates it\", so it would resolve to YOUR runtime zone rather than the merchant's; (3) it is a deterministic offset written in a spelling `Intl` rejects (`UTC+5`), which is interpretable and identical for every caller — this read simply does not publish that spelling, and you should NOT read it as ambiguous the way `local` is. In cases 2 and 3 checkout still computes dates, so do not read `null` as \"checkout shows no dates\". Cases 2 and 3 also require a row written outside the platform API, which validates this column with the same predicate this read uses. Either way nothing publishable is available, so when this is `null`, `processingDays` and `cutoffTime` are BOTH `null` too. The invariant runs ONE WAY only: a cutoff is never published without a zone, but a zone IS published without a cutoff whenever the merchant configured none. `timezone` set alongside `cutoffTime: null` is a normal, valid response — do not reject or re-interpret it."
          },
          "processingDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "example": 2,
            "description": "Effective business days (Mon–Fri) of processing before an order ships, as the platform applies it — not the raw stored value. `null` in two cases, both of which mean \"no processing policy is published\" rather than zero: `mode` is `description`, or `timezone` is `null` (see below). That is what distinguishes \"not configured\" from a configured `0`. A published `0` means dispatch on the SAME BUSINESS DAY, not literally the same day: business days are Mon–Fri, so a weekend order ships the next weekday even at `0`. It normally arrives WITH a `cutoffTime`, because a structured estimate configured with no cutoff is floored to 1 business day rather than promising same-business-day dispatch at any hour. `0` together with `cutoffTime: null` IS reachable, for a tenant whose stored cutoff is in a form the platform cannot apply, and it means what it says: same-business-day dispatch, no cutoff. Do not treat that pair as impossible. No holiday calendar is applied, so a configured holiday is not skipped."
          },
          "cutoffTime": {
            "type": "string",
            "nullable": true,
            "example": "16:00",
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
            "description": "Effective local order cutoff in canonical 24-hour `HH:mm`, evaluated in `timezone`, which is non-null whenever this is. An order placed at or after it starts processing the next calendar day. `null` covers four cases: `mode` is `description`; the merchant configured no cutoff; the stored value is in a form the platform cannot apply and therefore ignores; or `timezone` is `null`, so no cutoff could be expressed without the zone a consumer needs to render it. The first three mean orders are not shifted to the next day by a cutoff. The fourth is announced by `timezone` being `null` as well, which also nulls `processingDays` — read `timezone` first."
          }
        },
        "required": [
          "mode",
          "timezone",
          "processingDays",
          "cutoffTime"
        ]
      },
      "StorefrontSiteConfigDto": {
        "type": "object",
        "properties": {
          "organizationSlug": {
            "type": "string",
            "description": "Organization slug resolved from the x-organization-slug tenant context."
          },
          "checkoutMode": {
            "type": "string",
            "enum": [
              "hosted_litecheckout",
              "byo",
              "hybrid"
            ],
            "description": "Tenant checkout posture from checkoutSettings. `hosted_litecheckout` uses hosted cartonium checkout, `byo` uses the tenant frontend, and `hybrid` keeps both routes available."
          },
          "phoneRequired": {
            "type": "boolean",
            "default": false,
            "description": "Whether ordinary cart checkout bind requires a non-blank `customer.phone`. Subscription and booking checkout are excluded. The response always includes this effective boolean after applying the legacy storage rule: Absent means not configured, which means not required. When true, a consumer should render phone as required; the API also enforces the requirement at bind, so a client that ignores the flag receives a field-keyed validation error instead of silently dropping it."
          },
          "checkoutConfirmationEmailGuidanceEnabled": {
            "type": "boolean",
            "description": "Whether current server configuration supports generic confirmation-email guidance for both cart and booking checkout without identifying a recipient. Always present. True permits only conditional guidance about an email the shopper may already have received; it does not establish a purchase, queued message, recipient eligibility, provider acceptance or inbox delivery. False means unsupported or not provable, including restricted non-production delivery, and does not mean no email was sent. A field omitted by an older API must be treated as false. This signal never authorizes sending email."
          },
          "supportEmail": {
            "type": "string",
            "nullable": true,
            "format": "email",
            "maxLength": 254,
            "description": "Customer-facing support email resolved from the active Business Profile with the legacy checkout-settings fallback. Null when the merchant has not configured a valid value of at most 254 characters or explicitly cleared it."
          },
          "supportPhone": {
            "type": "string",
            "nullable": true,
            "maxLength": 50,
            "description": "Customer-facing support phone resolved from the active Business Profile with the legacy checkout-settings fallback. Null when the merchant has not configured a valid value of at most 50 characters or explicitly cleared it."
          },
          "termsUrl": {
            "type": "string",
            "nullable": true,
            "maxLength": 10500,
            "description": "Customer-facing Terms of Service URL resolved from checkout settings through the public http(s)-only URL guard. Null when unset or invalid."
          },
          "privacyUrl": {
            "type": "string",
            "nullable": true,
            "maxLength": 10500,
            "description": "Customer-facing Privacy Policy URL resolved from checkout settings through the public http(s)-only URL guard. Null when unset or invalid."
          },
          "returnPolicyUrl": {
            "type": "string",
            "nullable": true,
            "maxLength": 10500,
            "description": "Customer-facing Returns Policy URL resolved from checkout settings through the public http(s)-only URL guard. Null when unset or invalid."
          },
          "storefrontOrigin": {
            "type": "string",
            "nullable": true,
            "example": "https://shop.example.com",
            "description": "The tenant’s canonical storefront origin (`https://<host>`, no trailing slash or path), from the selected Production or Sandbox commerce schema (ADR-003), independently of the serving API deployment. Registered browser origins and server `x-storefront-origin` resolve the same Domains entry and select its commerce mode. Storefronts use this as the `SITE_URL` source for canonicals / JSON-LD / sitemaps; a deployment names and local mode variables do not select data. `null` when no origin is configured for the selected commerce mode (including the dormant SUBDOMAIN hosting mode) — render no canonical rather than a broken one."
          },
          "commerceEnvironment": {
            "type": "string",
            "enum": [
              "production",
              "sandbox"
            ],
            "description": "Commerce data selected by the registered request origin. Independent of API deployment; server callers forward the actual storefront origin, not a mode."
          },
          "hostedCheckoutUrl": {
            "type": "string",
            "nullable": true,
            "description": "API-resolved cartonium checkout origin for this tenant and selected commerce mode. Null if the tenant slug cannot produce a valid hosted origin; do not invent a checkout URL or fall back to Production."
          },
          "trustedStorefrontOrigin": {
            "type": "string",
            "nullable": true,
            "description": "The env-aware storefront origin only when its custom domain is VERIFIED or operator-ATTESTED. Null for an absent, malformed, unverified, pending, or failed domain."
          },
          "checkoutRecoveryUrls": {
            "allOf": [
              {
                "type": "object",
                "required": [
                  "returnToStoreUrl",
                  "checkoutRetryUrl",
                  "checkoutCancelUrl"
                ],
                "properties": {
                  "returnToStoreUrl": {
                    "type": "string",
                    "nullable": true,
                    "description": "Full effective return-to-store destination after environment and redirect-trust resolution. `null` means no configured candidate, canonical storefront origin, or operator fallback resolved to a safe destination; a consumer MUST NOT redirect when it is null."
                  },
                  "checkoutRetryUrl": {
                    "type": "string",
                    "nullable": true,
                    "description": "Full effective checkout-retry destination. A safe return-to-store setting may supply the configured fallback before the canonical storefront or operator fallback is considered. `null` means none of those branches produced a safe destination; a consumer MUST NOT redirect when it is null."
                  },
                  "checkoutCancelUrl": {
                    "type": "string",
                    "nullable": true,
                    "description": "Full effective checkout-cancel destination. Safe retry and return settings may supply configured fallbacks before the canonical storefront or operator fallback is considered. `null` means none of those branches produced a safe destination; a consumer MUST NOT redirect when it is null."
                  }
                }
              }
            ],
            "description": "Full effective checkout retry, cancel, and return destinations after environment and redirect-trust resolution. Paths and queries are preserved; raw checkout settings are never returned."
          },
          "destinationOrigins": {
            "description": "Origins of the effective API-resolved checkout, customer-action, and newsletter destinations. Null means the API emits no destination for that branch. Raw checkout settings are never returned.",
            "allOf": [
              {
                "$ref": "#/components/schemas/StorefrontDestinationOriginsDto"
              }
            ]
          },
          "orderProcessing": {
            "description": "#3275 — the tenant-wide order-processing timing a shipping-policy surface needs: effective processing business days, the effective local order cutoff, and the timezone both are evaluated in. Always present. Read each field for its own state: `mode` says whether structured estimation is ENABLED, not whether either timing value is non-null. These are the same inputs that produce `shipByDate` on a checkout session, so a policy page wired to this object tracks what checkout promises — with one exception worth knowing: for a tenant whose stored zone is process-relative (`local`, `system`) or a deterministic offset in a spelling `Intl` rejects (`UTC+5`), this object publishes nothing while checkout still computes dates, so the page under-reports rather than contradicting. Neither is reachable through the platform write API. Per-rate transit windows and the free-text per-rate estimate stay on `GET /api/v1/public/shipping/zones`, since they are per-rate rather than tenant-wide.",
            "allOf": [
              {
                "$ref": "#/components/schemas/StorefrontOrderProcessingDto"
              }
            ]
          }
        },
        "required": [
          "organizationSlug",
          "checkoutMode",
          "phoneRequired",
          "checkoutConfirmationEmailGuidanceEnabled",
          "supportEmail",
          "supportPhone",
          "termsUrl",
          "privacyUrl",
          "returnPolicyUrl",
          "storefrontOrigin",
          "commerceEnvironment",
          "hostedCheckoutUrl",
          "trustedStorefrontOrigin",
          "checkoutRecoveryUrls",
          "destinationOrigins",
          "orderProcessing"
        ]
      },
      "MerchantOrganizationSnapshotDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "description": "Historical website value. May be empty; storefrontOrigin is the authoritative store destination managed in Storefront domains."
          },
          "status": {
            "type": "string",
            "description": "Organization lifecycle status in lowercase, after authenticated membership authorization."
          },
          "logoUrl": {
            "type": "string",
            "nullable": true,
            "description": "Validated tenant logo asset URL. Null when no valid attached asset exists; render the tenant name."
          },
          "accentColor": {
            "type": "string",
            "nullable": true,
            "description": "Normalized checkout accent color. Null when not configured or invalid; the client uses its standard brand color."
          },
          "checkoutMode": {
            "type": "string",
            "enum": [
              "hosted_litecheckout",
              "byo",
              "hybrid"
            ]
          },
          "phoneRequired": {
            "type": "boolean",
            "description": "Whether ordinary checkout requires a phone number. Absent stored configuration resolves to false."
          },
          "ga4MeasurementId": {
            "type": "string",
            "nullable": true,
            "description": "Activated GA4 measurement ID. Null when absent, invalid, or without the required disclosure attestation."
          },
          "analyticsConsentPolicy": {
            "type": "string",
            "enum": [
              "legacy",
              "adopted",
              "unknown"
            ],
            "description": "Effective hosted analytics consent policy. Unknown means configuration could not be proved and does not permit adopted analytics."
          },
          "analyticsConfigurationRevision": {
            "type": "string",
            "nullable": true,
            "description": "Opaque analytics configuration revision. Null when unavailable; this marker alone never authorizes analytics."
          },
          "ga4ConsentConfiguration": {
            "description": "Current replacement configuration for the verified tenant environment. Older API versions may omit this field. A failed configuration read returns an unknown, non-collecting configuration. This snapshot supplies no trusted visitor region. Hosted checkout qualifies its own request independently.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Ga4ConsentConfigurationDto"
              }
            ]
          },
          "termsUrl": {
            "type": "string",
            "nullable": true,
            "description": "Customer-facing terms URL. Null when unset, invalid, or beyond the public URL limit."
          },
          "privacyUrl": {
            "type": "string",
            "nullable": true,
            "description": "Customer-facing privacy URL. Null when unset, invalid, or beyond the public URL limit."
          },
          "returnPolicyUrl": {
            "type": "string",
            "nullable": true,
            "description": "Customer-facing returns policy URL. Null when unset, invalid, or beyond the public URL limit."
          },
          "shippingPolicyUrl": {
            "type": "string",
            "nullable": true,
            "description": "Customer-facing shipping policy URL. Null when unset, invalid, or beyond the public URL limit."
          },
          "subscriptionPolicyUrl": {
            "type": "string",
            "nullable": true,
            "description": "Customer-facing subscription policy URL. Null when unset, invalid, or beyond the public URL limit."
          },
          "supportEmail": {
            "type": "string",
            "nullable": true,
            "description": "Effective customer support email. Null when no valid support contact is configured or it was explicitly cleared."
          },
          "supportPhone": {
            "type": "string",
            "nullable": true,
            "description": "Effective customer support phone. Null when no valid support contact is configured or it was explicitly cleared."
          },
          "timezone": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "storefrontOrigin": {
            "type": "string",
            "nullable": true,
            "description": "Canonical storefront origin from the merchant-selected Production or Sandbox Domains entry. Null when no usable domain is configured; never fall back to another mode or the historical website value."
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "website",
          "status",
          "logoUrl",
          "accentColor",
          "checkoutMode",
          "phoneRequired",
          "ga4MeasurementId",
          "analyticsConsentPolicy",
          "analyticsConfigurationRevision",
          "ga4ConsentConfiguration",
          "termsUrl",
          "privacyUrl",
          "returnPolicyUrl",
          "shippingPolicyUrl",
          "subscriptionPolicyUrl",
          "supportEmail",
          "supportPhone",
          "timezone",
          "currency",
          "createdAt",
          "updatedAt",
          "storefrontOrigin"
        ]
      },
      "MerchantCatalogPriceCurrencyDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "enum": [
              "USD",
              "CAD"
            ],
            "description": "Currency of the organization’s stored catalog price minor units. CAD only for an organization created through the Canadian signup admission, whose admission receipt was bound to it at approval; it stays CAD after Canadian eligibility is withdrawn. Every other organization keeps the ordinary USD catalog denomination, whatever its store profile currency."
          }
        },
        "required": [
          "currency"
        ]
      },
      "OrganizationAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "description": "Street address line 1.",
            "maxLength": 300,
            "example": "1120 S Rackham Way"
          },
          "line2": {
            "type": "string",
            "description": "Street address line 2 (suite, unit, floor).",
            "maxLength": 300,
            "example": "Suite 300"
          },
          "city": {
            "type": "string",
            "description": "City / locality.",
            "maxLength": 200,
            "example": "Meridian"
          },
          "state": {
            "type": "string",
            "description": "State / province / region.",
            "maxLength": 200,
            "example": "ID"
          },
          "zip": {
            "type": "string",
            "description": "Postal / ZIP code.",
            "maxLength": 32,
            "example": "83642"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code (e.g. `US`). Must be an ASSIGNED code; user-assigned ranges such as `ZZ` are rejected.",
            "minLength": 2,
            "maxLength": 2,
            "enum": [
              "AD",
              "AE",
              "AF",
              "AG",
              "AI",
              "AL",
              "AM",
              "AO",
              "AQ",
              "AR",
              "AS",
              "AT",
              "AU",
              "AW",
              "AX",
              "AZ",
              "BA",
              "BB",
              "BD",
              "BE",
              "BF",
              "BG",
              "BH",
              "BI",
              "BJ",
              "BL",
              "BM",
              "BN",
              "BO",
              "BQ",
              "BR",
              "BS",
              "BT",
              "BV",
              "BW",
              "BY",
              "BZ",
              "CA",
              "CC",
              "CD",
              "CF",
              "CG",
              "CH",
              "CI",
              "CK",
              "CL",
              "CM",
              "CN",
              "CO",
              "CR",
              "CU",
              "CV",
              "CW",
              "CX",
              "CY",
              "CZ",
              "DE",
              "DJ",
              "DK",
              "DM",
              "DO",
              "DZ",
              "EC",
              "EE",
              "EG",
              "EH",
              "ER",
              "ES",
              "ET",
              "FI",
              "FJ",
              "FK",
              "FM",
              "FO",
              "FR",
              "GA",
              "GB",
              "GD",
              "GE",
              "GF",
              "GG",
              "GH",
              "GI",
              "GL",
              "GM",
              "GN",
              "GP",
              "GQ",
              "GR",
              "GS",
              "GT",
              "GU",
              "GW",
              "GY",
              "HK",
              "HM",
              "HN",
              "HR",
              "HT",
              "HU",
              "ID",
              "IE",
              "IL",
              "IM",
              "IN",
              "IO",
              "IQ",
              "IR",
              "IS",
              "IT",
              "JE",
              "JM",
              "JO",
              "JP",
              "KE",
              "KG",
              "KH",
              "KI",
              "KM",
              "KN",
              "KP",
              "KR",
              "KW",
              "KY",
              "KZ",
              "LA",
              "LB",
              "LC",
              "LI",
              "LK",
              "LR",
              "LS",
              "LT",
              "LU",
              "LV",
              "LY",
              "MA",
              "MC",
              "MD",
              "ME",
              "MF",
              "MG",
              "MH",
              "MK",
              "ML",
              "MM",
              "MN",
              "MO",
              "MP",
              "MQ",
              "MR",
              "MS",
              "MT",
              "MU",
              "MV",
              "MW",
              "MX",
              "MY",
              "MZ",
              "NA",
              "NC",
              "NE",
              "NF",
              "NG",
              "NI",
              "NL",
              "NO",
              "NP",
              "NR",
              "NU",
              "NZ",
              "OM",
              "PA",
              "PE",
              "PF",
              "PG",
              "PH",
              "PK",
              "PL",
              "PM",
              "PN",
              "PR",
              "PS",
              "PT",
              "PW",
              "PY",
              "QA",
              "RE",
              "RO",
              "RS",
              "RU",
              "RW",
              "SA",
              "SB",
              "SC",
              "SD",
              "SE",
              "SG",
              "SH",
              "SI",
              "SJ",
              "SK",
              "SL",
              "SM",
              "SN",
              "SO",
              "SR",
              "SS",
              "ST",
              "SV",
              "SX",
              "SY",
              "SZ",
              "TC",
              "TD",
              "TF",
              "TG",
              "TH",
              "TJ",
              "TK",
              "TL",
              "TM",
              "TN",
              "TO",
              "TR",
              "TT",
              "TV",
              "TW",
              "TZ",
              "UA",
              "UG",
              "UM",
              "US",
              "UY",
              "UZ",
              "VA",
              "VC",
              "VE",
              "VG",
              "VI",
              "VN",
              "VU",
              "WF",
              "WS",
              "YE",
              "YT",
              "ZA",
              "ZM",
              "ZW"
            ],
            "example": "US"
          }
        },
        "required": [
          "line1",
          "city",
          "state",
          "zip",
          "country"
        ]
      },
      "DomainVerificationEnvironment": {
        "type": "string",
        "enum": [
          "PRODUCTION",
          "STAGING"
        ]
      },
      "DomainVerificationStatus": {
        "type": "string",
        "enum": [
          "UNVERIFIED",
          "PENDING",
          "VERIFIED",
          "ATTESTED",
          "FAILED"
        ]
      },
      "DomainVerificationPurpose": {
        "type": "string",
        "enum": [
          "CURRENT_DOMAIN",
          "DOMAIN_CHANGE"
        ],
        "description": "CURRENT_DOMAIN verifies an already configured host. DOMAIN_CHANGE is a proposal: its host is not active until the proposal verification succeeds."
      },
      "DomainVerificationMethod": {
        "type": "string",
        "enum": [
          "DNS_TXT",
          "DNS_CNAME"
        ]
      },
      "DomainVerificationChallengeDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "environment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationEnvironment"
              }
            ]
          },
          "host": {
            "type": "string",
            "description": "Bare host (no scheme) this challenge proves."
          },
          "purpose": {
            "description": "CURRENT_DOMAIN verifies an already configured host. DOMAIN_CHANGE is a proposal: its host is not active until the proposal verification succeeds.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationPurpose"
              }
            ]
          },
          "method": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationMethod"
              }
            ]
          },
          "recordName": {
            "type": "string",
            "description": "DNS record name the tenant must create.",
            "example": "_litecommerce-challenge.shop.acme.com"
          },
          "recordValue": {
            "type": "string",
            "description": "Exact TXT value the tenant must publish.",
            "example": "litecommerce-domain-verification=3f8a…"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationStatus"
              }
            ]
          },
          "attempts": {
            "type": "number",
            "description": "Number of verify attempts made so far."
          },
          "lastCheckedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "lastError": {
            "type": "string",
            "nullable": true,
            "description": "Why the last check did not pass (DNS miss, expiry, …)."
          },
          "verifiedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "environment",
          "host",
          "purpose",
          "method",
          "recordName",
          "recordValue",
          "status",
          "attempts",
          "lastCheckedAt",
          "lastError",
          "verifiedAt",
          "expiresAt",
          "createdAt"
        ]
      },
      "DomainEnvVerificationStatusDto": {
        "type": "object",
        "properties": {
          "environment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationEnvironment"
              }
            ]
          },
          "host": {
            "type": "string",
            "nullable": true,
            "description": "The configured custom-domain host for this env, if any."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationStatus"
              }
            ]
          },
          "trusted": {
            "type": "boolean",
            "description": "Whether this host is currently auto-trustable (VERIFIED or ATTESTED)."
          },
          "verifiedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "activeChallenge": {
            "nullable": true,
            "description": "The latest pending verification or domain proposal for this environment; null means none is pending. Its host may differ from the active host. Check purpose and expiresAt; a pending row alone does not establish trust.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationChallengeDto"
              }
            ]
          }
        },
        "required": [
          "environment",
          "host",
          "status",
          "trusted",
          "verifiedAt",
          "activeChallenge"
        ]
      },
      "DomainVerificationStatusDto": {
        "type": "object",
        "properties": {
          "sandboxEnabled": {
            "type": "boolean",
            "description": "Whether the tenant has an initialized Sandbox. False means the staging (Sandbox) slot is empty and cannot be configured until Sandbox is enabled; this flag does not prove hosting or payment readiness."
          },
          "production": {
            "$ref": "#/components/schemas/DomainEnvVerificationStatusDto"
          },
          "staging": {
            "description": "Sandbox storefront status. The legacy staging wire name identifies tenant Sandbox data, independently of deployment. Empty and untrusted when sandboxEnabled is false.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainEnvVerificationStatusDto"
              }
            ]
          }
        },
        "required": [
          "sandboxEnabled",
          "production",
          "staging"
        ]
      },
      "DisconnectDomainDto": {
        "type": "object",
        "properties": {
          "expectedHost": {
            "type": "string",
            "nullable": true,
            "maxLength": 2048,
            "description": "Exact host from the selected status slot, or null if already disconnected. A changed host returns 409 without clearing the newer configuration."
          }
        },
        "required": [
          "expectedHost"
        ]
      },
      "ProposeDomainDto": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "description": "Public bare DNS hostname to verify, without scheme, port, path, or wildcard. Up to 229 characters, leaving room for the DNS verification prefix. The active storefront domain remains unchanged until ownership is proven.",
            "example": "shop.example.com",
            "maxLength": 229
          }
        },
        "required": [
          "host"
        ]
      },
      "DomainVerificationResultDto": {
        "type": "object",
        "properties": {
          "environment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationEnvironment"
              }
            ]
          },
          "host": {
            "type": "string"
          },
          "verified": {
            "type": "boolean",
            "description": "True only when ownership was just proven."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DomainVerificationStatus"
              }
            ]
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "challenge": {
            "$ref": "#/components/schemas/DomainVerificationChallengeDto"
          }
        },
        "required": [
          "environment",
          "host",
          "verified",
          "status",
          "message",
          "challenge"
        ]
      },
      "DomainProposalChallengeDto": {
        "type": "object",
        "properties": {
          "challengeId": {
            "type": "string",
            "description": "Exact active proposal challenge id from the status or proposal response."
          }
        },
        "required": [
          "challengeId"
        ]
      },
      "SendingDomainDnsRecordDto": {
        "type": "object",
        "properties": {
          "purpose": {
            "type": "string",
            "enum": [
              "SPF",
              "DKIM"
            ],
            "description": "What the record authenticates. Only records needed to authenticate **sending** are returned. Note that one of them may legitimately be an MX record: the SPF entry is published as MX in some regions, and it is required. What is never returned is the inbound `Receiving` MX record — publishing that would redirect the domain’s incoming mail to the email provider — nor tracking records, which this integration disables."
          },
          "type": {
            "type": "string",
            "description": "DNS record type, e.g. `TXT`, `CNAME`, `MX`."
          },
          "name": {
            "type": "string",
            "description": "Record name/host to create in the DNS zone."
          },
          "value": {
            "type": "string",
            "description": "Record value."
          },
          "ttl": {
            "type": "string",
            "description": "Suggested TTL, as reported by the provider."
          },
          "priority": {
            "type": "number",
            "nullable": true,
            "description": "MX priority when the record type needs one, otherwise null."
          },
          "status": {
            "type": "string",
            "description": "The provider's per-record verification state, passed through verbatim so the merchant can see which single record is still missing."
          }
        },
        "required": [
          "purpose",
          "type",
          "name",
          "value",
          "ttl",
          "priority",
          "status"
        ]
      },
      "EmailSendingDomainDto": {
        "type": "object",
        "properties": {
          "configured": {
            "type": "boolean",
            "description": "Whether this organization has a sending domain configured at all. When false there is no provider-bound local domain row; pending intent and lifecycle fields may still describe unresolved configuration or removal. A missing row does not prove provider removal or ownership release; REMOVING and NEEDS_ATTENTION remain incomplete. New mail continues to use the platform default sender."
          },
          "removalRequired": {
            "type": "boolean",
            "description": "True when the local domain row is absent but original provider ownership is still retained and removal has not started. Configure remains blocked. Explicit removal can be requested after any active operation is reconciled, subject to permission and runtime availability. This does not prove provider presence or absence. False also covers removal already in progress; consult lifecycleState for completion."
          },
          "domain": {
            "type": "string",
            "nullable": true
          },
          "fromEmail": {
            "type": "string",
            "nullable": true,
            "description": "The sender address this domain would use (`fromLocalPart@domain`). A candidate, not a guarantee that admission succeeds or that an existing delivery uses it — see `activeSender` for the current sender-policy selection for new tenant-authored production deliveries."
          },
          "pendingDomain": {
            "type": "string",
            "nullable": true,
            "description": "Normalized domain from an unresolved CONFIGURE intent when no provider-bound local domain exists yet."
          },
          "pendingFromEmail": {
            "type": "string",
            "nullable": true,
            "description": "Candidate sender address for an unresolved CONFIGURE intent. It is never an active sender."
          },
          "status": {
            "type": "string",
            "enum": [
              "NOT_STARTED",
              "PENDING",
              "TEMPORARY_FAILURE",
              "VERIFIED",
              "PARTIALLY_VERIFIED",
              "FAILED",
              "PARTIALLY_FAILED"
            ],
            "nullable": true
          },
          "verifiedForSending": {
            "type": "boolean",
            "description": "Whether the domain has a stable, completed provider-bound lifecycle operation whose status is VERIFIED. Legacy, pending, removing, failed, resolved, and attention states are ineligible even when a stale provider snapshot says VERIFIED. This reports eligibility; the closed-default sender-resolution switch separately controls whether sender policy selects this candidate or the platform sender for new tenant-authored deliveries."
          },
          "dnsRecords": {
            "description": "DNS records the merchant must publish for this domain.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SendingDomainDnsRecordDto"
            }
          },
          "lastCheckedAt": {
            "type": "string",
            "nullable": true,
            "description": "When verification was last ATTEMPTED, whatever the outcome. Distinct from `verifiedAt`."
          },
          "verifiedAt": {
            "type": "string",
            "nullable": true
          },
          "activeSender": {
            "type": "string",
            "description": "The address sender-selection policy chooses for a new tenant-authored production delivery after its independent delivery-admission checks succeed. This field does not assert canonical-key-pin or delivery-store health. Platform-authored notices always retain the platform sender. Always present: it is `fromEmail` only when sender resolution is enabled and the complete provider-bound VERIFIED predicate passes; otherwise it is the configured platform sender after surrounding-whitespace normalization. Automatic retries keep the sender already stored on their durable attempt, so an older in-flight delivery may intentionally retain a different address."
          },
          "lifecycleState": {
            "type": "string",
            "enum": [
              "UNCONFIGURED",
              "CONFIGURING",
              "LEGACY_PROVENANCE_MISSING",
              "PENDING_DNS",
              "VERIFYING",
              "VERIFIED",
              "REMOVING",
              "NEEDS_ATTENTION",
              "FAILED",
              "RESOLVED_NON_SENDABLE"
            ],
            "description": "Provider-neutral durable lifecycle. Legacy, pending, removing, failed, resolved, and attention states are never sender-eligible even when a stale provider snapshot says VERIFIED. REMOVING may have configured=false and a locally COMPLETED or attended RESOLVED REMOVE operation while global ownership release is still pending. NEEDS_ATTENTION may likewise describe removal without a materialized row; neither state means deletion completed."
          },
          "operationKind": {
            "type": "string",
            "enum": [
              "CONFIGURE",
              "REFRESH",
              "REMOVE"
            ],
            "nullable": true
          },
          "operationState": {
            "type": "string",
            "enum": [
              "QUEUED",
              "PROCESSING",
              "RETRY_SCHEDULED",
              "NEEDS_ATTENTION",
              "FAILED",
              "RESOLVED",
              "COMPLETED"
            ],
            "nullable": true
          },
          "attentionCode": {
            "type": "string",
            "enum": [
              "CREATE_OUTCOME_UNKNOWN",
              "UNBOUND_PROVIDER_OBJECT",
              "PROVIDER_UNAVAILABLE",
              "PROVIDER_RATE_LIMITED",
              "PROVIDER_REJECTED",
              "PROVIDER_CONFIGURATION_INVALID",
              "PROVIDER_DISPATCH_DEADLINE_EXPIRED",
              "PROVIDER_ACCOUNT_SCOPE_MISMATCH",
              "LEGACY_PROVENANCE_MISSING",
              "PROVIDER_RESPONSE_INVALID",
              "VERIFICATION_TIMEOUT",
              "RETRY_BUDGET_EXHAUSTED",
              "KNOWN_ID_ROLLBACK_FAILED",
              "KNOWN_ID_ROLLED_BACK",
              "LOCAL_PROJECTION_CONFLICT",
              "LOCAL_PROJECTION_UNAVAILABLE",
              "PROVIDER_ABSENCE_CONFIRMED"
            ],
            "nullable": true,
            "description": "Fixed, secret-free reconciliation reason for failed/attention/resolved states. Raw provider errors are never returned."
          },
          "retryAt": {
            "type": "string",
            "nullable": true
          },
          "reconciliationRequired": {
            "type": "boolean",
            "description": "True when ownership or lifecycle reconciliation must finish before sender eligibility. When removalRequired is true, an authorized merchant may request removal after the active operation finishes; other attention states require operator reconciliation."
          }
        },
        "required": [
          "configured",
          "removalRequired",
          "domain",
          "fromEmail",
          "pendingDomain",
          "pendingFromEmail",
          "status",
          "verifiedForSending",
          "dnsRecords",
          "lastCheckedAt",
          "verifiedAt",
          "activeSender",
          "lifecycleState",
          "operationKind",
          "operationState",
          "attentionCode",
          "retryAt",
          "reconciliationRequired"
        ]
      },
      "ConfigureEmailSendingDomainDto": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "maxLength": 253,
            "example": "mail.acme-supply.com",
            "description": "Bare domain to send from — no scheme, port, path, or address. Stored lowercased. A domain already claimed by another tenant, the platform sending domain (or a subdomain of it), and consumer mailbox providers are all rejected."
          },
          "fromLocalPart": {
            "type": "string",
            "maxLength": 64,
            "default": "noreply",
            "example": "orders",
            "description": "Local part of the sender address. The domain half is always the verified domain above and cannot be set independently. Defaults to `noreply`."
          }
        },
        "required": [
          "domain"
        ]
      },
      "ApiKeyResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Operator-facing label for the key."
          },
          "publicKey": {
            "type": "string",
            "description": "Non-secret public identifier (`lck_…`). Safe to display."
          },
          "scopes": {
            "description": "Granted scope strings.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Last use, or `null` if never used."
          },
          "revokedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Revocation time, or `null` if active."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Expiry time, or `null` if the key never expires (no default TTL). A past `expiresAt` authenticates identically to a revoked key."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "publicKey",
          "scopes",
          "lastUsedAt",
          "revokedAt",
          "expiresAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "CreateApiKeyDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Human-readable label for the operator. Shown in admin.",
            "minLength": 1,
            "maxLength": 100
          },
          "scopes": {
            "description": "Scope strings from the supported vocabulary (e.g. `storefront:read`). Lowercase ASCII with optional colon-separated namespacing. Unknown scopes are rejected at mint (400). `import:*` write scopes are operator-granted only and rejected from this self-serve surface (403).",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name"
        ]
      },
      "ApiKeyWithSecretDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Operator-facing label for the key."
          },
          "publicKey": {
            "type": "string",
            "description": "Non-secret public identifier (`lck_…`). Safe to display."
          },
          "scopes": {
            "description": "Granted scope strings.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Last use, or `null` if never used."
          },
          "revokedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Revocation time, or `null` if active."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Expiry time, or `null` if the key never expires (no default TTL). A past `expiresAt` authenticates identically to a revoked key."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "secret": {
            "type": "string",
            "description": "Plaintext API secret (`lck_…`). Returned ONCE on creation only — store it now; it is never retrievable again."
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "publicKey",
          "scopes",
          "lastUsedAt",
          "revokedAt",
          "expiresAt",
          "createdAt",
          "updatedAt",
          "secret"
        ]
      },
      "MerchantAuditLogDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Actor user id, or `null` for system actions."
          },
          "action": {
            "type": "string",
            "example": "order.status_changed",
            "description": "Dotted action key."
          },
          "targetType": {
            "type": "string",
            "example": "order"
          },
          "targetId": {
            "type": "string",
            "description": "The target's id: usually its UUID, which still names a row that no longer exists. Some targets use a documented logical key instead; `commerce_number_config` rows use the document kind (`ORDER`, `QUOTE`, `INVOICE`, `CONTRACT`), or `invalid-kind` for an attempt whose kind was absent or invalid.",
            "example": "3f1c9a52-6a0e-4c1f-9a43-5c2a1b8e7d10"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Action metadata (free-form JSON)."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "actorUserId",
          "action",
          "targetType",
          "targetId",
          "metadata",
          "createdAt"
        ]
      },
      "MerchantAuditLogPageDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantAuditLogDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor for the next page, or `null` at the end."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "ConnectionDetailsResponseDto": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "description": "ID of the organization resolved by the authenticated membership guard."
          },
          "organizationSlug": {
            "type": "string",
            "readOnly": true,
            "description": "Current persisted slug of the authenticated organization. Use this value as the x-organization-slug header on tenant-scoped API requests."
          },
          "environment": {
            "type": "string",
            "enum": [
              "preview",
              "production"
            ],
            "nullable": true,
            "readOnly": true,
            "description": "Serving API deployment environment, independent of tenant commerce mode. Preview includes valid local development runtimes. Null when the deployment and database runtime identity cannot be safely matched; hostedAccountUrl is also null."
          },
          "commerceEnvironment": {
            "type": "string",
            "enum": [
              "production",
              "sandbox"
            ],
            "readOnly": true,
            "description": "Selected tenant commerce mode, independent of the API deployment environment. This mode controls which isolated commerce records and storefront are used."
          },
          "hostedCheckoutUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true,
            "description": "Tenant-scoped cartonium checkout origin for the selected commerce mode and serving deployment. This is a base origin, not a checkout session URL. Null when runtime identity is mismatched or the tenant slug cannot form a hosted subdomain. Presence does not prove deployment reachability."
          },
          "hostedAccountUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true,
            "description": "Tenant-scoped hosted cartonium checkout /account URL for the serving environment, resolved using the configured hosted base domain. This is the hosted account entry point, not a storefront origin or the effective BYO customer-action URL. Null when runtime identity cannot be safely matched or the persisted slug cannot form a hosted subdomain. Presence does not prove deployment reachability."
          }
        },
        "required": [
          "organizationId",
          "organizationSlug",
          "environment",
          "commerceEnvironment",
          "hostedCheckoutUrl",
          "hostedAccountUrl"
        ]
      },
      "PosTipPresetDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "description": "Tenant-configured stable preset identifier. The sale submits this id, never its percentage."
          },
          "basisPoints": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "description": "Percentage in basis points; 1500 means 15%. Applied by the server to the pre-tax goods subtotal using shared rounding."
          }
        },
        "required": [
          "id",
          "basisPoints"
        ]
      },
      "PosTipPolicyDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Closed tenant policy format. Other versions are unsupported."
          },
          "presets": {
            "minItems": 3,
            "maxItems": 3,
            "description": "Exactly three tenant-owned presets, in display order, with distinct ids. There are no default rates.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosTipPresetDto"
            }
          },
          "customMaximumInCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Tenant-owned maximum custom tip in minor currency units. Zero is always permitted as a custom no-fee result; NONE is always available independently of configuration."
          }
        },
        "required": [
          "version",
          "presets",
          "customMaximumInCents"
        ]
      },
      "DeliveryEstimateSettingsDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "description",
              "structured"
            ],
            "description": "#1103 — `description` (default) keeps the free-text per-rate estimate; `structured` opts into computed ship-by / delivery-window dates from the rate transit window + the processing/cutoff settings below."
          },
          "displayStyle": {
            "type": "string",
            "enum": [
              "ship_by",
              "delivery_window",
              "both"
            ],
            "description": "How a structured estimate renders: `ship_by`, `delivery_window` (default), or `both`."
          },
          "processingDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60,
            "description": "Business days (Mon–Fri) of processing before an order ships. Default 0."
          },
          "cutoffTime": {
            "type": "string",
            "nullable": true,
            "description": "Local order cutoff `HH:mm` (24h, tenant timezone). Orders at/after it start processing the next day. Null/omitted = no cutoff."
          }
        }
      },
      "CheckoutLogoAssetDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "storagePath": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "Environment-matched public platform-media URL. A different immutable URL is minted for every replacement."
          },
          "mimeType": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/avif"
            ]
          },
          "bytes": {
            "type": "integer",
            "maximum": 5242880
          },
          "width": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096
          },
          "height": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "storagePath",
          "url",
          "mimeType",
          "bytes",
          "width",
          "height",
          "createdAt"
        ]
      },
      "CheckoutSettingsResponseDto": {
        "type": "object",
        "properties": {
          "posTips": {
            "nullable": true,
            "description": "POS card-present tip policy. Omitted means unchanged; null removes configuration so new sales can choose NONE only. A complete policy replaces all three presets and the custom bound atomically. Existing sale/replay evidence is never repriced. Configure through the tenant settings authority; sale clients cannot author these values.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosTipPolicyDto"
              }
            ]
          },
          "checkoutMode": {
            "type": "string",
            "enum": [
              "hosted_litecheckout",
              "byo",
              "hybrid"
            ],
            "description": "Tenant checkout posture. `hosted_litecheckout` uses the first-party hosted surface, `byo` expects the tenant frontend to consume the public APIs, and `hybrid` allows either route."
          },
          "phoneRequired": {
            "type": "boolean",
            "default": false,
            "description": "When true, ordinary cart checkout requires a non-blank customer phone at bind and hosted cartonium checkout renders the phone field as required. Subscription and booking checkout are excluded. Absent means not configured, which means not required."
          },
          "ga4MeasurementId": {
            "type": "string",
            "nullable": true,
            "maxLength": 15,
            "pattern": "^G-[A-Z0-9]{4,12}$",
            "description": "#4023 (DR-2265-02) — Google Analytics 4 web-stream measurement ID for hosted cartonium checkout: `G-` plus 4–12 letters/digits, trimmed and uppercased on write. Stored per environment, so a Preview value never reaches production hosts. Anyone with settings permission may store, change, or clear it, but it is projected on the public organization snapshot only while a disclosure attestation is recorded (`ga4DisclosureAttestedAt`), so an un-attested ID stays dark. Absent means unchanged; `null` clears the ID and its attestation, which is the kill switch: no tag renders. Changing an attested ID to a different value also clears the attestation, so the new ID stays dark until an Owner or Admin attests again. Stores using replacement settings also select a consent mode."
          },
          "ga4ConsentMode": {
            "type": "string",
            "enum": [
              "opt_in",
              "opt_out"
            ],
            "nullable": true,
            "description": "Replacement GA4 consent mode for this tenant environment. Omit to keep the saved mode. Null leaves it blank and is only valid without a measurement ID."
          },
          "ga4OptOutRegions": {
            "maxItems": 249,
            "description": "Assigned ISO 3166-1 alpha-2 countries and territories for opt-out mode. Omit to keep the saved list. An empty list requires opt-in everywhere. Opt-in mode stores an empty list.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ga4CheckOnReturn": {
            "type": "boolean",
            "description": "Allow a storefront consent check when a shopper returns to an eligible open tab. Defaults to false before configuration. Omit to keep the saved setting."
          },
          "logoUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "deprecated": true,
            "description": "Read-compatible legacy field. New values, replacements, and removal must use `/merchant/uploads/checkout-logo`; arbitrary external URLs are not renderable under hosted checkout CSP."
          },
          "brandColor": {
            "type": "string",
            "maxLength": 64,
            "nullable": true
          },
          "accentColor": {
            "type": "string",
            "maxLength": 7,
            "nullable": true,
            "description": "#1062 — hosted-checkout accent color as a hex string (`#rgb` or `#rrggbb`, normalized to lowercase `#rrggbb`). Drives the hosted surface `--color-accent` + Stripe Elements appearance. Blank/null falls back to the platform brand-purple default."
          },
          "supportEmail": {
            "type": "string",
            "maxLength": 254,
            "nullable": true
          },
          "supportPhone": {
            "type": "string",
            "maxLength": 50,
            "nullable": true
          },
          "checkoutHeadline": {
            "type": "string",
            "maxLength": 120,
            "nullable": true
          },
          "checkoutSubcopy": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "When true, hosted checkout shows a default-unchecked marketing opt-in checkbox; a ticked box subscribes the shopper to the tenant newsletter (double opt-in) on confirmation, separate from transactional email."
          },
          "marketingOptInCopy": {
            "type": "string",
            "maxLength": 300,
            "nullable": true
          },
          "returnToStoreUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional explicit return-to-store destination for hosted checkout and order-status CTAs. Honored only when trusted by the #1127 destination gate; otherwise the API falls back to the tenant storefront origin / neutral fallback."
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional explicit completion redirect after the server-read checkout session is CONFIRMED. Honored only when trusted by the #1127 destination gate; otherwise falls back to returnToStoreUrl, then the tenant storefront origin / neutral fallback."
          },
          "checkoutRetryUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional destination for retry/start-over checkout CTAs after a checkout cannot continue. Honored only when trusted by the #1127 destination gate; otherwise falls back to returnToStoreUrl, then the tenant storefront origin / neutral fallback."
          },
          "checkoutCancelUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional destination for canceled/expired checkout CTAs. Honored only when trusted by the #1127 destination gate; otherwise falls back to checkoutRetryUrl, returnToStoreUrl, then the tenant storefront origin / neutral fallback."
          },
          "customerActionBaseUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1117 — BYO customer-action base ORIGIN. For a tenant that hosts its OWN customer transaction/account surfaces instead of hosted cartonium checkout, this is the origin (scheme + host) that customer-action links are built onto in place of `<slug>.litecheckout.io`: magic-link sign-in (`/account/sign-in`), order status (`/order/<token>/status`), and the forward-looking my-account / payment-retry / returns / saved-card pages in the BYO action-path set. NOTE: the full BYO path map is not yet published — do not assume it matches the hosted cartonium checkout paths, which differ on several surfaces. Confirm the exact paths with support before implementing beyond the two named above. ORIGIN-ONLY: only the scheme + host are used and the platform appends the standard action path, so configure your customer-action root (a path is ignored). Honored ONLY when its host is the tenant's VERIFIED custom domain (#1126), the hosted cartonium checkout origin, or an operator-approved host (the #1127 destination-trust gate); otherwise links fall back to the hosted default — never a tokenized link to an unverified host. Distinct from `returnToStoreUrl` / `postCheckoutRedirectUrl` (#1116), which are post-checkout redirect DESTINATIONS, not a customer-action origin."
          },
          "postActionRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Trusted destination for the Continue to storefront link after server-verified newsletter confirmation; confirmation first shows the platform acknowledgement without an automatic redirect (#4078). Also the shared fallback destination for newsletter unsubscribe redirects (#566/#1115). Honored only for a verified custom domain, hosted cartonium checkout origin, or operator-approved host. Blank/untrusted falls back to the ADR-003 storefront origin. With no trusted confirmation destination, the acknowledgement has no Continue link; unsubscribe retains its neutral fallback page."
          },
          "newsletterUnsubscribeRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Optional trusted override (#566/#1115) for where a customer lands after a successful newsletter UNSUBSCRIBE, distinct from confirm. Falls back to postActionRedirectUrl, then the ADR-003 storefront origin, then the neutral fallback page."
          },
          "newsletterInactiveRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Optional trusted destination (#566/#1115) for a confirm link clicked AFTER the customer already unsubscribed (\"link no longer active\"). Resolved on its own chain — never a success page or storefront-origin fallback — so it can never imply the customer is subscribed. Blank/untrusted keeps the neutral API-hosted page or operator neutral fallback."
          },
          "termsUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "privacyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "returnPolicyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "shippingPolicyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "subscriptionPolicyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "taxMode": {
            "type": "string",
            "enum": [
              "stripe_tax",
              "manual_no_tax"
            ],
            "description": "`stripe_tax` means cartonium should use the configured Stripe Tax provider when available. `manual_no_tax` is an explicit tenant fallback where checkout/receipts must disclose that cartonium did not calculate tax."
          },
          "manualTaxResponsibilityAccepted": {
            "type": "boolean",
            "description": "Required to be true when `taxMode=manual_no_tax`; records that the merchant accepted responsibility for tax handling."
          },
          "deliveryEstimate": {
            "description": "#1103 — tenant delivery-estimate behavior (mode + display style + processing/cutoff). Combined with each rate transit window to render structured ship-by / delivery-window dates at checkout.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryEstimateSettingsDto"
              }
            ]
          },
          "ga4AvailableRegions": {
            "readOnly": true,
            "description": "Assigned ISO 3166-1 countries and territories for stores eligible to configure consent-driven GA4 in this environment.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ga4ReplacementAcknowledged": {
            "type": "boolean",
            "readOnly": true,
            "description": "Whether this store has switched to consent-driven GA4 in this environment. A saved draft or earlier hosted disclosure does not switch the store. Omitted when replacement settings are unavailable."
          },
          "logoAsset": {
            "description": "Server-owned upload-backed checkout logo metadata. Absent when no logo is configured, only a legacy external `logoUrl` remains, or the stored metadata is malformed, belongs to another tenant, or was copied from a different Preview/Production environment.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutLogoAssetDto"
              }
            ]
          },
          "ga4DisclosureAttestedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "readOnly": true,
            "description": "#4023 (DR-2265-04) — server-stamped ISO timestamp of the Owner/Admin disclosure attestation that activates `ga4MeasurementId` on public surfaces. Absent or `null` means no attestation is recorded, so no measurement ID is projected publicly even when one is stored. Read-only: PATCH rejects it; send `ga4DisclosureAttested: true` instead."
          },
          "ga4DisclosureAttestedByUserId": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "#4023 (DR-2265-04) — user id of the tenant Owner or Admin who recorded the disclosure attestation; `null` or absent when none is recorded. Read-only: stamped by the service together with `ga4DisclosureAttestedAt` and cleared with it."
          }
        }
      },
      "LiveRatePresentationDto": {
        "type": "object",
        "properties": {
          "strategy": {
            "type": "string",
            "enum": [
              "all",
              "cheapest_n",
              "cheapest_and_fastest"
            ],
            "description": "How quoted services are picked: `all` (default) offers every quoted service up to `maxOptions`; `cheapest_n` is the same math under the name the admin UI shows (\"cheapest N\" of the cheapest-first list); `cheapest_and_fastest` offers at most two options — the cheapest service plus the fastest (fewest transit days), collapsing to just the cheapest when they coincide or no transit data exists."
          },
          "serviceFilterMode": {
            "type": "string",
            "enum": [
              "exclude",
              "include"
            ],
            "description": "#1781 — which service list governs curation. `exclude` (default) is a blocklist: offer every quoted service EXCEPT `excludedServiceCodes` (fail-open). `include` is an allowlist: offer ONLY the services in `includedServiceCodes` (fail-closed) — an EMPTY allowlist offers no live services at all (flat rates only). Absent/`exclude` preserves the pre-#1781 behavior exactly."
          },
          "maxOptions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "description": "Most live options checkout may offer (integer 1..8). Default 8 — the pre-#1767 hard cap."
          },
          "excludedServiceCodes": {
            "maxItems": 50,
            "description": "ShipEngine service codes (e.g. `usps_media_mail`) checkout must never offer, matched case-insensitively. At most 50 entries, each a non-blank string of at most 100 characters; persisted trimmed and lowercased.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "includedServiceCodes": {
            "maxItems": 50,
            "description": "#1781 — ShipEngine service codes checkout may offer EXCLUSIVELY when `serviceFilterMode` is `include` (matched case-insensitively). Same shape/validation as `excludedServiceCodes`: at most 50 entries, each a non-blank string of at most 100 characters; persisted trimmed and lowercased. An empty list in `include` mode offers no live services (fail-closed). Ignored while `serviceFilterMode` is `exclude`.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DeliveryPromiseTierResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Server-owned stable tier id."
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 240
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "sortOrder"
        ]
      },
      "DeliveryPromisePresentationResponseDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "exact_services",
              "delivery_promises"
            ]
          },
          "tiers": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryPromiseTierResponseDto"
            }
          },
          "retiredTierIds": {
            "description": "Server-maintained stable-id tombstones. Retired ids cannot be reused.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "revision": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#2413 — catalog concurrency revision to echo as `expectedRevision` on save."
          }
        },
        "required": [
          "mode",
          "tiers",
          "retiredTierIds",
          "revision"
        ]
      },
      "ShipFromOriginResponseDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Contact / facility name printed on the shipping label.",
            "minLength": 1,
            "maxLength": 120
          },
          "phone": {
            "type": "string",
            "description": "Origin contact phone. Carriers require one on the ship-from address.",
            "minLength": 1,
            "maxLength": 40
          },
          "line1": {
            "type": "string",
            "description": "Street address line 1.",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "description": "Street address line 2 (suite, unit). Null/omitted = none.",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "description": "City / town.",
            "minLength": 1,
            "maxLength": 120
          },
          "state": {
            "type": "string",
            "description": "State / province / region — ISO 3166-2 subdivision code when possible (e.g. `ID`).",
            "minLength": 1,
            "maxLength": 120
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP / postal code.",
            "minLength": 1,
            "maxLength": 20
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code (e.g. `US`).",
            "minLength": 2,
            "maxLength": 2,
            "example": "US"
          }
        },
        "required": [
          "name",
          "phone",
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "ShippingSettingsResponseDto": {
        "type": "object",
        "properties": {
          "liveRatePresentation": {
            "nullable": true,
            "description": "#1767 — merchant policy for how live carrier quotes are presented at checkout (strategy, option cap, and #1781 service-filter mode with its exclude/include service lists). Persisted normalized; set to `null` to reset to the defaults (`all`, 8, `exclude` mode, no service lists).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/LiveRatePresentationDto"
              }
            ]
          },
          "deliveryPromisePresentation": {
            "description": "#2000/#2413 — normalized presentation mode, server-owned global tier catalog, retirement tombstones, and optimistic-concurrency revision.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPromisePresentationResponseDto"
              }
            ]
          },
          "shipFromOrigin": {
            "nullable": true,
            "description": "Saved origin address used for live rate quotes. Absent until configured; `null` means the origin was cleared.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShipFromOriginResponseDto"
              }
            ]
          }
        }
      },
      "OrganizationSettingsResponseDto": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "description": "Organization id this settings row belongs to."
          },
          "timezone": {
            "type": "string",
            "description": "Active organization IANA timezone used by tenant-local settings such as delivery cutoff.",
            "example": "America/Boise"
          },
          "businessProfile": {
            "type": "object",
            "additionalProperties": true
          },
          "checkoutSettings": {
            "$ref": "#/components/schemas/CheckoutSettingsResponseDto"
          },
          "apiSettings": {
            "type": "object",
            "additionalProperties": true
          },
          "notifications": {
            "type": "object",
            "additionalProperties": true
          },
          "shippingSettings": {
            "$ref": "#/components/schemas/ShippingSettingsResponseDto"
          },
          "reserveDuringCheckout": {
            "type": "boolean"
          },
          "checkoutReservationMinutes": {
            "type": "number",
            "nullable": true
          },
          "subscriptionPastDueGraceHours": {
            "type": "number",
            "nullable": true,
            "description": "#631 — PAST_DUE entitlement grace window in hours; null = no grace."
          },
          "subscriptionPauseBehavior": {
            "type": "string",
            "enum": [
              "PAUSE_IMMEDIATELY",
              "CONTINUE_UNTIL_PERIOD_END",
              "FREEZE_ALLOWANCES"
            ],
            "nullable": true,
            "description": "#631 — PAUSED entitlement behavior; null = not chosen (projection fail-closes to PAUSE_IMMEDIATELY)."
          },
          "subscriptionAllowanceRollover": {
            "type": "string",
            "enum": [
              "NONE",
              "CARRY_UNUSED"
            ],
            "nullable": true,
            "description": "#631 — ALLOWANCE/SERVICE_CREDIT rollover policy; null = not chosen (balance-type plans cannot publish until set)."
          },
          "subscriptionRecoveryTerminalAction": {
            "type": "string",
            "enum": [
              "UNPAID",
              "CANCEL",
              "SUSPEND",
              "MANUAL_RECOVERY"
            ],
            "nullable": true,
            "description": "#2411 — exhausted-recovery terminal action; null is stored as unconfigured and the terminal-policy selector fail-closes to UNPAID."
          },
          "subscriptionTerminalEntitlementBehavior": {
            "type": "string",
            "enum": [
              "LAPSE_IMMEDIATELY",
              "FREEZE_BALANCES"
            ],
            "nullable": true,
            "description": "#2411 / DR-2411-09 — terminal entitlement behavior; null means the tenant has not selected lapse or frozen balances."
          },
          "subscriptionTerminalSelfServeRecovery": {
            "type": "boolean",
            "default": false,
            "description": "#2411 / DR-2411-10 — whether an eligible terminal cycle permits customer self-service recovery."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "organizationId",
          "timezone",
          "businessProfile",
          "checkoutSettings",
          "apiSettings",
          "notifications",
          "shippingSettings",
          "reserveDuringCheckout",
          "checkoutReservationMinutes",
          "subscriptionPastDueGraceHours",
          "subscriptionPauseBehavior",
          "subscriptionAllowanceRollover",
          "subscriptionRecoveryTerminalAction",
          "subscriptionTerminalEntitlementBehavior",
          "subscriptionTerminalSelfServeRecovery",
          "createdAt",
          "updatedAt"
        ]
      },
      "CheckoutSettingsDto": {
        "type": "object",
        "properties": {
          "posTips": {
            "nullable": true,
            "description": "POS card-present tip policy. Omitted means unchanged; null removes configuration so new sales can choose NONE only. A complete policy replaces all three presets and the custom bound atomically. Existing sale/replay evidence is never repriced. Configure through the tenant settings authority; sale clients cannot author these values.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosTipPolicyDto"
              }
            ]
          },
          "checkoutMode": {
            "type": "string",
            "enum": [
              "hosted_litecheckout",
              "byo",
              "hybrid"
            ],
            "description": "Tenant checkout posture. `hosted_litecheckout` uses the first-party hosted surface, `byo` expects the tenant frontend to consume the public APIs, and `hybrid` allows either route."
          },
          "phoneRequired": {
            "type": "boolean",
            "default": false,
            "description": "When true, ordinary cart checkout requires a non-blank customer phone at bind and hosted cartonium checkout renders the phone field as required. Subscription and booking checkout are excluded. Absent means not configured, which means not required."
          },
          "ga4MeasurementId": {
            "type": "string",
            "nullable": true,
            "maxLength": 15,
            "pattern": "^G-[A-Z0-9]{4,12}$",
            "description": "#4023 (DR-2265-02) — Google Analytics 4 web-stream measurement ID for hosted cartonium checkout: `G-` plus 4–12 letters/digits, trimmed and uppercased on write. Stored per environment, so a Preview value never reaches production hosts. Anyone with settings permission may store, change, or clear it, but it is projected on the public organization snapshot only while a disclosure attestation is recorded (`ga4DisclosureAttestedAt`), so an un-attested ID stays dark. Absent means unchanged; `null` clears the ID and its attestation, which is the kill switch: no tag renders. Changing an attested ID to a different value also clears the attestation, so the new ID stays dark until an Owner or Admin attests again. Stores using replacement settings also select a consent mode."
          },
          "ga4ConsentMode": {
            "type": "string",
            "enum": [
              "opt_in",
              "opt_out"
            ],
            "nullable": true,
            "description": "Replacement GA4 consent mode for this tenant environment. Omit to keep the saved mode. Null leaves it blank and is only valid without a measurement ID."
          },
          "ga4OptOutRegions": {
            "maxItems": 249,
            "description": "Assigned ISO 3166-1 alpha-2 countries and territories for opt-out mode. Omit to keep the saved list. An empty list requires opt-in everywhere. Opt-in mode stores an empty list.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ga4CheckOnReturn": {
            "type": "boolean",
            "description": "Allow a storefront consent check when a shopper returns to an eligible open tab. Defaults to false before configuration. Omit to keep the saved setting."
          },
          "ga4DisclosureAttested": {
            "type": "boolean",
            "writeOnly": true,
            "description": "Write-only Owner/Admin acknowledgement. For the shipped hosted setup, true attests the saved or supplied measurement ID without adopting the replacement. To acknowledge the replacement, save the ID, consent mode and any opt-out regions together in a standalone settings save with atomic adoption evidence. Persistent staging supports first enrollment with a configured tenant database connection. An unavailable connection returns 503 CHECKOUT_ANALYTICS_ADOPTION_UNAVAILABLE. First enrollment elsewhere follows hosted qualification. A missing ID or required mode is invalid (400). An unauthorized role is refused (403). False or omission preserves an existing acknowledgement. Changing its covered settings or clearing the ID invalidates it. Only JSON booleans are accepted."
          },
          "logoUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "deprecated": true,
            "description": "Read-compatible legacy field. New values, replacements, and removal must use `/merchant/uploads/checkout-logo`; arbitrary external URLs are not renderable under hosted checkout CSP."
          },
          "brandColor": {
            "type": "string",
            "maxLength": 64,
            "nullable": true
          },
          "accentColor": {
            "type": "string",
            "maxLength": 7,
            "nullable": true,
            "description": "#1062 — hosted-checkout accent color as a hex string (`#rgb` or `#rrggbb`, normalized to lowercase `#rrggbb`). Drives the hosted surface `--color-accent` + Stripe Elements appearance. Blank/null falls back to the platform brand-purple default."
          },
          "supportEmail": {
            "type": "string",
            "maxLength": 254,
            "nullable": true
          },
          "supportPhone": {
            "type": "string",
            "maxLength": 50,
            "nullable": true
          },
          "checkoutHeadline": {
            "type": "string",
            "maxLength": 120,
            "nullable": true
          },
          "checkoutSubcopy": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "marketingOptInEnabled": {
            "type": "boolean",
            "description": "When true, hosted checkout shows a default-unchecked marketing opt-in checkbox; a ticked box subscribes the shopper to the tenant newsletter (double opt-in) on confirmation, separate from transactional email."
          },
          "marketingOptInCopy": {
            "type": "string",
            "maxLength": 300,
            "nullable": true
          },
          "returnToStoreUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional explicit return-to-store destination for hosted checkout and order-status CTAs. Honored only when trusted by the #1127 destination gate; otherwise the API falls back to the tenant storefront origin / neutral fallback."
          },
          "postCheckoutRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional explicit completion redirect after the server-read checkout session is CONFIRMED. Honored only when trusted by the #1127 destination gate; otherwise falls back to returnToStoreUrl, then the tenant storefront origin / neutral fallback."
          },
          "checkoutRetryUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional destination for retry/start-over checkout CTAs after a checkout cannot continue. Honored only when trusted by the #1127 destination gate; otherwise falls back to returnToStoreUrl, then the tenant storefront origin / neutral fallback."
          },
          "checkoutCancelUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1116 — optional destination for canceled/expired checkout CTAs. Honored only when trusted by the #1127 destination gate; otherwise falls back to checkoutRetryUrl, returnToStoreUrl, then the tenant storefront origin / neutral fallback."
          },
          "customerActionBaseUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "#1117 — BYO customer-action base ORIGIN. For a tenant that hosts its OWN customer transaction/account surfaces instead of hosted cartonium checkout, this is the origin (scheme + host) that customer-action links are built onto in place of `<slug>.litecheckout.io`: magic-link sign-in (`/account/sign-in`), order status (`/order/<token>/status`), and the forward-looking my-account / payment-retry / returns / saved-card pages in the BYO action-path set. NOTE: the full BYO path map is not yet published — do not assume it matches the hosted cartonium checkout paths, which differ on several surfaces. Confirm the exact paths with support before implementing beyond the two named above. ORIGIN-ONLY: only the scheme + host are used and the platform appends the standard action path, so configure your customer-action root (a path is ignored). Honored ONLY when its host is the tenant's VERIFIED custom domain (#1126), the hosted cartonium checkout origin, or an operator-approved host (the #1127 destination-trust gate); otherwise links fall back to the hosted default — never a tokenized link to an unverified host. Distinct from `returnToStoreUrl` / `postCheckoutRedirectUrl` (#1116), which are post-checkout redirect DESTINATIONS, not a customer-action origin."
          },
          "postActionRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Trusted destination for the Continue to storefront link after server-verified newsletter confirmation; confirmation first shows the platform acknowledgement without an automatic redirect (#4078). Also the shared fallback destination for newsletter unsubscribe redirects (#566/#1115). Honored only for a verified custom domain, hosted cartonium checkout origin, or operator-approved host. Blank/untrusted falls back to the ADR-003 storefront origin. With no trusted confirmation destination, the acknowledgement has no Continue link; unsubscribe retains its neutral fallback page."
          },
          "newsletterUnsubscribeRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Optional trusted override (#566/#1115) for where a customer lands after a successful newsletter UNSUBSCRIBE, distinct from confirm. Falls back to postActionRedirectUrl, then the ADR-003 storefront origin, then the neutral fallback page."
          },
          "newsletterInactiveRedirectUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Optional trusted destination (#566/#1115) for a confirm link clicked AFTER the customer already unsubscribed (\"link no longer active\"). Resolved on its own chain — never a success page or storefront-origin fallback — so it can never imply the customer is subscribed. Blank/untrusted keeps the neutral API-hosted page or operator neutral fallback."
          },
          "termsUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "privacyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "returnPolicyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "shippingPolicyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "subscriptionPolicyUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true
          },
          "taxMode": {
            "type": "string",
            "enum": [
              "stripe_tax",
              "manual_no_tax"
            ],
            "description": "`stripe_tax` means cartonium should use the configured Stripe Tax provider when available. `manual_no_tax` is an explicit tenant fallback where checkout/receipts must disclose that cartonium did not calculate tax."
          },
          "manualTaxResponsibilityAccepted": {
            "type": "boolean",
            "description": "Required to be true when `taxMode=manual_no_tax`; records that the merchant accepted responsibility for tax handling."
          },
          "deliveryEstimate": {
            "description": "#1103 — tenant delivery-estimate behavior (mode + display style + processing/cutoff). Combined with each rate transit window to render structured ship-by / delivery-window dates at checkout.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryEstimateSettingsDto"
              }
            ]
          }
        }
      },
      "ShipFromOriginDto": {
        "type": "object",
        "properties": {
          "canadianAddressVersion": {
            "type": "integer",
            "enum": [
              1
            ],
            "writeOnly": true,
            "description": "Opt in to Canadian merchant ship-from setup v1. Requires country CA, a two-letter Canadian subdivision in state, and a Canadian postal code. The API stores canonical values and omits this write marker from the saved origin. Quebec and Nunavut are excluded from this setup. Omit for the existing origin contract."
          },
          "name": {
            "type": "string",
            "description": "Contact / facility name printed on the shipping label.",
            "minLength": 1,
            "maxLength": 120
          },
          "phone": {
            "type": "string",
            "description": "Origin contact phone. Carriers require one on the ship-from address.",
            "minLength": 1,
            "maxLength": 40
          },
          "line1": {
            "type": "string",
            "description": "Street address line 1.",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "description": "Street address line 2 (suite, unit). Null/omitted = none.",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "description": "City / town.",
            "minLength": 1,
            "maxLength": 120
          },
          "state": {
            "type": "string",
            "description": "State / province / region — ISO 3166-2 subdivision code when possible (e.g. `ID`).",
            "minLength": 1,
            "maxLength": 120
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP / postal code.",
            "minLength": 1,
            "maxLength": 20
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code (e.g. `US`).",
            "minLength": 2,
            "maxLength": 2,
            "example": "US"
          }
        },
        "required": [
          "name",
          "phone",
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "DeliveryPromiseTierDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "#2000 — durable promise-tier id. Omit this field when creating a tier; the server allocates the id. Existing tiers must echo their returned id, which cannot be changed or reused after retirement."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "Customer-facing promise label, such as `Standard` or `Express`."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 240,
            "description": "Optional customer-facing explanation. Null removes the description."
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Customer display order, ascending."
          }
        },
        "required": [
          "name",
          "sortOrder"
        ]
      },
      "DeliveryPromisePresentationDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "exact_services",
              "delivery_promises"
            ],
            "description": "`exact_services` is the backward-compatible default. `delivery_promises` opts checkout into enforceable generic promise tiers."
          },
          "tiers": {
            "maxItems": 20,
            "description": "Organization-global customer promise tiers. Zone rules decide where each tier is enabled and which provider services may anchor it.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryPromiseTierDto"
            }
          },
          "expectedRevision": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "#2413 — optimistic concurrency fence for this promise catalog only. Echo the `revision` returned by GET, or null when the catalog has never been saved. A stale value is rejected with HTTP 409."
          }
        },
        "required": [
          "mode",
          "tiers",
          "expectedRevision"
        ]
      },
      "ShippingSettingsDto": {
        "type": "object",
        "properties": {
          "shipFromOrigin": {
            "nullable": true,
            "description": "#1564 — the origin address live rate quotes ship from. All fields but `line2` are required when the object is present; set to `null` to clear the configured origin.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShipFromOriginDto"
              }
            ]
          },
          "liveRatePresentation": {
            "nullable": true,
            "description": "#1767 — merchant policy for how live carrier quotes are presented at checkout (strategy, option cap, and #1781 service-filter mode with its exclude/include service lists). Persisted normalized; set to `null` to reset to the defaults (`all`, 8, `exclude` mode, no service lists).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/LiveRatePresentationDto"
              }
            ]
          },
          "deliveryPromisePresentation": {
            "description": "#2000 / ADR-023 — checkout presentation mode plus the global promise tier catalog. The API stamps revision/tombstone evidence internally; zone eligibility stays on each shipping zone. Null is not a reset because it cannot carry the required optimistic-concurrency revision; reset with `exact_services`, the current `expectedRevision`, and an empty tier list.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPromisePresentationDto"
              }
            ]
          }
        }
      },
      "UpdateSettingsDto": {
        "type": "object",
        "properties": {
          "businessProfile": {
            "type": "object",
            "additionalProperties": true,
            "description": "Business profile keys (company name, support email/phone, legal address, etc.). Shallow-merged into the existing column value: unmentioned keys are preserved, mentioned keys overwrite, and explicit `null` clears the value."
          },
          "checkoutSettings": {
            "description": "Checkout configuration. Shallow-merged into the existing column value: unmentioned keys are preserved, mentioned keys overwrite, and explicit `null` clears nullable values.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CheckoutSettingsDto"
              }
            ]
          },
          "reserveDuringCheckout": {
            "type": "boolean",
            "description": "Mode-B inventory reservation seam from #605. false = reserve at confirmation, true = reserve during checkout."
          },
          "checkoutReservationMinutes": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 5,
            "maximum": 1440,
            "description": "Optional Mode-B hold duration in minutes. Null uses the checkout default; ignored when reserveDuringCheckout is false."
          },
          "subscriptionPastDueGraceHours": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "minimum": 1,
            "maximum": 8760,
            "description": "#631 (M5-8) — PAST_DUE entitlement grace window in hours. Explicit null UNSETS the knob: past-due grants then lapse immediately (fail-closed; Batch-5 item 11 forbids an implicit default)."
          },
          "subscriptionPauseBehavior": {
            "type": "string",
            "enum": [
              "PAUSE_IMMEDIATELY",
              "CONTINUE_UNTIL_PERIOD_END",
              "FREEZE_ALLOWANCES"
            ],
            "nullable": true,
            "description": "#631 (M5-8) — what PAUSED does to entitlements. Explicit null UNSETS the choice; the projection then fail-closes to PAUSE_IMMEDIATELY."
          },
          "subscriptionAllowanceRollover": {
            "type": "string",
            "enum": [
              "NONE",
              "CARRY_UNUSED"
            ],
            "nullable": true,
            "description": "#631 (M5-8) — REQUIRED rollover policy for ALLOWANCE / SERVICE_CREDIT entitlements (no implicit default). Explicit null unsets it, but is rejected while ACTIVE plans carry balance-type rules — the publish-gate invariant, applied at the settings edge."
          },
          "subscriptionRecoveryTerminalAction": {
            "type": "string",
            "enum": [
              "UNPAID",
              "CANCEL",
              "SUSPEND",
              "MANUAL_RECOVERY"
            ],
            "nullable": true,
            "description": "#2411 (M5-9 Slice C) — organization-level action selected after subscription payment recovery is exhausted. Explicit null unsets the choice; the terminal-policy selector then fail-closes to UNPAID."
          },
          "subscriptionTerminalEntitlementBehavior": {
            "type": "string",
            "enum": [
              "LAPSE_IMMEDIATELY",
              "FREEZE_BALANCES"
            ],
            "nullable": true,
            "description": "#2411 / DR-2411-09 — entitlement treatment at terminal recovery. Explicit null unsets the tenant choice; FREEZE_BALANCES preserves value for later revival without allowing unpaid use."
          },
          "subscriptionTerminalSelfServeRecovery": {
            "type": "boolean",
            "default": false,
            "description": "#2411 / DR-2411-10 — allow customer self-service recovery from an eligible terminal cycle. Defaults false; merchant recovery is governed by its separate policy/workbench path."
          },
          "apiSettings": {
            "type": "object",
            "additionalProperties": true,
            "description": "API surface preferences (rate-limit policy, webhook defaults, CORS allow-list, etc.). Shallow-merge semantics."
          },
          "notifications": {
            "type": "object",
            "additionalProperties": true,
            "description": "Notification preferences (email/SMS opt-ins, digest cadence, incident routing, etc.). Shallow-merge semantics."
          },
          "shippingSettings": {
            "description": "#1564 — shipping configuration (ship-from origin). Shallow-merged into the existing column value: unmentioned keys are preserved, mentioned keys overwrite, and explicit `null` clears nullable values.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ShippingSettingsDto"
              }
            ]
          }
        }
      },
      "TaxReadinessDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "tenant_setup_required",
              "platform_unavailable",
              "read_unavailable"
            ],
            "description": "Fresh connected-account readiness for the authenticated tenant. Ready means the connected provider is loaded, payment account is verified and Stripe Tax settings are active; it does not certify registrations, nexus, product classification, filing, or the tax amount of a future checkout. read_unavailable means the check failed, never that setup is complete. Independent of the stored tax-mode selection."
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test",
              "unknown"
            ],
            "description": "API Stripe mode. test includes test mode and isolated sandboxes and does not prove live readiness. unknown means mode could not be established; no credential or account identifier is exposed."
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time this readiness check completed. Advisory only; checkout rechecks before committing."
          }
        },
        "required": [
          "status",
          "mode",
          "checkedAt"
        ]
      },
      "SignUploadUrlDto": {
        "type": "object",
        "properties": {
          "ownerType": {
            "type": "string",
            "enum": [
              "item",
              "collection"
            ],
            "description": "Polymorphic owner type. The service looks up the row by `ownerId` in the matching table and enforces tenant ownership before minting the signed URL."
          },
          "ownerId": {
            "type": "string",
            "description": "UUID of the owning Item or Collection. The service checks tenant ownership and existence.",
            "format": "uuid"
          },
          "filename": {
            "type": "string",
            "description": "Original client filename. Only the extension is honored; the server mints a fresh uuid for the storage path so two clients uploading `cover.jpg` never collide.",
            "minLength": 1,
            "maxLength": 255
          },
          "mimeType": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/avif"
            ],
            "description": "Allow-list-restricted MIME type. The Supabase Storage bucket enforces the same list on its end; a payload that slipped past this DTO would fail at upload time."
          },
          "bytes": {
            "type": "number",
            "description": "File size in bytes. Capped server-side against MAX_IMAGE_BYTES (env-tunable, default 15 MB). Reject early so the merchant doesn't upload a 200 MB blob just to be told no.",
            "minimum": 1
          }
        },
        "required": [
          "ownerType",
          "ownerId",
          "filename",
          "mimeType",
          "bytes"
        ]
      },
      "SignedUploadResultDto": {
        "type": "object",
        "properties": {
          "imageId": {
            "type": "string",
            "format": "uuid",
            "description": "Pre-allocated image id to reference after upload."
          },
          "uploadUrl": {
            "type": "string",
            "description": "Time-limited signed Supabase upload URL (expires per `expiresAt`)."
          },
          "token": {
            "type": "string",
            "description": "Single-use token; pass with `storagePath` to `uploadToSignedUrl`."
          },
          "bucket": {
            "type": "string",
            "description": "Supabase storage bucket name."
          },
          "publicUrl": {
            "type": "string",
            "description": "Eventual public URL once the upload completes."
          },
          "storagePath": {
            "type": "string",
            "description": "Bucket-relative object path."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Signed-URL expiry (ISO, ~2h from mint)."
          }
        },
        "required": [
          "imageId",
          "uploadUrl",
          "token",
          "bucket",
          "publicUrl",
          "storagePath",
          "expiresAt"
        ]
      },
      "SignCheckoutLogoUploadDto": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Original client filename. The basename and extension are not trusted for the storage path; the server derives the extension from the allow-listed MIME type and mints a fresh UUID."
          },
          "mimeType": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/avif"
            ],
            "description": "Static raster MIME type accepted for checkout logos. SVG and animated/multi-page content are not supported."
          },
          "bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5242880,
            "description": "Client-reported file size in bytes, capped at 5 MiB."
          }
        },
        "required": [
          "filename",
          "mimeType",
          "bytes"
        ]
      },
      "ConfirmCheckoutLogoUploadDto": {
        "type": "object",
        "properties": {
          "imageId": {
            "type": "string",
            "format": "uuid",
            "description": "Id minted by the signed-upload endpoint."
          },
          "storagePath": {
            "type": "string",
            "maxLength": 500,
            "description": "Bucket-relative path minted by the signed-upload endpoint. The API requires the matching durable tenant-owned mint intent before attach."
          }
        },
        "required": [
          "imageId",
          "storagePath"
        ]
      },
      "CheckoutLogoRemovalResultDto": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "boolean",
            "description": "True when an upload-backed asset or retained legacy URL was cleared; false when the tenant already had neither."
          }
        },
        "required": [
          "removed"
        ]
      },
      "EmailSuppressionStatusDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "UNAVAILABLE",
              "NEEDS_ATTENTION",
              "NO_OPEN_INCIDENT"
            ],
            "description": "UNAVAILABLE means suppression observation is disabled, unbound, or unreadable. NO_OPEN_INCIDENT means no observed open local-suppression incident for this organization; neither state establishes delivery, inbox placement, or provider-wide permission."
          },
          "banner": {
            "type": "string",
            "nullable": true,
            "description": "Redacted support banner when an observed local suppression incident remains open. Null when there is no observed open incident or observation is unavailable; inspect state to distinguish these cases. Contains no recipient or provider identity."
          }
        },
        "required": [
          "state",
          "banner"
        ]
      },
      "EmailHistoryAdmissionDto": {
        "type": "object",
        "properties": {
          "admitted": {
            "type": "boolean",
            "description": "A durable admission was observed; false means not observed, not proof that no send exists."
          },
          "locallyBlocked": {
            "type": "boolean",
            "description": "This exact trigger was blocked locally before provider I/O; distinct from provider suppression."
          }
        },
        "required": [
          "admitted",
          "locallyBlocked"
        ]
      },
      "EmailHistoryProviderDto": {
        "type": "object",
        "properties": {
          "inFlightObserved": {
            "type": "boolean",
            "description": "A provider invocation was observed; not a claim that one is still running."
          },
          "accepted": {
            "type": "boolean",
            "description": "Provider acceptance was observed. Not proof of sending, delivery, or inbox placement."
          },
          "sent": {
            "type": "boolean",
            "description": "Provider-sent evidence was observed; not proof of destination acceptance or inbox placement."
          },
          "uncorrelatableAcceptance": {
            "type": "boolean",
            "description": "Acceptance could not be safely correlated. It does not authorize resending."
          },
          "submissionFailed": {
            "type": "boolean",
            "description": "A local provider-submission failure was observed; distinct from a delivery failure callback."
          },
          "quarantined": {
            "type": "boolean",
            "description": "The attempt was observed quarantined; not proof of provider nonacceptance."
          }
        },
        "required": [
          "inFlightObserved",
          "accepted",
          "sent",
          "uncorrelatableAcceptance",
          "submissionFailed",
          "quarantined"
        ]
      },
      "EmailHistoryDestinationDto": {
        "type": "object",
        "properties": {
          "mxAccepted": {
            "type": "boolean",
            "description": "Destination MX acceptance was observed; inbox placement is unknown."
          },
          "delayed": {
            "type": "boolean",
            "description": "Delay was observed. Later or earlier achieved evidence is preserved."
          },
          "failed": {
            "type": "boolean",
            "description": "A canonical provider delivery-failure event was observed."
          },
          "bounced": {
            "type": "boolean",
            "description": "A bounce was observed; this read does not interpret bounce class as resend permission."
          },
          "suppressed": {
            "type": "boolean",
            "description": "Provider suppression was observed; separate from a local deny or blocked trigger."
          }
        },
        "required": [
          "mxAccepted",
          "delayed",
          "failed",
          "bounced",
          "suppressed"
        ]
      },
      "EmailHistoryRecipientSafetyDto": {
        "type": "object",
        "properties": {
          "complaintObserved": {
            "type": "boolean",
            "description": "A complaint was observed on this exact attempt."
          },
          "localDenyObserved": {
            "type": "boolean",
            "description": "A local deny assertion was observed within this exact trigger decision boundary."
          },
          "localReleaseObserved": {
            "type": "boolean",
            "description": "A local release was observed within this exact trigger decision boundary. Not present-day send permission."
          },
          "localDenyAtLastCheck": {
            "type": "string",
            "enum": [
              "DENIED",
              "ALLOWED",
              "NOT_OBSERVED"
            ],
            "description": "Decision at this trigger’s last observed check, including shadow decisions; not the current recipient state or proof a trigger was blocked. NOT_OBSERVED is unknown."
          }
        },
        "required": [
          "complaintObserved",
          "localDenyObserved",
          "localReleaseObserved",
          "localDenyAtLastCheck"
        ]
      },
      "EmailHistoryFactDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "ADMITTED",
              "PROVIDER_IN_FLIGHT",
              "PROVIDER_ACCEPTED",
              "PROVIDER_ACCEPTED_UNCORRELATABLE",
              "PROVIDER_SENT",
              "DESTINATION_MX_ACCEPTED",
              "DELIVERY_DELAYED",
              "PROVIDER_FAILED",
              "PROVIDER_SUBMISSION_FAILED",
              "BOUNCED",
              "SUPPRESSED",
              "COMPLAINED",
              "QUARANTINED",
              "LOCAL_DENY_ASSERTED",
              "LOCAL_DENY_RELEASED",
              "TRIGGER_BLOCKED_BY_LOCAL_DENY",
              "LOCAL_ALLOW_AT_CHECK",
              "LOCAL_DENY_AT_CHECK"
            ]
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "Recorded occurrence time; provider timestamps do not control retention or local observation order."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Local receipt time, or the read watermark for an explicitly marked current attempt snapshot."
          },
          "evidence": {
            "type": "string",
            "enum": [
              "APPEND_ONLY",
              "CURRENT_ATTEMPT_SNAPSHOT"
            ],
            "description": "APPEND_ONLY is an immutable ledger fact. CURRENT_ATTEMPT_SNAPSHOT is current send-side state, not a complete or historical transition ledger."
          }
        },
        "required": [
          "type",
          "occurredAt",
          "observedAt",
          "evidence"
        ]
      },
      "EmailHistoryItemDto": {
        "type": "object",
        "properties": {
          "flow": {
            "type": "string",
            "enum": [
              "FOUNDING_OWNER_WELCOME",
              "CUSTOM_PLAN_READY",
              "PLATFORM_TENANT_CREATED_WELCOME",
              "TEAMMATE_INVITE",
              "STOCK_NOTIFICATION_SEND",
              "STOCK_NOTIFICATION_CONFIRM",
              "NEWSLETTER_CONFIRM",
              "ABANDONED_CART_RECOVERY",
              "RETURN_NOTIFICATION",
              "ORDER_CONFIRMATION",
              "ORDER_SHIPPED",
              "CARRIER_PICKUP_ESTIMATE",
              "CARRIER_DELIVERED",
              "COMMERCE_QUOTE_SEND",
              "COMMERCE_INVOICE_SEND",
              "COMMERCE_CONTRACT_SEND",
              "COMMERCE_CONTRACT_COUNTERSIGNED",
              "COMMERCE_CONTRACT_VOIDED",
              "COMMERCE_QUOTE_EXPIRED",
              "COMMERCE_PAYMENT_RECEIVED",
              "BOOKING_NOTIFICATION",
              "BOOKING_REMINDER",
              "BOOKING_GROUP_RECOVERY",
              "SUBSCRIPTION_PAYMENT_RECOVERY",
              "AGREEMENT_EXECUTION_NOTIFICATION",
              "FIRST_SIGNIN_WELCOME",
              "CUSTOMER_AUTH",
              "TEMPLATE_TEST_SEND",
              "PLATFORM_USER_INVITE",
              "PLATFORM_OPERATOR_ALERT",
              "PLATFORM_NOTICE",
              "TENANT_USAGE_ALERT",
              "PLATFORM_BILLING_RECOVERY",
              "SUPABASE_AUTH_SIGNUP",
              "SUPABASE_AUTH_INVITE",
              "SUPABASE_AUTH_MAGIC_LINK",
              "SUPABASE_AUTH_RECOVERY",
              "SUPABASE_AUTH_EMAIL_CHANGE",
              "SUPABASE_AUTH_REAUTHENTICATION",
              "SUPABASE_AUTH_NOTIFICATION"
            ]
          },
          "sourceKind": {
            "type": "string",
            "enum": [
              "OUTBOX",
              "DIRECT"
            ]
          },
          "recordKind": {
            "type": "string",
            "enum": [
              "ATTEMPT",
              "SUPPRESSION_CHECK"
            ],
            "description": "Attempts and suppression checks are separate records; no address/timing-based association is inferred between them."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          },
          "admission": {
            "$ref": "#/components/schemas/EmailHistoryAdmissionDto"
          },
          "provider": {
            "$ref": "#/components/schemas/EmailHistoryProviderDto"
          },
          "destination": {
            "$ref": "#/components/schemas/EmailHistoryDestinationDto"
          },
          "recipientSafety": {
            "$ref": "#/components/schemas/EmailHistoryRecipientSafetyDto"
          },
          "facts": {
            "description": "At most 100 ordered, redacted observations. Empty means no authorized observation was collected, not proof that no email or safety state exists. factsComplete describes this bounded collection only.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailHistoryFactDto"
            }
          },
          "factsComplete": {
            "type": "boolean",
            "description": "All selected observation rows were interpreted within this record’s cap. Does not establish complete send history, all attempt transitions, or provider coverage."
          }
        },
        "required": [
          "flow",
          "sourceKind",
          "recordKind",
          "recordedAt",
          "admission",
          "provider",
          "destination",
          "recipientSafety",
          "facts",
          "factsComplete"
        ]
      },
      "EmailHistoryCoverageDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "PARTIAL",
              "UNAVAILABLE",
              "EXPIRED"
            ],
            "description": "Coverage is always partial: legacy/unattached/excluded/deleted/missing sources and provider gaps remain possible. EXPIRED means the entire requested creation window predates the 400-day display window; held evidence is not deleted by this read."
          },
          "scope": {
            "type": "string",
            "enum": [
              "RECORDED_STRUCTURAL_SOURCES_ONLY"
            ]
          },
          "collection": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "TRUNCATED",
              "UNAVAILABLE"
            ],
            "description": "COMPLETE means the authorized bounded source/observation scan was exhausted, not complete delivery history. TRUNCATED means a record/fact cap or uninterpretable observation prevented exhaustion."
          },
          "permissionLimited": {
            "type": "boolean",
            "description": "True for staff: independently restricted Booking, Subscription, and Agreement domain history is omitted without querying or revealing its presence."
          },
          "missingHistoryPossible": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Always true: an empty result must never be read as no email was sent."
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "through": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "state",
          "scope",
          "collection",
          "permissionLimited",
          "missingHistoryPossible",
          "from",
          "through"
        ]
      },
      "EmailHistoryResponseDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE",
              "EXPIRED"
            ],
            "description": "UNAVAILABLE means observation is disabled, schema/environment is not ready, or the read failed; no rows does not establish no history. EXPIRED applies to the requested display window, not physical evidence destruction."
          },
          "projection": {
            "type": "string",
            "enum": [
              "TENANT",
              "CUSTOMER",
              "NATIVE_ORDER",
              "COMMERCE_ORDER"
            ]
          },
          "reducerVersion": {
            "type": "string",
            "enum": [
              "email-history-v1"
            ]
          },
          "items": {
            "description": "Authorized records only, ordered by local creation time. Empty can mean unavailable, expired, no recorded structural associations, or no authorized matching records; inspect state and coverage. No recipient/provider/internal attempt identifiers are exposed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailHistoryItemDto"
            }
          },
          "coverage": {
            "$ref": "#/components/schemas/EmailHistoryCoverageDto"
          },
          "watermark": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Database snapshot boundary used by the common live/rebuild reducer. Null means the snapshot was unavailable, not that observation never existed."
          },
          "observedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Time this authorized snapshot was read. Null means unavailable. It is not a provider completeness watermark."
          },
          "freshness": {
            "type": "string",
            "enum": [
              "CURRENT_AT_WATERMARK",
              "STALE",
              "UNAVAILABLE"
            ],
            "description": "Snapshot age only. CURRENT_AT_WATERMARK does not mean callbacks are complete or provider state is current."
          }
        },
        "required": [
          "state",
          "projection",
          "reducerVersion",
          "items",
          "coverage",
          "watermark",
          "observedAt",
          "freshness"
        ]
      },
      "IntercomMerchantCapabilityStatusDto": {
        "type": "object",
        "properties": {
          "capability": {
            "type": "string",
            "description": "Provider-neutral capability name allowed on the connection.",
            "example": "customer_context_read"
          },
          "authorityState": {
            "type": "string",
            "enum": [
              "UNBOUND",
              "ACTIVE",
              "DISABLED"
            ]
          },
          "resourceState": {
            "type": "string",
            "enum": [
              "UNCONFIGURED",
              "PROVISIONING",
              "DRAFT",
              "PUBLISHING",
              "LIVE",
              "DRIFTED",
              "CLEANUP_REQUIRED"
            ]
          },
          "attentionRequired": {
            "type": "boolean",
            "description": "Whether this capability requires operator attention before it can be used."
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextVerificationAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "attentionRequiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "capability",
          "authorityState",
          "resourceState",
          "attentionRequired",
          "verifiedAt",
          "nextVerificationAt",
          "attentionRequiredAt"
        ]
      },
      "IntercomCleanupContinuationDto": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "Whether an explicit Preview continuation can advance the selected existing cleanup now. Below the attempt limit it can schedule a provider attempt; an exhausted, expired operation is finalized locally as Needs support without a provider call or reset. POST rechecks authorization, provider readiness, due time, lease, and budget."
          },
          "precondition": {
            "type": "string",
            "nullable": true,
            "description": "Opaque operation scope pin. Null when no unresolved operation is selectable, the selection is ambiguous, or runtime/schema/provider readiness is unavailable. A non-null pin can accompany unavailable backoff or a current lease; it grants no authority or attempt eligibility and contains no provider or credential identifiers."
          },
          "nextAttemptAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Earliest provider retry, stale-lease recovery, or exhausted-operation local finalization time. Can be a future non-null time while available is false. Null when no selectable operation or runtime/schema/provider readiness exists (precondition is also null). Exhausted work retains a time until it is finalized as Needs support; it never gains another provider attempt. GET and reload never start cleanup."
          }
        },
        "required": [
          "available",
          "precondition",
          "nextAttemptAt"
        ]
      },
      "IntercomMerchantCleanupStatusDto": {
        "type": "object",
        "properties": {
          "continuation": {
            "$ref": "#/components/schemas/IntercomCleanupContinuationDto"
          },
          "state": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "ACTION_REQUIRED",
              "COMPLETE"
            ]
          },
          "pendingCredentialRevocations": {
            "type": "integer",
            "minimum": 0
          },
          "pendingProviderActions": {
            "type": "integer",
            "minimum": 0
          },
          "actionRequiredItems": {
            "type": "integer",
            "minimum": 0
          },
          "lastConfirmedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "actionRequiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "continuation",
          "state",
          "pendingCredentialRevocations",
          "pendingProviderActions",
          "actionRequiredItems",
          "lastConfirmedAt",
          "actionRequiredAt"
        ]
      },
      "IntercomMerchantActionStatusDto": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean"
          },
          "blockedReason": {
            "type": "string",
            "enum": [
              "ALREADY_CONNECTED",
              "ALREADY_DISCONNECTED",
              "CONNECT_IN_PROGRESS",
              "CONFIGURATION_UNAVAILABLE",
              "CREDENTIAL_RETIREMENT_PENDING",
              "NOT_CONNECTED",
              "OPERATOR_ACTION_REQUIRED",
              "ORGANIZATION_SUSPENDED",
              "RECONNECT_REQUIRED"
            ],
            "nullable": true
          }
        },
        "required": [
          "available",
          "blockedReason"
        ]
      },
      "IntercomMerchantLifecycleActionsDto": {
        "type": "object",
        "properties": {
          "connect": {
            "description": "Initial-connect action. Execute an available action with POST /merchant/support-provider-connections/intercom/connect.",
            "allOf": [
              {
                "$ref": "#/components/schemas/IntercomMerchantActionStatusDto"
              }
            ]
          },
          "reconnect": {
            "description": "Same-owner reconnect action after cleanup completes. Execute an available action with the same POST /merchant/support-provider-connections/intercom/connect route.",
            "allOf": [
              {
                "$ref": "#/components/schemas/IntercomMerchantActionStatusDto"
              }
            ]
          },
          "disconnect": {
            "$ref": "#/components/schemas/IntercomMerchantActionStatusDto"
          },
          "reasonRequired": {
            "type": "boolean",
            "description": "Connect, reconnect, and disconnect all require a human reason."
          }
        },
        "required": [
          "connect",
          "reconnect",
          "disconnect",
          "reasonRequired"
        ]
      },
      "IntercomMerchantLifecycleStatusDto": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "intercom"
            ]
          },
          "surfaceAvailable": {
            "type": "boolean",
            "description": "Whether this tenant may render the merchant Intercom lifecycle surface. False is a routine eligibility answer, not a service failure."
          },
          "lifecycleState": {
            "type": "string",
            "enum": [
              "NOT_CONNECTED",
              "CONNECTING",
              "ACTIVE",
              "DISCONNECTING",
              "ACTION_REQUIRED",
              "DISCONNECTED"
            ]
          },
          "connectionMode": {
            "type": "string",
            "enum": [
              "PUBLIC_OAUTH",
              "OPERATOR_MANAGED_PILOT"
            ],
            "nullable": true
          },
          "region": {
            "type": "string",
            "enum": [
              "US",
              "EU",
              "AU"
            ],
            "nullable": true
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reconnectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "disconnectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "capabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntercomMerchantCapabilityStatusDto"
            }
          },
          "cleanup": {
            "$ref": "#/components/schemas/IntercomMerchantCleanupStatusDto"
          },
          "actions": {
            "$ref": "#/components/schemas/IntercomMerchantLifecycleActionsDto"
          }
        },
        "required": [
          "provider",
          "surfaceAvailable",
          "lifecycleState",
          "connectionMode",
          "region",
          "connectedAt",
          "reconnectedAt",
          "disconnectedAt",
          "capabilities",
          "cleanup",
          "actions"
        ]
      },
      "IntercomMerchantWorkspaceIdentityDto": {
        "type": "object",
        "properties": {
          "workspaceId": {
            "type": "string",
            "description": "Intercom app/workspace ID verified against this tenant and runtime's active connection. Display-only: it is not a credential, connector ID, or proof that Fin is enabled.",
            "example": "abc12345"
          },
          "name": {
            "type": "string",
            "description": "Current Intercom app/workspace display name from the same verified GET /me read. Names can change and are not unique identifiers.",
            "example": "Example Store Test"
          },
          "region": {
            "type": "string",
            "enum": [
              "US",
              "EU",
              "AU"
            ]
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Time of the successful live provider read; this is not connector or Fin certification."
          }
        },
        "required": [
          "workspaceId",
          "name",
          "region",
          "verifiedAt"
        ]
      },
      "StartIntercomConnectionDto": {
        "type": "object",
        "properties": {
          "region": {
            "type": "string",
            "enum": [
              "US",
              "EU",
              "AU"
            ],
            "description": "Proposed Intercom data region. The server maps this enum to a fixed OAuth host and persists it only after GET /me attests the same region."
          },
          "reason": {
            "type": "string",
            "minLength": 12,
            "maxLength": 500,
            "description": "Reason for this high-risk provider connection change; retained in the typed lifecycle audit.",
            "example": "Connect this tenant support workspace"
          }
        },
        "required": [
          "region",
          "reason"
        ]
      },
      "StartIntercomConnectionResponseDto": {
        "type": "object",
        "properties": {
          "authorizeUrl": {
            "type": "string",
            "description": "Fixed-region Intercom OAuth authorization URL containing a signed, single-use state."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Expiry of the one-time OAuth state."
          }
        },
        "required": [
          "authorizeUrl",
          "expiresAt"
        ]
      },
      "DisconnectIntercomConnectionDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Caller-generated idempotency key for this lifecycle command."
          },
          "reason": {
            "type": "string",
            "minLength": 12,
            "maxLength": 500,
            "description": "Reason for the high-risk lifecycle command; retained only in typed lifecycle audit evidence.",
            "example": "Disconnect before replacing this workspace"
          }
        },
        "required": [
          "requestId",
          "reason"
        ]
      },
      "ContinueIntercomCleanupDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Caller-generated idempotency key for this lifecycle command."
          },
          "reason": {
            "type": "string",
            "minLength": 12,
            "maxLength": 500,
            "description": "Reason for the high-risk lifecycle command; retained only in typed lifecycle audit evidence.",
            "example": "Disconnect before replacing this workspace"
          },
          "precondition": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque operation precondition from cleanup.continuation. It grants no authority and cannot select a generation. Use a fresh requestId for a later explicit attempt; exact replay returns progress without dispatch."
          }
        },
        "required": [
          "requestId",
          "reason",
          "precondition"
        ]
      },
      "IntercomCatalogStatusDto": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "UNAVAILABLE",
              "WORKSPACE_CONNECTED",
              "SETUP_NEEDED",
              "AWAITING_HANDOFF",
              "VERIFICATION_NEEDED",
              "CATALOG_READY",
              "ACCESS_DISABLED",
              "NEEDS_SUPPORT",
              "PLATFORM_MANAGED"
            ],
            "description": "Projection of the existing backend lifecycle. Preparation and OAuth do not mean Catalog ready; that requires active authority/credential and complete verified current LIVE pins."
          },
          "canManage": {
            "type": "boolean",
            "description": "Current enrolled Owner/Admin authority plus explicit merchant management eligibility; customers:support alone is insufficient."
          },
          "allowedActions": {
            "type": "array",
            "description": "Explicit currently permitted commands. GET/reload never dispatches work.",
            "items": {
              "type": "string",
              "enum": [
                "PREPARE",
                "ISSUE",
                "BIND",
                "VERIFY",
                "PUBLISH",
                "ACTIVATE",
                "REVOKE"
              ]
            }
          },
          "precondition": {
            "type": "string",
            "nullable": true,
            "description": "Opaque exact state precondition. Null when unavailable, ambiguous, ineligible, or no command can advance now."
          },
          "blocker": {
            "type": "string",
            "nullable": true,
            "description": "Safe explanation of a blocker or recovery-only action. Null when the advertised setup action can advance normally."
          },
          "pendingCredential": {
            "type": "string",
            "nullable": true,
            "description": "Masked pending generation display. Null when no exact pending generation exists; never its secret or identifier."
          },
          "testEvidenceExpiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Single-use test evidence expiry for the exact pending generation. Null before its successful test or when no pending generation exists."
          },
          "testUrl": {
            "type": "string",
            "nullable": true,
            "description": "Server-derived canonical no-data test endpoint. Null when no exact pending generation can be verified. It contains no tenant/resource/credential selector."
          },
          "textTokenId": {
            "type": "string",
            "nullable": true,
            "description": "Saved non-secret Text-token ID for this separate catalog surface. Null before first preparation or when the current approved profile cannot be corroborated."
          }
        },
        "required": [
          "stage",
          "canManage",
          "allowedActions",
          "precondition",
          "blocker",
          "pendingCredential",
          "testEvidenceExpiresAt",
          "testUrl",
          "textTokenId"
        ]
      },
      "PrepareIntercomCatalogDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "One finite human command. Exact replay returns safe progress only, never a credential or another provider mutation."
          },
          "reason": {
            "type": "string",
            "minLength": 12,
            "maxLength": 500,
            "description": "Human reason retained in typed audit evidence. Do not include secrets."
          },
          "precondition": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque current operation/version fence from catalog status. It cannot select a tenant, runtime, workspace, resource or generation."
          },
          "textTokenId": {
            "type": "string",
            "description": "Non-secret Intercom Text-token artifact ID, required only for first-time draft preparation. Omit for retained C1 preparation; that branch derives the saved ID and never creates another connector.",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "requestId",
          "reason",
          "precondition"
        ]
      },
      "IntercomCatalogIssuedValueDto": {
        "type": "object",
        "properties": {
          "connectionToken": {
            "type": "string",
            "description": "Complete secret returned only by the original committed synchronous issuance. Keep solely in volatile client memory; never log, cache, persist or replay."
          }
        },
        "required": [
          "connectionToken"
        ]
      },
      "IntercomCatalogCommandResultDto": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/IntercomCatalogStatusDto"
          },
          "replayed": {
            "type": "boolean",
            "description": "True for an existing exact UUID claim; replay performs no new command effect."
          },
          "issuedValue": {
            "nullable": true,
            "description": "Show-once value from original successful ISSUE only. Always null on replay, lost-response recovery and every other command.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/IntercomCatalogIssuedValueDto"
              }
            ]
          },
          "verificationRequestId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Non-secret exact VERIFY claim for the no-data test request header. Null for all other commands or completed verification. It carries no authority without the exact pending credential and fresh human permission."
          }
        },
        "required": [
          "status",
          "replayed",
          "issuedValue",
          "verificationRequestId"
        ]
      },
      "IntercomCatalogCommandDto": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "One finite human command. Exact replay returns safe progress only, never a credential or another provider mutation."
          },
          "reason": {
            "type": "string",
            "minLength": 12,
            "maxLength": 500,
            "description": "Human reason retained in typed audit evidence. Do not include secrets."
          },
          "precondition": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque current operation/version fence from catalog status. It cannot select a tenant, runtime, workspace, resource or generation."
          }
        },
        "required": [
          "requestId",
          "reason",
          "precondition"
        ]
      },
      "MerchantNoticeDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "GENERAL",
              "INCIDENT",
              "DEPRECATION",
              "BILLING"
            ]
          },
          "publishedAt": {
            "format": "date-time",
            "type": "string"
          },
          "readAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dismissedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "title",
          "body",
          "kind",
          "publishedAt",
          "readAt",
          "dismissedAt"
        ]
      },
      "MarkMerchantNoticesReadDto": {
        "type": "object",
        "properties": {
          "noticeIds": {
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "noticeIds"
        ]
      },
      "OrganizationNoticeStateDto": {
        "type": "object",
        "properties": {
          "noticeId": {
            "type": "string",
            "format": "uuid"
          },
          "readAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dismissedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "noticeId",
          "readAt",
          "dismissedAt"
        ]
      },
      "SubmitContactMessageDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Submitter's display name. Untrusted free text.",
            "example": "Jamie Rivera",
            "maxLength": 200
          },
          "email": {
            "type": "string",
            "description": "Reply address. Normalised lowercase before insert. Validated as an email but never verified — treated as a reply target only.",
            "example": "jamie@example.com",
            "maxLength": 320
          },
          "subject": {
            "type": "string",
            "description": "Optional subject line.",
            "example": "Question about bulk orders",
            "maxLength": 200
          },
          "message": {
            "type": "string",
            "description": "Message body.",
            "example": "Do you ship to Canada?",
            "maxLength": 5000
          }
        },
        "required": [
          "name",
          "email",
          "message"
        ]
      },
      "ContactSubmitResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Always `true`. Constant regardless of what happened server-side.",
            "example": true
          }
        },
        "required": [
          "ok"
        ]
      },
      "MerchantContactMessageSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Submitter's display name (untrusted text)."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Reply address as submitted. Validated as an email but never verified — a reply target, not proof of identity."
          },
          "subject": {
            "type": "string",
            "nullable": true,
            "description": "Subject line, or `null` when the form did not collect one."
          },
          "status": {
            "type": "string",
            "enum": [
              "UNREAD",
              "READ",
              "ARCHIVED"
            ],
            "example": "UNREAD"
          },
          "readAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "First time the message was marked read. Retained if it is later marked unread again."
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "When it was submitted."
          },
          "preview": {
            "type": "string",
            "description": "First 200 characters of the body, whitespace-collapsed to one line and ellipsised when truncated. Fetch the detail route for the full message."
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "subject",
          "status",
          "readAt",
          "archivedAt",
          "createdAt",
          "preview"
        ]
      },
      "MerchantContactMessagePageDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantContactMessageSummaryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor for the next page, or `null` at the end."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "MerchantContactMessageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Submitter's display name (untrusted text)."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Reply address as submitted. Validated as an email but never verified — a reply target, not proof of identity."
          },
          "subject": {
            "type": "string",
            "nullable": true,
            "description": "Subject line, or `null` when the form did not collect one."
          },
          "status": {
            "type": "string",
            "enum": [
              "UNREAD",
              "READ",
              "ARCHIVED"
            ],
            "example": "UNREAD"
          },
          "readAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "First time the message was marked read. Retained if it is later marked unread again."
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "When it was submitted."
          },
          "message": {
            "type": "string",
            "description": "Full message body (untrusted text)."
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "subject",
          "status",
          "readAt",
          "archivedAt",
          "createdAt",
          "message"
        ]
      },
      "UpdateContactMessageStatusDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "UNREAD",
              "READ",
              "ARCHIVED"
            ],
            "description": "New triage state. `UNREAD` restores the row to the unread filter without erasing `readAt` — that records that it was once seen.",
            "example": "READ"
          }
        },
        "required": [
          "status"
        ]
      },
      "ApplyCouponDto": {
        "description": "Preview a coupon code against the cart in exactly one shape: server-priced `lines` (authoritative), or the original client-priced `subtotalInCents` (preview-only). Exactly one alternative must match.",
        "oneOf": [
          {
            "title": "Server-priced lines",
            "description": "The cart as catalog references and quantities. The server prices it as the checkout session does, so the result honours sale state and the eligible base of a coupon that excludes items already on sale.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "description": "Coupon code. Trimmed + upper-cased server-side before lookup. Customer-typed; case-insensitive match against the merchant-configured canonical form.",
                "minLength": 1,
                "maxLength": 50
              },
              "lines": {
                "minItems": 1,
                "maxItems": 200,
                "description": "Server-priced preview (recommended): the cart lines as catalog references and quantities, no prices — the same line shape the checkout session accepts. The API prices them from the catalog, including active sale windows, compare-at markdowns and collection membership, and previews the code through the same pricing the checkout session runs. Must be omitted when `subtotalInCents` is sent. A line that does not resolve to a purchasable catalog row is rejected with a 400, as at checkout.",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RepriceLineDto"
                }
              }
            },
            "required": [
              "code",
              "lines"
            ]
          },
          {
            "title": "Client-priced subtotal",
            "description": "The original shape, unchanged: a preview of the client-asserted subtotal. It cannot see sale state, so it can over-promise a coupon that excludes items already on sale.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "description": "Coupon code. Trimmed + upper-cased server-side before lookup. Customer-typed; case-insensitive match against the merchant-configured canonical form.",
                "minLength": 1,
                "maxLength": 50
              },
              "subtotalInCents": {
                "type": "number",
                "description": "Client-priced preview (the original shape): the cart subtotal the shopper currently sees, in cents. Required when `lines` is omitted, and must be omitted when `lines` is sent. Used for minimum-spend gating and for the PERCENTAGE / FIXED_AMOUNT discount math, and trusted for this preview only. It carries no line detail, so a coupon that excludes items already on sale is previewed against this whole number and can over-promise; the checkout session re-prices the real cart before anything is charged. Prefer `lines`.",
                "minimum": 0
              }
            },
            "required": [
              "code",
              "subtotalInCents"
            ]
          }
        ]
      },
      "ApplyCouponResultDto": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "Discriminant. `true` = the coupon applied and the discount fields are populated; `false` = it did not apply and `message` explains why. With server-priced `lines`, `true` means the code applies to those lines as the checkout session prices them now. With the client-priced `subtotalInCents`, it previews that number only and is not checkout eligibility. Either way it is a preview, not a reservation: the checkout session re-evaluates the code whenever it prices or binds the cart.",
            "example": true
          },
          "code": {
            "type": "string",
            "description": "Normalized (upper-cased) coupon code. Present on `valid:true`.",
            "example": "SUMMER25"
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type. Present on `valid:true`."
          },
          "value": {
            "type": "number",
            "description": "Raw discount value (basis points for PERCENTAGE, cents for FIXED_AMOUNT, 0 for FREE_SHIPPING). A Buy X, Get Y coupon is PERCENTAGE with value 0: its percentage applies to its reward units only, so its saving is `discountInCents`. Present on `valid:true`.",
            "example": 2500
          },
          "discountInCents": {
            "type": "number",
            "description": "Computed discount to subtract from the cart subtotal, in cents (always 0 for FREE_SHIPPING — shipping is waived separately). Present on `valid:true`. With `lines`, it is the coupon amount the checkout session would bind for those lines now: computed on the eligible base when the coupon excludes items already on sale, and allocated together with the cart's other active promotions, so it can be less than the coupon's own math. No shipping rate is selected yet, so a Buy X, Get Y coupon can still be skipped at checkout once the selected rate has a charge that an automatic discount or a bundle waives. With `subtotalInCents`, it is the coupon's math against that number alone.",
            "example": 1250
          },
          "message": {
            "type": "string",
            "description": "Customer-facing message. Always present on `valid:false`; public rejects use neutral unavailable/cannot-apply copy and do not disclose which validation gate failed.",
            "example": "This coupon is unavailable or cannot be applied."
          }
        },
        "required": [
          "valid"
        ]
      },
      "CalculateAutoDiscountsItemDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "description": "Catalog item UUID for the cart line.",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "description": "Variant id when the line targets a specific variant. Optional because not every catalog row has variants.",
            "format": "uuid"
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "description": "Number of units on this line. Lines with quantity <= 0 should be omitted from the request rather than included with a zero."
          },
          "unitPriceInCents": {
            "type": "number",
            "minimum": 0,
            "description": "Per-unit price in cents at calculate-time. The line total used by the matcher is `quantity * unitPriceInCents`."
          },
          "collectionIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Collection ids this line's item belongs to. Used to gate ITEMS_BY_COLLECTION discounts. Empty/omitted = line belongs to no collections. Unknown ids are silently ignored by the matcher."
          }
        },
        "required": [
          "itemId",
          "quantity",
          "unitPriceInCents"
        ],
        "additionalProperties": false
      },
      "CalculateAutoDiscountsDto": {
        "description": "Calculate automatic discounts for the cart in exactly one shape: server-priced `lines` (authoritative), or the original client-priced `items` + `subtotalInCents` (preview-only). Exactly one alternative must match.",
        "oneOf": [
          {
            "title": "Server-priced lines",
            "description": "The cart as catalog references and quantities. The server prices it as the checkout session does, so real prices, sale state and collection membership decide every discount.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "lines": {
                "minItems": 1,
                "maxItems": 200,
                "description": "Server-priced preview (recommended): the cart lines as catalog references and quantities, no prices — the same line shape the checkout session accepts. The API prices them from the catalog, including active sale windows, compare-at markdowns and collection membership, and evaluates automatic discounts through the same pricing the checkout session runs. Must be omitted when `items` or `subtotalInCents` is sent. A line that does not resolve to a purchasable catalog row is rejected with a 400, as at checkout.",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RepriceLineDto"
                }
              }
            },
            "required": [
              "lines"
            ]
          },
          {
            "title": "Client-priced items",
            "description": "The original shape, unchanged: a preview of the client-asserted prices, collection memberships and subtotal. It cannot see sale state, so it can over-promise a discount that excludes items already on sale.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "items": {
                "minItems": 1,
                "maxItems": 200,
                "description": "Client-priced preview (the original shape): the cart lines with the prices and collection memberships the caller asserts. Required with `subtotalInCents` when `lines` is omitted, and must be omitted when `lines` is sent. Trusted for this preview only; it carries no sale state, so a rule that excludes items already on sale is previewed as if nothing were on sale. Prefer `lines`.",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CalculateAutoDiscountsItemDto"
                }
              },
              "subtotalInCents": {
                "type": "number",
                "minimum": 0,
                "description": "Client-priced preview (the original shape): cart subtotal in cents. Required with `items` when `lines` is omitted, and must be omitted when `lines` is sent. Drives the `minimumSubtotalInCents` gate and the `ORDER_TOTAL` math directly. Expected to equal `sum(items[].quantity * unitPriceInCents)` but accepted verbatim."
              }
            },
            "required": [
              "items",
              "subtotalInCents"
            ]
          }
        ]
      },
      "AppliedAutoDiscountDto": {
        "type": "object",
        "properties": {
          "autoDiscountId": {
            "type": "string",
            "description": "Auto-discount id."
          },
          "name": {
            "type": "string",
            "description": "Merchant-facing auto-discount name."
          },
          "scope": {
            "type": "string",
            "enum": [
              "ALL_ITEMS",
              "ITEMS_BY_COLLECTION",
              "ORDER_TOTAL"
            ],
            "description": "What the discount applies to (ALL_ITEMS / ITEMS_BY_COLLECTION / ORDER_TOTAL)."
          },
          "type": {
            "type": "string",
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "FREE_SHIPPING"
            ],
            "description": "Discount type (PERCENTAGE / FIXED_AMOUNT / FREE_SHIPPING)."
          },
          "appliedToInCents": {
            "type": "number",
            "description": "Base in cents the percentage/fixed math ran against (subtotal, matching line totals, or order total per scope). With `lines`, the server-resolved base; for a discount that excludes items already on sale, only the part of that base that is not on sale."
          },
          "discountInCents": {
            "type": "number",
            "description": "Cents saved by this discount. With `lines`, the amount the checkout session would bind for those lines now without a coupon, which can be less than the discount's own math when several promotions share the same lines."
          }
        },
        "required": [
          "autoDiscountId",
          "name",
          "scope",
          "type",
          "appliedToInCents",
          "discountInCents"
        ]
      },
      "CalculateAutoDiscountsResponseDto": {
        "type": "object",
        "properties": {
          "appliedDiscounts": {
            "description": "Every ACTIVE auto-discount that matched the supplied cart. Empty array when none apply. With `lines`, matching uses the server-priced lines, so a discount that excludes items already on sale and has nothing eligible does not appear.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppliedAutoDiscountDto"
            }
          },
          "totalDiscountInCents": {
            "type": "number",
            "description": "Sum of all applied discount amounts in cents."
          },
          "finalSubtotalInCents": {
            "type": "number",
            "description": "Cart subtotal in cents after the applied discounts: the supplied `subtotalInCents`, or with `lines` the server-resolved cart subtotal, minus `totalDiscountInCents`. Automatic discounts only; coupons, bundles and package savings are not included, so it is not the checkout total."
          }
        },
        "required": [
          "appliedDiscounts",
          "totalDiscountInCents",
          "finalSubtotalInCents"
        ]
      },
      "CreateContractSignatureDto": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "MERCHANT"
            ],
            "description": "CUSTOMER signs via the customer token surface; MERCHANT is the first-party countersignature (#1380). INTERNAL is not signable yet."
          },
          "signerName": {
            "type": "string",
            "maxLength": 200
          },
          "signerEmail": {
            "type": "string",
            "description": "Signatory email (used for delivery in #598)."
          }
        },
        "required": [
          "role"
        ]
      },
      "CreateContractPacketDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "description": "The commerce record (quote/invoice/order) this packet is for."
          },
          "revisionId": {
            "type": "string",
            "description": "Pin the packet to a specific revision of the record."
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Optional signing deadline."
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateContractSignatureDto"
            }
          }
        },
        "required": [
          "recordId",
          "title",
          "signatures"
        ]
      },
      "MerchantContractSignatureDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "MERCHANT",
              "INTERNAL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "signerName": {
            "type": "string",
            "nullable": true
          },
          "signerEmail": {
            "type": "string",
            "nullable": true
          },
          "signedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "declinedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "role",
          "status",
          "signerName",
          "signerEmail",
          "signedAt",
          "declinedAt"
        ]
      },
      "MerchantContractPacketDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "recordId": {
            "type": "string"
          },
          "revisionId": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "VOIDED"
            ]
          },
          "title": {
            "type": "string"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "sentAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "signedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantContractSignatureDto"
            }
          }
        },
        "required": [
          "id",
          "recordId",
          "revisionId",
          "status",
          "title",
          "displayNumber",
          "expiresAt",
          "sentAt",
          "signedAt",
          "createdAt",
          "signatures"
        ]
      },
      "ContractPacketListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantContractPacketDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "SendContractPacketDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "ContractActionLinkDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Raw customer action token — returned ONCE at send."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "token",
          "expiresAt"
        ]
      },
      "SendContractResultDto": {
        "type": "object",
        "properties": {
          "packet": {
            "$ref": "#/components/schemas/MerchantContractPacketDto"
          },
          "customerAction": {
            "$ref": "#/components/schemas/ContractActionLinkDto"
          }
        },
        "required": [
          "packet",
          "customerAction"
        ]
      },
      "CommercePaymentTermPresetDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Operator-facing preset label (e.g. \"Net 30\")."
          },
          "kind": {
            "type": "string",
            "enum": [
              "DUE_ON_RECEIPT",
              "DUE_ON_FULFILLMENT",
              "NET_TERMS",
              "FIXED_DATE",
              "MANUAL"
            ],
            "description": "Term style: DUE_ON_RECEIPT, DUE_ON_FULFILLMENT, NET_TERMS (see netDays), FIXED_DATE, or MANUAL (free-text termsText)."
          },
          "netDays": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Net days for NET_TERMS presets (e.g. 30 for \"Net 30\"). Null otherwise."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "termsText": {
            "type": "string",
            "nullable": true,
            "description": "Free-text terms shown on the document (required for MANUAL presets)."
          },
          "isDefault": {
            "type": "boolean",
            "description": "The org's default preset for new documents."
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Set when the preset is archived; archived presets are omitted from this list."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "kind",
          "netDays",
          "description",
          "termsText",
          "isDefault",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommercePaymentTermPresetListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommercePaymentTermPresetDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "CommerceRecordDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ],
            "description": "Commercial lifecycle axis (DRAFT→SENT→ACCEPTED/DECLINED/EXPIRED→CONVERTED, plus terminal VOIDED/CANCELLED). Forward-only; drives which lifecycle actions are permitted. Independent of the payment/fulfillment/signature axes."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "description": "Payment axis, derived from the payment/refund ledger. Full value space: NOT_REQUIRED, UNPAID, PARTIALLY_PAID, PAID, PARTIALLY_REFUNDED, REFUNDED, FAILED, CANCELLED. Moves independently of the commercial status."
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ],
            "description": "Shipment fulfillment axis. Committed orders with positive PRODUCT quantity start UNFULFILLED; orders without shippable PRODUCT quantity remain NOT_REQUIRED. Booking/service and subscription entitlement work stays on its operational projection."
          },
          "outboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true,
            "description": "Canonical outbound physical handoff mode; null when not planned."
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true,
            "description": "Canonical inbound return handoff mode; null when not planned."
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Deprecated display-only compatibility summary derived from authoritative agreement requirements/satisfactions, with a legacy execution fallback. Full value space: NOT_REQUIRED, PENDING, SIGNED, DECLINED, EXPIRED, CANCELLED. Never use it to authorize or gate a command."
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Human-facing document number (e.g. Q-1001, INV-1001, C-1001), allocated once at send/issue and stable for the life of the record. Null while DRAFT. Customers address account documents by this number."
          },
          "displayNumberKind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ],
            "nullable": true,
            "description": "Which numbering series allocated displayNumber (QUOTE/INVOICE/…)."
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "customerPhone": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The source quote this order was converted from (#1333)."
          },
          "orderRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Authoritative shared-commerce order linked to this invoice, when present."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "paymentTermPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Payment-term preset applied to this record; its terms are frozen into paymentTermsSnapshot at send. Null when no terms apply."
          },
          "paymentTermsSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen payment-terms snapshot (net-days / deposit schedule) captured at send from paymentTermPresetId. Null when no terms apply."
          },
          "taxExempt": {
            "type": "boolean"
          },
          "taxExemptionReason": {
            "type": "string",
            "nullable": true
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "shippingInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Document total in minor units (cents). Commerce money amounts are 32-bit integer cents by design: document totals are capped at 2,147,483,647 cents (~$21.47M), and per-amount line inputs at ±1,000,000,000 cents ($10M). Pricing writes that would exceed these bounds are rejected with 400."
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross recorded payments (minor units), derived from the payment ledger. Net paid = amountPaidInCents − refundedInCents."
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total refunded (minor units), derived from the payment ledger."
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Outstanding balance (minor units): max(0, totalInCents − amountPaidInCents), i.e. based on GROSS payments. A refund does NOT re-open the balance (ADR-013); the refund dimension lives on refundedInCents + paymentStatus. Zero once gross payments cover the total. An Order with linked invoices (E11, once activated) mirrors its sale once one has been issued: the issued-invoice projection sets this balance and paymentStatus from its live issued invoices whenever a linked invoice is issued, takes money, or ends after it was issued, and amountPaidInCents and refundedInCents report only the Order's own ledger. A never-sent draft, created or cancelled, leaves this balance and paymentStatus as they were. The sale's paid and refunded totals are its invoice-capacity position. When an issued linked invoice ends and no issued one remains live, the projection sets 0 and NOT_REQUIRED. Once every linked invoice has ended, a direct Order payment is accepted and sets all four values from the Order's own ledger."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "declinedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "voidedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "convertedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "externalSource": {
            "type": "string",
            "nullable": true,
            "description": "System of record for an externally-originated document (e.g. a wholesale ERP). Together with externalId it forms the external identity; the list filter requires externalSource whenever externalId is supplied."
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "description": "Opaque id of this document in the externalSource system. The triple (organization, externalSource, externalId) is unique — many externalIds may exist per source, each unique within its (organization, externalSource) pair — which enables idempotent external imports."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "type",
          "source",
          "commercialStatus",
          "paymentStatus",
          "fulfillmentStatus",
          "outboundFulfillmentMode",
          "outboundDueAt",
          "inboundFulfillmentMode",
          "inboundDueAt",
          "signatureStatus",
          "displayNumber",
          "displayNumberKind",
          "customerId",
          "customerName",
          "customerEmail",
          "customerPhone",
          "companyName",
          "orderId",
          "sourceRecordId",
          "orderRecordId",
          "currency",
          "paymentTermPresetId",
          "paymentTermsSnapshot",
          "taxExempt",
          "taxExemptionReason",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "expiresAt",
          "sentAt",
          "acceptedAt",
          "declinedAt",
          "cancelledAt",
          "voidedAt",
          "convertedAt",
          "externalSource",
          "externalId",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceRecordListItemDto": {
        "type": "object",
        "properties": {
          "primaryStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED",
              "PENDING",
              "CONFIRMED",
              "PROCESSING",
              "COMPLETED"
            ],
            "description": "Primary lifecycle shown by the Sales list. A tenant-owned linked ORDER projects its Order processing status; quotes, invoices, and unlinked orders fall back to commercialStatus."
          },
          "primaryStatusKind": {
            "type": "string",
            "enum": [
              "COMMERCIAL",
              "ORDER_PROCESSING"
            ],
            "description": "Lifecycle that supplied primaryStatus. Clients must use this discriminator because values such as CANCELLED exist on both lifecycles."
          }
        },
        "required": [
          "primaryStatus",
          "primaryStatusKind"
        ]
      },
      "CommerceRecordListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/CommerceRecordDto"
                },
                {
                  "$ref": "#/components/schemas/CommerceRecordListItemDto"
                }
              ]
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page (the last record id), or null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CommercePaymentLedgerRecordDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "INVOICE",
              "ORDER"
            ]
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "customerId": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "customerEmail": {
            "type": "string",
            "nullable": true,
            "format": "email"
          },
          "companyName": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "type",
          "displayNumber",
          "customerId",
          "customerName",
          "customerEmail",
          "companyName"
        ]
      },
      "CommercePaymentLedgerEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "REFUND",
              "REFUND_REVERSAL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "COMPLETED",
              "FAILED",
              "VOIDED"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "CASH",
              "CHECK",
              "BANK_TRANSFER",
              "STORE_CREDIT",
              "CARD",
              "OTHER"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Signed by intent via `direction`; always a positive magnitude."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "actorType": {
            "type": "string",
            "description": "Who recorded it: USER | SYSTEM."
          },
          "actorId": {
            "type": "string",
            "nullable": true,
            "description": "Actor id — a user id for USER, or a system identifier for SYSTEM."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment/refund actually occurred (business date)."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the ledger row was written."
          },
          "record": {
            "$ref": "#/components/schemas/CommercePaymentLedgerRecordDto"
          }
        },
        "required": [
          "id",
          "direction",
          "status",
          "method",
          "amountInCents",
          "currency",
          "actorType",
          "actorId",
          "occurredAt",
          "createdAt",
          "record"
        ]
      },
      "CommercePaymentLedgerListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommercePaymentLedgerEntryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque `(occurredAt,id)` cursor for the next business-date-ordered page, or null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CommerceCustomerOptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "normalizedEmail": {
            "type": "string",
            "description": "Normalized (folded) email — the picker label / secondary match."
          },
          "phone": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "name",
          "normalizedEmail",
          "phone"
        ]
      },
      "CommerceCustomerOptionListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceCustomerOptionDto"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "MerchantCommerceRecordReadDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ],
            "description": "Commercial lifecycle axis (DRAFT→SENT→ACCEPTED/DECLINED/EXPIRED→CONVERTED, plus terminal VOIDED/CANCELLED). Forward-only; drives which lifecycle actions are permitted. Independent of the payment/fulfillment/signature axes."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "description": "Payment axis, derived from the payment/refund ledger. Full value space: NOT_REQUIRED, UNPAID, PARTIALLY_PAID, PAID, PARTIALLY_REFUNDED, REFUNDED, FAILED, CANCELLED. Moves independently of the commercial status."
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ],
            "description": "Shipment fulfillment axis. Committed orders with positive PRODUCT quantity start UNFULFILLED; orders without shippable PRODUCT quantity remain NOT_REQUIRED. Booking/service and subscription entitlement work stays on its operational projection."
          },
          "outboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "nullable": true,
            "description": "Canonical outbound physical handoff mode; null when not planned."
          },
          "outboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "inboundFulfillmentMode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "RETRIEVAL",
              "CUSTOMER_RETURN"
            ],
            "nullable": true,
            "description": "Canonical inbound return handoff mode; null when not planned."
          },
          "inboundDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Deprecated display-only compatibility summary derived from authoritative agreement requirements/satisfactions, with a legacy execution fallback. Full value space: NOT_REQUIRED, PENDING, SIGNED, DECLINED, EXPIRED, CANCELLED. Never use it to authorize or gate a command."
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Human-facing document number (e.g. Q-1001, INV-1001, C-1001), allocated once at send/issue and stable for the life of the record. Null while DRAFT. Customers address account documents by this number."
          },
          "displayNumberKind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ],
            "nullable": true,
            "description": "Which numbering series allocated displayNumber (QUOTE/INVOICE/…)."
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "customerPhone": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The source quote this order was converted from (#1333)."
          },
          "orderRecordId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Authoritative shared-commerce order linked to this invoice, when present."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "paymentTermPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Payment-term preset applied to this record; its terms are frozen into paymentTermsSnapshot at send. Null when no terms apply."
          },
          "paymentTermsSnapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Frozen payment-terms snapshot (net-days / deposit schedule) captured at send from paymentTermPresetId. Null when no terms apply."
          },
          "taxExempt": {
            "type": "boolean"
          },
          "taxExemptionReason": {
            "type": "string",
            "nullable": true
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "shippingInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Document total in minor units (cents). Commerce money amounts are 32-bit integer cents by design: document totals are capped at 2,147,483,647 cents (~$21.47M), and per-amount line inputs at ±1,000,000,000 cents ($10M). Pricing writes that would exceed these bounds are rejected with 400."
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross recorded payments (minor units), derived from the payment ledger. Net paid = amountPaidInCents − refundedInCents."
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total refunded (minor units), derived from the payment ledger."
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Outstanding balance (minor units): max(0, totalInCents − amountPaidInCents), i.e. based on GROSS payments. A refund does NOT re-open the balance (ADR-013); the refund dimension lives on refundedInCents + paymentStatus. Zero once gross payments cover the total. An Order with linked invoices (E11, once activated) mirrors its sale once one has been issued: the issued-invoice projection sets this balance and paymentStatus from its live issued invoices whenever a linked invoice is issued, takes money, or ends after it was issued, and amountPaidInCents and refundedInCents report only the Order's own ledger. A never-sent draft, created or cancelled, leaves this balance and paymentStatus as they were. The sale's paid and refunded totals are its invoice-capacity position. When an issued linked invoice ends and no issued one remains live, the projection sets 0 and NOT_REQUIRED. Once every linked invoice has ended, a direct Order payment is accepted and sets all four values from the Order's own ledger."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "declinedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "voidedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "convertedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "externalSource": {
            "type": "string",
            "nullable": true,
            "description": "System of record for an externally-originated document (e.g. a wholesale ERP). Together with externalId it forms the external identity; the list filter requires externalSource whenever externalId is supplied."
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "description": "Opaque id of this document in the externalSource system. The triple (organization, externalSource, externalId) is unique — many externalIds may exist per source, each unique within its (organization, externalSource) pair — which enables idempotent external imports."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "revisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceRecordRevisionDto"
            }
          },
          "lineGroups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceLineGroupDto"
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceLineDto"
            }
          },
          "fulfillments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceFulfillmentDto"
            }
          },
          "contractPackets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceContractPacketDto"
            }
          },
          "bookingId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Booking operations record linked through the booking-side commerceRecordId foreign key, or null."
          }
        },
        "required": [
          "id",
          "organizationId",
          "type",
          "source",
          "commercialStatus",
          "paymentStatus",
          "fulfillmentStatus",
          "outboundFulfillmentMode",
          "outboundDueAt",
          "inboundFulfillmentMode",
          "inboundDueAt",
          "signatureStatus",
          "displayNumber",
          "displayNumberKind",
          "customerId",
          "customerName",
          "customerEmail",
          "customerPhone",
          "companyName",
          "orderId",
          "sourceRecordId",
          "orderRecordId",
          "currency",
          "paymentTermPresetId",
          "paymentTermsSnapshot",
          "taxExempt",
          "taxExemptionReason",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "expiresAt",
          "sentAt",
          "acceptedAt",
          "declinedAt",
          "cancelledAt",
          "voidedAt",
          "convertedAt",
          "externalSource",
          "externalId",
          "metadata",
          "createdAt",
          "updatedAt",
          "revisions",
          "lineGroups",
          "lines",
          "fulfillments",
          "contractPackets",
          "bookingId"
        ]
      },
      "CommerceSignatureDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "packetId": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "MERCHANT",
              "INTERNAL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "signerName": {
            "type": "string",
            "nullable": true
          },
          "signerEmail": {
            "type": "string",
            "nullable": true
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "declinedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "packetId",
          "role",
          "status",
          "signerName",
          "signerEmail",
          "signedAt",
          "declinedAt",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommerceContractPacketDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "VOIDED"
            ]
          },
          "title": {
            "type": "string"
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Human-facing contract number (e.g. C-1001), allocated at send. Null while DRAFT."
          },
          "contentSnapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "provider": {
            "type": "string",
            "nullable": true,
            "description": "External e-signature provider, when the packet is fulfilled off-platform. Null for first-party (in-app) signing, the only mode shipped in M3.5."
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "description": "Provider-side packet id when provider is set."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "declinedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceSignatureDto"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "recordId",
          "revisionId",
          "status",
          "title",
          "displayNumber",
          "contentSnapshot",
          "provider",
          "externalId",
          "sentAt",
          "signedAt",
          "declinedAt",
          "expiresAt",
          "createdAt",
          "updatedAt",
          "signatures"
        ]
      },
      "CommercePaymentTransactionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "REFUND",
              "REFUND_REVERSAL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "COMPLETED",
              "FAILED",
              "VOIDED"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "CASH",
              "CHECK",
              "BANK_TRANSFER",
              "STORE_CREDIT",
              "CARD",
              "OTHER"
            ]
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Signed by intent via `direction`; always a positive magnitude."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-supplied reference (cheque no., transfer id, …)."
          },
          "actorType": {
            "type": "string",
            "description": "Who recorded it: USER | SYSTEM."
          },
          "actorId": {
            "type": "string",
            "nullable": true,
            "description": "Actor id — a user id for USER, or a system identifier (e.g. \"stripe-webhook\") for SYSTEM."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment/refund actually occurred (business date)."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the ledger row was written."
          }
        },
        "required": [
          "id",
          "direction",
          "status",
          "method",
          "amountInCents",
          "currency",
          "reference",
          "actorType",
          "actorId",
          "occurredAt",
          "createdAt"
        ]
      },
      "CommercePaymentTransactionListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommercePaymentTransactionDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Cursor for the next page (last entry id), or null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CommerceActivityEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The revision the event anchors to, when revision-scoped."
          },
          "eventType": {
            "type": "string",
            "description": "Dotted event type, e.g. `commerce.record.sent`."
          },
          "actorType": {
            "type": "string",
            "nullable": true,
            "description": "USER (merchant staff) | TOKEN (customer action link) | SYSTEM (webhook/sweep)."
          },
          "actorId": {
            "type": "string",
            "nullable": true,
            "description": "User id for USER, token id for TOKEN, or a system identifier (e.g. \"expiry-sweep\") for SYSTEM."
          },
          "customerVisible": {
            "type": "boolean"
          },
          "moneyMoving": {
            "type": "boolean"
          },
          "statusChanging": {
            "type": "boolean"
          },
          "permissionSensitive": {
            "type": "boolean",
            "description": "True when the event records the exercise of a permission-gated (high-risk) capability (#651)."
          },
          "fromStatus": {
            "type": "string",
            "nullable": true
          },
          "toStatus": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "Reason captured by the high-risk gate, when one was given."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Allow-listed event detail (ids/numbers/enums/timestamps); audit-only values are excluded."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "revisionId",
          "eventType",
          "actorType",
          "actorId",
          "customerVisible",
          "moneyMoving",
          "statusChanging",
          "permissionSensitive",
          "fromStatus",
          "toStatus",
          "reason",
          "metadata",
          "createdAt"
        ]
      },
      "CommerceActivityEventListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceActivityEventDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Cursor for the next page (last event id), or null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CommerceInvoiceCreateMode": {
        "type": "string",
        "enum": [
          "STANDALONE",
          "EXISTING_ORDER",
          "SUCCESSOR"
        ],
        "description": "Invoices only (E11 #4841). `STANDALONE` also creates the lightweight, unnumbered DRAFT Order anchor, hidden from Sales Orders until first send; `EXISTING_ORDER` (requires `orderRecordId`) consumes an allocated base of an eligible MANUAL Order; `SUCCESSOR` (requires `predecessorInvoiceId` and an `x-idempotency-key`) reissues against the reserved base of a voided or cancelled, previously issued linked invoice. Once linked invoices are activated, a MANUAL invoice created without a mode is STANDALONE. Dormant: while not activated, any create naming a mode, `orderRecordId`, `commitmentBase` or `predecessorInvoiceId` returns 503 `COMMERCE_LINKED_INVOICE_UNAVAILABLE`."
      },
      "CommitmentBaseComponentDto": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string",
            "description": "Commitment component: a priced line ref from the Order's accepted snapshot, or `shipping`.",
            "maxLength": 200
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Take this many units of a line (its net and discount follow as floor shares). Omit both `quantity` and `netInCents` to take everything left of the component."
          },
          "netInCents": {
            "type": "integer",
            "minimum": 1,
            "description": "Take this much post-discount net, in cents (the discount share follows as a floor share). Mutually exclusive with `quantity`."
          }
        },
        "required": [
          "ref"
        ]
      },
      "CommitmentBaseSelectionDto": {
        "type": "object",
        "properties": {
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommitmentBaseComponentDto"
            }
          }
        },
        "required": [
          "components"
        ]
      },
      "CreateCommerceRecordDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "description": "Origin of the record. Defaults to MANUAL for staff-created docs.",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "customerId": {
            "type": "string",
            "description": "Linked customer id."
          },
          "customerName": {
            "type": "string",
            "description": "Customer display name captured on the document."
          },
          "customerEmail": {
            "type": "string",
            "description": "Customer email."
          },
          "customerPhone": {
            "type": "string",
            "description": "Customer phone."
          },
          "companyName": {
            "type": "string",
            "description": "Company / account name for B2B documents."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency, lower-case (e.g. `usd`). Defaults to `usd`."
          },
          "paymentTermPresetId": {
            "type": "string",
            "description": "Reusable payment-term preset id to snapshot on send."
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Document-level tax exemption."
          },
          "taxExemptionReason": {
            "type": "string",
            "description": "Reason for the tax exemption (audited)."
          },
          "expiresAt": {
            "type": "string",
            "description": "Quote/document expiry (ISO-8601). Required before sending a quote.",
            "format": "date-time"
          },
          "externalSource": {
            "type": "string",
            "description": "External source system (for import dedupe with externalId)."
          },
          "externalId": {
            "type": "string",
            "description": "External id, unique per (org, externalSource)."
          },
          "metadata": {
            "type": "object",
            "description": "Free-form metadata object stored on the record."
          },
          "invoiceMode": {
            "description": "Invoices only (E11 #4841). `STANDALONE` also creates the lightweight, unnumbered DRAFT Order anchor, hidden from Sales Orders until first send; `EXISTING_ORDER` (requires `orderRecordId`) consumes an allocated base of an eligible MANUAL Order; `SUCCESSOR` (requires `predecessorInvoiceId` and an `x-idempotency-key`) reissues against the reserved base of a voided or cancelled, previously issued linked invoice. Once linked invoices are activated, a MANUAL invoice created without a mode is STANDALONE. Dormant: while not activated, any create naming a mode, `orderRecordId`, `commitmentBase` or `predecessorInvoiceId` returns 503 `COMMERCE_LINKED_INVOICE_UNAVAILABLE`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceInvoiceCreateMode"
              }
            ]
          },
          "orderRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "EXISTING_ORDER mode: the same-tenant MANUAL Order to invoice. Ineligible, missing and cross-tenant targets are refused with 409 `COMMERCE_INVOICE_ORDER_INELIGIBLE` without revealing existence."
          },
          "commitmentBase": {
            "description": "EXISTING_ORDER mode: the base to consume. Omit for all remaining capacity.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommitmentBaseSelectionDto"
              }
            ]
          },
          "predecessorInvoiceId": {
            "type": "string",
            "format": "uuid",
            "description": "SUCCESSOR mode: the voided or cancelled, previously issued linked invoice whose reserved base this draft claims exactly (ADR-011 E11-5). Its Order must still be an eligible committed MANUAL Order; one live claim per base. Refusals are 409 `COMMERCE_INVOICE_ORDER_INELIGIBLE` with `details.reason`."
          }
        }
      },
      "UpdateCommerceRecordDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string",
            "description": "Linked customer id."
          },
          "customerName": {
            "type": "string",
            "description": "Customer display name."
          },
          "customerEmail": {
            "type": "string",
            "description": "Customer email."
          },
          "customerPhone": {
            "type": "string",
            "description": "Customer phone."
          },
          "companyName": {
            "type": "string",
            "description": "Company / account name."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency, lower-case."
          },
          "paymentTermPresetId": {
            "type": "string",
            "description": "Reusable payment-term preset id. Pass null to clear.",
            "nullable": true
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Document-level tax exemption."
          },
          "taxExemptionReason": {
            "type": "string",
            "description": "Reason for the tax exemption (audited)."
          },
          "expiresAt": {
            "type": "string",
            "description": "Quote/document expiry (ISO-8601). Pass null to clear.",
            "format": "date-time",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "description": "Free-form metadata object stored on the record."
          }
        }
      },
      "AcknowledgeExternalLabelRetirementDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "carrierResponsibilityAccepted": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Must be true. Confirms the merchant owns any required external carrier void and carrier-account refund; this is not provider proof."
          }
        },
        "required": [
          "reason",
          "carrierResponsibilityAccepted"
        ]
      },
      "AcknowledgeExternalLabelRetirementResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "CANCELLED"
            ]
          },
          "replayed": {
            "type": "boolean",
            "description": "True when the exact acknowledgement already completed and this request only reloaded it."
          },
          "message": {
            "type": "string",
            "description": "Server-authored merchant guidance. It never claims provider confirmation or carrier credit."
          },
          "acknowledgement": {
            "$ref": "#/components/schemas/CommerceExternalLabelRetirementAcknowledgementDto"
          },
          "record": {
            "$ref": "#/components/schemas/CommerceRecordDetailDto"
          }
        },
        "required": [
          "outcome",
          "replayed",
          "message",
          "acknowledgement",
          "record"
        ]
      },
      "HandoffCommerceFulfillmentDto": {
        "type": "object",
        "properties": {
          "notify": {
            "type": "boolean",
            "description": "Required customer-communication decision. True durably enqueues one shipment notification; false durably records suppression."
          },
          "trackingNumber": {
            "type": "string",
            "maxLength": 120,
            "description": "Optional tracking number for a READY shipment that does not already have one. An existing tracking number cannot be replaced at handoff."
          }
        },
        "required": [
          "notify"
        ]
      },
      "DeliverCommerceFulfillmentDto": {
        "type": "object",
        "properties": {
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "description": "The instant the merchant asserts the recipient received this shipment. Must be a valid ISO 8601 date-time, on or after the recorded handoff, and not in the future. Distinct from the server-recorded time of the assertion itself.",
            "example": "2026-09-12T18:30:00.000Z"
          },
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500,
            "description": "Required merchant-facing justification for asserting delivery without carrier confirmation. Stored as durable internal evidence and never exposed on a customer projection.",
            "example": "Recipient confirmed receipt by phone; carrier scan never posted."
          }
        },
        "required": [
          "deliveredAt",
          "reason"
        ]
      },
      "CreateCommerceFulfillmentLineDto": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "format": "uuid",
            "description": "Fulfillment-eligible CommerceLine id from the same ORDER CommerceRecord. Only positive PRODUCT lines are shipment-eligible; SERVICE, CUSTOM, FEE, DEPOSIT, and ADJUSTMENT lines are not. A REPLACEMENT_GOODS request may repeat a lineId when each entry names a different exact original allocation."
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Positive quantity fulfilled in this shipment. ORIGINAL_ORDER quantity is capped by the ordered line; REPLACEMENT_GOODS quantity is capped by its linked ReturnItem and original handed-off allocation. Multiple replacement entries can share a lineId while retaining distinct source links."
          },
          "replacementReturnItemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Required for REPLACEMENT_GOODS: the ReturnItem authorizing this replacement quantity."
          },
          "replacesFulfillmentLineId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Required for REPLACEMENT_GOODS: the exact original SHIPPED/DELIVERED fulfillment-line allocation being replaced."
          }
        },
        "required": [
          "lineId",
          "quantity"
        ]
      },
      "CreateCommerceFulfillmentDto": {
        "type": "object",
        "properties": {
          "goodsKind": {
            "type": "string",
            "enum": [
              "ORIGINAL_ORDER",
              "REPLACEMENT_GOODS"
            ],
            "default": "ORIGINAL_ORDER",
            "description": "Original-order goods own the canonical order rollup. Replacement goods require explicit per-line return/original-allocation links and project separately."
          },
          "lines": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCommerceFulfillmentLineDto"
            }
          },
          "notify": {
            "type": "boolean",
            "description": "Required customer-communication decision for this direct carrier handoff. True durably enqueues one shipment notification; false durably records suppression. DELIVERY and CUSTOMER_PICKUP require false."
          },
          "mode": {
            "type": "string",
            "enum": [
              "SHIPMENT",
              "DELIVERY",
              "CUSTOMER_PICKUP"
            ],
            "default": "SHIPMENT",
            "description": "Canonical outbound handoff mode. Defaults to SHIPMENT for backward compatibility; DELIVERY and CUSTOMER_PICKUP do not enqueue a shipment email."
          },
          "carrier": {
            "type": "string",
            "maxLength": 80,
            "nullable": true,
            "description": "Optional carrier label for this fulfillment."
          },
          "serviceLevel": {
            "type": "string",
            "maxLength": 80,
            "nullable": true,
            "description": "Optional carrier service level."
          },
          "trackingNumber": {
            "type": "string",
            "maxLength": 120,
            "nullable": true,
            "description": "Optional carrier tracking number."
          },
          "trackingUrl": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Optional http(s) carrier tracking URL."
          },
          "shippedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Shipment time; defaults to the current server time."
          }
        },
        "required": [
          "lines",
          "notify"
        ]
      },
      "SelectComposedProductDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid",
            "minLength": 1,
            "maxLength": 255,
            "description": "Tenant-owned composed parent Item id from the merchant package picker."
          },
          "expectedRevision": {
            "type": "number",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Exact composition revision shown by the package picker. A stale revision fails before any group or line is written."
          },
          "selectedQuantity": {
            "type": "number",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "servicePeriodStartsAt": {
            "type": "string",
            "format": "date-time",
            "description": "Operational window start for tracked RENTAL/SERVICE components. Must be supplied with servicePeriodEndsAt."
          },
          "servicePeriodEndsAt": {
            "type": "string",
            "format": "date-time",
            "description": "Operational window end for tracked RENTAL/SERVICE components. Must be later than servicePeriodStartsAt."
          }
        },
        "required": [
          "itemId",
          "expectedRevision",
          "selectedQuantity"
        ]
      },
      "CreateCommerceLineDto": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "SERVICE",
              "FEE",
              "DEPOSIT",
              "ADJUSTMENT",
              "CUSTOM"
            ]
          },
          "name": {
            "type": "string",
            "description": "Line name / label."
          },
          "quantity": {
            "type": "integer",
            "description": "Quantity (default 1).",
            "format": "int32",
            "minimum": 0,
            "maximum": 1000000
          },
          "unitPriceInCents": {
            "type": "integer",
            "description": "Unit price in cents. >= 0 for all categories except ADJUSTMENT (credit) lines, which may be negative.",
            "format": "int32",
            "minimum": -1000000000,
            "maximum": 1000000000
          },
          "groupId": {
            "type": "string",
            "description": "Line group id (must belong to this record)."
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "description": "Catalog item id (snapshot reference)."
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "description": "Catalog variant id (snapshot reference)."
          },
          "sku": {
            "type": "string",
            "description": "SKU snapshot."
          },
          "description": {
            "type": "string",
            "description": "Line description."
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Line-level tax exemption."
          },
          "taxExemptionReason": {
            "type": "string",
            "description": "Reason for the line tax exemption."
          },
          "servicePeriodStartsAt": {
            "type": "string",
            "description": "Service period start (ISO-8601).",
            "format": "date-time"
          },
          "servicePeriodEndsAt": {
            "type": "string",
            "description": "Service period end (ISO-8601).",
            "format": "date-time"
          },
          "depositPurpose": {
            "type": "string",
            "description": "Structured deposit purpose for DEPOSIT lines."
          },
          "tags": {
            "description": "Free-form tags.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "integer",
            "description": "Sort order within the record/group.",
            "format": "int32"
          },
          "metadata": {
            "type": "object",
            "description": "Free-form metadata object."
          }
        },
        "required": [
          "category",
          "name"
        ]
      },
      "UpdateCommerceLineDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Line name / label."
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "maximum": 1000000
          },
          "unitPriceInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": -1000000000,
            "maximum": 1000000000,
            "description": "Unit price in cents. Negative is only accepted when the line is an ADJUSTMENT (credit); enforced by the service."
          },
          "groupId": {
            "type": "string",
            "description": "Move the line to a group (must belong to this record), or `null` to ungroup it. Omit to leave the current group unchanged.",
            "nullable": true
          },
          "sku": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "taxExempt": {
            "type": "boolean"
          },
          "taxExemptionReason": {
            "type": "string"
          },
          "servicePeriodStartsAt": {
            "type": "string",
            "format": "date-time"
          },
          "servicePeriodEndsAt": {
            "type": "string",
            "format": "date-time"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "metadata": {
            "type": "object"
          }
        }
      },
      "CreateCommerceLineGroupDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "BUNDLE",
              "PACKAGE",
              "KIT",
              "PROPOSAL_SECTION",
              "CUSTOM"
            ]
          },
          "title": {
            "type": "string",
            "description": "Group title / section heading."
          },
          "description": {
            "type": "string"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": [
          "kind",
          "title"
        ]
      },
      "UpdateCommerceLineGroupDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "BUNDLE",
              "PACKAGE",
              "KIT",
              "PROPOSAL_SECTION",
              "CUSTOM"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "metadata": {
            "type": "object"
          }
        }
      },
      "SetLinePriceOverrideDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the override action — required by the high-risk gate (#651); recorded in the pricing snapshot and on the activity timeline.",
            "maxLength": 500
          },
          "unitPriceInCents": {
            "type": "integer",
            "description": "Overridden unit price in cents. >= 0 for all categories except ADJUSTMENT (credit) lines, which may be negative.",
            "format": "int32",
            "minimum": -1000000000,
            "maximum": 1000000000
          }
        },
        "required": [
          "unitPriceInCents"
        ]
      },
      "CommerceOverrideActionDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the override action — required by the high-risk gate (#651); recorded in the pricing snapshot and on the activity timeline.",
            "maxLength": 500
          }
        }
      },
      "SetDiscountOverrideDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the override action — required by the high-risk gate (#651); recorded in the pricing snapshot and on the activity timeline.",
            "maxLength": 500
          },
          "amountInCents": {
            "type": "integer",
            "description": "Fixed discount in cents (> 0). Mutually exclusive with percentDecimal.",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000
          },
          "percentDecimal": {
            "type": "string",
            "description": "Discount rate as a decimal string (\"0.10\" = 10%), 0 < rate <= 1, up to 4 decimal places. Mutually exclusive with amountInCents.",
            "example": "0.10"
          },
          "label": {
            "type": "string",
            "description": "Human-facing label rendered in the pricing explanation (defaults to \"Manual discount\").",
            "maxLength": 255
          }
        }
      },
      "SetTaxOverrideDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the override action — required by the high-risk gate (#651); recorded in the pricing snapshot and on the activity timeline.",
            "maxLength": 500
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Overridden document-level tax exemption."
          },
          "taxExemptionReason": {
            "type": "string",
            "description": "Exemption reason surfaced on the document (defaults to the override reason).",
            "maxLength": 500
          }
        },
        "required": [
          "taxExempt"
        ]
      },
      "ReconcilePosTerminalGenerationRequestDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for reconciling the original POS Terminal payment generation; required by this route, must not be blank, and recorded for audit.",
            "minLength": 1,
            "maxLength": 500,
            "pattern": "\\S"
          }
        },
        "required": [
          "reason"
        ]
      },
      "PosTerminalGenerationRecoveryResultDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "reconciled_unpaid",
              "awaiting_provider",
              "money_or_processing_hold",
              "manual_evidence_required"
            ]
          },
          "paymentAttemptId": {
            "type": "string",
            "description": "Exact local PaymentAttempt being reconciled, when found."
          },
          "paymentIntentId": {
            "type": "string",
            "description": "Server-verified provider PaymentIntent identity, if one is bound."
          }
        },
        "required": [
          "outcome"
        ]
      },
      "SendCommerceRecordDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for sending — required for high-risk send actions that mandate one (#651); recorded on the audit/activity timeline.",
            "maxLength": 500
          }
        }
      },
      "CustomerActionLinkDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Raw customer action token — returned ONCE at send. Deliver it to the customer; they read/act via /api/v1/customer/commerce/{quotes,invoices}/:tokenOrId."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the action link expires (document expiry + grace)."
          }
        },
        "required": [
          "token",
          "expiresAt"
        ]
      },
      "SendCommerceResultDto": {
        "type": "object",
        "properties": {
          "record": {
            "$ref": "#/components/schemas/CommerceRecordDetailDto"
          },
          "customerAction": {
            "nullable": true,
            "description": "The link minted by this send. Null only when an `x-idempotency-key` replays an already-committed linked-invoice send (E11 #4841): the raw token exists once, and issuing a new one would revoke the link the first response delivered.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerActionLinkDto"
              }
            ]
          }
        },
        "required": [
          "record",
          "customerAction"
        ]
      },
      "CommerceActionDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the action — required for high-risk actions that mandate one (#651); recorded on the audit/activity timeline.",
            "maxLength": 500
          }
        }
      },
      "CommerceCommitmentAmountsDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "nullable": true,
            "description": "Units. Null for shipping, and for a line once a share of it was taken by amount, after which its remaining units are unknowable."
          },
          "netInCents": {
            "type": "integer",
            "description": "Post-discount net, in cents."
          },
          "discountInCents": {
            "type": "integer",
            "description": "Allocated discount, in cents."
          },
          "grossInCents": {
            "type": "integer",
            "description": "Gross (net + discount), in cents."
          }
        },
        "required": [
          "quantity",
          "netInCents",
          "discountInCents",
          "grossInCents"
        ]
      },
      "CommerceCommitmentComponentDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "nullable": true,
            "description": "Units. Null for shipping, and for a line once a share of it was taken by amount, after which its remaining units are unknowable."
          },
          "netInCents": {
            "type": "integer",
            "description": "Post-discount net, in cents."
          },
          "discountInCents": {
            "type": "integer",
            "description": "Allocated discount, in cents."
          },
          "grossInCents": {
            "type": "integer",
            "description": "Gross (net + discount), in cents."
          },
          "ref": {
            "type": "string",
            "description": "A priced line ref from the Order's accepted snapshot, or `shipping`."
          },
          "kind": {
            "type": "string",
            "enum": [
              "LINE",
              "SHIPPING"
            ]
          },
          "taxInCents": {
            "type": "integer",
            "description": "Tax frozen on this component. Not part of the commitment; a component with tax can only be invoiced whole until per-base tax estimates exist."
          },
          "remaining": {
            "description": "What is left after every drafted, retained and reserved row.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceCommitmentAmountsDto"
              }
            ]
          }
        },
        "required": [
          "quantity",
          "netInCents",
          "discountInCents",
          "grossInCents",
          "ref",
          "kind",
          "taxInCents",
          "remaining"
        ]
      },
      "CommerceConsumedComponentDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "nullable": true,
            "description": "Units. Null for shipping, and for a line once a share of it was taken by amount, after which its remaining units are unknowable."
          },
          "netInCents": {
            "type": "integer",
            "description": "Post-discount net, in cents."
          },
          "discountInCents": {
            "type": "integer",
            "description": "Allocated discount, in cents."
          },
          "grossInCents": {
            "type": "integer",
            "description": "Gross (net + discount), in cents."
          },
          "ref": {
            "type": "string",
            "description": "The commitment component this entry consumed."
          },
          "kind": {
            "type": "string",
            "enum": [
              "LINE",
              "SHIPPING"
            ]
          }
        },
        "required": [
          "quantity",
          "netInCents",
          "discountInCents",
          "grossInCents",
          "ref",
          "kind"
        ]
      },
      "CommerceInvoiceSuccessionState": {
        "type": "string",
        "enum": [
          "CLAIMED",
          "RETAINED",
          "ENDED"
        ],
        "description": "CLAIMED: a never-sent successor draft; the base stays reserved. RETAINED: the successor was issued and holds the base. ENDED: the successor draft was cancelled before any send; the base stays reserved."
      },
      "CommerceInvoiceSuccessionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumptionId": {
            "type": "string",
            "format": "uuid",
            "description": "The reserved base claimed."
          },
          "predecessorInvoiceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "The voided or cancelled invoice replaced."
          },
          "successorInvoiceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "The successor invoice."
          },
          "state": {
            "description": "CLAIMED: a never-sent successor draft; the base stays reserved. RETAINED: the successor was issued and holds the base. ENDED: the successor draft was cancelled before any send; the base stays reserved.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceInvoiceSuccessionState"
              }
            ]
          },
          "claimedAt": {
            "type": "string",
            "format": "date-time"
          },
          "retainedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the successor was issued and took the base. Null unless `state` is RETAINED."
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the successor draft was cancelled before any send. Null unless `state` is ENDED."
          }
        },
        "required": [
          "id",
          "consumptionId",
          "predecessorInvoiceRecordId",
          "successorInvoiceRecordId",
          "state",
          "claimedAt",
          "retainedAt",
          "endedAt"
        ]
      },
      "CommerceCommitmentConsumptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "The linked invoice this row belongs to."
          },
          "kind": {
            "type": "string",
            "enum": [
              "EXISTING_ORDER",
              "STANDALONE"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFTED",
              "RETAINED",
              "RESERVED",
              "RELEASED"
            ],
            "description": "DRAFTED: a never-sent base. RETAINED: issued. RESERVED: issued, then voided or cancelled, and held for its successor. RELEASED: a never-sent draft was cancelled; it no longer counts against capacity."
          },
          "netInCents": {
            "type": "integer"
          },
          "discountInCents": {
            "type": "integer"
          },
          "grossInCents": {
            "type": "integer"
          },
          "components": {
            "description": "Empty for a STANDALONE row until its invoice is first sent, because its commitment is that first sent revision.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceConsumedComponentDto"
            }
          },
          "holderInvoiceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "The invoice that holds this base now: its original invoice until a successor is issued against it, then the last successor issued."
          },
          "claim": {
            "nullable": true,
            "description": "The live claim of a never-sent successor draft on this reserved base, if any.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceInvoiceSuccessionDto"
              }
            ]
          },
          "complete": {
            "type": "boolean",
            "description": "ADR-011 E11-7 completion: the holder is a live issued invoice whose balance due is 0 (PAID, NOT_REQUIRED, or refunded after full payment). A never-sent draft and a reserved base are never complete."
          }
        },
        "required": [
          "id",
          "invoiceRecordId",
          "kind",
          "state",
          "netInCents",
          "discountInCents",
          "grossInCents",
          "components",
          "holderInvoiceRecordId",
          "claim",
          "complete"
        ]
      },
      "CommerceLinkedOrderPositionDto": {
        "type": "object",
        "properties": {
          "issuedTotalInCents": {
            "type": "integer",
            "description": "Totals of the live issued invoices."
          },
          "grossPaidInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Gross payments across every linked invoice, voided or cancelled ones included. This is the sale's paid total; the Order's own amountPaidInCents covers only its own ledger."
          },
          "effectiveRefundedInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Effective refunds across every linked invoice, voided or cancelled ones included. This is the sale's refunded total; the Order's own refundedInCents covers only its own ledger."
          },
          "balanceDueInCents": {
            "type": "integer",
            "description": "What the live issued invoices still owe. The issued-invoice projection sets it onto the Order's balanceDueInCents whenever a linked invoice is issued, takes money, or ends after it was issued; cancelling a never-sent draft leaves the Order's balance as it was. After every linked invoice ends, a direct Order payment sets the Order's balance from its own ledger instead."
          },
          "reservedBaseInCents": {
            "type": "integer",
            "description": "Bases held by a voided or cancelled invoice and awaiting a successor."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "description": "ADR-013 status over the live issued invoices. The issued-invoice projection sets it onto the Order's paymentStatus whenever a linked invoice is issued, takes money, or ends after it was issued; cancelling a never-sent draft leaves the Order's status as it was. After every linked invoice ends, a direct Order payment sets the Order's status from its own ledger instead."
          }
        },
        "required": [
          "issuedTotalInCents",
          "grossPaidInCents",
          "effectiveRefundedInCents",
          "balanceDueInCents",
          "reservedBaseInCents",
          "paymentStatus"
        ]
      },
      "CommerceLinkedReconciliationExceptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "enum": [
              "RECONCILIATION_EXCEPTION",
              "CAPTURE_CASE"
            ],
            "description": "What holds the money, and so what `id` names: a reconciliation exception, or the retained capture case that the provider capture path keeps instead when it refuses to post a capture. A capture case is listed while OPEN."
          },
          "invoiceRecordId": {
            "type": "string",
            "format": "uuid"
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The payment attempt this money belongs to. A capture case always names one. Null when a reconciliation exception was recorded against the invoice without an attempt; `invoiceRecordId` is then its only binding."
          },
          "direction": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "REFUND",
              "REFUND_REVERSAL"
            ]
          },
          "amountInCents": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "RESOLVED"
            ]
          },
          "reasonCode": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source",
          "invoiceRecordId",
          "paymentAttemptId",
          "direction",
          "amountInCents",
          "currency",
          "status",
          "reasonCode",
          "occurredAt"
        ]
      },
      "CommerceInvoiceCapacityDto": {
        "type": "object",
        "properties": {
          "orderRecordId": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The Order's durable Customer; null when the Order names none."
          },
          "commitmentRevisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The accepted revision the commitment was read from; null when the Order has no accepted revision, so it has no commitment to invoice."
          },
          "commitmentReadable": {
            "type": "boolean",
            "description": "False when there is no accepted snapshot, or it lies outside the A1 commitment domain (for example a negative credit line); then `components` is empty and existing-Order invoices are refused."
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceCommitmentComponentDto"
            }
          },
          "consumptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceCommitmentConsumptionDto"
            }
          },
          "successions": {
            "description": "Every successor claim on this Order, oldest first, ended ones included.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceInvoiceSuccessionDto"
            }
          },
          "position": {
            "$ref": "#/components/schemas/CommerceLinkedOrderPositionDto"
          },
          "reconciliationExceptions": {
            "description": "Money held outside the ledger on the linked invoices, newest first: reconciliation exceptions and OPEN capture cases. A late provider success on a voided or cancelled invoice is shown here with the sale and stays bound to its original invoice and attempt.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceLinkedReconciliationExceptionDto"
            }
          }
        },
        "required": [
          "orderRecordId",
          "source",
          "commercialStatus",
          "currency",
          "customerId",
          "commitmentRevisionId",
          "commitmentReadable",
          "components",
          "consumptions",
          "successions",
          "position",
          "reconciliationExceptions"
        ]
      },
      "CreateCommerceTerminalRequestDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for collecting a card-present Terminal payment; required by this route, must not be blank, and recorded for audit.",
            "minLength": 1,
            "maxLength": 500,
            "pattern": "\\S"
          },
          "source": {
            "type": "string",
            "description": "Short source label for audit metadata.",
            "maxLength": 120
          }
        },
        "required": [
          "reason"
        ]
      },
      "CommerceTerminalConnectionTokenDto": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "description": "Short-lived Stripe Terminal connection token secret for the browser SDK."
          },
          "stripeAccountId": {
            "type": "string",
            "description": "Tenant connected Stripe account the Terminal token is scoped to."
          }
        },
        "required": [
          "secret",
          "stripeAccountId"
        ]
      },
      "CommerceTerminalPaymentIntentDto": {
        "type": "object",
        "properties": {
          "clientSecret": {
            "type": "string",
            "description": "PaymentIntent client secret for Stripe Terminal collect/process calls."
          },
          "paymentIntentId": {
            "type": "string",
            "description": "Stripe PaymentIntent id created on the tenant connected account."
          },
          "paymentAttemptId": {
            "type": "string",
            "description": "Internal PaymentAttempt id used by webhook reconciliation."
          },
          "stripeAccountId": {
            "type": "string",
            "description": "Tenant connected Stripe account the PaymentIntent lives on."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Server-authoritative balance due being collected, in cents."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          }
        },
        "required": [
          "clientSecret",
          "paymentIntentId",
          "paymentAttemptId",
          "stripeAccountId",
          "amountInCents",
          "currency"
        ]
      },
      "CommerceManualPaymentMethod": {
        "type": "string",
        "enum": [
          "CASH",
          "CHECK",
          "BANK_TRANSFER",
          "STORE_CREDIT",
          "OTHER"
        ],
        "description": "Manual/offline settlement method (cash, check, bank transfer, store credit, other). CARD is reserved for online Stripe capture and is rejected on this manual route."
      },
      "RecordCommercePaymentDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the action — required for high-risk actions that mandate one (#651); recorded on the audit/activity timeline.",
            "maxLength": 500
          },
          "amountInCents": {
            "type": "integer",
            "description": "Amount of the payment/refund in cents (> 0).",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000
          },
          "method": {
            "description": "Manual/offline settlement method (cash, check, bank transfer, store credit, other). CARD is reserved for online Stripe capture and is rejected on this manual route.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceManualPaymentMethod"
              }
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency. Defaults to the document currency; a mismatch is rejected.",
            "minLength": 3,
            "maxLength": 3
          },
          "reference": {
            "type": "string",
            "description": "Operator's external reference — check number, transfer id, etc.",
            "maxLength": 200
          },
          "occurredAt": {
            "type": "string",
            "description": "When the money actually moved (ISO 8601). Defaults to now.",
            "format": "date-time"
          }
        },
        "required": [
          "amountInCents",
          "method"
        ]
      },
      "PosCashRefundPreparedComponentDto": {
        "type": "object",
        "properties": {
          "componentKind": {
            "type": "string",
            "enum": [
              "LINE"
            ]
          },
          "componentKey": {
            "type": "string"
          },
          "lineId": {
            "type": "string",
            "format": "uuid"
          },
          "pricingRef": {
            "type": "string"
          },
          "originalGrossInCents": {
            "type": "integer"
          },
          "originalTaxInCents": {
            "type": "integer",
            "description": "Original frozen tax, for display. Submission never supplies a tax amount."
          },
          "committedGrossInCents": {
            "type": "integer"
          },
          "reservedGrossInCents": {
            "type": "integer"
          },
          "remainingGrossInCents": {
            "type": "integer"
          }
        },
        "required": [
          "componentKind",
          "componentKey",
          "lineId",
          "pricingRef",
          "originalGrossInCents",
          "originalTaxInCents",
          "committedGrossInCents",
          "reservedGrossInCents",
          "remainingGrossInCents"
        ]
      },
      "PosCashRefundPreparationDto": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "originalPaymentTransactionId": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string"
          },
          "originalAmountInCents": {
            "type": "integer"
          },
          "committedGrossInCents": {
            "type": "integer"
          },
          "reservedGrossInCents": {
            "type": "integer"
          },
          "remainingGrossInCents": {
            "type": "integer"
          },
          "components": {
            "description": "Advisory capacity, including exhausted/zero-price lines. Preparation reserves no money and works before forward tax filing.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCashRefundPreparedComponentDto"
            }
          }
        },
        "required": [
          "invoiceId",
          "orderId",
          "originalPaymentTransactionId",
          "currency",
          "originalAmountInCents",
          "committedGrossInCents",
          "reservedGrossInCents",
          "remainingGrossInCents",
          "components"
        ]
      },
      "PosCashRefundAllocationDto": {
        "type": "object",
        "properties": {
          "componentKind": {
            "type": "string",
            "enum": [
              "LINE"
            ]
          },
          "lineId": {
            "type": "string",
            "format": "uuid",
            "description": "Frozen Invoice line returned by cash preparation."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Explicit gross cents, including original tax."
          }
        },
        "required": [
          "componentKind",
          "lineId",
          "amountInCents"
        ]
      },
      "PosCashRefundDto": {
        "type": "object",
        "properties": {
          "paymentTransactionId": {
            "type": "string",
            "format": "uuid",
            "description": "The exact original payment selected in preparation."
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000
          },
          "allocations": {
            "minItems": 1,
            "maxItems": 100,
            "description": "Distinct explicit allocations summing exactly to amountInCents; capacity is rechecked at commit.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCashRefundAllocationDto"
            }
          },
          "reason": {
            "type": "string",
            "maxLength": 500,
            "description": "Required reason for cash returned to the customer; recorded in the financial audit."
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "External reference. Omitted, null or trimmed-empty means no external reference."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When cash was returned. Omitted/null chooses server time once. Retries must retain the original omission/null, not the returned timestamp."
          }
        },
        "required": [
          "paymentTransactionId",
          "amountInCents",
          "allocations",
          "reason"
        ]
      },
      "PosCashRefundResultDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.cash-refund/v1"
            ]
          },
          "commandId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "originalPaymentTransactionId": {
            "type": "string",
            "format": "uuid"
          },
          "refundPaymentTransactionId": {
            "type": "string",
            "format": "uuid"
          },
          "amountInCents": {
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "refundSequence": {
            "type": "integer"
          },
          "taxDisposition": {
            "type": "string",
            "enum": [
              "REVERSAL_INTENT",
              "MANUAL_NO_TAX_NO_CALL"
            ],
            "description": "REVERSAL_INTENT is durable pending tax bookkeeping, not proof of provider success. Manual-no-tax is an explicit no-call."
          },
          "replayed": {
            "type": "boolean",
            "description": "True for the same original command outcome; all financial identifiers/values remain unchanged."
          }
        },
        "required": [
          "version",
          "commandId",
          "invoiceId",
          "orderId",
          "originalPaymentTransactionId",
          "refundPaymentTransactionId",
          "amountInCents",
          "currency",
          "occurredAt",
          "refundSequence",
          "taxDisposition",
          "replayed"
        ]
      },
      "IssueCommerceStripeRefundDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Reason for the action — required for high-risk actions that mandate one (#651); recorded on the audit/activity timeline.",
            "maxLength": 500
          },
          "paymentTransactionId": {
            "type": "string",
            "format": "uuid",
            "description": "The COMPLETED online card PAYMENT ledger row whose original PaymentIntent this refund issues against."
          },
          "amountInCents": {
            "type": "integer",
            "description": "Amount to refund in cents (> 0). Partial or full, capped at both the targeted payment's amount and the record's net paid.",
            "format": "int32",
            "minimum": 1,
            "maximum": 1000000000
          },
          "allocations": {
            "minItems": 1,
            "maxItems": 100,
            "description": "Operator-specified component allocation. Gross component amounts must sum exactly to amountInCents and cannot exceed each component's remaining refundable balance.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RefundComponentAllocationDto"
            }
          }
        },
        "required": [
          "paymentTransactionId",
          "amountInCents",
          "allocations"
        ]
      },
      "RefundableComponentDto": {
        "type": "object",
        "properties": {
          "componentKind": {
            "type": "string",
            "enum": [
              "LINE",
              "SHIPPING"
            ],
            "description": "LINE is one frozen Sales line; SHIPPING is the frozen shipping component."
          },
          "componentKey": {
            "type": "string",
            "description": "Stable key identifying this component on the frozen revision. Echoed in capacity errors from the issue endpoint."
          },
          "lineId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Frozen Sales line id for LINE components; null for SHIPPING. Send this back as `allocations[].lineId` when allocating to a LINE."
          },
          "orderItemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Originating order item, when this component maps to one. Informational: return allocations against the same order item also consume capacity."
          },
          "grossAmountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total gross cents this component was billed for."
          },
          "allocatedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross cents already consumed by active refund allocations and by returns against the same order item."
          },
          "remainingInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross cents still allocatable. An `allocations[]` entry above this is rejected with REFUND_COMPONENT_CAPACITY_EXCEEDED."
          }
        },
        "required": [
          "componentKind",
          "componentKey",
          "lineId",
          "orderItemId",
          "grossAmountInCents",
          "allocatedInCents",
          "remainingInCents"
        ]
      },
      "RefundAllocationPreparationDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "description": "ISO currency of every amount in this payload."
          },
          "components": {
            "description": "Every refundable component on the frozen revision, including those with zero remaining cents so the operator can see why capacity is gone.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RefundableComponentDto"
            }
          }
        },
        "required": [
          "recordId",
          "currency",
          "components"
        ]
      },
      "CommerceCaptureCaseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Enrolled case reference; for a SIGNED_CAPTURE_AMOUNT_UNKNOWN diagnostic this is a conflict-evidence id that the capture-acceptance route does not accept. canRequestAcceptance distinguishes eligibility, subject to the route’s further checks."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "POSTED",
              "FULLY_RETURNED"
            ],
            "description": "Separate capture disposition; does not replace ledger-derived payment status."
          },
          "reasonCode": {
            "type": "string",
            "description": "Structured current refusal or capture classification."
          },
          "conflict": {
            "type": "boolean",
            "description": "Unresolved contradictory evidence; blocks financial disposition."
          },
          "expectedAmountInCents": {
            "type": "integer",
            "nullable": true,
            "description": "Immutable expected minor units; null when the original expected amount was invalid."
          },
          "expectedCurrency": {
            "type": "string",
            "nullable": true,
            "description": "Frozen expected currency, also used for recorded ledger amounts. Null when the original currency was invalid or a predecessor diagnostic did not retain it; never inferred from the current record or signed currency."
          },
          "capturedAmountInCents": {
            "type": "integer",
            "nullable": true,
            "description": "Verified full signed captured minor units; null for a missing-facts investigation diagnostic. Never the stored expected amount."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "description": "Signed currency; null when the ordinary successful delivery omitted it. Null prevents case acceptance."
          },
          "recordedAmountInCents": {
            "type": "integer",
            "description": "Amount recorded for this capture; zero while unposted, irrespective of Stripe success."
          },
          "returnedAmountInCents": {
            "type": "integer",
            "description": "Distinct verified successful refund evidence total; conflict may invalidate its use for disposition."
          },
          "recordedRefundAmountInCents": {
            "type": "integer",
            "description": "Distinct completed ledger refunds verified against this capture’s retained refund facts; separate from the provider-returned total."
          },
          "refundRecoveryStatus": {
            "type": "string",
            "enum": [
              "NOT_APPLICABLE",
              "PENDING",
              "REFUSED",
              "COMPLETE"
            ],
            "description": "Ordinary refund accounting recovery for a posted exact capture. PENDING means retained owner work is unfinished; REFUSED means its existing durable reconciliation refusal remains. COMPLETE is scoped to known retained observations, not future provider settlement. NOT_APPLICABLE means the capture is unposted or its money facts are unknown."
          },
          "occurredAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Signed occurrence time; null if absent on the ordinary successful path."
          },
          "acceptedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Staff acceptance time; null if no staff acceptance committed."
          },
          "acceptanceReason": {
            "type": "string",
            "nullable": true,
            "description": "Staff’s recorded reason; null if no staff acceptance committed."
          },
          "canRequestAcceptance": {
            "type": "boolean",
            "description": "Necessary evidence conditions only. Actor permission, high-risk reason, current identity, currency, document status and ledger cap are rechecked on acceptance."
          }
        },
        "required": [
          "id",
          "status",
          "reasonCode",
          "conflict",
          "expectedAmountInCents",
          "expectedCurrency",
          "capturedAmountInCents",
          "currency",
          "recordedAmountInCents",
          "returnedAmountInCents",
          "recordedRefundAmountInCents",
          "refundRecoveryStatus",
          "occurredAt",
          "acceptedAt",
          "acceptanceReason",
          "canRequestAcceptance"
        ]
      },
      "CommerceCaptureCaseListDto": {
        "type": "object",
        "properties": {
          "collectionHeld": {
            "type": "boolean",
            "description": "Full-history capture collection hold at read time, independent of pagination. True blocks new Terminal collection; manual recording eligibility is unchanged. False is a status snapshot, not collection authorization: the server rechecks under the record lock before admitting Terminal collection."
          },
          "data": {
            "description": "Up to 100 enrolled capture cases and unresolved missing-amount diagnostics, combined by immutable creation time, id and source descending. Follow nextCursor for older pages. Empty means no matching prospective item remains on this page; it does not prove historical accounting or provider settlement is complete.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceCaptureCaseDto"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when a further page existed at selection time. Pagination does not authorize collection or replace the server’s full-history capture hold."
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque continuation for the same organization and record; null when there is no further page. Newer inserts do not shift continuation; newly enrolled captures can replace earlier diagnostics, so refresh the newest page for current evidence. This is not a frozen historical snapshot."
          }
        },
        "required": [
          "collectionHeld",
          "data",
          "hasMore",
          "nextCursor"
        ]
      },
      "AcceptCommerceCaptureDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Required staff reason for recording this exact immutable capture; no money or provider identity may be supplied.",
            "maxLength": 500
          }
        },
        "required": [
          "reason"
        ]
      },
      "CustomerCommerceDocumentType": {
        "type": "string",
        "enum": [
          "QUOTE",
          "INVOICE"
        ]
      },
      "CustomerCommerceLineDto": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "SERVICE",
              "FEE",
              "DEPOSIT",
              "ADJUSTMENT",
              "CUSTOM"
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "number"
          },
          "includedQuantity": {
            "type": "number",
            "description": "Frozen operational quantity included. For package components this is compositionEffectiveQuantity; otherwise it equals quantity."
          },
          "unitPriceInCents": {
            "type": "number",
            "description": "Unit price in minor units (cents)."
          },
          "subtotalInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          },
          "intrinsicSavingsInCents": {
            "type": "number",
            "description": "Intrinsic COMPOSED_PRODUCT savings included in discountInCents."
          },
          "promotionDiscountInCents": {
            "type": "number",
            "description": "Coupon, automatic, bundle, or entitlement savings excluding intrinsic package savings."
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          },
          "servicePeriodStartsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "servicePeriodEndsAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "category",
          "name",
          "description",
          "quantity",
          "includedQuantity",
          "unitPriceInCents",
          "subtotalInCents",
          "discountInCents",
          "intrinsicSavingsInCents",
          "promotionDiscountInCents",
          "taxInCents",
          "totalInCents",
          "servicePeriodStartsAt",
          "servicePeriodEndsAt"
        ]
      },
      "CustomerCommerceLineGroupDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "BUNDLE",
              "PACKAGE",
              "KIT",
              "PROPOSAL_SECTION",
              "CUSTOM"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "selectedQuantity": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "nullable": true,
            "description": "Frozen top-level package quantity; null for an ordinary proposal section."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCommerceLineDto"
            }
          }
        },
        "required": [
          "kind",
          "title",
          "description",
          "selectedQuantity",
          "lines"
        ]
      },
      "CustomerCommerceDocumentDto": {
        "type": "object",
        "properties": {
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommerceDocumentType"
              }
            ]
          },
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Customer-visible document number, allocated at send."
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "CANCELLED"
            ]
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Display-only agreement compatibility summary; never an action authority or payment gate."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "revisionNumber": {
            "type": "number",
            "description": "The revision number this token addresses (immutable once sent)."
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Business expiry of the document (quotes). May be in the past."
          },
          "sentAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "acceptedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "subtotalInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          },
          "shippingInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          },
          "amountPaidInCents": {
            "type": "number"
          },
          "balanceDueInCents": {
            "type": "number"
          },
          "lineGroups": {
            "description": "Grouped line items (e.g. proposal sections), in display order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCommerceLineGroupDto"
            }
          },
          "lines": {
            "description": "Ungrouped line items, in display order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCommerceLineDto"
            }
          }
        },
        "required": [
          "type",
          "displayNumber",
          "commercialStatus",
          "paymentStatus",
          "fulfillmentStatus",
          "signatureStatus",
          "currency",
          "customerName",
          "companyName",
          "revisionNumber",
          "title",
          "expiresAt",
          "sentAt",
          "acceptedAt",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "balanceDueInCents",
          "lineGroups",
          "lines"
        ]
      },
      "CustomerInvoicePaymentDto": {
        "type": "object",
        "properties": {
          "clientSecret": {
            "type": "string",
            "description": "The PaymentIntent client secret for the Stripe Payment Element."
          },
          "publishableKey": {
            "type": "string",
            "description": "The Stripe publishable key for this environment."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "The tenant's connected Stripe account the PaymentIntent lives on. The client must initialize Stripe.js with `{ stripeAccount }` so the Payment Element confirms against it (mirrors the checkout PaymentSessionDto). null on the platform account (test/sandbox)."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Amount being charged (the outstanding balance), in cents."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          }
        },
        "required": [
          "clientSecret",
          "publishableKey",
          "stripeAccountId",
          "amountInCents",
          "currency"
        ]
      },
      "DeclineCommerceDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Optional reason for declining — recorded on the audit timeline.",
            "maxLength": 1000
          }
        }
      },
      "CustomerContractStatus": {
        "type": "string",
        "enum": [
          "SENT",
          "SIGNED",
          "DECLINED",
          "EXPIRED",
          "VOIDED"
        ]
      },
      "CustomerContractSignatureDto": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "MERCHANT",
              "INTERNAL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "signerName": {
            "type": "string",
            "nullable": true,
            "description": "Display name of the signatory."
          },
          "signedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "role",
          "status",
          "signerName",
          "signedAt"
        ]
      },
      "CustomerContractPacketDto": {
        "type": "object",
        "properties": {
          "displayNumber": {
            "type": "string",
            "nullable": true,
            "description": "Customer-visible contract number."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerContractStatus"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "sentAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "signedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "declinedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "signatures": {
            "description": "Signature requests on the packet, in creation order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerContractSignatureDto"
            }
          }
        },
        "required": [
          "displayNumber",
          "status",
          "title",
          "expiresAt",
          "sentAt",
          "signedAt",
          "declinedAt",
          "signatures"
        ]
      },
      "SignContractDto": {
        "type": "object",
        "properties": {
          "signerName": {
            "type": "string",
            "description": "Optional typed signer name recorded on the signature.",
            "maxLength": 200
          }
        }
      },
      "CustomerCommerceSummaryDto": {
        "type": "object",
        "properties": {
          "displayNumber": {
            "type": "string",
            "description": "Public document number (e.g. Q-1042) — the row handle."
          },
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Display-only agreement compatibility summary; never an action authority or payment gate."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total of the latest customer-visible revision, in minor units."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Business expiry, when set (quotes)."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the latest visible revision was sent."
          },
          "stale": {
            "type": "boolean",
            "description": "True while the merchant is revising: the shown revision has been superseded and an updated document will follow."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "displayNumber",
          "type",
          "commercialStatus",
          "paymentStatus",
          "signatureStatus",
          "currency",
          "totalInCents",
          "expiresAt",
          "sentAt",
          "stale",
          "createdAt"
        ]
      },
      "CustomerCommerceListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCommerceSummaryDto"
            }
          },
          "page": {
            "type": "integer",
            "format": "int32",
            "description": "1-based page number."
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "data",
          "page",
          "pageSize",
          "total"
        ]
      },
      "CustomerAccountCommerceLineDto": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "SERVICE",
              "FEE",
              "DEPOSIT",
              "ADJUSTMENT",
              "CUSTOM"
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "includedQuantity": {
            "type": "integer",
            "format": "int32",
            "description": "Frozen operational quantity; compositionEffectiveQuantity for package components."
          },
          "unitPriceInCents": {
            "type": "integer",
            "format": "int32"
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "intrinsicSavingsInCents": {
            "type": "integer",
            "format": "int32"
          },
          "promotionDiscountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalPriceInCents": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "category",
          "name",
          "description",
          "quantity",
          "includedQuantity",
          "unitPriceInCents",
          "subtotalInCents",
          "discountInCents",
          "intrinsicSavingsInCents",
          "promotionDiscountInCents",
          "taxInCents",
          "totalPriceInCents"
        ]
      },
      "CustomerAccountCommerceLineGroupDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "BUNDLE",
              "PACKAGE",
              "KIT",
              "PROPOSAL_SECTION",
              "CUSTOM"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "selectedQuantity": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAccountCommerceLineDto"
            }
          }
        },
        "required": [
          "kind",
          "title",
          "description",
          "selectedQuantity",
          "lines"
        ]
      },
      "CustomerCommerceDetailDto": {
        "type": "object",
        "properties": {
          "displayNumber": {
            "type": "string",
            "description": "Public document number (e.g. Q-1042) — the row handle."
          },
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Display-only agreement compatibility summary; never an action authority or payment gate."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code (lowercase)."
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Total of the latest customer-visible revision, in minor units."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Business expiry, when set (quotes)."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the latest visible revision was sent."
          },
          "stale": {
            "type": "boolean",
            "description": "True while the merchant is revising: the shown revision has been superseded and an updated document will follow."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "discountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxInCents": {
            "type": "integer",
            "format": "int32"
          },
          "lines": {
            "description": "Lines of the latest customer-visible revision.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAccountCommerceLineDto"
            }
          },
          "lineGroups": {
            "description": "Frozen grouped lines, including package headers and all component quantities and money.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAccountCommerceLineGroupDto"
            }
          }
        },
        "required": [
          "displayNumber",
          "type",
          "commercialStatus",
          "paymentStatus",
          "signatureStatus",
          "currency",
          "totalInCents",
          "expiresAt",
          "sentAt",
          "stale",
          "createdAt",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "lines",
          "lineGroups"
        ]
      },
      "PosPhysicalAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Omitted or null means no second address line; a supplied string must be nonblank."
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "state": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Omitted or null means no state/region supplied. This local save does not establish provider address or tax readiness."
          },
          "postalCode": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "description": "Assigned ISO 3166-1 alpha-2 country code, normalized to uppercase. No provider verification is implied.",
            "enum": [
              "AD",
              "AE",
              "AF",
              "AG",
              "AI",
              "AL",
              "AM",
              "AO",
              "AQ",
              "AR",
              "AS",
              "AT",
              "AU",
              "AW",
              "AX",
              "AZ",
              "BA",
              "BB",
              "BD",
              "BE",
              "BF",
              "BG",
              "BH",
              "BI",
              "BJ",
              "BL",
              "BM",
              "BN",
              "BO",
              "BQ",
              "BR",
              "BS",
              "BT",
              "BV",
              "BW",
              "BY",
              "BZ",
              "CA",
              "CC",
              "CD",
              "CF",
              "CG",
              "CH",
              "CI",
              "CK",
              "CL",
              "CM",
              "CN",
              "CO",
              "CR",
              "CU",
              "CV",
              "CW",
              "CX",
              "CY",
              "CZ",
              "DE",
              "DJ",
              "DK",
              "DM",
              "DO",
              "DZ",
              "EC",
              "EE",
              "EG",
              "EH",
              "ER",
              "ES",
              "ET",
              "FI",
              "FJ",
              "FK",
              "FM",
              "FO",
              "FR",
              "GA",
              "GB",
              "GD",
              "GE",
              "GF",
              "GG",
              "GH",
              "GI",
              "GL",
              "GM",
              "GN",
              "GP",
              "GQ",
              "GR",
              "GS",
              "GT",
              "GU",
              "GW",
              "GY",
              "HK",
              "HM",
              "HN",
              "HR",
              "HT",
              "HU",
              "ID",
              "IE",
              "IL",
              "IM",
              "IN",
              "IO",
              "IQ",
              "IR",
              "IS",
              "IT",
              "JE",
              "JM",
              "JO",
              "JP",
              "KE",
              "KG",
              "KH",
              "KI",
              "KM",
              "KN",
              "KP",
              "KR",
              "KW",
              "KY",
              "KZ",
              "LA",
              "LB",
              "LC",
              "LI",
              "LK",
              "LR",
              "LS",
              "LT",
              "LU",
              "LV",
              "LY",
              "MA",
              "MC",
              "MD",
              "ME",
              "MF",
              "MG",
              "MH",
              "MK",
              "ML",
              "MM",
              "MN",
              "MO",
              "MP",
              "MQ",
              "MR",
              "MS",
              "MT",
              "MU",
              "MV",
              "MW",
              "MX",
              "MY",
              "MZ",
              "NA",
              "NC",
              "NE",
              "NF",
              "NG",
              "NI",
              "NL",
              "NO",
              "NP",
              "NR",
              "NU",
              "NZ",
              "OM",
              "PA",
              "PE",
              "PF",
              "PG",
              "PH",
              "PK",
              "PL",
              "PM",
              "PN",
              "PR",
              "PS",
              "PT",
              "PW",
              "PY",
              "QA",
              "RE",
              "RO",
              "RS",
              "RU",
              "RW",
              "SA",
              "SB",
              "SC",
              "SD",
              "SE",
              "SG",
              "SH",
              "SI",
              "SJ",
              "SK",
              "SL",
              "SM",
              "SN",
              "SO",
              "SR",
              "SS",
              "ST",
              "SV",
              "SX",
              "SY",
              "SZ",
              "TC",
              "TD",
              "TF",
              "TG",
              "TH",
              "TJ",
              "TK",
              "TL",
              "TM",
              "TN",
              "TO",
              "TR",
              "TT",
              "TV",
              "TW",
              "TZ",
              "UA",
              "UG",
              "UM",
              "US",
              "UY",
              "UZ",
              "VA",
              "VC",
              "VE",
              "VG",
              "VI",
              "VN",
              "VU",
              "WF",
              "WS",
              "YE",
              "YT",
              "ZA",
              "ZM",
              "ZW"
            ]
          }
        },
        "required": [
          "line1",
          "city",
          "postalCode",
          "country"
        ]
      },
      "ReviewPosPhysicalLocationDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "address": {
            "$ref": "#/components/schemas/PosPhysicalAddressDto"
          }
        },
        "required": [
          "label",
          "address"
        ]
      },
      "PosPhysicalAddressSnapshotDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "description": "Null when no second address line was saved."
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "nullable": true,
            "description": "Null when no state/region was saved; no provider validity is implied."
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          }
        },
        "required": [
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "PosPhysicalLocationReviewDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "address": {
            "$ref": "#/components/schemas/PosPhysicalAddressSnapshotDto"
          },
          "reviewVersion": {
            "type": "string",
            "description": "Opaque review digest to pass back with unchanged reviewed input; not authorization or a capability token."
          },
          "taxMode": {
            "type": "string",
            "enum": [
              "stripe_tax",
              "manual_no_tax",
              "unconfigured"
            ],
            "description": "Effective tax mode, defaulting to stripe_tax when unset; unconfigured includes an unsupported mode or incomplete manual/no-tax acknowledgement. It does not establish cash or provider readiness."
          },
          "taxDisclosure": {
            "type": "string",
            "description": "Truthful tax/address disclosure for the review; local confirmation alone never enables cash or enrolled card."
          }
        },
        "required": [
          "label",
          "address",
          "reviewVersion",
          "taxMode",
          "taxDisclosure"
        ]
      },
      "CreatePosPhysicalLocationDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "address": {
            "$ref": "#/components/schemas/PosPhysicalAddressDto"
          },
          "reviewVersion": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Exact reviewVersion from the creation review for this normalized label/address and current tenant configuration. Any edit or context drift requires a fresh review."
          },
          "expectedAddressVersion": {
            "type": "number",
            "enum": [
              0
            ],
            "description": "Creation requires no prior address version. Existing identities are never overwritten by this command."
          },
          "confirmAddress": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicit acknowledgement that the returned normalized physical selling address was reviewed."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Required reason for settings.destructive_change. Do not include an address, credential, or payment data."
          }
        },
        "required": [
          "label",
          "address",
          "reviewVersion",
          "expectedAddressVersion",
          "confirmAddress",
          "reason"
        ]
      },
      "PosPhysicalLocationCreatedDto": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable local identity; resolve current state using GET /merchant/pos/physical-locations/{locationId}. Not a Terminal or inventory origin id."
          },
          "addressVersion": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "The immutable initial address version saved by this command, even if a later version exists."
          },
          "confirmationId": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable confirmation evidence id, not an independent API resource or payment capability."
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original confirmation time; exact retries retain it."
          },
          "providerEffect": {
            "type": "string",
            "enum": [
              "NONE"
            ],
            "description": "No Stripe or other provider operation occurred; card setup/enrollment is separate."
          },
          "defaultEffect": {
            "type": "string",
            "enum": [
              "UNCHANGED"
            ],
            "description": "This command did not change the business default. The new location was saved as non-default."
          }
        },
        "required": [
          "locationId",
          "addressVersion",
          "confirmationId",
          "confirmedAt",
          "providerEffect",
          "defaultEffect"
        ]
      },
      "PosPhysicalLocationCommandConflictDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Open-ended stable string code. Branch on known codes and fall back to the HTTP status and generic error envelope for an unknown code.",
            "example": "VALIDATION_FAILED",
            "x-extensible-enum": [
              "VALIDATION_FAILED",
              "CANADIAN_OPERATING_PROFILE_UNAVAILABLE",
              "AUTH_MISSING_TOKEN",
              "AUTH_INVALID_TOKEN",
              "MEMBERSHIP_REQUIRED",
              "TEAM_REMOVAL_UNAVAILABLE",
              "ROLE_INSUFFICIENT",
              "PLATFORM_ACCESS_DENIED",
              "RESOURCE_NOT_FOUND",
              "RESOURCE_CONFLICT",
              "DATABASE_ERROR",
              "INTERNAL_ERROR",
              "STOREFRONT_CONSENT_UNAVAILABLE",
              "BAD_REQUEST",
              "LIMIT_EXCEEDED",
              "RATE_LIMIT_EXCEEDED",
              "ORGANIZATION_SUSPENDED",
              "ORGANIZATION_ARCHIVED",
              "ORGANIZATION_ACCESS_UNAVAILABLE",
              "API_KEY_SCOPE_INSUFFICIENT",
              "COMMERCE_REVISION_IMMUTABLE",
              "COMMERCE_REVISION_STALE",
              "HIGH_RISK_REASON_REQUIRED",
              "HIGH_RISK_STEP_UP_REQUIRED",
              "COMMERCE_IDEMPOTENCY_CONFLICT",
              "COMMERCE_EXTERNAL_ID_CONFLICT",
              "COMMERCE_LIFECYCLE_INVALID",
              "COMMERCE_PAYMENT_INVALID",
              "COMMERCE_OVERRIDE_ACTIVE",
              "COMMERCE_LINKED_INVOICE_UNAVAILABLE",
              "COMMERCE_INVOICE_ORDER_INELIGIBLE",
              "API_KEY_SCOPE_GATED",
              "IMPORT_ROW_VALIDATION_FAILED",
              "IMPORT_ROW_CONFLICT",
              "IMPORT_ROW_UNRESOLVED_REFERENCE",
              "IMPORT_BATCH_TOO_LARGE",
              "POS_NOT_READY",
              "POS_SESSION_INVALID",
              "POS_ORGANIZATION_REQUIRED",
              "BOOKING_CAPACITY_UNAVAILABLE",
              "BOOKING_IDEMPOTENCY_CONFLICT",
              "BOOKING_CONFIGURATION_BUSY",
              "BOOKING_GROUP_LIMIT_EXCEEDED",
              "BOOKING_GROUP_INCOMPATIBLE",
              "BOOKING_GROUP_SECURITY_AUTH_UNSUPPORTED",
              "BOOKING_GROUP_IDEMPOTENCY_CONFLICT",
              "BOOKING_GROUP_ACTION_REQUIRED",
              "BOOKING_GROUP_ACTION_INVALID",
              "PLATFORM_BILLING_UNAVAILABLE",
              "PLATFORM_BILLING_QUOTE_STALE",
              "PLATFORM_BILLING_RECOVERY_REQUIRED",
              "BOOKING_DELIVERY_INVALID",
              "BOOKING_DELIVERY_DESTINATION_INVALID",
              "BOOKING_DELIVERY_UNAVAILABLE",
              "BOOKING_DELIVERY_OUT_OF_RANGE",
              "BOOKING_DELIVERY_CONFIGURATION_CHANGED",
              "AGREEMENT_ACTION_REQUIRED",
              "AGREEMENT_POLICY_INVALID",
              "AGREEMENT_APPLICABILITY_INVALID",
              "AGREEMENT_WAIVER_REASON_REQUIRED",
              "AGREEMENT_REQUIREMENT_INVALID",
              "ENTITLEMENT_TOKENS_UNAVAILABLE",
              "ENTITLEMENT_NOT_CONSUMABLE",
              "SUBSCRIPTION_PAYMENT_RECOVERY_UNAVAILABLE",
              "SUBSCRIPTION_PAYMENT_RECOVERY_UNSUPPORTED",
              "COMPOSITION_REVISION_STALE",
              "COMPOSITION_INVALID",
              "COMPOSITION_INVENTORY_CONFLICT",
              "COMPOSITION_COMPONENT_MAPPING_MISSING",
              "COMPOSITION_COMPONENT_MAPPING_AMBIGUOUS",
              "SUPPORT_PROVIDER_CONFIGURATION_UNAVAILABLE",
              "SUPPORT_PROVIDER_CONNECTION_CONFLICT",
              "SUBSCRIPTION_PAYMENT_RECOVERY_RESEND_REJECTED",
              "CATALOG_MEDIA_QUARANTINED",
              "EMAIL_SENDING_DOMAIN_LIFECYCLE_UNAVAILABLE",
              "CHECKOUT_PREPARED_PAYMENT_CONFLICT",
              "HOSTED_CHECKOUT_POLICY_UNAVAILABLE",
              "CHECKOUT_UNAVAILABLE",
              "HOSTED_CHECKOUT_RESTART_REFUSED",
              "API_SCHEMA_IDENTITY_UNAVAILABLE",
              "PLATFORM_BILLING_PLAN_CHANGE_REJECTED",
              "BOOKING_PRICE_CONFIRMATION_REQUIRED",
              "BOOKING_PRICE_CONFIRMATION_UNAVAILABLE",
              "EMAIL_TEST_RECIPIENT_REJECTED",
              "EMAIL_TEST_DELIVERY_UNAVAILABLE",
              "PRICING_POLICY_INCOMPATIBLE",
              "CHECKOUT_IDENTITY_CHANGED",
              "CHECKOUT_IDENTITY_VERIFICATION_REQUIRED",
              "ORDER_REFERENCE_UNAVAILABLE",
              "ORDER_REFERENCE_SERVICE_UNAVAILABLE",
              "PLATFORM_TAX_UNAVAILABLE",
              "TENANT_TAX_NOT_CONFIGURED",
              "POS_SALE_REJECTED",
              "POS_SALE_FILTER_READ_UNAVAILABLE",
              "POS_SALE_REJECTION_PERSISTENCE_FAILED",
              "POS_CUSTOMER_CREATE_PERSISTENCE_UNAVAILABLE",
              "POS_SALE_CUSTOMER_CHANGE_UNAVAILABLE",
              "CHECKOUT_ALREADY_PAID",
              "CHECKOUT_SAVED_CARD_CHOICE_MISMATCH",
              "CHECKOUT_ANALYTICS_ADOPTION_UNAVAILABLE",
              "CHECKOUT_ANALYTICS_ADOPTION_REJECTED",
              "PAYMENT_POLICY_SETTINGS_UNAVAILABLE",
              "PAYMENT_POLICY_REVISION_CONFLICT",
              "PAYMENT_POLICY_SAVE_REJECTED",
              "POS_PAYMENT_PROOF_NOT_SETTLED",
              "POS_PAYMENT_PROOF_UNAVAILABLE",
              "POS_TERMINAL_OUTCOME_CONFLICT",
              "POS_TERMINAL_OUTCOME_UNAVAILABLE",
              "POS_TERMINAL_NOTIFICATION_UNAVAILABLE",
              "RETURN_STAFF_CREATION_UNAVAILABLE",
              "DOMAIN_VERIFICATION_UNAVAILABLE",
              "NUMBERING_SAVE_REJECTED",
              "NUMBERING_FORMAT_INVALID",
              "NUMBERING_FORMAT_LOCKED",
              "NUMBERING_WRITES_UNAVAILABLE",
              "NUMBERING_AUDIT_UNAVAILABLE",
              "RETURN_REQUESTED_REVIEW_STALE",
              "USAGE_ALERT_SETTINGS_UNAVAILABLE",
              "STOCK_LOCATION_WRITES_UNAVAILABLE",
              "STOCK_LOCATION_LOOKUP_UNAVAILABLE",
              "COUPON_ATTEMPT_LIMITED",
              "COUPON_ATTEMPT_UNAVAILABLE",
              "CUSTOMS_PROFILE_UNAVAILABLE"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation. Not localized.",
            "example": "Request body failed validation"
          },
          "details": {
            "type": "object",
            "description": "Optional structured conflict context. Generic conflicts may omit reason and rejection or include other context; they do not establish verified rejection.",
            "additionalProperties": true,
            "properties": {
              "reason": {
                "type": "string",
                "description": "Stable local-command conflict reason when present."
              },
              "organizationId": {
                "type": "string",
                "description": "Present only with qualified rejection: the actual API-authenticated immutable organization ID. Require an exact match to the dispatched frozen tenant ID. Missing or mismatched identity remains held; this is response scope evidence, not another request receipt."
              },
              "rejection": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "classification",
                  "operation"
                ],
                "description": "Present only with IDEMPOTENCY_CONFLICT when valid immutable evidence proves a different request occupies the exact authenticated tenant/key. It rejects only the dispatched candidate, without disclosing the other request or claiming its success. Absence does not establish rejection: retain the original key/body and hold uncertain outcomes. Require sibling organizationId to match the dispatched frozen immutable tenant ID; bind this marker to that exact command and operator; acknowledgment and any fresh review/new key are separate explicit actions, never automatic redispatch.",
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.physical-location-command-rejection/v1"
                    ]
                  },
                  "classification": {
                    "type": "string",
                    "enum": [
                      "DIFFERENT_REQUEST_OCCUPIES_KEY"
                    ]
                  },
                  "operation": {
                    "type": "string",
                    "enum": [
                      "CREATE",
                      "ADDRESS",
                      "SET_DEFAULT"
                    ],
                    "description": "The rejected candidate operation, not the occupying request operation."
                  }
                }
              }
            }
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "PosPhysicalConfirmationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable evidence identity; not a payment capability or independent route."
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "confirmedAt"
        ]
      },
      "PosPhysicalLocationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Local identity accepted by the detail route; not a Terminal binding or inventory origin."
          },
          "label": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean",
            "description": "Stored active state, necessary but not sufficient for payment readiness."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Stored local default flag; it does not by itself establish cash or card readiness."
          },
          "addressVersion": {
            "type": "number",
            "minimum": 0,
            "description": "Current immutable address version. Zero means no address has been published."
          },
          "address": {
            "nullable": true,
            "description": "Null only at version zero; never substitutes the organization, shipping or provider address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPhysicalAddressSnapshotDto"
              }
            ]
          },
          "confirmation": {
            "nullable": true,
            "description": "Null when this exact current address version has no explicit confirmation. A confirmation records review, not current account/tax/payment readiness or Terminal enrollment.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPhysicalConfirmationDto"
              }
            ]
          },
          "taxMode": {
            "type": "string",
            "enum": [
              "stripe_tax",
              "manual_no_tax",
              "unconfigured"
            ],
            "description": "Current effective tax mode in the same read snapshot as this location, defaulting to stripe_tax when unset. Unconfigured includes incomplete manual/no-tax acknowledgement; this is not the historical confirmation context or proof of payment readiness."
          },
          "taxDisclosure": {
            "type": "string",
            "description": "Current tax responsibility and physical-address authority disclosure, including the separate pre-enrollment card address. Local confirmation alone does not enable payments."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "label",
          "isActive",
          "isDefault",
          "addressVersion",
          "address",
          "confirmation",
          "taxMode",
          "taxDisclosure",
          "createdAt",
          "updatedAt"
        ]
      },
      "PosPhysicalLocationListDto": {
        "type": "object",
        "properties": {
          "locations": {
            "description": "One page of this tenant's locations, including inactive and unconfirmed records. Empty means none remain after the cursor, not that cash is ready.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosPhysicalLocationDto"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether more rows existed at this read. Paging is not a frozen snapshot."
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Null at the end of this read; otherwise pass unchanged as cursor to continue."
          }
        },
        "required": [
          "locations",
          "hasMore",
          "nextCursor"
        ]
      },
      "PosSellingContextUnavailableHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "UNAVAILABLE"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "SCHEMA_NOT_READY",
              "READ_UNVERIFIED"
            ],
            "description": "Schema/binary proof is unavailable, or the scoped read could not be verified. Neither reason means no explicit choice, no eligible place or permission to use a default."
          }
        },
        "required": [
          "kind",
          "reason"
        ]
      },
      "PosSellingContextExpectationHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.selling-context-expectation/v1"
            ]
          },
          "selectionGeneration": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483646,
            "description": "Default source requires zero; installation source requires at least one. Zero is not a tenant-default history/ABA clock."
          },
          "source": {
            "type": "string",
            "enum": [
              "INSTALLATION",
              "TENANT_DEFAULT"
            ]
          },
          "locationId": {
            "type": "string",
            "description": "Effective local identity for display/correlation. The selection route accepts only its exact untrusted generation/version expectation; this read supplies no private sale, address, enrollment or payment authority."
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          }
        },
        "required": [
          "contract",
          "selectionGeneration",
          "source",
          "locationId",
          "addressVersion"
        ]
      },
      "PosSellingContextNeverExplicitHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "NEVER_EXPLICIT"
            ]
          },
          "everExplicit": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "generation": {
            "type": "number",
            "enum": [
              0
            ]
          },
          "choice": {
            "oneOf": [
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Always null for a positively verified never-explicit installation; unavailable reads never manufacture this state."
          }
        },
        "required": [
          "kind",
          "everExplicit",
          "generation",
          "choice"
        ]
      },
      "PosSellingContextStoredChoiceHttpDto": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Retained explicitly chosen local identity, including an invalid or removed choice. Presence is not current eligibility."
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "label": {
            "type": "string",
            "nullable": true,
            "description": "Current label when the retained identity can be read; null when that identity is removed. Null never restores default inheritance."
          }
        },
        "required": [
          "locationId",
          "addressVersion",
          "label"
        ]
      },
      "PosSellingContextExplicitHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "EXPLICIT"
            ]
          },
          "everExplicit": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "generation": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "state": {
            "type": "string",
            "enum": [
              "SELECTED",
              "INVALID"
            ],
            "description": "INVALID retains the original explicit identity/generation and has no effective choice; it never silently inherits a default."
          },
          "choice": {
            "$ref": "#/components/schemas/PosSellingContextStoredChoiceHttpDto"
          }
        },
        "required": [
          "kind",
          "everExplicit",
          "generation",
          "state",
          "choice"
        ]
      },
      "PosSellingContextEffectiveHttpDto": {
        "type": "object",
        "properties": {
          "expectation": {
            "$ref": "#/components/schemas/PosSellingContextExpectationHttpDto"
          },
          "label": {
            "type": "string",
            "description": "Current effective local label; it establishes no payment or action readiness."
          }
        },
        "required": [
          "expectation",
          "label"
        ]
      },
      "PosSellingContextObservationHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.selling-context-observation/v1"
            ]
          },
          "selection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosSellingContextNeverExplicitHttpDto"
              },
              {
                "$ref": "#/components/schemas/PosSellingContextExplicitHttpDto"
              }
            ]
          },
          "effective": {
            "nullable": true,
            "description": "Null for an invalid explicit choice or when no active confirmed tenant default is effective for a never-explicit installation. Read the retained selection to distinguish these cases; unavailable reads have their own result. It is never collection/frozen-sale authority.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosSellingContextEffectiveHttpDto"
              }
            ]
          },
          "changeEligibility": {
            "type": "string",
            "enum": [
              "NOT_EVALUATED"
            ],
            "description": "No authoritative operation/money eligibility was evaluated. This value never enables changing choice, payment or releasing a native journal."
          }
        },
        "required": [
          "contract",
          "selection",
          "effective",
          "changeEligibility"
        ]
      },
      "PosSellingContextObservedHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "OBSERVED"
            ]
          },
          "observation": {
            "$ref": "#/components/schemas/PosSellingContextObservationHttpDto"
          }
        },
        "required": [
          "kind",
          "observation"
        ]
      },
      "PosSellingLocationOptionHttpDto": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "format": "uuid",
            "description": "Local identity for option display/correlation only. No selection/enrollment/payment action is registered by these reads."
          },
          "label": {
            "type": "string",
            "description": "Current local label; no full address is exposed."
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "isTenantDefault": {
            "type": "boolean",
            "description": "Observed tenant-default marker, not inheritance or action authority for this phone."
          },
          "isThisPhoneSelection": {
            "type": "boolean",
            "description": "True only when the current exact version/confirmation is this installation's valid explicit selection. False proves neither never-explicit nor removal; GET selling-context supplies that state."
          }
        },
        "required": [
          "locationId",
          "label",
          "addressVersion",
          "isTenantDefault",
          "isThisPhoneSelection"
        ]
      },
      "PosSellingLocationsPageHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.selling-locations/v1"
            ]
          },
          "data": {
            "description": "This bounded page of active confirmed local identities. Empty means this seek page has none at its SQL snapshot, not that the retained choice was removed or the installation never chose. Other pages may contain the selected/default identity; GET selling-context resolves selection separately. Unavailable reads use a separate result.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSellingLocationOptionHttpDto"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Eligible tenant-local count at this page's single SQL snapshot. Counts and membership may change between requests; this is not a frozen multi-page snapshot or readiness proof."
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "description": "Traversal ordinal carried by the cursor, starting at one. Concurrent changes can make this exceed the current totalPages."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0,
            "description": "ceil(total/limit) for the current SQL snapshot, zero when no eligible identities exist. It does not freeze subsequent pages."
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when one extra eligible row was observed beyond this bounded page. It supplies pagination only, never eligibility to switch or pay."
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "maxLength": 2048,
            "description": "Continuation cursor when hasMore is true; null means this seek page observed no continuation. It does not prove selected/default absence. Retain the same limit and authenticated tenant/installation; no credential or authority is carried."
          }
        },
        "required": [
          "contract",
          "data",
          "total",
          "page",
          "limit",
          "totalPages",
          "hasMore",
          "nextCursor"
        ]
      },
      "PosSellingLocationOptionsObservedHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "OBSERVED"
            ]
          },
          "options": {
            "$ref": "#/components/schemas/PosSellingLocationsPageHttpDto"
          }
        },
        "required": [
          "kind",
          "options"
        ]
      },
      "PosSellingContextReceiptExpectationHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.selling-context-expectation/v1"
            ]
          },
          "selectionGeneration": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646,
            "description": "Exactly original expectedGeneration plus one; never the current observation generation."
          },
          "source": {
            "type": "string",
            "enum": [
              "INSTALLATION"
            ],
            "description": "Immutable explicit result of the original command, independently of the current effective choice."
          },
          "locationId": {
            "type": "string",
            "description": "Effective local identity for display/correlation. The selection route accepts only its exact untrusted generation/version expectation; this read supplies no private sale, address, enrollment or payment authority."
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          }
        },
        "required": [
          "contract",
          "selectionGeneration",
          "source",
          "locationId",
          "addressVersion"
        ]
      },
      "PosSellingContextSelectionReceiptHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.selling-context-selection-receipt/v1"
            ]
          },
          "expectedGeneration": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483645
          },
          "selection": {
            "description": "Positive immutable result matching the original expected generation, location and address version. It is never a definitive rejection or current eligibility.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosSellingContextReceiptExpectationHttpDto"
              }
            ]
          }
        },
        "required": [
          "contract",
          "expectedGeneration",
          "selection"
        ]
      },
      "PosSellingContextCommandResultHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.selling-context-command-result/v1"
            ]
          },
          "receipt": {
            "$ref": "#/components/schemas/PosSellingContextSelectionReceiptHttpDto"
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosSellingContextObservedHttpDto"
              },
              {
                "$ref": "#/components/schemas/PosSellingContextUnavailableHttpDto"
              }
            ],
            "description": "Independent current observation. Newer selection, invalidation or unavailable current read never rewrites or erases the original receipt; NOT_EVALUATED supplies no money or journal-release authority."
          }
        },
        "required": [
          "contract",
          "receipt",
          "current"
        ]
      },
      "PosTerminalEnrollmentLocalExpectationDto": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "format": "uuid",
            "description": "Existing confirmed local identity; never a provider location ID or client authority."
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Enrollment CREATE requires an already confirmed positive local version; this is not physical-location creation at version zero."
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Expected current confirmation time in canonical UTC milliseconds. Server re-resolves the exact confirmation identity and current authority."
          }
        },
        "required": [
          "locationId",
          "addressVersion",
          "confirmedAt"
        ]
      },
      "PosMerchantEnrollmentLocalHttpDto": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "format": "uuid"
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "confirmedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Current confirmation time, null for an unconfirmed local version. Version zero is always unconfirmed; this state cannot become a qualified enrollment association."
          }
        },
        "required": [
          "locationId",
          "addressVersion",
          "confirmedAt"
        ]
      },
      "PosEnrollmentAssociationNotEvaluatedHttpDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NOT_EVALUATED"
            ]
          }
        },
        "required": [
          "state"
        ]
      },
      "PosEnrollmentAssociationUnavailableHttpDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "UNAVAILABLE"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "SCHEMA_NOT_READY",
              "READ_UNVERIFIED",
              "ACCOUNT_UNQUALIFIED",
              "LOCAL_UNCONFIRMED",
              "STALE_PROOF"
            ],
            "description": "Missing current proof, never positive absence or an unenrolled conclusion."
          }
        },
        "required": [
          "state",
          "reason"
        ]
      },
      "PosEnrollmentAssociationObservedHttpDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "OBSERVED"
            ]
          },
          "location": {
            "description": "Exact same positive local version/confirmation as setup.local. Parsing this tuple is not server qualification.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosTerminalEnrollmentLocalExpectationDto"
              }
            ]
          },
          "currentAccount": {
            "type": "string",
            "enum": [
              "OBSERVED_CURRENT"
            ],
            "description": "Server-qualified observation of current account context, never a client assertion or exposed account identity."
          },
          "currentAddress": {
            "type": "string",
            "enum": [
              "OBSERVED_CONFIRMED_CURRENT"
            ],
            "description": "Server-qualified current confirmed local observation joined to this same version."
          },
          "relation": {
            "type": "string",
            "enum": [
              "NONE",
              "EXPLICIT"
            ],
            "description": "NONE is positive absence of this governed current local/account relationship only; provider objects/history/pending effects may still exist. EXPLICIT is an actual reviewed current enrollment, never address matching or payment readiness."
          },
          "enrollmentRevision": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483646,
            "description": "Null exactly for NONE; positive current enrollment revision for EXPLICIT. No private enrollment/operation ID or action capability is exposed."
          }
        },
        "required": [
          "state",
          "location",
          "currentAccount",
          "currentAddress",
          "relation",
          "enrollmentRevision"
        ]
      },
      "PosTerminalEnrollmentSetupHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.terminal-enrollment.setup/v1"
            ]
          },
          "local": {
            "description": "Existing physical address reads remain separate and unchanged.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosMerchantEnrollmentLocalHttpDto"
              }
            ]
          },
          "association": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosEnrollmentAssociationNotEvaluatedHttpDto"
              },
              {
                "$ref": "#/components/schemas/PosEnrollmentAssociationUnavailableHttpDto"
              },
              {
                "$ref": "#/components/schemas/PosEnrollmentAssociationObservedHttpDto"
              }
            ],
            "description": "Qualification and positive absence are explicit and joined to the same local version. No card-ready/action flag or private identity is supplied."
          }
        },
        "required": [
          "contract",
          "local",
          "association"
        ]
      },
      "PosEnrollmentOriginalOperationHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.terminal-enrollment-operation-status/v1"
            ]
          },
          "operationState": {
            "type": "string",
            "enum": [
              "ADMITTED",
              "EFFECT_PENDING",
              "EFFECT_OBSERVED",
              "COMPLETED",
              "REJECTED"
            ],
            "description": "Qualified original operation state only; no generic HTTP/auth/current-read failure fabricates REJECTED."
          },
          "originalResult": {
            "type": "string",
            "nullable": true,
            "enum": [
              "ENROLLED",
              "NOT_ENROLLED",
              null
            ],
            "description": "Null while admitted/pending/observed but not finalized. COMPLETED is historical, and NOT_ENROLLED may retain observed provider effects; it never means nothing happened."
          },
          "currentEligibility": {
            "type": "string",
            "enum": [
              "NOT_EVALUATED"
            ],
            "description": "Original state/result supplies no current association/action/payment/replacement authority."
          }
        },
        "required": [
          "contract",
          "operationState",
          "originalResult",
          "currentEligibility"
        ]
      },
      "PosEnrollmentOriginalUnprovenHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "UNPROVEN"
            ]
          }
        },
        "required": [
          "kind"
        ]
      },
      "PosEnrollmentOriginalObservedHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "OBSERVED"
            ]
          },
          "operation": {
            "$ref": "#/components/schemas/PosEnrollmentOriginalOperationHttpDto"
          }
        },
        "required": [
          "kind",
          "operation"
        ]
      },
      "PosEnrollmentCurrentUnavailableHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "UNAVAILABLE"
            ]
          }
        },
        "required": [
          "kind"
        ]
      },
      "PosEnrollmentCurrentObservedHttpDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "OBSERVED"
            ]
          },
          "setup": {
            "$ref": "#/components/schemas/PosTerminalEnrollmentSetupHttpDto"
          }
        },
        "required": [
          "kind",
          "setup"
        ]
      },
      "PosTerminalEnrollmentAdoptReviewRequestDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.terminal-enrollment.review-request/v1"
            ]
          },
          "location": {
            "$ref": "#/components/schemas/PosTerminalEnrollmentLocalExpectationDto"
          },
          "action": {
            "type": "string",
            "enum": [
              "ADOPT"
            ],
            "description": "Reviewed existing-mapping adoption only; no provider-location creation or replacement action."
          },
          "candidateMappingReference": {
            "type": "string",
            "format": "uuid",
            "description": "Explicit existing merchant mapping UUID. Visibility is not enrollment or current eligibility."
          },
          "expectedPredecessor": {
            "type": "object",
            "additionalProperties": false,
            "nullable": true,
            "enum": [
              null
            ],
            "description": "ADOPT expects no predecessor. Null is an expectation, not proof of absence; predecessor-bearing actions remain separately gated."
          }
        },
        "required": [
          "contract",
          "location",
          "action",
          "candidateMappingReference",
          "expectedPredecessor"
        ]
      },
      "PosTerminalEnrollmentAdoptAdmissionRequestDto": {
        "type": "object",
        "properties": {
          "location": {
            "$ref": "#/components/schemas/PosTerminalEnrollmentLocalExpectationDto"
          },
          "contract": {
            "type": "string",
            "enum": [
              "pos.terminal-enrollment.admission-request/v1"
            ]
          },
          "reviewVersion": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Server-issued reviewed-context digest; not authentication or permission. Its authoritative source must bind current actor/tenant/local confirmation/account-link/candidate/predecessor and be freshly rechecked before admission."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Exact confirmed reason retained with the original request; never rebuilt from a later form during retry/status."
          },
          "confirmed": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicit confirmation expectation. It does not replace current Owner/Admin/high-risk authorization or fresh server review."
          },
          "action": {
            "type": "string",
            "enum": [
              "ADOPT"
            ]
          },
          "candidateMappingReference": {
            "type": "string",
            "format": "uuid",
            "description": "The exact mapping candidate retained with the original reviewed request."
          },
          "expectedPredecessor": {
            "type": "object",
            "additionalProperties": false,
            "nullable": true,
            "enum": [
              null
            ],
            "description": "Only the original null predecessor expectation is admitted by this ADOPT ingress; it grants no absence or replacement authority."
          }
        },
        "required": [
          "location",
          "contract",
          "reviewVersion",
          "reason",
          "confirmed",
          "action",
          "candidateMappingReference",
          "expectedPredecessor"
        ]
      },
      "PosTerminalEnrollmentAdoptReviewHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.terminal-enrollment.review/v1"
            ]
          },
          "reviewVersion": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Fresh server-reviewed digest bound to this request, actor, tenant and private current facts. A pure parser cannot issue or authorize it."
          },
          "setup": {
            "$ref": "#/components/schemas/PosTerminalEnrollmentSetupHttpDto"
          },
          "request": {
            "$ref": "#/components/schemas/PosTerminalEnrollmentAdoptReviewRequestDto"
          }
        },
        "required": [
          "contract",
          "reviewVersion",
          "setup",
          "request"
        ]
      },
      "PosTerminalEnrollmentAdoptStatusHttpDto": {
        "type": "object",
        "properties": {
          "contract": {
            "type": "string",
            "enum": [
              "pos.terminal-enrollment.status/v1"
            ]
          },
          "original": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosEnrollmentOriginalUnprovenHttpDto"
              },
              {
                "$ref": "#/components/schemas/PosEnrollmentOriginalObservedHttpDto"
              }
            ],
            "description": "Exact correlated original outcome, independently retained when current setup is unavailable."
          },
          "current": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosEnrollmentCurrentUnavailableHttpDto"
              },
              {
                "$ref": "#/components/schemas/PosEnrollmentCurrentObservedHttpDto"
              }
            ],
            "description": "A failed fresh read never erases original status. Current setup can have a newer address version; it never rewrites the original request or outcome."
          },
          "originalRequest": {
            "$ref": "#/components/schemas/PosTerminalEnrollmentAdoptAdmissionRequestDto"
          }
        },
        "required": [
          "contract",
          "original",
          "current",
          "originalRequest"
        ]
      },
      "ReviewPosPhysicalAddressDto": {
        "type": "object",
        "properties": {
          "expectedAddressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646,
            "description": "Exact current addressVersion from the location detail. Stale versions require fresh review."
          },
          "address": {
            "$ref": "#/components/schemas/PosPhysicalAddressDto"
          }
        },
        "required": [
          "expectedAddressVersion",
          "address"
        ]
      },
      "PosPhysicalLifecycleReviewDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Local identity accepted by the detail route; not a Terminal binding or inventory origin."
          },
          "label": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean",
            "description": "Stored active state, necessary but not sufficient for payment readiness."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Stored local default flag; it does not by itself establish cash or card readiness."
          },
          "addressVersion": {
            "type": "number",
            "minimum": 0,
            "description": "Current immutable address version. Zero means no address has been published."
          },
          "address": {
            "nullable": true,
            "description": "Null only at version zero; never substitutes the organization, shipping or provider address.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPhysicalAddressSnapshotDto"
              }
            ]
          },
          "confirmation": {
            "nullable": true,
            "description": "Null when this exact current address version has no explicit confirmation. A confirmation records review, not current account/tax/payment readiness or Terminal enrollment.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPhysicalConfirmationDto"
              }
            ]
          },
          "taxMode": {
            "type": "string",
            "enum": [
              "stripe_tax",
              "manual_no_tax",
              "unconfigured"
            ],
            "description": "Current effective tax mode in the same read snapshot as this location, defaulting to stripe_tax when unset. Unconfigured includes incomplete manual/no-tax acknowledgement; this is not the historical confirmation context or proof of payment readiness."
          },
          "taxDisclosure": {
            "type": "string",
            "description": "Current tax responsibility and physical-address authority disclosure, including the separate pre-enrollment card address. Local confirmation alone does not enable payments."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "action": {
            "type": "string",
            "enum": [
              "ADDRESS",
              "SET_DEFAULT"
            ]
          },
          "reviewVersion": {
            "type": "string",
            "description": "Digest of the reviewed action, address version and current configuration. It is not authorization. Return unchanged with the original input."
          },
          "reviewedAddress": {
            "description": "Exact normalized address being reviewed. For an address revision this is the proposed address; the inherited address field describes the current saved version.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPhysicalAddressSnapshotDto"
              }
            ]
          },
          "defaultLocationId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Current local default identity, or null when none exists. This is independent of the Terminal default."
          }
        },
        "required": [
          "id",
          "label",
          "isActive",
          "isDefault",
          "addressVersion",
          "address",
          "confirmation",
          "taxMode",
          "taxDisclosure",
          "createdAt",
          "updatedAt",
          "action",
          "reviewVersion",
          "reviewedAddress",
          "defaultLocationId"
        ]
      },
      "RevisePosPhysicalAddressDto": {
        "type": "object",
        "properties": {
          "expectedAddressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646,
            "description": "Exact current addressVersion from the location detail. Stale versions require fresh review."
          },
          "reviewVersion": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Exact digest returned by this action’s review, binding the address and current tenant/account/tax/default context."
          },
          "confirmAddress": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicitly confirms the reviewed physical address and the requested local configuration change."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Mandatory settings.destructive_change reason, retained in the command evidence but excluded from audit metadata. Do not include addresses, credentials or payment data."
          },
          "address": {
            "$ref": "#/components/schemas/PosPhysicalAddressDto"
          }
        },
        "required": [
          "expectedAddressVersion",
          "reviewVersion",
          "confirmAddress",
          "reason",
          "address"
        ]
      },
      "PosPhysicalLifecycleResultDto": {
        "type": "object",
        "properties": {
          "commandId": {
            "type": "string",
            "format": "uuid",
            "description": "Permanent command receipt id; evidence only, not a separately addressable resource."
          },
          "action": {
            "type": "string",
            "enum": [
              "ADDRESS",
              "SET_DEFAULT"
            ]
          },
          "locationId": {
            "type": "string",
            "format": "uuid",
            "description": "Local identity; GET /merchant/pos/physical-locations/{locationId} returns current state."
          },
          "addressVersion": {
            "type": "integer",
            "minimum": 1,
            "description": "Address version at the original successful command. Replay never substitutes a newer version."
          },
          "confirmationId": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable confirmation evidence used or created by the original command, not a payment capability."
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original completion time, retained on exact replay."
          },
          "previousDefaultLocationId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Local default before the original command; null means none existed. It does not describe the current default."
          },
          "defaultEffect": {
            "type": "string",
            "enum": [
              "UNCHANGED",
              "SELECTED"
            ],
            "description": "Original command effect only: ADDRESS never changes default; SET_DEFAULT selects the location or records an unchanged existing selection. Replay never republishes it."
          },
          "providerEffect": {
            "type": "string",
            "enum": [
              "NONE"
            ],
            "description": "No provider operation or Terminal enrollment occurred."
          }
        },
        "required": [
          "commandId",
          "action",
          "locationId",
          "addressVersion",
          "confirmationId",
          "confirmedAt",
          "completedAt",
          "previousDefaultLocationId",
          "defaultEffect",
          "providerEffect"
        ]
      },
      "ReviewPosPhysicalDefaultDto": {
        "type": "object",
        "properties": {
          "expectedAddressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646,
            "description": "Exact current addressVersion from the location detail. Stale versions require fresh review."
          }
        },
        "required": [
          "expectedAddressVersion"
        ]
      },
      "SetPosPhysicalDefaultDto": {
        "type": "object",
        "properties": {
          "expectedAddressVersion": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646,
            "description": "Exact current addressVersion from the location detail. Stale versions require fresh review."
          },
          "reviewVersion": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Exact digest returned by this action’s review, binding the address and current tenant/account/tax/default context."
          },
          "confirmAddress": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicitly confirms the reviewed physical address and the requested local configuration change."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Mandatory settings.destructive_change reason, retained in the command evidence but excluded from audit metadata. Do not include addresses, credentials or payment data."
          }
        },
        "required": [
          "expectedAddressVersion",
          "reviewVersion",
          "confirmAddress",
          "reason"
        ]
      },
      "RegisterPosSessionDto": {
        "type": "object",
        "properties": {
          "installationId": {
            "type": "string",
            "format": "uuid",
            "description": "Random per-installation identifier. The API stores only its SHA-256 hash."
          },
          "appVersion": {
            "type": "string",
            "example": "1.0.0"
          },
          "appBuild": {
            "type": "string",
            "example": "42"
          }
        },
        "required": [
          "installationId",
          "appVersion",
          "appBuild"
        ]
      },
      "PosSessionMembershipDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "organizationSlug": {
            "type": "string"
          },
          "organizationName": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "staff"
            ]
          },
          "permissionGroups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "permissionPresetId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "id",
          "organizationId",
          "organizationSlug",
          "organizationName",
          "role",
          "permissionGroups",
          "permissionPresetId"
        ]
      },
      "PosSessionResponseDto": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid",
            "description": "The cartonium user this POS session acts as. Payment outcome bindings carry this ID as actorUserId; it is not the Supabase auth user ID (#5227)."
          },
          "selectedOrganizationId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "selectedOrganizationSlug": {
            "type": "string",
            "nullable": true
          },
          "requiresOrganizationSelection": {
            "type": "boolean"
          },
          "memberships": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSessionMembershipDto"
            }
          }
        },
        "required": [
          "sessionId",
          "actorUserId",
          "selectedOrganizationId",
          "selectedOrganizationSlug",
          "requiresOrganizationSelection",
          "memberships"
        ]
      },
      "SelectPosOrganizationDto": {
        "type": "object",
        "properties": {
          "organizationSlug": {
            "type": "string",
            "example": "acme-outfitters"
          }
        },
        "required": [
          "organizationSlug"
        ]
      },
      "PosSessionRevocationDto": {
        "type": "object",
        "properties": {
          "revoked": {
            "type": "boolean",
            "example": true
          }
        },
        "required": [
          "revoked"
        ]
      },
      "CreatePosCustomerDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "description": "Required canonical profile name. The server trims surrounding whitespace before persistence."
          },
          "email": {
            "type": "string",
            "maxLength": 320,
            "format": "email",
            "description": "Required canonical identity email. The server trims and lowercases it before tenant-scoped matching or persistence."
          },
          "phone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "\\S",
            "description": "Required canonical profile phone. The server trims surrounding whitespace before persistence."
          }
        },
        "required": [
          "name",
          "email",
          "phone"
        ],
        "additionalProperties": false
      },
      "PosCustomerCreateResultDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "CREATED",
              "EXISTING_MATCH"
            ],
            "description": "CREATED when this request inserted the reusable profile; EXISTING_MATCH when the tenant already had this normalized email. A match never edits or restores the existing profile."
          },
          "customerId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "outcome",
          "customerId"
        ]
      },
      "PosCustomerIdentityDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string",
            "description": "API displayName is name ?? \"Guest\": only null selects the fallback; empty and whitespace-only names pass through unchanged. For presentation, preserve this value for a nonblank canonical name. Otherwise, REGISTERED rows display \"Unnamed customer\"; GUEST rows keep a nonblank API display value or use \"Unnamed customer\" if it is blank. Use name to identify the fallback so a stored name of \"Guest\" is preserved. This value is not identity or verification proof."
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "Canonical Customer name. Null when no canonical name is recorded; displayName then contains the literal Guest fallback. Empty and whitespace-only strings are returned unchanged."
          },
          "normalizedEmail": {
            "type": "string",
            "description": "Normalized email and tenant-scoped Customer identity key."
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "Canonical Customer phone number. Null when no canonical phone is recorded. Empty and whitespace-only strings are returned unchanged."
          },
          "accountStatus": {
            "type": "string",
            "enum": [
              "GUEST",
              "REGISTERED"
            ],
            "description": "Derived from email verification. GUEST means unverified and REGISTERED means verified; neither status guarantees that canonical name or phone is populated."
          },
          "emailVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Time the canonical email was verified. Null when accountStatus is GUEST and the email is unverified."
          },
          "isArchived": {
            "type": "boolean",
            "description": "Archived Customers are hidden from the default list but remain addressable by exact id."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "displayName",
          "name",
          "normalizedEmail",
          "phone",
          "accountStatus",
          "emailVerifiedAt",
          "isArchived",
          "createdAt"
        ]
      },
      "PosCustomerListDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Matching active, non-tombstoned Customer identities for the selected POS-session organization. An empty array means no identities matched the search on this page; with nextCursor null, the result is exhausted.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCustomerIdentityDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page. Null means there is no later page and the current result is complete."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "PosCustomerSaleDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "description": "Canonical CommerceRecord Order id, not the legacy storefront Order id."
          },
          "orderNumber": {
            "type": "string",
            "description": "Assigned canonical Order display number."
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Authoritative document total in currency minor units."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "orderId",
          "orderNumber",
          "source",
          "commercialStatus",
          "currency",
          "totalInCents",
          "createdAt"
        ]
      },
      "PosCustomerSalePageDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Issued, non-DRAFT canonical Orders with an assigned display number durably linked to this tenant Customer, across all sources, newest first. Cancelled/voided historical Orders remain visible. Empty means no matching Orders on this page, not a failed or unavailable read; email-only historical matches and retained unnumbered bridge Orders are outside this population. Reads never renumber historical Orders or substitute a legacy number.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCustomerSaleDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Bookmark for the next page; null means the matching population was exhausted at this read."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "PosCustomerOpenBalanceDto": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "description": "Canonical CommerceRecord Invoice id. GET /api/v1/merchant/pos/customers/{customerId}/invoices/{invoiceId} reads this exact issued Invoice under the same Customer and invoice-read permissions. This read does not grant payment-collection authority."
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Assigned canonical Invoice display number."
          },
          "orderRecordId": {
            "type": "string",
            "nullable": true,
            "description": "Linked canonical Order id; null means the Invoice has no linked Order. It is not a legacy storefront Order id."
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Authoritative document total in currency minor units."
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross completed payments from the authoritative payment rollup, in currency minor units."
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Effective completed refunds, net of refund reversals, in currency minor units. Net cash held is amountPaidInCents minus refundedInCents; refunds do not reopen the receivable."
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Authoritative stored outstanding balance: max(0, totalInCents minus gross amountPaidInCents). Refunds do not reopen this balance. Display this server value; do not subtract refunds or recompute it in the client."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Recorded Invoice send time; null means no send timestamp is recorded and does not imply a zero balance or permission to collect."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "invoiceId",
          "invoiceNumber",
          "orderRecordId",
          "source",
          "paymentStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "sentAt",
          "createdAt"
        ]
      },
      "PosCustomerOpenBalancePageDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Durably linked canonical Invoices across all sources with SENT or ACCEPTED commercial status and positive stored balanceDueInCents, regardless of payment-status label. Other commercial statuses and zero balances are excluded. FAILED and CANCELLED payment labels do not remove an outstanding receivable. Refunds do not reopen balances, but PARTIALLY_REFUNDED or REFUNDED Invoices can still owe the uncollected portion. Inconsistent money/status rollups fail the read with a typed error rather than silently omitting an Invoice. Empty means no matching outstanding Invoices on this page, not a failed read, an aggregate zero balance, or proof of no email-only historical debt. Presence is not permission or a guarantee of payment collectability.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCustomerOpenBalanceDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Bookmark for the next page; null means the matching population was exhausted at this read."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "PosSaleFrozenLineDto": {
        "type": "object",
        "properties": {
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "description": "Public HTTPS thumbnail recorded on this frozen line at sale creation; may be the parent fallback in that snapshot. Null means no usable recorded image. Display only: never reprices or joins current catalog data. Older APIs omit this field."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "category": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "SERVICE",
              "FEE",
              "DEPOSIT",
              "ADJUSTMENT",
              "CUSTOM"
            ],
            "description": "Frozen line category. PRODUCT is a sold good; FEE carries non-goods amounts such as the #2537 card-present tip."
          },
          "itemId": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitPriceInCents": {
            "type": "number"
          },
          "subtotalInCents": {
            "type": "number"
          },
          "discountInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "True when this line is excluded from tax under ADR-012 line-level exemption."
          }
        },
        "required": [
          "imageUrl",
          "id",
          "category",
          "itemId",
          "variantId",
          "sku",
          "name",
          "quantity",
          "unitPriceInCents",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "taxExempt"
        ]
      },
      "PosCustomerInvoiceDto": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "description": "Canonical CommerceRecord Invoice id. GET /api/v1/merchant/pos/customers/{customerId}/invoices/{invoiceId} reads this exact issued Invoice under the same Customer and invoice-read permissions. This read does not grant payment-collection authority."
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Assigned canonical Invoice display number."
          },
          "orderRecordId": {
            "type": "string",
            "nullable": true,
            "description": "Linked canonical Order id; null means the Invoice has no linked Order. It is not a legacy storefront Order id."
          },
          "source": {
            "type": "string",
            "enum": [
              "ONLINE",
              "MANUAL",
              "POS",
              "WHOLESALE",
              "BOOKING",
              "SUBSCRIPTION",
              "RENEWAL"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Authoritative document total in currency minor units."
          },
          "amountPaidInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Gross completed payments from the authoritative payment rollup, in currency minor units."
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Effective completed refunds, net of refund reversals, in currency minor units. Net cash held is amountPaidInCents minus refundedInCents; refunds do not reopen the receivable."
          },
          "balanceDueInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Authoritative stored outstanding balance: max(0, totalInCents minus gross amountPaidInCents). Refunds do not reopen this balance. Display this server value; do not subtract refunds or recompute it in the client."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Recorded Invoice send time; null means no send timestamp is recorded and does not imply a zero balance or permission to collect."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "subtotalInCents": {
            "type": "number",
            "description": "Authoritative invoice subtotal in currency minor units."
          },
          "discountInCents": {
            "type": "number",
            "description": "Authoritative invoice discount in currency minor units."
          },
          "shippingInCents": {
            "type": "number",
            "description": "Authoritative invoice shipping charge in currency minor units."
          },
          "taxInCents": {
            "type": "number",
            "description": "Authoritative invoice tax in currency minor units."
          },
          "lines": {
            "description": "Stored lines of this exact invoice, ordered by sortOrder/id. Empty means no stored lines; no current-catalog repricing or order-line substitution. At most 200 are returned; consult linesTruncated.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleFrozenLineDto"
            }
          },
          "linesTruncated": {
            "type": "boolean",
            "description": "True means only the first 200 stored invoice lines are returned. False means all stored lines were returned, including an empty collection."
          }
        },
        "required": [
          "invoiceId",
          "invoiceNumber",
          "orderRecordId",
          "source",
          "paymentStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "sentAt",
          "createdAt",
          "commercialStatus",
          "subtotalInCents",
          "discountInCents",
          "shippingInCents",
          "taxInCents",
          "lines",
          "linesTruncated"
        ]
      },
      "PosCatalogAvailabilityDto": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "Whether this exact item/variant selection is currently sellable."
          },
          "tracked": {
            "type": "boolean",
            "description": "Whether inventory is explicitly tracked. Untracked SALE items follow existing order semantics and are treated as unbounded."
          },
          "availableQuantity": {
            "type": "number",
            "nullable": true,
            "description": "Current reservation-aware quantity, or null when inventory is untracked."
          }
        },
        "required": [
          "available",
          "tracked",
          "availableQuantity"
        ]
      },
      "PosCatalogVariantDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "priceInCents": {
            "type": "number",
            "description": "Current server preview price. Sale creation re-resolves and freezes the authoritative price."
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "description": "This variant's featured image URL from its own item gallery. Null when no featured image is configured or that image is no longer in the gallery; clients may fall back to the parent item's imageUrl."
          },
          "availability": {
            "$ref": "#/components/schemas/PosCatalogAvailabilityDto"
          }
        },
        "required": [
          "id",
          "name",
          "sku",
          "priceInCents",
          "imageUrl",
          "availability"
        ]
      },
      "PosCatalogItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "shortDescription": {
            "type": "string"
          },
          "priceInCents": {
            "type": "number",
            "description": "Current server preview price. Sale creation re-resolves and freezes the authoritative price."
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "availability": {
            "$ref": "#/components/schemas/PosCatalogAvailabilityDto"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCatalogVariantDto"
            }
          }
        },
        "required": [
          "id",
          "name",
          "shortDescription",
          "priceInCents",
          "imageUrl",
          "availability",
          "variants"
        ]
      },
      "PosCatalogPageDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "Tenant currency, normalized to lower-case ISO."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosCatalogItemDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "currency",
          "items",
          "nextCursor"
        ]
      },
      "PosPreflightResponseDto": {
        "type": "object",
        "properties": {
          "tipCommandCapability": {
            "type": "string",
            "enum": [
              "card_present_tip_v1"
            ],
            "description": "Supports lossless explicit CARD/tip commands, V3 frozen pricing and durable replay. Clients must observe this exact value before persisting or submitting a V3 command. It is compatibility evidence, not pricing/admission authority or cash support. Unknown or missing values leave controls disabled; historical stored commands retain their original version."
          },
          "tipPolicy": {
            "nullable": true,
            "description": "Current server-owned tip options for this tenant. Null means no valid tenant policy is configured: NONE remains available, while preset/custom choices are unavailable. These are preview values; the durable sale owner resolves and freezes the policy at creation. Exact terminal retries never read this current policy.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosTipPolicyDto"
              }
            ]
          },
          "discountCommandCapability": {
            "type": "string",
            "enum": [
              "cart_manual_discount_v1"
            ],
            "description": "This API supports durable cart-discount validation and replay. Clients must observe this exact value before enabling or persisting discount intent; missing or unknown values fail closed. It does not grant pricing permission or guarantee that a sale will pass validation. Discount-capable server recovery must remain deployed while submitted discount operations can still recover."
          },
          "ready": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Always true on success: at least one tender this member may collect is active. When none is, preflight returns that refusal instead of a response."
          },
          "currency": {
            "type": "string",
            "description": "Tenant currency, normalized to lower-case ISO."
          },
          "terminalLocationId": {
            "type": "string",
            "nullable": true,
            "description": "Server-selected Stripe Terminal Location id. Null exactly when cardPaymentsCapability is not active."
          },
          "terminalLocationLabel": {
            "type": "string",
            "nullable": true,
            "description": "Display label of the selected Terminal Location. Null exactly when cardPaymentsCapability is not active."
          },
          "terminalLocationSelectionSource": {
            "type": "string",
            "enum": [
              "INSTALLATION",
              "TENANT_DEFAULT"
            ],
            "nullable": true,
            "description": "Which configuration chose the effective Terminal Location for this POS installation. INSTALLATION is this phone's saved choice; TENANT_DEFAULT is the business default used because this phone has no saved choice. The location is a Stripe operational grouping for card payments, not the device's live geolocation. A saved choice that is no longer eligible fails card readiness with a TERMINAL_LOCATION_SELECTION_* reason instead of falling back to the default. Null exactly when cardPaymentsCapability is not active."
          },
          "cardPaymentsCapability": {
            "type": "string",
            "enum": [
              "active",
              "unavailable",
              "not_permitted"
            ],
            "description": "Card collection for this member. Card readiness, with its provider calls, runs only for a member who may collect card (Owner, Admin, or Staff with shared-commerce:manual-payments). When it fails and cash is not active, preflight fails exactly as before with the same status and code instead of returning unavailable. A capability is presentation only; every collection route re-authorizes."
          },
          "cardPaymentsCapabilityReason": {
            "type": "string",
            "nullable": true,
            "description": "Typed reason when card is not active: the card readiness refusal's details.reason when unavailable, ROLE_INSUFFICIENT when not permitted. Null when active."
          },
          "cashPaymentsCapability": {
            "type": "string",
            "enum": [
              "active",
              "disabled",
              "unavailable",
              "not_permitted"
            ],
            "description": "Cash collection for this member (Owner, Admin, or Staff with shared-commerce:cash-payments). disabled means cash is not available in this environment (reason CASH_TENDER_NOT_AVAILABLE) and makes no read. unavailable means the account, physical location or tax configuration is not ready. Nonauthoritative: the sale and the tender re-prove everything. A member who may collect only cash gets no Terminal or provider call, and gets the cash refusal itself when cash is not active."
          },
          "cashPaymentsCapabilityReason": {
            "type": "string",
            "nullable": true,
            "description": "Typed reason when cash is not active: CASH_TENDER_NOT_AVAILABLE when disabled, the cash readiness refusal's details.reason when unavailable, ROLE_INSUFFICIENT when not permitted. Null when active."
          }
        },
        "required": [
          "tipCommandCapability",
          "tipPolicy",
          "discountCommandCapability",
          "ready",
          "currency",
          "terminalLocationId",
          "terminalLocationLabel",
          "terminalLocationSelectionSource",
          "cardPaymentsCapability",
          "cardPaymentsCapabilityReason",
          "cashPaymentsCapability",
          "cashPaymentsCapabilityReason"
        ]
      },
      "PosSaleLineDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 999
          }
        },
        "required": [
          "itemId",
          "quantity"
        ]
      },
      "CreatePosSaleDto": {
        "type": "object",
        "properties": {
          "sellingContextExpectation": {
            "description": "Optional original local-choice expectation. Omit entirely for retained historical commands. When supplied, retain all five original values for retries; null, malformed values and additional fields are invalid. This expectation supplies no sale-readiness or payment authority.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "selectionGeneration",
                  "source",
                  "locationId",
                  "addressVersion"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.selling-context-expectation/v1"
                    ]
                  },
                  "selectionGeneration": {
                    "type": "integer",
                    "enum": [
                      0
                    ]
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "TENANT_DEFAULT"
                    ]
                  },
                  "locationId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^(?:\\S|\\S[\\s\\S]*\\S)$"
                  },
                  "addressVersion": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contract",
                  "selectionGeneration",
                  "source",
                  "locationId",
                  "addressVersion"
                ],
                "properties": {
                  "contract": {
                    "type": "string",
                    "enum": [
                      "pos.selling-context-expectation/v1"
                    ]
                  },
                  "selectionGeneration": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483646
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "INSTALLATION"
                    ]
                  },
                  "locationId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^(?:\\S|\\S[\\s\\S]*\\S)$"
                  },
                  "addressVersion": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  }
                }
              }
            ]
          },
          "tender": {
            "type": "string",
            "enum": [
              "CARD",
              "CASH"
            ],
            "description": "Omitted only for retained legacy commands. Explicit CARD requires a closed tip selection and uses V3 pricing evidence. CASH without tip is reserved and currently durably refused; this enum advertises no cash capability. Only submit explicit tender after preflight advertises card_present_tip_v1."
          },
          "tip": {
            "description": "Required with CARD; forbidden with CASH or omitted tender. NONE adds no fee. PRESET resolves a tenant-owned percentage against the pre-tax goods subtotal. CUSTOM accepts integer cents within the current server-owned bounds. Selected before creation, frozen with the sale and never changed at collection. Null and additional keys are durably rejected. No client percentage, price, tax or total is accepted.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "NONE"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "presetId"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "PRESET"
                    ]
                  },
                  "presetId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,64}$"
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "amountInCents"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "CUSTOM"
                    ]
                  },
                  "amountInCents": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000
                  }
                }
              }
            ]
          },
          "discount": {
            "additionalProperties": true,
            "description": "Omit for no manual discount; null is invalid. Exactly one fixed or percentage cart discount, applied by the server after automatic/bundle discounts and before tax. Requires Owner/Admin authority or delegated Staff pricing:write permission, and a nonblank reason trimmed only at its edges (maximum 500 Unicode characters). Only submit after preflight advertises cart_manual_discount_v1. The capability grants no authorization. For a present discount value, after replay and durable claim, owner permission and required-reason failures take precedence over discount-shape validation. Malformed values, including null, can therefore produce ROLE_INSUFFICIENT or HIGH_RISK_REASON_REQUIRED as the cause of POS_SALE_REJECTED. The persisted terminal result is replayed unchanged.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "amountInCents",
                  "reason"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "FIXED"
                    ]
                  },
                  "amountInCents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000000
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "description": "After edge trimming, nonblank and at most 500 Unicode characters."
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "percentDecimal",
                  "reason"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "PERCENTAGE"
                    ]
                  },
                  "percentDecimal": {
                    "type": "string",
                    "pattern": "^(?:0\\.(?!0{1,4}$)[0-9]{1,4}|1(?:\\.0{1,4})?)$",
                    "description": "Exact decimal fraction greater than zero and at most one, with at most four fractional digits; normalized to integer basis points."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "description": "After edge trimming, nonblank and at most 500 Unicode characters."
                  }
                }
              }
            ]
          },
          "pricing": {
            "description": "Reserved; not available yet. The current draft's \"Prices include tax\" switch. Omit, or send {\"pricesIncludeTax\": false}, for the legacy sale: both are the same command. ON keeps the post-discount merchandise gross fixed and carves the included tax out of it. It requires Owner/Admin or Staff delegated pricing:write, a nonblank reason, the cashier's confirmation of exactly the merchandise gross, included tax and net from POST /merchant/pos/pricing/preview, and the draft binding. The server reprices and admits the confirmation only if its fresh amounts are identical; the actor, draft, reason and confirmation are part of the idempotent command. Every ON command is currently durably refused with POS_SALE_REJECTED wrapping POS_NOT_READY / INCLUSIVE_PRICING_NOT_AVAILABLE; preflight advertises no capability for it. Null and additional keys are invalid.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "pricesIncludeTax"
                ],
                "properties": {
                  "pricesIncludeTax": {
                    "type": "boolean",
                    "enum": [
                      false
                    ]
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "pricesIncludeTax",
                  "reason",
                  "confirmation"
                ],
                "properties": {
                  "pricesIncludeTax": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "description": "After edge trimming, nonblank and at most 500 Unicode characters. The same reason the preview priced."
                  },
                  "confirmation": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "merchandiseGrossInCents",
                      "merchandiseIncludedTaxInCents",
                      "merchandiseNetInCents"
                    ],
                    "properties": {
                      "merchandiseGrossInCents": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "merchandiseIncludedTaxInCents": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "merchandiseNetInCents": {
                        "type": "integer",
                        "minimum": 0
                      }
                    }
                  }
                }
              }
            ]
          },
          "draft": {
            "description": "Reserved; not available yet. Required with \"Prices include tax\" ON and invalid otherwise: the client cart instance and revision the cashier confirmed, as sent to the pricing preview. It is bound into the tax-included payable and the command, and compared, never used for money.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "ref",
                  "revision"
                ],
                "properties": {
                  "ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,128}$"
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            ]
          },
          "lines": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleLineDto"
            }
          },
          "customer": {
            "additionalProperties": true,
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "mode"
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "WALK_IN"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "mode",
                  "customerId"
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "EXISTING_CUSTOMER"
                    ]
                  },
                  "customerId": {
                    "type": "string",
                    "format": "uuid",
                    "maxLength": 200
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "mode",
                  "email"
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "CONTACT"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 320,
                    "description": "The submitted value is validated without trimming whitespace. An accepted email is lowercased for Customer lookup."
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "companyName": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              }
            ],
            "description": "Omit for WALK_IN. EXISTING_CUSTOMER requires an exact tenant Customer id. A new CONTACT sale requires email; optional name, phone, and company values are immutable sale snapshots only."
          }
        },
        "required": [
          "lines"
        ]
      },
      "PosOriginalPricingAmountsDto": {
        "type": "object",
        "properties": {
          "netInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Frozen original amount excluding included tax."
          },
          "includedTaxInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Tax already inside the frozen gross. Never added on top."
          },
          "grossInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Frozen original gross: netInCents + includedTaxInCents."
          }
        },
        "required": [
          "netInCents",
          "includedTaxInCents",
          "grossInCents"
        ]
      },
      "PosOriginalPricingLineDto": {
        "type": "object",
        "properties": {
          "netInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Frozen original amount excluding included tax."
          },
          "includedTaxInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Tax already inside the frozen gross. Never added on top."
          },
          "grossInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Frozen original gross: netInCents + includedTaxInCents."
          },
          "ref": {
            "type": "string",
            "description": "Original pricing reference, in basis order; not a current line ID or an independently addressable resource."
          },
          "role": {
            "type": "string",
            "enum": [
              "MERCHANDISE",
              "ANCILLARY"
            ]
          },
          "quantity": {
            "type": "integer",
            "minimum": 0,
            "description": "Original line quantity; amounts are extended line totals, not unit prices."
          }
        },
        "required": [
          "netInCents",
          "includedTaxInCents",
          "grossInCents",
          "ref",
          "role",
          "quantity"
        ]
      },
      "PosSaleOriginalPricingDto": {
        "type": "object",
        "properties": {
          "netInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Frozen original amount excluding included tax."
          },
          "includedTaxInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Tax already inside the frozen gross. Never added on top."
          },
          "grossInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Frozen original gross: netInCents + includedTaxInCents."
          },
          "version": {
            "type": "string",
            "enum": [
              "pos.sale-original-pricing/v1"
            ]
          },
          "revisionNumber": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Original Order/Invoice revision pair only. Later revisions do not replace this evidence."
          },
          "taxTreatment": {
            "type": "string",
            "enum": [
              "INCLUDED"
            ]
          },
          "currency": {
            "type": "string",
            "description": "Currency frozen with the original payable, independent of current catalog or tenant settings."
          },
          "merchandise": {
            "description": "Original merchandise after genuine discounts.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosOriginalPricingAmountsDto"
              }
            ]
          },
          "ancillaryInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Separately treated original ancillary charges; already included in grossInCents."
          },
          "shippingInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Original shipping charge; already included in grossInCents."
          },
          "lines": {
            "description": "Every original priced line in basis order; never empty. Shipping is separate above.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosOriginalPricingLineDto"
            }
          }
        },
        "required": [
          "netInCents",
          "includedTaxInCents",
          "grossInCents",
          "version",
          "revisionNumber",
          "taxTreatment",
          "currency",
          "merchandise",
          "ancillaryInCents",
          "shippingInCents",
          "lines"
        ]
      },
      "PosSaleDiscountActivityDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "FIXED",
              "PERCENTAGE"
            ]
          },
          "requestedAmountInCents": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 1000000000,
            "description": "The amount the operator requested for a FIXED discount. Null for PERCENTAGE."
          },
          "requestedBasisPoints": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 10000,
            "description": "The rate the operator requested for a PERCENTAGE discount, in basis points (1 through 10000). Null for FIXED."
          },
          "appliedAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "The pre-tax amount the server applied across the eligible goods lines. It can be lower than the request, and a FIXED discount never applies more than it requested; the sale totals remain the authority for what was charged."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "description": "The operator-supplied reason, trimmed only at the edges when the sale was created."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the discount was recorded with the sale."
          }
        },
        "required": [
          "type",
          "requestedAmountInCents",
          "requestedBasisPoints",
          "appliedAmountInCents",
          "reason",
          "recordedAt"
        ]
      },
      "PosSaleResponseDto": {
        "type": "object",
        "properties": {
          "originalPricing": {
            "description": "Frozen original inclusive-price evidence, verified against both original Order/Invoice revisions. Present only for the inclusive cohort; omitted for proven legacy/exclusive originals, whose existing tax fields retain their meanings. Omission never establishes zero tax. Missing or inconsistent inclusive evidence refuses the single-sale read (409) or omits that history row. This historical summary remains readable after quote expiry or later revisions; it is not a fresh quote, current document total, permission, or collection/refund authority. Existing flat monetary fields retain their additive projection and may differ from this original after revision; use this summary to explain original included tax.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosSaleOriginalPricingDto"
              }
            ]
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "orderNumber": {
            "type": "string"
          },
          "orderStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceNumber": {
            "type": "string"
          },
          "invoiceStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "description": "Authoritative payment status of the linked issued invoice, including PARTIALLY_REFUNDED / REFUNDED after an Admin refund (ADR-021 #2531 amendment section 8)."
          },
          "customerMode": {
            "type": "string",
            "enum": [
              "WALK_IN",
              "EXISTING_CUSTOMER",
              "CONTACT"
            ],
            "description": "Immutable creation provenance (ADR-021 section 6). It records what was true when the sale was created and is never rewritten. It is NOT an answer to \"does this sale have a customer?\" — read customerId for that."
          },
          "customerId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Current tenant-scoped customer association on the authoritative order, or null when the sale has none. Separate from customerMode by ADR-021 #2531 amendment section 5: a WALK_IN sale that later gains a customer keeps customerMode=WALK_IN and reports the attachment here."
          },
          "currency": {
            "type": "string"
          },
          "subtotalInCents": {
            "type": "number"
          },
          "tipInCents": {
            "type": "number",
            "description": "Frozen card-present tip included in subtotal and total; zero for V3 and inclusive V4 no-tip sales, omitted on historical V1/V2 sales.",
            "minimum": 0
          },
          "discountInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          },
          "amountPaidInCents": {
            "type": "number",
            "description": "Gross completed payments recorded against the linked invoice (ADR-013 derived rollup). Refunds are reported separately in refundedInCents."
          },
          "refundedInCents": {
            "type": "number",
            "description": "Completed refunds recorded against the linked invoice. Admin (#1630/#1634) is the only first-release refund mechanism; POS reflects it and never initiates it."
          },
          "balanceDueInCents": {
            "type": "number",
            "description": "Remaining collectible balance from the authoritative invoice rollup, never a POS-local tally."
          },
          "payable": {
            "type": "boolean",
            "description": "True only while the linked issued invoice has a positive collectible balance."
          },
          "tender": {
            "type": "string",
            "enum": [
              "CASH",
              "CHECK",
              "BANK_TRANSFER",
              "STORE_CREDIT",
              "CARD",
              "OTHER"
            ],
            "nullable": true,
            "description": "Tender of the settled payment, derived from completed payment transactions on the linked invoice. Null when nothing has settled yet, and null when more than one tender settled the invoice (split tender is D2 #2538 and is not representable here). The tender the sale was created for is collectionTender."
          },
          "collectionTender": {
            "type": "string",
            "enum": [
              "CARD",
              "CASH"
            ],
            "nullable": true,
            "description": "The tender this sale was created for. The card and cash collection routes each refuse a sale created for the other tender. Read only from the pricing snapshot the sale's Order froze at creation, so payments, refunds, voids and later revisions never change it, and record metadata and Invoice snapshots never decide it. POS sales from before explicit tender were card-only and report CARD; explicit-tender sales report their frozen CARD or CASH. Null when that creation evidence is missing, unrecognized or contradictory: it is never defaulted to CARD, and a client should treat it as unknown and let the collection route decide. Servers from before DR-2536-04 item 5 omit the field. Omission is a distinct legacy state: clients may use trustworthy local creation-tender evidence for the same sale, as the first-party POS does with its retained sale journal. Explicit null means the server could not establish the creation tender; it does not authorize that legacy fallback. For the tender that settled the sale, read tender."
          },
          "lines": {
            "description": "Frozen lines of the authoritative order, in commit order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleFrozenLineDto"
            }
          },
          "discountActivity": {
            "maxItems": 1,
            "description": "The sale's canonical manual-discount activity, read from its authoritative order only. Never more than one entry. Empty when the sale has no manual discount, and also when its activity record is unreadable or duplicated, which is reported as empty rather than failing the sale read. An empty list therefore does not by itself distinguish \"no manual discount\" from \"activity could not be presented\": the order's merchant activity timeline (GET /api/v1/merchant/commerce/{id}/activity) shows the underlying commerce.record.discount_overridden event, and the server logs a warning naming the order and the reason. The sale's discount and total fields remain authoritative for what was charged either way.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleDiscountActivityDto"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the authoritative order was committed."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the authoritative order last changed."
          },
          "invoiceIssuedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the linked invoice was issued (ADR-021 section 5 freezes it at creation)."
          },
          "settledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Occurrence time of the most recent completed payment on the linked invoice, or null when nothing has settled."
          },
          "pricingSnapshotVersion": {
            "type": "string"
          },
          "pricingSnapshotHash": {
            "type": "string",
            "description": "SHA-256 of the immutable ADR-012 snapshot."
          },
          "terminalLocationId": {
            "type": "string",
            "nullable": true,
            "description": "#4497: the Stripe Terminal Location this sale was created with, frozen in its pricing snapshot. Card payment for the sale must be collected there. It is attribution only: no POS route accepts it, and a phone chooses its location by the configured mapping id. `null` only when the snapshot records no location, which no POS sale created since #1650 lacks."
          },
          "terminalLocationLabel": {
            "type": "string",
            "nullable": true,
            "description": "#4497: the current label of this organization's configured Terminal Location for `terminalLocationId`, read when the sale is returned, so a later rename shows here. A retired location keeps its label. `null` when this organization no longer holds that location, for example after a previous-account location was released (#2365), or when `terminalLocationId` is `null`. It is never another location's label."
          }
        },
        "required": [
          "orderId",
          "orderNumber",
          "orderStatus",
          "invoiceId",
          "invoiceNumber",
          "invoiceStatus",
          "paymentStatus",
          "customerMode",
          "customerId",
          "currency",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "payable",
          "tender",
          "collectionTender",
          "lines",
          "discountActivity",
          "createdAt",
          "updatedAt",
          "invoiceIssuedAt",
          "settledAt",
          "pricingSnapshotVersion",
          "pricingSnapshotHash",
          "terminalLocationId",
          "terminalLocationLabel"
        ]
      },
      "PosSaleListDto": {
        "type": "object",
        "properties": {
          "sales": {
            "description": "Order-anchored POS sales, newest first. Each entry preserves its order and invoice as distinct records (ADR-021 section 10).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "filterCapability": {
            "type": "string",
            "enum": [
              "number_payment_status_created_at_v1"
            ],
            "description": "Recognized search/filter compatibility evidence, including empty and unfiltered pages. Missing or unknown values leave ordinary Sales usable with filters unavailable. Filtered pages require this exact value; it is not authorization."
          },
          "extendedFilterCapability": {
            "type": "string",
            "enum": [
              "customer_local_dates_v1"
            ],
            "description": "Additional compatibility evidence for customerId, customerEmail and IANA local-day timeZone filters. Older APIs omit this; new clients must not treat an unrecognized/missing value as filtered results. Does not grant directory or Sales access."
          },
          "dateFilterCapability": {
            "type": "string",
            "enum": [
              "optional_unrestricted_dates_v1"
            ],
            "description": "Compatibility evidence for optional dates on payment-status searches and date ranges without a maximum length. Missing/unknown on older APIs: clients retain the prior status/date-window rules and must not accept relaxed-filter pages. Pagination, authorization and finite read timeouts still apply; this does not guarantee completion of a large query."
          }
        },
        "required": [
          "sales",
          "nextCursor"
        ]
      },
      "PosReceiptAvailabilityScopeDto": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "description": "Current guard-selected organization. Scope binding only; not authorization."
          },
          "posSessionId": {
            "type": "string",
            "format": "uuid",
            "description": "Current authenticated POS session binding, not a credential."
          },
          "installationIdHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 binding of the current registered installation. Not a credential or send authority."
          }
        },
        "required": [
          "organizationId",
          "posSessionId",
          "installationIdHash"
        ]
      },
      "PosReceiptInitiationModeDto": {
        "type": "object",
        "properties": {
          "canInitiate": {
            "type": "boolean",
            "description": "Necessary advisory preflight for NEW preparation and NEW SEND/RESEND in this mode. False includes missing, unknown, unqualified or unavailable source. True is not sale eligibility, authorization, admission/nonadmission or delivery proof; every existing per-request check still applies. Original status and exact-key/body retry remain separate current-auth operations."
          }
        },
        "required": [
          "canInitiate"
        ]
      },
      "PosReceiptAvailabilityDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.receipt-availability/v1"
            ]
          },
          "scope": {
            "$ref": "#/components/schemas/PosReceiptAvailabilityScopeDto"
          },
          "completed": {
            "description": "Independently qualified completed-payment receipt initiation; never inferred from service or helper presence.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosReceiptInitiationModeDto"
              }
            ]
          },
          "declined": {
            "description": "Independently qualified declined-attempt receipt initiation; never inferred from completed availability or a local card failure.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosReceiptInitiationModeDto"
              }
            ]
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC observation time for this advisory read. It establishes neither admission absence nor a retry/abandon deadline."
          }
        },
        "required": [
          "version",
          "scope",
          "completed",
          "declined",
          "checkedAt"
        ]
      },
      "PosReceiptPreparationRequestDto": {
        "type": "object",
        "properties": {
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
            "nullable": true,
            "description": "Original server attempt selection only, in its lower-case server spelling. Null requests completed-payment proof. A non-null ID requests independently verified declined-attempt proof; the ID supplies no outcome, money or authority. Reader/local failure is not evidence."
          }
        },
        "required": [
          "paymentAttemptId"
        ]
      },
      "PosPaymentProofDto": {
        "type": "object",
        "properties": {
          "proofVersion": {
            "type": "string",
            "enum": [
              "pos.payment-proof/v1"
            ]
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "description": "Tenant-scoped POS order routing identity."
          },
          "orderNumber": {
            "type": "string",
            "description": "Issued human-readable order number."
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid",
            "description": "Tenant-scoped issued invoice routing identity."
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Issued human-readable invoice number."
          },
          "currency": {
            "type": "string",
            "description": "Frozen lower-case ISO currency. Monetary fields use its minor units."
          },
          "subtotalInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Original frozen subtotal, including a known tip. Subtract tip only when tipInCents is non-null to display the goods subtotal."
          },
          "tipInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true,
            "description": "Original V3 frozen tip, including explicit zero. Null means the historical version has no authoritative tip contract; never interpret it as zero. Refunds do not change this amount."
          },
          "discountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Original frozen discount."
          },
          "taxInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Original frozen tax."
          },
          "totalInCents": {
            "type": "integer",
            "minimum": 1,
            "description": "Positive original issued invoice total, proven against both frozen documents."
          },
          "amountPaidInCents": {
            "type": "integer",
            "minimum": 1,
            "description": "Gross completed invoice-owned payments, before refunds."
          },
          "refundedInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Current completed refunds less completed refund reversals."
          },
          "balanceDueInCents": {
            "type": "number",
            "enum": [
              0
            ],
            "description": "Original collection balance remains zero after refunds."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED"
            ],
            "description": "Current ledger-derived and persisted payment/refund status at this fresh read."
          },
          "tender": {
            "type": "string",
            "enum": [
              "CASH",
              "CHECK",
              "BANK_TRANSFER",
              "STORE_CREDIT",
              "CARD",
              "OTHER"
            ],
            "nullable": true,
            "description": "The single distinct completed PAYMENT method. Null means mixed or unavailable; no SDK or client tender inference."
          },
          "saleCreatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Persisted order creation instant in UTC."
          },
          "invoiceIssuedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Persisted invoice issue instant in UTC."
          },
          "paidAt": {
            "type": "string",
            "format": "date-time",
            "description": "Latest completed PAYMENT ledger occurrence in UTC, not application or SDK success time."
          },
          "locationLabel": {
            "type": "string",
            "nullable": true,
            "description": "Current tenant-owned label of the historically frozen Terminal binding. Null means no safe historical binding/label is available. This is not a sale-time label or a physical-device location claim."
          },
          "locationLabelProvenance": {
            "type": "string",
            "enum": [
              "CURRENT_LABEL_OF_FROZEN_BINDING"
            ],
            "nullable": true,
            "description": "Explains locationLabel. Null exactly when locationLabel is null. No provider binding ID or address is exposed."
          }
        },
        "required": [
          "proofVersion",
          "orderId",
          "orderNumber",
          "invoiceId",
          "invoiceNumber",
          "currency",
          "subtotalInCents",
          "tipInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "paymentStatus",
          "tender",
          "saleCreatedAt",
          "invoiceIssuedAt",
          "paidAt",
          "locationLabel",
          "locationLabelProvenance"
        ]
      },
      "PosReceiptDeclineProofDto": {
        "type": "object",
        "properties": {
          "proofVersion": {
            "type": "string",
            "enum": [
              "pos.receipt.decline-proof/v1"
            ]
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "description": "Original tenant-scoped POS order identity, not payment authority."
          },
          "orderNumber": {
            "type": "string",
            "description": "Server-issued label of the original Order, frozen at receipt admission; not an assertion of an attempt-time pricing revision."
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid",
            "description": "Original tenant-scoped invoice identity."
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Server-issued label of the original Invoice, frozen at receipt admission."
          },
          "currency": {
            "type": "string",
            "pattern": "^[a-z]{3}$",
            "description": "Exact lower-case currency of the original server attempt and failed Charge."
          },
          "attemptedAmountInCents": {
            "type": "integer",
            "minimum": 1,
            "description": "Original attempted amount in currency minor units. It is not a paid amount, invoice balance, tax or itemized subtotal."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "DECLINED"
            ],
            "description": "An independently verified definitive declined attempt; does not assert that the invoice remains unpaid or that a later attempt failed."
          },
          "tender": {
            "type": "string",
            "enum": [
              "CARD"
            ]
          },
          "evidenceObservedAt": {
            "type": "string",
            "format": "date-time",
            "description": "First retained database observation/recording instant in UTC. Not processor execution or paid time, and never refreshed by retry."
          }
        },
        "required": [
          "proofVersion",
          "orderId",
          "orderNumber",
          "invoiceId",
          "invoiceNumber",
          "currency",
          "attemptedAmountInCents",
          "paymentStatus",
          "tender",
          "evidenceObservedAt"
        ]
      },
      "PosReceiptSaleContactDto": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "Current normalized contact suggestion, not an already-confirmed destination. No customer or buyer identity is inferred."
          },
          "contactVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Current server contact commitment to copy only after explicit confirmation of this exact address. It grants no authority."
          }
        },
        "required": [
          "address",
          "contactVersion"
        ]
      },
      "PosReceiptPreparationDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.receipt-preparation/v1"
            ]
          },
          "preparation": {
            "type": "string",
            "maxLength": 4096,
            "description": "Opaque optimistic preparation data for the selected original proof and controls. It never grants authorization and includes no recipient, provider secret or send capability. Copy unchanged into an explicit send command."
          },
          "commandKey": {
            "type": "string",
            "maxLength": 99,
            "description": "Random original receipt command identity. Retain this key with the exact command during retry; it grants no authority and never changes payment recovery."
          },
          "proof": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosPaymentProofDto"
              },
              {
                "$ref": "#/components/schemas/PosReceiptDeclineProofDto"
              }
            ],
            "description": "Closed server-selected proof. Discriminate by proofVersion; reject unsupported versions. Native supplies no outcome or monetary facts."
          },
          "saleContact": {
            "nullable": true,
            "description": "Current consistent contact suggestion for both original documents. Null means absent, inconsistent or unusable contact; the operator may explicitly confirm a SEND_TIME address. Always requires confirmation and a fresh current contact check at send.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosReceiptSaleContactDto"
              }
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original epoch deadline in UTC. New preparation does not refresh it. Presence does not guarantee admission; permission, source, proof, root and uncertainty checks must still pass."
          }
        },
        "required": [
          "version",
          "preparation",
          "commandKey",
          "proof",
          "saleContact",
          "expiresAt"
        ]
      },
      "PosReceiptDeliveryResultDto": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "format": "uuid",
            "description": "Original receipt operation identity. This is separate from the payment attempt and never authorizes a second payment."
          },
          "state": {
            "type": "string",
            "enum": [
              "ADMITTED",
              "PROVIDER_ACCEPTED",
              "ACCEPTED",
              "NO_SUBMISSION",
              "HOLD"
            ],
            "description": "ADMITTED is queued, PROVIDER_ACCEPTED is provider acceptance, ACCEPTED is retained terminal acceptance, NO_SUBMISSION proves terminal non-submission, and HOLD preserves uncertainty. None proves inbox delivery."
          }
        },
        "required": [
          "operationId",
          "state"
        ]
      },
      "PosReceiptStatusDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.receipt-status/v1"
            ]
          },
          "operation": {
            "nullable": true,
            "description": "Current retained original receipt operation for this sale, or a positively qualified absence. Null is not sending eligibility or proof of non-submission: fresh preparation and all current server checks remain required. Unavailable/unknown history returns an error and stays HOLD. With receiptKind, see that field for the per-kind meaning.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosReceiptDeliveryResultDto"
              }
            ]
          },
          "receiptKind": {
            "type": "string",
            "enum": [
              "completed",
              "declined"
            ],
            "description": "Present only when the request selected receiptKind, and then exactly that kind. operation is the active receipt operation of either kind (one invoice-wide uncertainty fence covers both kinds), else that kind's retained terminal receipt, else a qualified absence of that kind. A request without receiptKind gets the existing response, without this field. A client that selected a kind must treat a missing or different value as unavailable."
          }
        },
        "required": [
          "version",
          "operation"
        ]
      },
      "PosReceiptRecipientDto": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "SEND_TIME",
              "SALE_CONTACT"
            ],
            "description": "Explicitly confirmed target. SALE_CONTACT also requires the current server contact commitment; an address is never buyer identity or authorization."
          },
          "confirmedAddress": {
            "type": "string",
            "maxLength": 254,
            "description": "One confirmed normalized address. It must already be trimmed and lower-case; controls, lists and display-name forms are refused."
          },
          "confirmed": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "The operator explicitly confirmed this exact target. This assertion supplies no current permission or send authority."
          },
          "expectedContactVersion": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Required exactly for SALE_CONTACT; omitted for SEND_TIME. Binds the current server-qualified sale contact, not customer identity."
          }
        },
        "required": [
          "source",
          "confirmedAddress",
          "confirmed"
        ]
      },
      "PosReceiptDeliveryRequestDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.receipt-delivery/v1",
              "commerce.pos.receipt-delivery/v2"
            ],
            "description": "Outer request protocol. Only commerce.pos.receipt-delivery/v2 can be admitted or resolved: the first receipt of each kind (completed or declined) is SEND, and a later explicit receipt of that kind is RESEND from that kind's retained terminal receipt. A well-formed commerce.pos.receipt-delivery/v1 request keeps its existing unavailable (503) result: it is never admitted, resolved or reinterpreted as v2, and its malformed or unauthorized forms keep their existing errors. The version selects semantics only; it is not authority or proof of a capable client."
          },
          "preparation": {
            "type": "string",
            "maxLength": 4096,
            "description": "Original opaque preparation data, copied unchanged. It is an optimistic precondition, never a credential or independent authorization; all current checks repeat."
          },
          "action": {
            "type": "string",
            "enum": [
              "SEND",
              "RESEND"
            ],
            "description": "RESEND is explicit and requires the exact retained terminal predecessor. Retry the original key/body after uncertainty; a new action or target cannot bypass the invoice uncertainty fence."
          },
          "recipient": {
            "$ref": "#/components/schemas/PosReceiptRecipientDto"
          },
          "predecessorOperationId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
            "description": "Required exactly for RESEND, in the lower-case server spelling of the original operation ID; omitted for SEND. Missing or unproven original terminal closure stays unavailable."
          }
        },
        "required": [
          "version",
          "preparation",
          "action",
          "recipient"
        ]
      },
      "PosReceiptResolutionDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.receipt-resolution/v1"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ADMITTED",
              "PENDING"
            ],
            "description": "ADMITTED: this exact original request (same key and body) was admitted, and operation is its current retained status. PENDING: no admission of this exact request exists at this serialized read and its original admission window has not ended, so it is not closed; keep the original key and body. PENDING does not predict that an exact retry is admitted now: another active or uncertain receipt operation, or current proof, recipient, predecessor or sending checks, can still refuse it. Neither outcome is a send, a release of the original request, inbox delivery or new send authority. An ended window without a matching admission, a conflict or unavailable history returns an error and stays HOLD; a matching admission still resolves to ADMITTED after the window ends."
          },
          "operation": {
            "nullable": true,
            "description": "The admitted original operation when outcome is ADMITTED; always null when outcome is PENDING.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosReceiptDeliveryResultDto"
              }
            ]
          }
        },
        "required": [
          "version",
          "outcome",
          "operation"
        ]
      },
      "PosReceiptResolutionV2Dto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "commerce.pos.receipt-resolution/v2"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ADMITTED",
              "PENDING",
              "NOT_ADMITTED_FINAL"
            ],
            "description": "ADMITTED binds the exact original to its own retained operation. PENDING keeps the original in HOLD while its admission window is open. NOT_ADMITTED_FINAL means the exact original had no admission and its expired window is durably closed. Only an acknowledged result can release that command."
          },
          "operation": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosReceiptDeliveryResultDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "ADMITTED carries the matched original operation. PENDING and NOT_ADMITTED_FINAL carry null."
          }
        },
        "required": [
          "version",
          "outcome",
          "operation"
        ]
      },
      "PosTerminalOperationStateDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ],
            "description": "Contract version. A client treats any other version as no answer."
          },
          "state": {
            "type": "string",
            "enum": [
              "NO_ATTEMPT",
              "RETRYABLE",
              "IN_PROGRESS",
              "PAYMENT_REPORTED",
              "CANCELLED",
              "UNRESOLVED"
            ],
            "description": "NO_ATTEMPT: the key holds no payment attempt in this organization. RETRYABLE: the key's attempt on this invoice has no recorded processor success, authorization, progress or cancellation, and the existing payment-intent route can resume it; that route re-checks the processor before any card handoff. IN_PROGRESS: the processor last reported the attempt processing or awaiting action. PAYMENT_REPORTED: a signed processor event reported success or authorization, and the invoice ledger may not have recorded it yet. CANCELLED: the attempt's PaymentIntent was cancelled and is never replaced. UNRESOLVED: the evidence for this key is contradictory or incomplete. Each state is as of this read only."
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The key's payment attempt on this invoice, or `null` when it has none here."
          },
          "paymentIntentId": {
            "type": "string",
            "nullable": true,
            "description": "That attempt's PaymentIntent, or `null` while none is recorded."
          }
        },
        "required": [
          "version",
          "state",
          "paymentAttemptId",
          "paymentIntentId"
        ]
      },
      "PosSaleReadResponseDto": {
        "type": "object",
        "properties": {
          "originalPricing": {
            "description": "Frozen original inclusive-price evidence, verified against both original Order/Invoice revisions. Present only for the inclusive cohort; omitted for proven legacy/exclusive originals, whose existing tax fields retain their meanings. Omission never establishes zero tax. Missing or inconsistent inclusive evidence refuses the single-sale read (409) or omits that history row. This historical summary remains readable after quote expiry or later revisions; it is not a fresh quote, current document total, permission, or collection/refund authority. Existing flat monetary fields retain their additive projection and may differ from this original after revision; use this summary to explain original included tax.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosSaleOriginalPricingDto"
              }
            ]
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "orderNumber": {
            "type": "string"
          },
          "orderStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceNumber": {
            "type": "string"
          },
          "invoiceStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ],
            "description": "Authoritative payment status of the linked issued invoice, including PARTIALLY_REFUNDED / REFUNDED after an Admin refund (ADR-021 #2531 amendment section 8)."
          },
          "customerMode": {
            "type": "string",
            "enum": [
              "WALK_IN",
              "EXISTING_CUSTOMER",
              "CONTACT"
            ],
            "description": "Immutable creation provenance (ADR-021 section 6). It records what was true when the sale was created and is never rewritten. It is NOT an answer to \"does this sale have a customer?\" — read customerId for that."
          },
          "customerId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "Current tenant-scoped customer association on the authoritative order, or null when the sale has none. Separate from customerMode by ADR-021 #2531 amendment section 5: a WALK_IN sale that later gains a customer keeps customerMode=WALK_IN and reports the attachment here."
          },
          "currency": {
            "type": "string"
          },
          "subtotalInCents": {
            "type": "number"
          },
          "tipInCents": {
            "type": "number",
            "description": "Frozen card-present tip included in subtotal and total; zero for V3 and inclusive V4 no-tip sales, omitted on historical V1/V2 sales.",
            "minimum": 0
          },
          "discountInCents": {
            "type": "number"
          },
          "taxInCents": {
            "type": "number"
          },
          "totalInCents": {
            "type": "number"
          },
          "amountPaidInCents": {
            "type": "number",
            "description": "Gross completed payments recorded against the linked invoice (ADR-013 derived rollup). Refunds are reported separately in refundedInCents."
          },
          "refundedInCents": {
            "type": "number",
            "description": "Completed refunds recorded against the linked invoice. Admin (#1630/#1634) is the only first-release refund mechanism; POS reflects it and never initiates it."
          },
          "balanceDueInCents": {
            "type": "number",
            "description": "Remaining collectible balance from the authoritative invoice rollup, never a POS-local tally."
          },
          "payable": {
            "type": "boolean",
            "description": "True only while the linked issued invoice has a positive collectible balance."
          },
          "tender": {
            "type": "string",
            "enum": [
              "CASH",
              "CHECK",
              "BANK_TRANSFER",
              "STORE_CREDIT",
              "CARD",
              "OTHER"
            ],
            "nullable": true,
            "description": "Tender of the settled payment, derived from completed payment transactions on the linked invoice. Null when nothing has settled yet, and null when more than one tender settled the invoice (split tender is D2 #2538 and is not representable here). The tender the sale was created for is collectionTender."
          },
          "collectionTender": {
            "type": "string",
            "enum": [
              "CARD",
              "CASH"
            ],
            "nullable": true,
            "description": "The tender this sale was created for. The card and cash collection routes each refuse a sale created for the other tender. Read only from the pricing snapshot the sale's Order froze at creation, so payments, refunds, voids and later revisions never change it, and record metadata and Invoice snapshots never decide it. POS sales from before explicit tender were card-only and report CARD; explicit-tender sales report their frozen CARD or CASH. Null when that creation evidence is missing, unrecognized or contradictory: it is never defaulted to CARD, and a client should treat it as unknown and let the collection route decide. Servers from before DR-2536-04 item 5 omit the field. Omission is a distinct legacy state: clients may use trustworthy local creation-tender evidence for the same sale, as the first-party POS does with its retained sale journal. Explicit null means the server could not establish the creation tender; it does not authorize that legacy fallback. For the tender that settled the sale, read tender."
          },
          "lines": {
            "description": "Frozen lines of the authoritative order, in commit order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleFrozenLineDto"
            }
          },
          "discountActivity": {
            "maxItems": 1,
            "description": "The sale's canonical manual-discount activity, read from its authoritative order only. Never more than one entry. Empty when the sale has no manual discount, and also when its activity record is unreadable or duplicated, which is reported as empty rather than failing the sale read. An empty list therefore does not by itself distinguish \"no manual discount\" from \"activity could not be presented\": the order's merchant activity timeline (GET /api/v1/merchant/commerce/{id}/activity) shows the underlying commerce.record.discount_overridden event, and the server logs a warning naming the order and the reason. The sale's discount and total fields remain authoritative for what was charged either way.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleDiscountActivityDto"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the authoritative order was committed."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the authoritative order last changed."
          },
          "invoiceIssuedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the linked invoice was issued (ADR-021 section 5 freezes it at creation)."
          },
          "settledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Occurrence time of the most recent completed payment on the linked invoice, or null when nothing has settled."
          },
          "pricingSnapshotVersion": {
            "type": "string"
          },
          "pricingSnapshotHash": {
            "type": "string",
            "description": "SHA-256 of the immutable ADR-012 snapshot."
          },
          "terminalLocationId": {
            "type": "string",
            "nullable": true,
            "description": "#4497: the Stripe Terminal Location this sale was created with, frozen in its pricing snapshot. Card payment for the sale must be collected there. It is attribution only: no POS route accepts it, and a phone chooses its location by the configured mapping id. `null` only when the snapshot records no location, which no POS sale created since #1650 lacks."
          },
          "terminalLocationLabel": {
            "type": "string",
            "nullable": true,
            "description": "#4497: the current label of this organization's configured Terminal Location for `terminalLocationId`, read when the sale is returned, so a later rename shows here. A retired location keeps its label. `null` when this organization no longer holds that location, for example after a previous-account location was released (#2365), or when `terminalLocationId` is `null`. It is never another location's label."
          },
          "terminalOperation": {
            "description": "Present only when the request supplied `x-idempotency-key`: the state of that original card operation, read in the same snapshot as this sale.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosTerminalOperationStateDto"
              }
            ]
          }
        },
        "required": [
          "orderId",
          "orderNumber",
          "orderStatus",
          "invoiceId",
          "invoiceNumber",
          "invoiceStatus",
          "paymentStatus",
          "customerMode",
          "customerId",
          "currency",
          "subtotalInCents",
          "discountInCents",
          "taxInCents",
          "totalInCents",
          "amountPaidInCents",
          "refundedInCents",
          "balanceDueInCents",
          "payable",
          "tender",
          "collectionTender",
          "lines",
          "discountActivity",
          "createdAt",
          "updatedAt",
          "invoiceIssuedAt",
          "settledAt",
          "pricingSnapshotVersion",
          "pricingSnapshotHash",
          "terminalLocationId",
          "terminalLocationLabel"
        ]
      },
      "PosTerminalCollectionRequestDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated and ignored. Earlier cartonium POS builds sent an operator reason; routine collection records server-derived provenance instead. Omit it.",
            "maxLength": 500
          }
        }
      },
      "PosTerminalConnectionTokenDto": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "description": "Short-lived Stripe Terminal connection token secret for the native SDK."
          },
          "stripeAccountId": {
            "type": "string",
            "description": "Tenant connected Stripe account the token is scoped to."
          },
          "terminalLocationId": {
            "type": "string",
            "description": "Server-selected Stripe Terminal Location for Tap to Pay reader connection."
          },
          "terminalLocationLabel": {
            "type": "string",
            "description": "Display label for the selected Terminal Location."
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "secret",
          "stripeAccountId",
          "terminalLocationId",
          "terminalLocationLabel",
          "orderId",
          "invoiceId"
        ]
      },
      "PosTerminalReaderConnectionTokenDto": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "description": "Short-lived Stripe Terminal connection token secret for the native SDK. Never persist or log it."
          },
          "organizationId": {
            "type": "string",
            "description": "Organization selected by this POS session. The phone refuses a token for any organization except the one whose workspace it shows."
          },
          "stripeAccountId": {
            "type": "string",
            "description": "Tenant connected Stripe account the token is scoped to."
          },
          "terminalLocationId": {
            "type": "string",
            "description": "This installation's effective Stripe Terminal Location: the same one a sale created now would freeze."
          },
          "terminalLocationLabel": {
            "type": "string",
            "description": "Display label for that Terminal Location."
          }
        },
        "required": [
          "secret",
          "organizationId",
          "stripeAccountId",
          "terminalLocationId",
          "terminalLocationLabel"
        ]
      },
      "PrepareTerminalOutcomeDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-generated outcome identity, persisted before requesting the original payment handoff. Reuse only for the same original collection; it cannot be rebound to a replacement PaymentIntent."
          },
          "collectionOperationId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-generated identity for one SDK collection. Retained for confirmation recovery of that collection; a new collection gets a new identity. It does not identify individual physical taps."
          }
        },
        "required": [
          "recordId",
          "collectionOperationId"
        ]
      },
      "PosTerminalPaymentIntentRequestDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated and ignored. Earlier cartonium POS builds sent an operator reason; routine collection records server-derived provenance instead. Omit it.",
            "maxLength": 500
          },
          "outcomeIntent": {
            "type": "string",
            "enum": [
              "RECOVER_ORIGINAL",
              "PREPARE_COLLECTION",
              "RESUME_INITIAL_OPERATION"
            ],
            "description": "RECOVER_ORIGINAL proves an existing original keyed payment and never creates an attempt, PaymentIntent or observation. PREPARE_COLLECTION requires a complete current-scope observation identity and requests optional recording of the original initial payment. RESUME_INITIAL_OPERATION resumes only that initial financial operation with the same key and no outcome identity or binding. All explicit intents preserve original-payment proof and never replace a canceled payment or fall back to the legacy path. Unknown or unproved original operations remain held. Outcome or notification unavailability does not block an independently authorized financial handoff; a missing binding means unavailable optional coverage. Reconcile the original payment before collecting; confirmation recovery confirms the same original without recollection."
          },
          "outcome": {
            "description": "Persist these two identities before the original collection. Reuse only for its confirmation recovery; a new collection gets new IDs. This never replaces the financial idempotency key. For RESUME_INITIAL_OPERATION this field must be absent, including null or partial identities.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PrepareTerminalOutcomeDto"
              }
            ]
          }
        }
      },
      "TerminalOutcomeBindingDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-generated outcome identity, persisted before requesting the original payment handoff. Reuse only for the same original collection; it cannot be rebound to a replacement PaymentIntent."
          },
          "collectionOperationId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-generated identity for one SDK collection. Retained for confirmation recovery of that collection; a new collection gets a new identity. It does not identify individual physical taps."
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "description": "Original authenticated organization."
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid",
            "description": "Original server-owned payment attempt; its mutable status is not the historical observation."
          },
          "posSessionId": {
            "type": "string",
            "format": "uuid",
            "description": "Original POS session. Reading or reporting also requires this session to remain authorized."
          },
          "actorUserId": {
            "type": "string",
            "format": "uuid",
            "description": "Original authenticated user. This identifier grants no user lookup or acting authority."
          },
          "installationIdHash": {
            "type": "string",
            "description": "Original installation digest from the authenticated session; a scope binding, not hardware attestation."
          },
          "applicationEnvironment": {
            "type": "string",
            "enum": [
              "development",
              "staging",
              "production"
            ],
            "description": "Server-owned application environment, independent of Stripe mode and APNs environment."
          },
          "stripeAccountId": {
            "type": "string",
            "description": "Frozen connected Stripe account for the original handoff."
          },
          "stripeMode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ],
            "description": "Original Stripe account mode; does not select APNs sandbox or production."
          },
          "paymentIntentId": {
            "type": "string",
            "description": "Frozen original PaymentIntent. Later replacement of the attempt pointer does not change this binding."
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "amountInCents": {
            "type": "integer",
            "description": "Server-frozen amount offered for this collection, in cents. This is not proof that any amount was paid."
          },
          "currency": {
            "type": "string",
            "description": "Server-frozen lowercase ISO-4217 currency."
          },
          "appVersion": {
            "type": "string",
            "description": "App version recorded by the authenticated POS session at preparation."
          },
          "appBuild": {
            "type": "string",
            "description": "App build recorded by the authenticated POS session at preparation."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Server preparation time in UTC. Preparation alone is not a decline."
          }
        },
        "required": [
          "recordId",
          "collectionOperationId",
          "version",
          "organizationId",
          "paymentAttemptId",
          "posSessionId",
          "actorUserId",
          "installationIdHash",
          "applicationEnvironment",
          "stripeAccountId",
          "stripeMode",
          "paymentIntentId",
          "orderId",
          "invoiceId",
          "amountInCents",
          "currency",
          "appVersion",
          "appBuild",
          "createdAt"
        ]
      },
      "PosTerminalPaymentIntentDto": {
        "type": "object",
        "properties": {
          "outcomeBinding": {
            "description": "Optional durable current-scope observation binding; not payment proof. PREPARE_COLLECTION may omit it when outcome recording is unavailable. RECOVER_ORIGINAL may omit it when the observation is absent, unknown, foreign or unavailable, without revealing, recreating or reparenting that observation. RESUME_INITIAL_OPERATION never returns a binding. Absence does not invalidate the independently verified financial response or authorize a new payment: use the same key and proven original PaymentIntent with all financial and native lifetime guards. A present binding must match the original financial and current observation scope exactly; a foreign record never enters the native sink.",
            "allOf": [
              {
                "$ref": "#/components/schemas/TerminalOutcomeBindingDto"
              }
            ]
          },
          "clientSecret": {
            "type": "string",
            "description": "PaymentIntent client secret for Stripe Terminal collect and process calls."
          },
          "paymentIntentId": {
            "type": "string",
            "description": "Stripe PaymentIntent created on the tenant connected account."
          },
          "paymentAttemptId": {
            "type": "string",
            "description": "Internal PaymentAttempt used by webhook reconciliation."
          },
          "stripeAccountId": {
            "type": "string",
            "description": "Tenant connected Stripe account the PaymentIntent lives on."
          },
          "amountInCents": {
            "type": "integer",
            "format": "int32",
            "description": "Server-authoritative invoice balance being collected, in cents."
          },
          "currency": {
            "type": "string",
            "description": "ISO-4217 currency code in lowercase."
          },
          "terminalLocationId": {
            "type": "string",
            "description": "Server-selected Stripe Terminal Location for Tap to Pay reader connection."
          },
          "terminalLocationLabel": {
            "type": "string",
            "description": "Display label for the selected Terminal Location."
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "clientSecret",
          "paymentIntentId",
          "paymentAttemptId",
          "stripeAccountId",
          "amountInCents",
          "currency",
          "terminalLocationId",
          "terminalLocationLabel",
          "orderId",
          "invoiceId"
        ]
      },
      "PosCashTenderRequestDto": {
        "type": "object",
        "properties": {
          "amountReceivedInCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Cash received from the customer, in the sale currency's minor units. It must cover the server-derived balance due: full tender only, never partial or split."
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Za-z]{3}$",
            "description": "Three-letter ISO currency the client believes the sale is in. A mismatch refuses rather than converts."
          }
        },
        "required": [
          "amountReceivedInCents",
          "currency"
        ]
      },
      "PosCashTenderResultDto": {
        "type": "object",
        "properties": {
          "commandId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "paymentTransactionId": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "description": "Sale currency, lower-case ISO."
          },
          "amountInCents": {
            "type": "integer",
            "description": "The balance collected: the one completed CASH ledger amount."
          },
          "amountReceivedInCents": {
            "type": "integer"
          },
          "changeDueInCents": {
            "type": "integer",
            "description": "Change to hand back. A cash-handling display fact; it never reaches the ledger."
          },
          "taxMode": {
            "type": "string",
            "enum": [
              "stripe_tax",
              "manual_no_tax"
            ]
          },
          "taxDisposition": {
            "type": "string",
            "enum": [
              "FORWARD_RECORDING_QUEUED",
              "MANUAL_NO_TAX_NO_CALL"
            ]
          },
          "settledAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "commandId",
          "orderId",
          "invoiceId",
          "paymentTransactionId",
          "currency",
          "amountInCents",
          "amountReceivedInCents",
          "changeDueInCents",
          "taxMode",
          "taxDisposition",
          "settledAt"
        ]
      },
      "SetPosSaleCustomerDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string",
            "format": "uuid",
            "maxLength": 200,
            "nullable": true,
            "description": "Required. The exact tenant Customer to attach, or null to detach. Attach only replaces a null current association and detach only replaces a non-null one; a direct change from one Customer to another is refused (HTTP 400, details.reason=POS_SALE_CUSTOMER_REBIND_FORBIDDEN). Detach first, then attach."
          },
          "expectedCustomerId": {
            "type": "string",
            "format": "uuid",
            "maxLength": 200,
            "nullable": true,
            "description": "Required. The current association the caller last read from the sale: the attached Customer id, or null when the sale has none. The server applies the change only when both the Order and its Invoice still carry exactly this value; otherwise it refuses with HTTP 409 and details.reason=POS_SALE_CUSTOMER_ASSOCIATION_STALE and writes nothing."
          }
        },
        "required": [
          "customerId",
          "expectedCustomerId"
        ],
        "additionalProperties": false
      },
      "PosSaleCustomerChangeResultDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "change": {
            "type": "string",
            "enum": [
              "ATTACHED",
              "DETACHED"
            ],
            "description": "ATTACHED when a Customer was added to a sale that had none; DETACHED when the current Customer was removed."
          },
          "customerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The association this change wrote to both the Order and its Invoice: the attached Customer id, or null after a detach."
          },
          "previousCustomerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The association this change replaced: null for an attach, the removed Customer id for a detach."
          },
          "customerMode": {
            "type": "string",
            "enum": [
              "WALK_IN",
              "EXISTING_CUSTOMER",
              "CONTACT"
            ],
            "description": "The sale's immutable creation provenance, unchanged by this command. It is not the current association: an attached WALK_IN sale still reports WALK_IN here."
          },
          "changedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the server accepted this change."
          }
        },
        "required": [
          "orderId",
          "invoiceId",
          "change",
          "customerId",
          "previousCustomerId",
          "customerMode",
          "changedAt"
        ]
      },
      "PosPricingPreviewDraftDto": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$",
            "description": "The client cart instance this preview prices. It is bound into the tax-included payable and compared, never used for money."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "The draft revision this preview prices. Any cart, customer or location change makes a new revision, which needs a new preview."
          }
        },
        "required": [
          "ref",
          "revision"
        ]
      },
      "PosPricingPreviewRequestDto": {
        "type": "object",
        "properties": {
          "draft": {
            "$ref": "#/components/schemas/PosPricingPreviewDraftDto"
          },
          "lines": {
            "minItems": 1,
            "maxItems": 100,
            "description": "The same item/variant identifiers and quantities a POS sale accepts. The server reads every price from the catalog.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosSaleLineDto"
            }
          },
          "discount": {
            "additionalProperties": true,
            "description": "Omit for no manual discount; null is invalid. The same manual cart discount POST /merchant/pos/sales accepts, applied after automatic and bundle discounts and before tax, with the same authority: Owner/Admin or Staff delegated pricing:write, and a nonblank reason. A refused discount returns its error directly; nothing is recorded.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "amountInCents",
                  "reason"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "FIXED"
                    ]
                  },
                  "amountInCents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000000
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "description": "After edge trimming, nonblank and at most 500 Unicode characters."
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "type",
                  "percentDecimal",
                  "reason"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "PERCENTAGE"
                    ]
                  },
                  "percentDecimal": {
                    "type": "string",
                    "pattern": "^(?:0\\.(?!0{1,4}$)[0-9]{1,4}|1(?:\\.0{1,4})?)$",
                    "description": "Exact decimal fraction greater than zero and at most one, with at most four fractional digits; normalized to integer basis points."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "description": "After edge trimming, nonblank and at most 500 Unicode characters."
                  }
                }
              }
            ]
          },
          "pricing": {
            "description": "The current draft's \"Prices include tax\" switch. Omit for OFF, as every new sale starts; null is invalid. OFF prices tax added on top. ON keeps the post-discount merchandise gross fixed and carves the included tax out of it; it needs Owner/Admin or Staff delegated pricing:write and a nonblank reason. There is no confirmation field: a preview never accepts one.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "pricesIncludeTax"
                ],
                "properties": {
                  "pricesIncludeTax": {
                    "type": "boolean",
                    "enum": [
                      false
                    ]
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "pricesIncludeTax",
                  "reason"
                ],
                "properties": {
                  "pricesIncludeTax": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "description": "After edge trimming, nonblank and at most 500 Unicode characters."
                  }
                }
              }
            ]
          }
        },
        "required": [
          "draft",
          "lines"
        ]
      },
      "PosPricingPreviewSelectionDto": {
        "type": "object",
        "properties": {
          "pricesIncludeTax": {
            "type": "boolean",
            "description": "The normalized switch this preview priced."
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "The reason, trimmed at its edges, when ON. Null when OFF, which takes no reason. Collection must carry the same reason."
          }
        },
        "required": [
          "pricesIncludeTax",
          "reason"
        ]
      },
      "PosPricingPreviewAmountsDto": {
        "type": "object",
        "properties": {
          "subtotalInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Unit price times quantity."
          },
          "discountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "The genuine automatic, bundle and manual discounts allocated here."
          },
          "netInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Excluding tax. ADDED: subtotal - discount. INCLUDED: gross - tax."
          },
          "taxInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "The provider's tax: added on top (ADDED) or carved out of the gross (INCLUDED). Zero for a provider zero-rated or fully discounted line, or under the tenant's acknowledged manual no-tax mode."
          },
          "grossInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "What the customer pays, tax included. ADDED: net + tax. INCLUDED: the fixed post-discount amount, subtotal - discount."
          }
        },
        "required": [
          "subtotalInCents",
          "discountInCents",
          "netInCents",
          "taxInCents",
          "grossInCents"
        ]
      },
      "PosPricingPreviewLineDto": {
        "type": "object",
        "properties": {
          "subtotalInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Unit price times quantity."
          },
          "discountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "The genuine automatic, bundle and manual discounts allocated here."
          },
          "netInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Excluding tax. ADDED: subtotal - discount. INCLUDED: gross - tax."
          },
          "taxInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "The provider's tax: added on top (ADDED) or carved out of the gross (INCLUDED). Zero for a provider zero-rated or fully discounted line, or under the tenant's acknowledged manual no-tax mode."
          },
          "grossInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "What the customer pays, tax included. ADDED: net + tax. INCLUDED: the fixed post-discount amount, subtotal - discount."
          },
          "ref": {
            "type": "string",
            "description": "The server's pricing reference for this line, in basis order."
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Null when the line sells the item without a variant."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "subtotalInCents",
          "discountInCents",
          "netInCents",
          "taxInCents",
          "grossInCents",
          "ref",
          "itemId",
          "variantId",
          "quantity"
        ]
      },
      "PosPricingPreviewConfirmationFactsDto": {
        "type": "object",
        "properties": {
          "merchandiseGrossInCents": {
            "type": "integer",
            "minimum": 0
          },
          "merchandiseIncludedTaxInCents": {
            "type": "integer",
            "minimum": 0
          },
          "merchandiseNetInCents": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "merchandiseGrossInCents",
          "merchandiseIncludedTaxInCents",
          "merchandiseNetInCents"
        ]
      },
      "PosPricingPreviewDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "pos.pricing-preview/v1"
            ]
          },
          "draft": {
            "description": "The request's draft, echoed.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPricingPreviewDraftDto"
              }
            ]
          },
          "selection": {
            "$ref": "#/components/schemas/PosPricingPreviewSelectionDto"
          },
          "currency": {
            "type": "string",
            "description": "Lowercase ISO 4217 code: the tenant's Tap to Pay currency, as POS readiness verified it."
          },
          "pricedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The instant the server priced the catalog, discounts and tax settings; the provider quote is taken right after it. Any later catalog, rule, discount, draft, location, account, permission or tax-settings change makes this preview stale."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The provider quote's expiry; reprice at or after it. Null only for an OFF preview under the tenant's acknowledged manual no-tax mode, which has no quote."
          },
          "taxSource": {
            "type": "string",
            "enum": [
              "PROVIDER",
              "MANUAL_NO_TAX"
            ],
            "description": "PROVIDER: the tax was calculated on the tenant's connected account. MANUAL_NO_TAX: OFF only, under the tenant's acknowledged manual tax handling, so no tax is calculated."
          },
          "taxTreatment": {
            "type": "string",
            "enum": [
              "INCLUDED",
              "ADDED"
            ],
            "description": "INCLUDED when ON, ADDED when OFF."
          },
          "merchandise": {
            "description": "Product lines only, after genuine discounts. Tips, fees and shipping are not included: a preview has no tender or tip, and ancillary charges keep their own treatment.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPricingPreviewAmountsDto"
              }
            ]
          },
          "lines": {
            "description": "One entry per priced product line, in basis order; never empty.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosPricingPreviewLineDto"
            }
          },
          "confirmationFacts": {
            "nullable": true,
            "description": "ON only: the gross, included tax and net the cashier must review before collection. Null when OFF, which needs no confirmation. Presence is not a confirmation, and returning these values without the cashier reviewing them is not one either.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPricingPreviewConfirmationFactsDto"
              }
            ]
          },
          "payableFingerprint": {
            "type": "string",
            "nullable": true,
            "description": "ON only: the tax-included payable's content fingerprint, scoped to this tenant, draft revision, actor and reason. Null when OFF. It is an identity, not a credential: it authorizes nothing, and collection reprices."
          }
        },
        "required": [
          "version",
          "draft",
          "selection",
          "currency",
          "pricedAt",
          "expiresAt",
          "taxSource",
          "taxTreatment",
          "merchandise",
          "lines",
          "confirmationFacts",
          "payableFingerprint"
        ]
      },
      "PosTerminalLocationSelectionStateDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "STALE"
            ],
            "description": "ACTIVE when the saved location is still configured for this tenant's current connected account. STALE when it was removed, retired, or belongs to a previously connected account; preflight, sales and payments then fail closed until this phone chooses again or clears its choice to use the business default. Provider-side removal is not detected here; preflight reports it."
          },
          "staleReason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "REMOVED",
                  "RETIRED",
                  "ACCOUNT_CHANGED"
                ]
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Why the saved choice is stale. Null when `status` is ACTIVE."
          },
          "terminalLocationMappingId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "The saved location, when it still exists. Null only when it was removed (staleReason REMOVED)."
          },
          "terminalLocationId": {
            "type": "string",
            "description": "Stripe Terminal Location id this phone saved, retained so a removed choice can still be explained."
          },
          "selectedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "status",
          "staleReason",
          "terminalLocationMappingId",
          "terminalLocationId",
          "selectedAt"
        ]
      },
      "PosTerminalLocationOptionDto": {
        "type": "object",
        "properties": {
          "terminalLocationMappingId": {
            "type": "string",
            "format": "uuid",
            "description": "cartonium id of this configured location. Accepted only by PUT /api/v1/merchant/pos/terminal-location-selection."
          },
          "terminalLocationId": {
            "type": "string",
            "description": "Stripe Terminal Location id, for display and support only. POS never submits it."
          },
          "label": {
            "type": "string",
            "description": "Display label configured in Admin."
          },
          "isTenantDefault": {
            "type": "boolean",
            "description": "True for the business default a phone uses when it has no saved choice. At most one option is true."
          },
          "isThisPhoneSelection": {
            "type": "boolean",
            "description": "True when this POS installation saved this location. At most one option is true. All are false when this phone has no saved choice or its saved choice is stale; see `selection`."
          }
        },
        "required": [
          "terminalLocationMappingId",
          "terminalLocationId",
          "label",
          "isTenantDefault",
          "isThisPhoneSelection"
        ]
      },
      "PosTerminalLocationOptionsDto": {
        "type": "object",
        "properties": {
          "locations": {
            "description": "Active locations configured in Admin for the tenant's current connected Stripe account, default first, then by label. Empty means none are configured and POS card sales need Admin setup. Listed from cartonium configuration; Stripe availability, country and currency are verified when a location is selected and before every payment. At most 100 are returned per page; follow `nextCursor` for the rest.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PosTerminalLocationOptionDto"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when more locations follow this page; request them with `nextCursor`."
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "maxLength": 2048,
            "description": "Opaque cursor for the next page of `locations`. Null on the last page. The business default and this phone's saved choice are the same on every page."
          },
          "tenantDefaultTerminalLocationMappingId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "The business default location. Null when no default is configured for the current connected account; a phone with no saved choice then cannot take card payments until one is chosen or Admin sets a default."
          },
          "selection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PosTerminalLocationSelectionStateDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "This POS installation's saved choice. Null when the phone has no saved choice and uses the business default. A choice lasts until POS sign-out ends the installation."
          }
        },
        "required": [
          "locations",
          "hasMore",
          "nextCursor",
          "tenantDefaultTerminalLocationMappingId",
          "selection"
        ]
      },
      "SelectPosTerminalLocationDto": {
        "type": "object",
        "properties": {
          "terminalLocationMappingId": {
            "type": "string",
            "format": "uuid",
            "description": "A `terminalLocationMappingId` from GET /api/v1/merchant/pos/terminal-locations. It is a cartonium id, never a Stripe id; the server revalidates tenant, connected account, active state, provider availability, country and currency before saving the choice."
          }
        },
        "required": [
          "terminalLocationMappingId"
        ]
      },
      "ReportTerminalOutcomeDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-generated outcome identity, persisted before requesting the original payment handoff. Reuse only for the same original collection; it cannot be rebound to a replacement PaymentIntent."
          },
          "collectionOperationId": {
            "type": "string",
            "format": "uuid",
            "description": "Client-generated identity for one SDK collection. Retained for confirmation recovery of that collection; a new collection gets a new identity. It does not identify individual physical taps."
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "COLLECT",
              "CONFIRM"
            ],
            "description": "Pinned native callback that supplied this observation. Unknown confirmation, timeout and a preparation without a callback cannot complete a report."
          },
          "nativeDomain": {
            "type": "string",
            "enum": [
              "com.stripe-terminal"
            ]
          },
          "nativeCode": {
            "type": "integer",
            "enum": [
              6500
            ],
            "description": "Merchant-device observation from the pinned native reader callback. Not processor or issuer proof, device attestation, proof of settlement or a customer receipt source."
          },
          "terminalSdkVersion": {
            "type": "string",
            "enum": [
              "5.7.0"
            ]
          },
          "reactNativeSdkVersion": {
            "type": "string",
            "enum": [
              "0.0.1-beta.32"
            ]
          }
        },
        "required": [
          "recordId",
          "collectionOperationId",
          "version",
          "stage",
          "nativeDomain",
          "nativeCode",
          "terminalSdkVersion",
          "reactNativeSdkVersion"
        ]
      },
      "TerminalOutcomeCustodyAckDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid",
            "description": "Original accepted record. Use only with the authenticated outcome routes; not a payment command."
          },
          "reportHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Server SHA-256 of the closed v1 ordered report tuple. Identical replay retains this hash; it is not an authenticity or delivery claim."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original server custody time in UTC, preserved on replay. Does not mean displayed, read, financially settled or locally safe to delete without separate local disposition."
          }
        },
        "required": [
          "recordId",
          "reportHash",
          "recordedAt"
        ]
      },
      "TerminalOutcomeDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "enum": [
              "DEVICE",
              "PROCESSOR"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "MERCHANT_DEVICE",
              "PROCESSOR_REPORTED"
            ],
            "description": "Provenance of the historical fact. Neither value is approved/declined customer-receipt evidence or proof that no money moved."
          },
          "stage": {
            "type": "string",
            "enum": [
              "COLLECT",
              "CONFIRM"
            ],
            "nullable": true,
            "description": "Native callback stage for DEVICE only. PROCESSOR does not identify a physical presentation."
          },
          "paymentAttemptId": {
            "type": "string",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "amountInCents": {
            "type": "integer",
            "minimum": 1,
            "description": "Original collection amount, not an amount-paid assertion."
          },
          "currency": {
            "type": "string",
            "description": "Original lowercase ISO-4217 currency."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Original durable custody time; not device display time."
          },
          "acknowledgedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "First authenticated acknowledgement after rendering this exact outcome, or null."
          }
        },
        "required": [
          "version",
          "recordId",
          "source",
          "evidence",
          "stage",
          "paymentAttemptId",
          "orderId",
          "invoiceId",
          "amountInCents",
          "currency",
          "recordedAt",
          "acknowledgedAt"
        ]
      },
      "TerminalOutcomePageDto": {
        "type": "object",
        "properties": {
          "items": {
            "description": "Newest-first completed outcomes. Empty means no completed outcomes remain under the active scope, filters and cursor at query time.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TerminalOutcomeDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Pass this cursor with the same scope and filters to continue; acknowledging the cursor outcome does not invalidate it. null means no further page under those filters at query time, not that future outcomes cannot be recorded."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "TerminalOutcomeDetailDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "$ref": "#/components/schemas/TerminalOutcomeDto"
          },
          "currentPaymentProofStatus": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "NOT_SETTLED",
              "UNAVAILABLE"
            ],
            "description": "Fresh proof for the original sale. UNAVAILABLE is not evidence of nonpayment."
          },
          "currentPaymentProof": {
            "nullable": true,
            "description": "Existing authenticated POS payment-proof contract, present exactly when status is AVAILABLE. Does not replace the active basket.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PosPaymentProofDto"
              }
            ]
          }
        },
        "required": [
          "outcome",
          "currentPaymentProofStatus",
          "currentPaymentProof"
        ]
      },
      "TerminalOutcomeAcknowledgementDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid"
          },
          "acknowledgedAt": {
            "type": "string",
            "format": "date-time",
            "description": "First acknowledgement time, unchanged by replay."
          }
        },
        "required": [
          "recordId",
          "acknowledgedAt"
        ]
      },
      "RegisterTerminalNotificationDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "authorizationStatus": {
            "type": "string",
            "enum": [
              "AUTHORIZED"
            ],
            "description": "Native OS authorization must already be granted after the optional explanation. This assertion is not device attestation."
          },
          "token": {
            "type": "string",
            "writeOnly": true,
            "minLength": 2,
            "maxLength": 1024,
            "pattern": "^(?:[a-fA-F0-9]{2}){1,512}$",
            "description": "Opaque native APNs token as hex. Never returned, logged or included in outcome evidence."
          },
          "apnsEnvironment": {
            "type": "string",
            "enum": [
              "sandbox",
              "production"
            ],
            "description": "Signed APNs environment; independent of Stripe test/live. Must match this API deployment."
          }
        },
        "required": [
          "version",
          "authorizationStatus",
          "token",
          "apnsEnvironment"
        ]
      },
      "TerminalNotificationRegistrationDto": {
        "type": "object",
        "properties": {
          "registrationId": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque identity of this session/installation routing binding."
          },
          "registeredAt": {
            "type": "string",
            "format": "date-time",
            "description": "Current token-version registration time; never an authorization or delivery proof."
          }
        },
        "required": [
          "registrationId",
          "registeredAt"
        ]
      },
      "RevokeTerminalNotificationDto": {
        "type": "object",
        "properties": {
          "revoked": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "revoked"
        ]
      },
      "BoundedDomainCountDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "`available` — computed and visible. `restricted` — the caller lacks the owning-domain read; says NOTHING about whether data exists. `unavailable` — this build does not implement the feature. Charter §8: restricted or omitted information must not render as \"no history\"."
          },
          "count": {
            "type": "number",
            "nullable": true,
            "description": "The count, ONLY when `status` is `available`; otherwise `null` — never `0`. A hidden count is not zero."
          },
          "atLeast": {
            "type": "boolean",
            "description": "True when the bounded count hit its cap, meaning \"at least `count`\" rather than exactly. Charter §3 asks for bounded counts; an unbounded COUNT(*) over a large tenant is what that rules out."
          }
        },
        "required": [
          "status",
          "count",
          "atLeast"
        ]
      },
      "CustomerCommerceTypeCountsDto": {
        "type": "object",
        "properties": {
          "quote": {
            "description": "Non-draft QUOTE records in the aggregate commerce population.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          },
          "invoice": {
            "description": "Non-draft INVOICE records, including subscription-raised invoices.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          },
          "order": {
            "description": "Non-draft ORDER records, including subscription-raised orders. This is not limited to accepted orders; use acceptedOrderHistory for acceptance presence.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          }
        },
        "required": [
          "quote",
          "invoice",
          "order"
        ]
      },
      "CustomerDomainCountsDto": {
        "type": "object",
        "properties": {
          "commerce": {
            "description": "Canonical commerce records (quotes, invoices, orders).",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          },
          "commerceByType": {
            "description": "Composition of the same tenant-qualified, customer-linked non-draft commerce population as commerce. Subscription-raised records remain in their record kind. Each kind independently probes up to 101 records: 0–100 is exact; more than 100 returns count 100 with atLeast true. The aggregate retains its own independent cap, so capped values need not sum to it. Each kind preserves typed availability: restricted or unavailable counts are null, never zero; available zero means no matching records of that kind.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerCommerceTypeCountsDto"
              }
            ]
          },
          "booking": {
            "description": "Booking-domain records across BOTH tenant-qualified sources — bookings and booking groups — matching what the activity aggregate and the domain-presence facet consider authoritative. Counting only `bookings` let a group-only customer read `count: 0` in the same response that reported booking-derived activity.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          },
          "subscription": {
            "$ref": "#/components/schemas/BoundedDomainCountDto"
          },
          "operationalTag": {
            "description": "Operational tags (charter §7). Always `unavailable` in this slice — the tag model does not exist and §7 is gated on the surviving E21 policy. Reported as an omitted feature rather than an empty set, so a consumer cannot read \"not built\" as \"this customer has no tags\".",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          }
        },
        "required": [
          "commerce",
          "commerceByType",
          "booking",
          "subscription",
          "operationalTag"
        ]
      },
      "CustomerAcceptedOrderHistoryDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "`available` — accepted-order presence was checked through this exact tenant Customer link. `restricted` — the caller lacks the commerce-domain read, so `hasAcceptedOrders` is `null` and says NOTHING about whether orders exist. `unavailable` — the response could not establish the state. Only `available` plus `false` authorizes the Admin copy “No accepted orders yet.”"
          },
          "hasAcceptedOrders": {
            "type": "boolean",
            "nullable": true,
            "description": "`true` when at least one ORDER linked through this exact tenant Customer has authoritative acceptance history; `false` only when the authorized bounded existence check found none; otherwise `null`. This is not a payment result: `false` must never render as payment failed or payment not completed, and it does not alter spend, LTV, AOV, conversion, purchaser, verified-account, or marketing meaning."
          }
        },
        "required": [
          "status",
          "hasAcceptedOrders"
        ]
      },
      "CustomerDirectoryEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string",
            "description": "API `displayName` is `name ?? \"Guest\"`: only `null` selects the fallback; empty and whitespace-only names pass through unchanged (`DR-3032-24-A`). For presentation, preserve the API value for a nonblank canonical name, regardless of account status. Otherwise, `REGISTERED` rows display `Unnamed customer`; `GUEST` rows keep a nonblank API display value or use `Unnamed customer` if it is blank. Use `name` to identify the fallback; a stored name of `Guest` is preserved. This display value is not identity or verification proof."
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "The canonical `Customer.name`, or `null` when no canonical name is stored. Empty and whitespace-only strings are returned unchanged. An unverified Customer may have a canonical name, including a value retained from historical data. E26 charter §4 permits authorized merchant stewardship; that write surface is not yet implemented. Account status does not imply absence. Unverified checkout input never populates this field; order-derived names remain on immutable snapshots and appear as identity variants on the detail surface."
          },
          "normalizedEmail": {
            "type": "string",
            "description": "Normalized (case-folded) email — the tenant identity key."
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "Canonical phone, or `null` when no canonical phone is stored. Empty and whitespace-only strings are returned unchanged. An unverified Customer may have a canonical phone, including a value retained from historical data. E26 charter §4 permits authorized merchant stewardship; that write surface is not yet implemented. Account status does not imply absence. Unverified checkout input never populates this field; order-derived phones remain identity variants on detail."
          },
          "accountStatus": {
            "type": "string",
            "enum": [
              "GUEST",
              "REGISTERED"
            ],
            "description": "`DR-3032-20-A` account-status facet. Derived from verification: under `DR-3032-22-A` registering stamps the same row verified in place. `GUEST` means unverified, not that canonical name/phone are absent; `REGISTERED` does not guarantee those fields are populated."
          },
          "emailVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the customer proved control of this email, or `null` if never. An Order association is NOT verification (charter §1) — a customer can have many orders and a null value here."
          },
          "isArchived": {
            "type": "boolean",
            "description": "Archive posture. Archived customers are hidden from the default list yet remain addressable by id. Archive does not change authentication, purchase eligibility, retention, or data rights (charter §6)."
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastAuthoritativeActivityAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Last AUTHORITATIVE relationship activity, or `null` when there is none to report. Authority is charter §8: a tenant-qualified link only. `null` means \"no authoritative activity is linked to this customer\" — it does NOT mean the person never transacted. Orders accepted before #3233 carry no customer link and are not backfilled (`DR-3032-21-A`), so a long-standing customer can legitimately read `null` here."
          },
          "lastAuthoritativeActivityStatus": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "Whether the activity above was computed from EVERY authoritative source. `restricted` means at least one owning domain was withheld from this caller, so a `null` above does NOT mean inactive and a non-null value is a LOWER BOUND — read the two fields together, never the timestamp alone. Charter §8: restricted information must not render as \"no history\". The same reason every count carries a status."
          },
          "domainCounts": {
            "$ref": "#/components/schemas/CustomerDomainCountsDto"
          },
          "acceptedOrderHistory": {
            "description": "ADR-047 zero-order directory truth, kept separate from generalized commerce counts and every payment or customer-value metric.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerAcceptedOrderHistoryDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "displayName",
          "name",
          "normalizedEmail",
          "phone",
          "accountStatus",
          "emailVerifiedAt",
          "isArchived",
          "archivedAt",
          "createdAt",
          "lastAuthoritativeActivityAt",
          "lastAuthoritativeActivityStatus",
          "domainCounts",
          "acceptedOrderHistory"
        ]
      },
      "CustomerDirectoryListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerDirectoryEntryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor — pass back as `?cursor=` for the next page. `null` when there are no more customers. Bound to the sort it was issued for."
          },
          "capabilities": {
            "type": "array",
            "description": "The closed, compatibility-stable capability catalog published for this directory list. Detail-projection-only grants are intentionally not enumerated here; each detail projection reports its own `status` so clients can distinguish available, restricted, and unavailable without probing endpoints.",
            "items": {
              "type": "string",
              "enum": [
                "customer.directory.read",
                "customer.detail.read",
                "customer.domain.commerce.read",
                "customer.domain.booking.read",
                "customer.domain.subscription.read",
                "customer.tag.read"
              ]
            }
          },
          "sort": {
            "type": "string",
            "enum": [
              "CREATED",
              "NAME",
              "LAST_ACTIVITY"
            ],
            "description": "The sort actually applied, echoed so a client never guesses."
          }
        },
        "required": [
          "data",
          "nextCursor",
          "capabilities",
          "sort"
        ]
      },
      "CustomerSavedAddressDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "nullable": true,
            "description": "Reusable address label, or `null` when no label was recorded on this persisted address entry. Projection access and availability are reported by the enclosing address-book status."
          },
          "recipientName": {
            "type": "string",
            "description": "Recipient name stored on this address entry."
          },
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "description": "Second address line, or `null` when no second line was recorded on this persisted address entry."
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string",
            "nullable": true,
            "description": "Region, state, or province, or `null` when none was recorded on this persisted address entry."
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "Address-specific recipient phone, or `null` when no address-specific recipient phone was recorded on this persisted address entry. This is not the canonical profile phone. Projection access and availability are reported by the enclosing address-book status."
          },
          "isDefaultShipping": {
            "type": "boolean",
            "description": "Whether this entry is the reusable shipping default. Independent from billing."
          },
          "isDefaultBilling": {
            "type": "boolean",
            "description": "Whether this entry is the reusable billing default. Independent from shipping."
          }
        },
        "required": [
          "label",
          "recipientName",
          "line1",
          "line2",
          "city",
          "region",
          "postalCode",
          "country",
          "phone",
          "isDefaultShipping",
          "isDefaultBilling"
        ]
      },
      "CustomerSavedAddressBookDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "Availability of the reusable address-book projection. A present object from this route currently emits only `available`; `restricted` and `unavailable` are reserved compatibility states, not current server outcomes. If an older or skewed deployment omits the enclosing `savedAddressBook` field, clients must treat that absence as unavailable rather than as an empty address book."
          },
          "entries": {
            "maxItems": 100,
            "description": "Bounded reusable address entries. An empty array confirms that no persisted reusable addresses exist only when `status` is `available` and `completeness` is `complete`; empty alone does not establish address absence for any other status or completeness state.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSavedAddressDto"
            }
          },
          "completeness": {
            "type": "string",
            "enum": [
              "complete",
              "truncated",
              "indeterminate"
            ],
            "description": "Completeness of the bounded persisted address set. `complete` plus an empty array is the only confirmed empty address book."
          }
        },
        "required": [
          "status",
          "entries",
          "completeness"
        ]
      },
      "CustomerMaskedPaymentMethodDto": {
        "type": "object",
        "properties": {
          "brand": {
            "type": "string",
            "nullable": true,
            "example": "visa",
            "description": "Recorded safe card-brand metadata, or `null` when no brand was recorded. Projection access and availability are reported by the enclosing saved-payment-methods status."
          },
          "last4": {
            "type": "string",
            "nullable": true,
            "example": "4242",
            "description": "Recorded last four digits for support context only, or `null` when no last-four metadata was recorded. Not identity proof."
          },
          "expMonth": {
            "type": "number",
            "nullable": true,
            "example": 12,
            "description": "Recorded card expiry month, or `null` when no expiry month was recorded."
          },
          "expYear": {
            "type": "number",
            "nullable": true,
            "example": 2030,
            "description": "Recorded card expiry year, or `null` when no expiry year was recorded."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Recorded local default selection."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE"
            ],
            "description": "Typed local persistence status. The bounded projection returns only ACTIVE rows under the current charging-account binding; DETACHED rows are excluded."
          }
        },
        "required": [
          "brand",
          "last4",
          "expMonth",
          "expYear",
          "isDefault",
          "status"
        ]
      },
      "CustomerSavedPaymentMethodsDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "`available` means the bounded persisted projection was read. `restricted` means the caller lacks the payment-summary capability and says nothing about existence. `unavailable` is not a zero."
          },
          "source": {
            "type": "string",
            "enum": [
              "LITECOMMERCE_PERSISTED_PAYMENT_METHOD_METADATA"
            ],
            "description": "The source is cartonium persisted safe display metadata, never an order payment snapshot or live provider list."
          },
          "providerPosture": {
            "type": "string",
            "enum": [
              "NOT_PROVIDER_VERIFIED"
            ],
            "description": "No provider lookup or reconciliation ran. Provider freshness and provider-side completeness are therefore unknown; locally complete metadata can still be stale relative to provider state."
          },
          "activeCount": {
            "description": "Bounded count of locally ACTIVE methods for this organization, exact Customer, and current charging account. Null when not available.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BoundedDomainCountDto"
              }
            ]
          },
          "methods": {
            "maxItems": 100,
            "description": "Bounded locally persisted ACTIVE methods for the exact organization, Customer, and current charging account. An empty array confirms no matching local ACTIVE methods only when `status` is `available` and `metadataCompleteness` is `complete`; restricted or indeterminate empty results say nothing about method existence. This collection never establishes that the provider inventory is empty.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerMaskedPaymentMethodDto"
            }
          },
          "metadataCompleteness": {
            "type": "string",
            "enum": [
              "complete",
              "truncated",
              "indeterminate"
            ],
            "description": "Completeness of the bounded persisted metadata set, not a claim about the provider inventory. `indeterminate` accompanies restricted reads."
          }
        },
        "required": [
          "status",
          "source",
          "providerPosture",
          "activeCount",
          "methods",
          "metadataCompleteness"
        ]
      },
      "CustomerPaymentReconciliationTotalDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "Lowercase ISO currency code. Each currency is reported separately; consumers must never add unlike currencies into one customer total."
          },
          "grossPaidInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Gross collected cents: the sum of COMPLETED PAYMENT rows in the cartonium commerce payment ledger for tenant-qualified records linked to this Customer. This is not order value, net sales, LTV, or a Stripe Dashboard Customer Insights value."
          },
          "refundedInCents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Effective returned cents: COMPLETED REFUND rows minus their completed append-only REFUND_REVERSAL corrections for the same linked record set."
          }
        },
        "required": [
          "currency",
          "grossPaidInCents",
          "refundedInCents"
        ]
      },
      "CustomerPaymentReconciliationDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "`available` — the linked cartonium payment ledger was aggregated for this caller. `restricted` — the caller lacks the commerce-domain read, so `totals` is empty and says NOTHING about whether payment history exists. `unavailable` is reserved for a build that cannot provide this boundary."
          },
          "source": {
            "type": "string",
            "enum": [
              "LITECOMMERCE_PAYMENT_LEDGER"
            ],
            "description": "The authoritative source for these merchant operational totals. The value means completed rows in the cartonium commerce payment ledger, reached only through tenant-qualified `CommerceRecord.customerId` links; record rollups, email equality, and provider dashboard analytics are not summed independently."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "LINKED_COMMERCE_RECORDS"
            ],
            "description": "The identity boundary for the aggregate. Only commerce records carrying this exact tenant-scoped `Customer.id` contribute; matching email text does not. Older records intentionally left unlinked by the no-backfill decision are therefore outside coverage."
          },
          "providerCustomerInsightsPosture": {
            "type": "string",
            "enum": [
              "NOT_AUTHORITATIVE"
            ],
            "description": "Stripe Customer Insights is a provider-derived Dashboard summary, not the reconciliation authority for this flow. In particular, a Customer attached after PaymentIntent success can show a Dashboard `Spent` value that does not equal the one successful charge. Compare money against `totals`, never against that insight."
          },
          "totals": {
            "description": "Complete per-currency aggregation over completed ledger movements linked to this Customer. When `status` is `available`, empty means no such linked ledger movement exists. It does not prove the person never paid: pre-#3233 orders are intentionally not backfilled and email equality is never relationship authority. When `status` is not `available`, empty has no data meaning.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerPaymentReconciliationTotalDto"
            }
          }
        },
        "required": [
          "status",
          "source",
          "coverage",
          "providerCustomerInsightsPosture",
          "totals"
        ]
      },
      "CustomerIdentityVariantDto": {
        "type": "object",
        "properties": {
          "sourceReference": {
            "type": "string",
            "description": "The record this identity was captured on. Reference only — the detail surface does not reproduce owning-domain ledgers or mutations (§8)."
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true,
            "description": "Single-line rendering of a captured address on the source record, or `null` when neither address slot produced a renderable value. `null` can mean the snapshot was absent or empty, or that legacy data was present in an unrecognised shape; it does not prove the record carried no address. A rendering, not a parseable address object: this surface exists so an operator can recognise a variant, not so a client can re-address anything from it."
          },
          "addressUsages": {
            "type": "array",
            "maxItems": 2,
            "uniqueItems": true,
            "description": "How this rendered address was used on this source record. Distinct shipping and billing values each carry one usage; one equal rendered value carries both. Every variant keeps its source record's exact usages; usages from different records are never merged into a fabricated combined variant. The same rendered address can therefore appear in multiple record-local variants when each adds role coverage, so consumers must not deduplicate by address alone. Empty exactly when `address` is `null`. A usage is omitted when that snapshot slot was absent or empty, or could not be rendered from a legacy shape; omission does not prove the source record lacked that address. This does not preserve whether an equal billing address was copied or entered independently.",
            "items": {
              "type": "string",
              "enum": [
                "SHIPPING",
                "BILLING"
              ]
            }
          }
        },
        "required": [
          "sourceReference",
          "capturedAt",
          "name",
          "phone",
          "address",
          "addressUsages"
        ]
      },
      "CustomerDirectoryDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string",
            "description": "API `displayName` is `name ?? \"Guest\"`: only `null` selects the fallback; empty and whitespace-only names pass through unchanged (`DR-3032-24-A`). For presentation, preserve the API value for a nonblank canonical name, regardless of account status. Otherwise, `REGISTERED` rows display `Unnamed customer`; `GUEST` rows keep a nonblank API display value or use `Unnamed customer` if it is blank. Use `name` to identify the fallback; a stored name of `Guest` is preserved. This display value is not identity or verification proof."
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "The canonical `Customer.name`, or `null` when no canonical name is stored. Empty and whitespace-only strings are returned unchanged. An unverified Customer may have a canonical name, including a value retained from historical data. E26 charter §4 permits authorized merchant stewardship; that write surface is not yet implemented. Account status does not imply absence. Unverified checkout input never populates this field; order-derived names remain on immutable snapshots and appear as identity variants on the detail surface."
          },
          "normalizedEmail": {
            "type": "string",
            "description": "Normalized (case-folded) email — the tenant identity key."
          },
          "phone": {
            "type": "string",
            "nullable": true,
            "description": "Canonical phone, or `null` when no canonical phone is stored. Empty and whitespace-only strings are returned unchanged. An unverified Customer may have a canonical phone, including a value retained from historical data. E26 charter §4 permits authorized merchant stewardship; that write surface is not yet implemented. Account status does not imply absence. Unverified checkout input never populates this field; order-derived phones remain identity variants on detail."
          },
          "accountStatus": {
            "type": "string",
            "enum": [
              "GUEST",
              "REGISTERED"
            ],
            "description": "`DR-3032-20-A` account-status facet. Derived from verification: under `DR-3032-22-A` registering stamps the same row verified in place. `GUEST` means unverified, not that canonical name/phone are absent; `REGISTERED` does not guarantee those fields are populated."
          },
          "emailVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the customer proved control of this email, or `null` if never. An Order association is NOT verification (charter §1) — a customer can have many orders and a null value here."
          },
          "isArchived": {
            "type": "boolean",
            "description": "Archive posture. Archived customers are hidden from the default list yet remain addressable by id. Archive does not change authentication, purchase eligibility, retention, or data rights (charter §6)."
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastAuthoritativeActivityAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Last AUTHORITATIVE relationship activity, or `null` when there is none to report. Authority is charter §8: a tenant-qualified link only. `null` means \"no authoritative activity is linked to this customer\" — it does NOT mean the person never transacted. Orders accepted before #3233 carry no customer link and are not backfilled (`DR-3032-21-A`), so a long-standing customer can legitimately read `null` here."
          },
          "lastAuthoritativeActivityStatus": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "Whether the activity above was computed from EVERY authoritative source. `restricted` means at least one owning domain was withheld from this caller, so a `null` above does NOT mean inactive and a non-null value is a LOWER BOUND — read the two fields together, never the timestamp alone. Charter §8: restricted information must not render as \"no history\". The same reason every count carries a status."
          },
          "domainCounts": {
            "$ref": "#/components/schemas/CustomerDomainCountsDto"
          },
          "acceptedOrderHistory": {
            "description": "ADR-047 zero-order directory truth, kept separate from generalized commerce counts and every payment or customer-value metric.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerAcceptedOrderHistoryDto"
              }
            ]
          },
          "savedAddressBook": {
            "description": "#4061 reusable Customer addresses and independent default flags. Separate from canonical profile contacts and immutable order snapshots.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerSavedAddressBookDto"
              }
            ]
          },
          "savedPaymentMethods": {
            "description": "#4061 permission-filtered masked saved-method metadata under the current charging-account binding. This object offers no card action or provider id.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerSavedPaymentMethodsDto"
              }
            ]
          },
          "paymentReconciliation": {
            "description": "#3519 merchant payment truth for this Customer, explicitly separated from provider Customer Insights and grouped by currency.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerPaymentReconciliationDto"
              }
            ]
          },
          "identityVariants": {
            "description": "Every distinct order-derived identity for this customer, newest first (`DR-3032-24-A`). Legitimately EMPTY for a customer whose orders all predate #3233, because no backfill links them (`DR-3032-21-A`) — empty here means \"no linked snapshot carries an identity\", not \"this person never ordered\".",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerIdentityVariantDto"
            }
          },
          "identityVariantsStatus": {
            "type": "string",
            "enum": [
              "available",
              "restricted",
              "unavailable"
            ],
            "description": "Whether `identityVariants` was computed for this caller. When not `available` the array is empty AND this field says why — the two are read together, never the array alone."
          },
          "identityVariantsCompleteness": {
            "type": "string",
            "enum": [
              "complete",
              "truncated",
              "indeterminate"
            ],
            "description": "Whether `identityVariants` is the WHOLE set. `identityVariantsStatus` reports whether the set could be computed at all; this reports whether what was computed is everything. Both are needed — without this a capped set would report `available` and read as exhaustive, the partial-answer-indistinguishable-from-complete failure charter §8 forbids. `complete` — the source was exhausted. `truncated` — more variants were built than are returned, so more definitely exist. `indeterminate` — the bounded scan ended first, so whether more exist was never established. `indeterminate` is deliberately NOT merged into `truncated`: asserting that more exist without having looked is the same overclaim in the other direction."
          }
        },
        "required": [
          "id",
          "displayName",
          "name",
          "normalizedEmail",
          "phone",
          "accountStatus",
          "emailVerifiedAt",
          "isArchived",
          "archivedAt",
          "createdAt",
          "lastAuthoritativeActivityAt",
          "lastAuthoritativeActivityStatus",
          "domainCounts",
          "acceptedOrderHistory",
          "savedAddressBook",
          "savedPaymentMethods",
          "paymentReconciliation",
          "identityVariants",
          "identityVariantsStatus",
          "identityVariantsCompleteness"
        ]
      },
      "SubmitReviewDto": {
        "type": "object",
        "properties": {
          "rating": {
            "type": "number",
            "description": "Star rating, 1–5 inclusive.",
            "minimum": 1,
            "maximum": 5,
            "example": 5
          },
          "title": {
            "type": "string",
            "description": "Optional short review headline.",
            "nullable": true,
            "maxLength": 120
          },
          "body": {
            "type": "string",
            "description": "Optional free-form review body.",
            "nullable": true,
            "maxLength": 4000
          },
          "authorName": {
            "type": "string",
            "description": "Display name shown on the storefront next to the review.",
            "example": "Jordan P.",
            "maxLength": 80
          },
          "authorEmail": {
            "type": "string",
            "description": "Author email. Normalised lowercase before insert. Used for dedupe and the verified-purchase match ONLY — never returned to public callers.",
            "example": "customer@example.com",
            "maxLength": 320
          }
        },
        "required": [
          "rating",
          "authorName",
          "authorEmail"
        ],
        "additionalProperties": false
      },
      "SubmitReviewResponseDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Always `true` on a 201 — the review was accepted for moderation.",
            "example": true
          }
        },
        "required": [
          "ok"
        ]
      },
      "PublicProductReviewDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rating": {
            "type": "number",
            "description": "Star rating, 1–5.",
            "minimum": 1,
            "maximum": 5,
            "example": 5
          },
          "title": {
            "type": "string",
            "nullable": true,
            "description": "Optional review headline. `null` when the author left none."
          },
          "body": {
            "type": "string",
            "nullable": true,
            "description": "Optional review body. `null` when the author left none."
          },
          "authorName": {
            "type": "string",
            "description": "Author display name only — never the author email.",
            "example": "Jordan P."
          },
          "verifiedPurchase": {
            "type": "boolean",
            "description": "True when the review email matched a paid order for this item. A badge only — it never gated submission.",
            "example": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "rating",
          "title",
          "body",
          "authorName",
          "verifiedPurchase",
          "createdAt"
        ]
      },
      "PublicItemReviewsResponseDto": {
        "type": "object",
        "properties": {
          "reviews": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicProductReviewDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page; pass it back as `?cursor=`. `null` when there are no more reviews."
          },
          "ratingAverage": {
            "type": "number",
            "nullable": true,
            "description": "Mean rating across PUBLISHED reviews. `null` when there are none (distinguishes \"unrated\" from a literal 0).",
            "example": 4.6
          },
          "ratingCount": {
            "type": "number",
            "description": "Number of PUBLISHED reviews for the item.",
            "example": 23
          }
        },
        "required": [
          "reviews",
          "nextCursor",
          "ratingAverage",
          "ratingCount"
        ]
      },
      "MerchantReviewItemRefDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "MerchantReviewModerationItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "rating": {
            "type": "number",
            "minimum": 1,
            "maximum": 5,
            "description": "1–5 star rating."
          },
          "title": {
            "type": "string",
            "nullable": true,
            "description": "Optional review headline; `null` for a bare star rating."
          },
          "body": {
            "type": "string",
            "nullable": true,
            "description": "Optional review prose; `null` for a bare star rating."
          },
          "authorName": {
            "type": "string",
            "description": "Public display name shown next to the review."
          },
          "authorEmail": {
            "type": "string",
            "description": "Reviewer email. PRIVATE — exposed on the merchant moderation surface (moderators need it to judge a review) but never on the public read."
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PUBLISHED",
              "REJECTED"
            ],
            "description": "Moderation status: PENDING / PUBLISHED / REJECTED."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "VISIBLE",
              "HIDDEN"
            ],
            "description": "Storefront visibility of a PUBLISHED review: VISIBLE / HIDDEN (hide/show toggle this without changing `status`)."
          },
          "verifiedPurchase": {
            "type": "boolean",
            "description": "True when the author email matched a paid/fulfilled order for this item at submit time. A badge only."
          },
          "moderatedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Moderation decision timestamp; `null` while PENDING."
          },
          "moderatedByUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Id of the moderating user; `null` while PENDING."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "item": {
            "$ref": "#/components/schemas/MerchantReviewItemRefDto"
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "rating",
          "title",
          "body",
          "authorName",
          "authorEmail",
          "status",
          "visibility",
          "verifiedPurchase",
          "moderatedAt",
          "moderatedByUserId",
          "createdAt",
          "item"
        ]
      },
      "MerchantProductReviewDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid"
          },
          "rating": {
            "type": "number",
            "minimum": 1,
            "maximum": 5,
            "description": "1–5 star rating."
          },
          "title": {
            "type": "string",
            "nullable": true,
            "description": "Optional review headline; `null` for a bare star rating."
          },
          "body": {
            "type": "string",
            "nullable": true,
            "description": "Optional review prose; `null` for a bare star rating."
          },
          "authorName": {
            "type": "string",
            "description": "Public display name shown next to the review."
          },
          "authorEmail": {
            "type": "string",
            "description": "Reviewer email. PRIVATE — exposed on the merchant moderation surface (moderators need it to judge a review) but never on the public read."
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PUBLISHED",
              "REJECTED"
            ],
            "description": "Moderation status: PENDING / PUBLISHED / REJECTED."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "VISIBLE",
              "HIDDEN"
            ],
            "description": "Storefront visibility of a PUBLISHED review: VISIBLE / HIDDEN (hide/show toggle this without changing `status`)."
          },
          "verifiedPurchase": {
            "type": "boolean",
            "description": "True when the author email matched a paid/fulfilled order for this item at submit time. A badge only."
          },
          "moderatedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Moderation decision timestamp; `null` while PENDING."
          },
          "moderatedByUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Id of the moderating user; `null` while PENDING."
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "rating",
          "title",
          "body",
          "authorName",
          "authorEmail",
          "status",
          "visibility",
          "verifiedPurchase",
          "moderatedAt",
          "moderatedByUserId",
          "createdAt"
        ]
      },
      "PaymentAccountRequirementsDto": {
        "type": "object",
        "properties": {
          "currentlyDue": {
            "description": "Stripe requirement keys currently due on the connected account. Keys only; no submitted values or documents are returned.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pastDue": {
            "description": "Stripe requirement keys that are past due on the connected account. Keys only; no submitted values or documents are returned.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pendingVerification": {
            "description": "Stripe requirement keys pending Stripe verification. Keys only; no submitted values or documents are returned.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "disabledReason": {
            "type": "string",
            "nullable": true,
            "description": "Stripe disabled reason for the connected account, when Stripe reports one."
          }
        },
        "required": [
          "currentlyDue",
          "pastDue",
          "pendingVerification",
          "disabledReason"
        ]
      },
      "StripeConnectedAccountSummaryDto": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "nullable": true,
            "description": "Safe display/business name from the connected Stripe account, when Stripe reports one. Never includes legal/person objects."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Safe connected-account email from Stripe, when available to the account owner/admin status surface."
          },
          "chargesEnabled": {
            "type": "boolean",
            "description": "Raw Stripe `charges_enabled` readiness flag for the connected account."
          },
          "detailsSubmitted": {
            "type": "boolean",
            "description": "Raw Stripe `details_submitted` readiness flag for the connected account."
          },
          "requirements": {
            "$ref": "#/components/schemas/PaymentAccountRequirementsDto"
          }
        },
        "required": [
          "displayName",
          "email",
          "chargesEnabled",
          "detailsSubmitted",
          "requirements"
        ]
      },
      "PaymentAccountStatusDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NONE",
              "CONNECTED",
              "VERIFIED",
              "RESTRICTED"
            ],
            "description": "Capability gate. Live charges require VERIFIED; everything else fails closed at the charge boundary. CONNECTED = mid-onboarding, RESTRICTED = Stripe has disabled charges, NONE = no account linked."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Masked connected Stripe account id (e.g. `acct_••••1234`), or null when no account is linked. Never the full id."
          },
          "provider": {
            "type": "string",
            "description": "Payment-account provider. Always `stripe` today."
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the account was first connected (ISO 8601), or null."
          },
          "stripeAccount": {
            "nullable": true,
            "description": "Safe connected-account identity and requirement summary from Stripe, or null when no account is linked or the live Stripe lookup is unavailable.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/StripeConnectedAccountSummaryDto"
              }
            ]
          }
        },
        "required": [
          "status",
          "stripeAccountId",
          "provider",
          "connectedAt",
          "stripeAccount"
        ]
      },
      "StartConnectResponseDto": {
        "type": "object",
        "properties": {
          "authorizeUrl": {
            "type": "string",
            "description": "Stripe Connect OAuth authorize URL to redirect the merchant to. Carries the single-use CSRF `state` bound to this organization.",
            "example": "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_…&scope=read_write&redirect_uri=…&state=…"
          }
        },
        "required": [
          "authorizeUrl"
        ]
      },
      "TerminalLocationAddressSnapshotDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "nullable": true
          },
          "line2": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "postalCode": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "TerminalLocationSnapshotDto": {
        "type": "object",
        "properties": {
          "terminalLocationId": {
            "type": "string",
            "example": "tml_FBakXQG8bQk4Mm"
          },
          "displayName": {
            "type": "string",
            "example": "Front counter"
          },
          "address": {
            "$ref": "#/components/schemas/TerminalLocationAddressSnapshotDto"
          }
        },
        "required": [
          "terminalLocationId",
          "displayName",
          "address"
        ]
      },
      "VerifiedDefaultTerminalLocationDto": {
        "type": "object",
        "properties": {
          "terminalLocationId": {
            "type": "string",
            "example": "tml_FBakXQG8bQk4Mm"
          },
          "displayName": {
            "type": "string",
            "example": "Front counter"
          },
          "address": {
            "$ref": "#/components/schemas/TerminalLocationAddressSnapshotDto"
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "terminalLocationId",
          "displayName",
          "address",
          "verifiedAt"
        ]
      },
      "TerminalLocationSuggestedAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "example": "1120 S Rackham Way"
          },
          "line2": {
            "type": "string",
            "example": "Suite 300"
          },
          "city": {
            "type": "string",
            "example": "Meridian"
          },
          "state": {
            "type": "string",
            "example": "ID"
          },
          "postalCode": {
            "type": "string",
            "example": "83642"
          },
          "country": {
            "type": "string",
            "example": "US",
            "description": "ISO 3166-1 alpha-2 country code."
          }
        },
        "required": [
          "line1",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "TerminalLocationSetupResponseDto": {
        "type": "object",
        "properties": {
          "cardPaymentsCapability": {
            "type": "string",
            "enum": [
              "active"
            ],
            "description": "The connected account card_payments capability. This endpoint fails closed unless it is active."
          },
          "locations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TerminalLocationSnapshotDto"
            }
          },
          "defaultLocation": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/VerifiedDefaultTerminalLocationDto"
              }
            ]
          },
          "suggestedAddress": {
            "nullable": true,
            "description": "Complete organization address offered only as an editable prefill. Creating a Location always requires an explicit request body.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/TerminalLocationSuggestedAddressDto"
              }
            ]
          },
          "requiredAddressParts": {
            "type": "array",
            "example": [
              "city",
              "state",
              "postalCode"
            ],
            "description": "The address parts beyond `line1` and `country` that Stripe requires for a Terminal Location in the connected Stripe account's country, which is the only country a new or edited location can be in. For a country cartonium POS doesn't support, or when Stripe reports no account country, every part except `line2`; a location is refused there anyway.",
            "items": {
              "type": "string",
              "enum": [
                "line2",
                "city",
                "state",
                "postalCode"
              ]
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "cardPaymentsCapability",
          "locations",
          "defaultLocation",
          "suggestedAddress",
          "requiredAddressParts",
          "hasMore",
          "nextCursor"
        ]
      },
      "TapToPayAppleAccountLinkResponseDto": {
        "type": "object",
        "properties": {
          "redirectUrl": {
            "type": "string",
            "format": "uri",
            "description": "Short-lived Stripe-generated HTTPS onboarding URL for accepting or relinking the active tenant's Tap to Pay on iPhone Apple Account. The URL must not be persisted or logged."
          }
        },
        "required": [
          "redirectUrl"
        ]
      },
      "TerminalLocationAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "example": "1120 S Rackham Way"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "maxLength": 300,
            "example": "Suite 300",
            "description": "Required in Mexico (the colonia). Elsewhere a blank, `null` or missing second line means none."
          },
          "city": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 200,
            "example": "Meridian",
            "description": "Required where Stripe requires it for a Terminal Location in the address's country; otherwise leave it out or send `null`. A given value is trimmed and must not be blank. Optional only in Bulgaria, Croatia, Cyprus, Hong Kong, Ireland, Malta, Singapore and Slovenia."
          },
          "state": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 200,
            "example": "ID",
            "description": "Required where Stripe requires it for a Terminal Location in the address's country; otherwise leave it out or send `null`. A given value is trimmed and must not be blank. Required only in Australia, Canada, Hong Kong, Italy, Japan, Mexico, Spain and the United States."
          },
          "postalCode": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 32,
            "example": "83642",
            "description": "Required where Stripe requires it for a Terminal Location in the address's country; otherwise leave it out or send `null`. A given value is trimmed and must not be blank. Optional only in Hong Kong."
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "example": "US",
            "description": "ISO 3166-1 alpha-2 country code."
          }
        },
        "required": [
          "line1",
          "country"
        ]
      },
      "CreateTerminalLocationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "example": "Front counter",
            "description": "Merchant-facing name for this physical POS location."
          },
          "address": {
            "$ref": "#/components/schemas/TerminalLocationAddressDto"
          }
        },
        "required": [
          "reason",
          "displayName",
          "address"
        ]
      },
      "SetDefaultTerminalLocationResponseDto": {
        "type": "object",
        "properties": {
          "defaultLocation": {
            "$ref": "#/components/schemas/VerifiedDefaultTerminalLocationDto"
          }
        },
        "required": [
          "defaultLocation"
        ]
      },
      "AdoptTerminalLocationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "terminalLocationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "example": "tml_FBakXQG8bQk4Mm",
            "description": "Existing Stripe Terminal Location to verify and make the default."
          }
        },
        "required": [
          "reason",
          "terminalLocationId"
        ]
      },
      "DisconnectPaymentAccountResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NONE",
              "CONNECTED",
              "VERIFIED",
              "RESTRICTED"
            ],
            "description": "Capability gate. Live charges require VERIFIED; everything else fails closed at the charge boundary. CONNECTED = mid-onboarding, RESTRICTED = Stripe has disabled charges, NONE = no account linked."
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Masked connected Stripe account id (e.g. `acct_••••1234`), or null when no account is linked. Never the full id."
          },
          "provider": {
            "type": "string",
            "description": "Payment-account provider. Always `stripe` today."
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the account was first connected (ISO 8601), or null."
          },
          "stripeAccount": {
            "nullable": true,
            "description": "Safe connected-account identity and requirement summary from Stripe, or null when no account is linked or the live Stripe lookup is unavailable.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/StripeConnectedAccountSummaryDto"
              }
            ]
          },
          "deauthorization": {
            "type": "string",
            "enum": [
              "deauthorized",
              "skipped_unconfigured",
              "failed"
            ],
            "description": "Best-effort Stripe OAuth deauthorization outcome. `deauthorized` = the platform↔account link was also severed in Stripe; `skipped_unconfigured` = Stripe Connect is not configured in this environment so no Stripe call was made; `failed` = the Stripe call errored. In every case the local disconnect has already succeeded and charges fail closed."
          }
        },
        "required": [
          "status",
          "stripeAccountId",
          "provider",
          "connectedAt",
          "stripeAccount",
          "deauthorization"
        ]
      },
      "ConfiguredTerminalLocationDto": {
        "type": "object",
        "properties": {
          "terminalLocationMappingId": {
            "type": "string",
            "format": "uuid",
            "description": "cartonium id of this configured location. Accepted by the lifecycle routes under /api/v1/merchant/payment-account/terminal-locations/configured/{terminalLocationMappingId}."
          },
          "terminalLocationId": {
            "type": "string",
            "description": "Stripe Terminal Location id."
          },
          "label": {
            "type": "string",
            "description": "Display name as last verified from Stripe. Stripe remains the source of the name."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "RETIRED",
              "PREVIOUS_ACCOUNT"
            ],
            "description": "ACTIVE: usable by POS phones on the current connected Stripe account. RETIRED: kept for history, not usable, restorable. PREVIOUS_ACCOUNT: configured under an earlier connected account; history only."
          },
          "isDefault": {
            "type": "boolean",
            "description": "True for the business default a phone uses when it has no saved choice. At most one location is true, and only an ACTIVE one."
          },
          "savedChoiceCount": {
            "type": "integer",
            "minimum": 0,
            "description": "POS installations whose saved choice is this location. An installation ends at POS sign-out without always reaching the server, so this can include phones that have since signed out; it does not prove current use."
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When cartonium last verified this location at Stripe."
          }
        },
        "required": [
          "terminalLocationMappingId",
          "terminalLocationId",
          "label",
          "status",
          "isDefault",
          "savedChoiceCount",
          "verifiedAt"
        ]
      },
      "ConfiguredTerminalLocationListDto": {
        "type": "object",
        "properties": {
          "configuredLocations": {
            "description": "Every location this tenant configured, including retired and previous-account ones: the default first, then active, retired and previous-account locations by name. Empty means none are configured. Read from cartonium only; Stripe availability is verified when a location is used or changed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConfiguredTerminalLocationDto"
            }
          }
        },
        "required": [
          "configuredLocations"
        ]
      },
      "CreateConfiguredTerminalLocationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "example": "Farmers market booth",
            "description": "Merchant-facing name for this physical selling location."
          },
          "address": {
            "description": "`country` must be the connected Stripe account's country, and the address must have every part Stripe requires there (#4549).",
            "allOf": [
              {
                "$ref": "#/components/schemas/TerminalLocationAddressDto"
              }
            ]
          },
          "makeDefault": {
            "type": "boolean",
            "description": "Also make this the business default. False adds it as an extra location POS phones can choose."
          }
        },
        "required": [
          "reason",
          "displayName",
          "address",
          "makeDefault"
        ]
      },
      "TerminalLocationLifecycleResponseDto": {
        "type": "object",
        "properties": {
          "configuredLocations": {
            "description": "Every location this tenant configured after the change, default first, then active, retired and previous-account locations by name. Empty means none are configured.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConfiguredTerminalLocationDto"
            }
          },
          "terminalLocationMappingId": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "The location this action targeted. Null only after a removal, and after clearing the default when no default existed."
          },
          "providerEffect": {
            "type": "string",
            "enum": [
              "NONE",
              "CREATED",
              "RENAMED",
              "ADDRESS_UPDATED",
              "KEPT"
            ],
            "description": "What happened at Stripe, reported separately from the cartonium change. NONE: no provider change. CREATED or RENAMED: the Stripe location was created or renamed. ADDRESS_UPDATED: the address Stripe holds for it changed. KEPT: removed from cartonium only; removal never deletes the Stripe location."
          }
        },
        "required": [
          "configuredLocations",
          "terminalLocationMappingId",
          "providerEffect"
        ]
      },
      "AdoptConfiguredTerminalLocationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "terminalLocationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "example": "tml_FBakXQG8bQk4Mm",
            "description": "Existing Stripe Terminal Location on the connected account to add."
          },
          "makeDefault": {
            "type": "boolean",
            "description": "Also make this the business default. False adds it as an extra location POS phones can choose."
          }
        },
        "required": [
          "reason",
          "terminalLocationId",
          "makeDefault"
        ]
      },
      "RenameConfiguredTerminalLocationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "example": "Arena booth",
            "description": "New display name. It is written to the Stripe Terminal Location first, then to cartonium."
          }
        },
        "required": [
          "reason",
          "displayName"
        ]
      },
      "TerminalLocationProviderAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "example": "1120 S Rackham Way"
          },
          "line2": {
            "type": "string",
            "nullable": true,
            "example": "Suite 300",
            "description": "`null` when Stripe holds no second address line."
          },
          "city": {
            "type": "string",
            "example": "Meridian",
            "description": "Empty when Stripe holds no city, which a location can go without in some countries (#4549)."
          },
          "state": {
            "type": "string",
            "example": "ID",
            "description": "Empty when Stripe holds no state or province, which a location can go without in most countries (#4549)."
          },
          "postalCode": {
            "type": "string",
            "example": "83642",
            "description": "Empty when Stripe holds no postal code, which a location in Hong Kong can go without (#4549)."
          },
          "country": {
            "type": "string",
            "example": "US",
            "description": "ISO 3166-1 alpha-2. Stripe cannot change a location's country. Empty when Stripe reports no country for the location: every check then treats it as outside the account's country, as POS readiness does, so it is replaced rather than edited."
          }
        },
        "required": [
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country"
        ]
      },
      "TerminalLocationAddressReviewDto": {
        "type": "object",
        "properties": {
          "terminalLocationMappingId": {
            "type": "string",
            "format": "uuid"
          },
          "address": {
            "description": "Read from Stripe for this request. cartonium does not store Terminal Location addresses.",
            "allOf": [
              {
                "$ref": "#/components/schemas/TerminalLocationProviderAddressDto"
              }
            ]
          },
          "addressVersion": {
            "type": "string",
            "example": "v1:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
            "description": "Opaque version of this address and of the location's record here, good only for this location. Send it back unchanged with an edit of the same location: if either has changed since, the edit is refused and must be reviewed again. Each review is good for one edit."
          },
          "accountCountry": {
            "type": "string",
            "nullable": true,
            "example": "US",
            "description": "The connected Stripe account's country. POS takes card payments only at a location in this country. Stripe can't move a location to another country, so a location outside it is replaced instead. `null` when Stripe reports no country for the connected account: whether this location is in the account's country can't be told from it, and an address edit or a replacement is refused until Stripe reports one."
          },
          "requiredAddressParts": {
            "type": "array",
            "example": [
              "city",
              "state",
              "postalCode"
            ],
            "description": "The address parts beyond `line1` and `country` that Stripe requires for a Terminal Location in the connected Stripe account's country, which is the only country a new or edited location can be in. For a country cartonium POS doesn't support, or when Stripe reports no account country, every part except `line2`; a location is refused there anyway. An edit or a replacement made from this review must have them.",
            "items": {
              "type": "string",
              "enum": [
                "line2",
                "city",
                "state",
                "postalCode"
              ]
            }
          }
        },
        "required": [
          "terminalLocationMappingId",
          "address",
          "addressVersion",
          "accountCountry",
          "requiredAddressParts"
        ]
      },
      "UpdateConfiguredTerminalLocationAddressDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "address": {
            "description": "The complete new address, which replaces the old one: a part left out or `null`, or a blank `line2`, clears that part at Stripe. It must have every part Stripe requires in its country (#4549), and `country` must stay the location's current country.",
            "allOf": [
              {
                "$ref": "#/components/schemas/TerminalLocationAddressDto"
              }
            ]
          },
          "reviewedAddressVersion": {
            "type": "string",
            "description": "`addressVersion` from the address review this edit was made from."
          }
        },
        "required": [
          "reason",
          "address",
          "reviewedAddressVersion"
        ]
      },
      "ReplaceConfiguredTerminalLocationDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Human-readable explanation for performing this high-risk action. Captured in audit metadata for traceability.",
            "minLength": 1,
            "maxLength": 500,
            "example": "Promotion was entered in error before launch"
          },
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "example": "Front counter",
            "description": "Name for the replacement, in Stripe and in cartonium."
          },
          "address": {
            "description": "The replacement's address. `country` must be the connected Stripe account's country, and the address must have every part Stripe requires there (#4549).",
            "allOf": [
              {
                "$ref": "#/components/schemas/TerminalLocationAddressDto"
              }
            ]
          },
          "reviewedAddressVersion": {
            "type": "string",
            "description": "`addressVersion` from the address review of the location being replaced. It is claimed before Stripe is called, so a second replacement made from the same review is refused instead of creating a second location."
          }
        },
        "required": [
          "reason",
          "displayName",
          "address",
          "reviewedAddressVersion"
        ]
      },
      "TerminalLocationRemovalPreviewDto": {
        "type": "object",
        "properties": {
          "terminalLocationMappingId": {
            "type": "string",
            "format": "uuid"
          },
          "terminalLocationId": {
            "type": "string"
          },
          "removable": {
            "type": "boolean",
            "description": "True when cartonium holds no sale or payment for this location, so it can be removed instead of retired."
          },
          "blockers": {
            "type": "array",
            "description": "Why removal is refused. Empty exactly when `removable` is true. A used location can be retired instead, which keeps its history.",
            "items": {
              "type": "string",
              "enum": [
                "SALE_HISTORY",
                "PAYMENT_HISTORY"
              ]
            }
          },
          "isDefault": {
            "type": "boolean",
            "description": "Removing the default leaves no default: POS phones without a saved choice cannot take card payments until a default is set."
          },
          "savedChoiceCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Saved POS choices that would go stale; those phones must choose again or use the default before their next card sale."
          }
        },
        "required": [
          "terminalLocationMappingId",
          "terminalLocationId",
          "removable",
          "blockers",
          "isDefault",
          "savedChoiceCount"
        ]
      },
      "PaymentPolicyActivationGateDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLOSED"
            ],
            "description": "`OPEN` classifies the entry as safe to request and to admit once E31 enforcement is live. It is NOT runtime activation of the method."
          },
          "reason": {
            "type": "string",
            "enum": [
              "ENFORCEMENT_PROOF_REQUIRED",
              "METHOD_SAFETY_PROOF_REQUIRED",
              "DELAYED_SETTLEMENT_LIFECYCLE_UNRESOLVED",
              "EXTERNAL_CONTROL_UNVERIFIED"
            ],
            "nullable": true,
            "description": "Why the gate is closed; `null` exactly when it is `OPEN`."
          },
          "trackers": {
            "description": "Tracking issues the gate waits on. Empty when none is recorded, which does not mean the gate is open.",
            "example": [
              "#3180"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "state",
          "reason",
          "trackers"
        ]
      },
      "PaymentPolicyCatalogEntryDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "CARDS",
              "APPLE_PAY",
              "GOOGLE_PAY",
              "LINK",
              "LINK_PROMOTIONS",
              "ACH_DIRECT_DEBIT",
              "AFFIRM",
              "KLARNA"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "FUNDING_METHOD",
              "CARD_WALLET",
              "PARTICIPATION"
            ],
            "description": "`FUNDING_METHOD` is a payment rail; `CARD_WALLET` is a presentation preference under Cards; `PARTICIPATION` is a provider programme, not a method."
          },
          "label": {
            "type": "string",
            "description": "Merchant-facing name."
          },
          "description": {
            "type": "string",
            "description": "Merchant-facing explanation of the entry."
          },
          "controlType": {
            "type": "string",
            "enum": [
              "METHOD_TOGGLE",
              "WALLET_PREFERENCE",
              "EXTERNAL_STATUS"
            ],
            "description": "`METHOD_TOGGLE` (ENABLED/DISABLED), `WALLET_PREFERENCE` (AUTO/NEVER) or `EXTERNAL_STATUS` (no cartonium control; status and reason only)."
          },
          "editable": {
            "type": "boolean",
            "description": "Whether a save may change this entry today: it has a cartonium control AND its activation gate is open. `false` entries stay visible, disabled and explained. `true` says a change is accepted, not that the method is effective or will render; see the effective preview."
          },
          "enforcement": {
            "type": "string",
            "enum": [
              "EXPLICIT_CARD_RAIL",
              "CONDITIONAL_WALLET_PREFERENCE",
              "UNPROVEN"
            ],
            "description": "How a requested value is enforced: `EXPLICIT_CARD_RAIL` (an admitted PaymentIntent rail), `CONDITIONAL_WALLET_PREFERENCE` (Payment Element wallet presentation, still subject to device eligibility) or `UNPROVEN` (no enforcement is proven, so no control is offered)."
          },
          "requiredProof": {
            "description": "What must be proven before the control is relied on. These are the catalog requirements, not a claim that anything has been verified.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "method": {
            "type": "string",
            "enum": [
              "CARDS",
              "LINK",
              "ACH_DIRECT_DEBIT",
              "AFFIRM",
              "KLARNA"
            ],
            "nullable": true,
            "description": "The funding method this entry controls, the key under `policy.methods`. `null` for card wallets (keyed under `policy.wallets` by `code`) and for Link promotions, which is not part of the saved document at all."
          },
          "dependencies": {
            "type": "array",
            "description": "Entries that must be effective for this one to be effective. Empty when it depends on none.",
            "items": {
              "type": "string",
              "enum": [
                "CARDS",
                "APPLE_PAY",
                "GOOGLE_PAY",
                "LINK",
                "LINK_PROMOTIONS",
                "ACH_DIRECT_DEBIT",
                "AFFIRM",
                "KLARNA"
              ]
            }
          },
          "safetyClass": {
            "type": "string",
            "enum": [
              "IMMEDIATE_CARD",
              "CARD_WALLET",
              "LINK_WALLET",
              "REDIRECT_BNPL",
              "DELAYED_SETTLEMENT",
              "PROVIDER_PROMOTION"
            ]
          },
          "activationGate": {
            "$ref": "#/components/schemas/PaymentPolicyActivationGateDto"
          },
          "reasonCodes": {
            "type": "array",
            "description": "Every reason code that can explain this entry in a preview.",
            "items": {
              "type": "string",
              "enum": [
                "NOT_REQUESTED",
                "DEPENDENCY_NOT_EFFECTIVE",
                "ENFORCEMENT_PROOF_REQUIRED",
                "METHOD_SAFETY_PROOF_REQUIRED",
                "DELAYED_SETTLEMENT_LIFECYCLE_UNRESOLVED",
                "EXTERNAL_CONTROL_UNVERIFIED",
                "PROVIDER_CAPABILITY_INACTIVE",
                "PROVIDER_METHOD_DISABLED",
                "PROVIDER_EVIDENCE_UNAVAILABLE",
                "ACCOUNT_COUNTRY_UNSUPPORTED",
                "CURRENCY_UNSUPPORTED",
                "AMOUNT_OUTSIDE_METHOD_LIMITS",
                "CHECKOUT_MODE_UNSUPPORTED",
                "DEVICE_ELIGIBILITY_UNRESOLVED",
                "CARD_RECOVERY_POLICY"
              ]
            }
          },
          "conditionalPredicates": {
            "type": "array",
            "description": "Predicates that can leave this entry CONDITIONAL. Empty when it is never conditional.",
            "items": {
              "type": "string",
              "enum": [
                "SHOPPER_COUNTRY_SUPPORTED",
                "TRANSACTION_AMOUNT_SUPPORTED",
                "DEVICE_WALLET_ELIGIBLE"
              ]
            }
          }
        },
        "required": [
          "code",
          "kind",
          "label",
          "description",
          "controlType",
          "editable",
          "enforcement",
          "requiredProof",
          "method",
          "dependencies",
          "safetyClass",
          "activationGate",
          "reasonCodes",
          "conditionalPredicates"
        ]
      },
      "PaymentPolicyCatalogDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "description": "The catalog version this deployment reads and writes.",
            "example": 1
          },
          "entries": {
            "description": "Every catalog entry, in merchant presentation order. Never empty. A method a provider adds or enables never appears here on its own.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentPolicyCatalogEntryDto"
            }
          }
        },
        "required": [
          "version",
          "entries"
        ]
      },
      "PaymentPolicyMethodRequestsDto": {
        "type": "object",
        "properties": {
          "CARDS": {
            "type": "string",
            "enum": [
              "ENABLED",
              "DISABLED"
            ],
            "description": "Cards, the funding rail both card wallets depend on. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          },
          "LINK": {
            "type": "string",
            "enum": [
              "ENABLED",
              "DISABLED"
            ],
            "description": "Link participation, separate from Link promotions. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          },
          "ACH_DIRECT_DEBIT": {
            "type": "string",
            "enum": [
              "ENABLED",
              "DISABLED"
            ],
            "description": "ACH Direct Debit. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          },
          "AFFIRM": {
            "type": "string",
            "enum": [
              "ENABLED",
              "DISABLED"
            ],
            "description": "Affirm. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          },
          "KLARNA": {
            "type": "string",
            "enum": [
              "ENABLED",
              "DISABLED"
            ],
            "description": "Klarna. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          }
        },
        "required": [
          "CARDS",
          "LINK",
          "ACH_DIRECT_DEBIT",
          "AFFIRM",
          "KLARNA"
        ]
      },
      "PaymentPolicyWalletPreferencesDto": {
        "type": "object",
        "properties": {
          "APPLE_PAY": {
            "type": "string",
            "enum": [
              "AUTO",
              "NEVER"
            ],
            "description": "`AUTO` allows Apple Pay under Cards when the device, browser and connected account all support it; it never promises the wallet renders. `NEVER` suppresses it. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          },
          "GOOGLE_PAY": {
            "type": "string",
            "enum": [
              "AUTO",
              "NEVER"
            ],
            "description": "`AUTO` allows Google Pay under Cards when the device, browser and connected account all support it; it never promises the wallet renders. `NEVER` suppresses it. A save may change this value only when the catalog entry is `editable`; otherwise it must repeat the current saved value, or the off value when no usable policy is saved (`PAYMENT_POLICY_SAVE_REJECTED` / `CONTROL_NOT_EDITABLE`)."
          }
        },
        "required": [
          "APPLE_PAY",
          "GOOGLE_PAY"
        ]
      },
      "PaymentPolicyDocumentDto": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "The document schema version. Only schema 1 exists.",
            "example": 1
          },
          "catalogVersion": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "The catalog version the document was written against. Only catalog 1 exists.",
            "example": 1
          },
          "methods": {
            "description": "Every funding method exactly once. A method whose catalog gate is closed stays excluded however it is requested.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyMethodRequestsDto"
              }
            ]
          },
          "wallets": {
            "description": "Both card-wallet preferences exactly once. A wallet is never effective while Cards is not; saving `AUTO` never enables Cards.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyWalletPreferencesDto"
              }
            ]
          }
        },
        "required": [
          "schemaVersion",
          "catalogVersion",
          "methods",
          "wallets"
        ]
      },
      "PaymentPolicyRequestedDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "USABLE",
              "RECOVERY_REQUIRED",
              "UNSUPPORTED_VERSION"
            ],
            "description": "`USABLE`: a valid saved policy, possibly one requesting no method at all (valid zero: nonpayable, never widened to Cards). `RECOVERY_REQUIRED`: no usable saved policy, so a new session will use the audited card-recovery policy once E31 is active; `recoveryReason` says why. `UNSUPPORTED_VERSION`: saved under a version this deployment cannot read; it is preserved, fails closed (nonpayable, never card recovery) and cannot be replaced from this deployment."
          },
          "recoveryReason": {
            "type": "string",
            "enum": [
              "MISSING",
              "MALFORMED",
              "INVALID"
            ],
            "nullable": true,
            "description": "Why card recovery applies: `MISSING` (nothing saved), `MALFORMED` or `INVALID` (the saved revision is corrupt). `null` exactly when `state` is not `RECOVERY_REQUIRED`."
          },
          "revision": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "description": "The current revision number, which a save echoes as `expectedRevision`. `null` exactly when no revision has ever been saved in this environment (`recoveryReason: MISSING`)."
          },
          "origin": {
            "type": "string",
            "enum": [
              "EXPLICIT_SAVE",
              "ENVIRONMENT_COPY"
            ],
            "nullable": true,
            "description": "How the current revision was created. `null` exactly when `revision` is `null`."
          },
          "schemaVersion": {
            "type": "integer",
            "nullable": true,
            "description": "The current revision's declared schema version. `null` exactly when `revision` is `null`."
          },
          "catalogVersion": {
            "type": "integer",
            "nullable": true,
            "description": "The current revision's declared catalog version. `null` exactly when `revision` is `null`."
          },
          "savedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the current revision was saved. `null` exactly when `revision` is `null`."
          },
          "policy": {
            "nullable": true,
            "description": "The saved requested policy. Present exactly when `state` is `USABLE`; `null` when nothing is saved, the saved revision is corrupt, or it was saved under a version this deployment cannot read. Never the card-recovery policy and never an effective result.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyDocumentDto"
              }
            ]
          },
          "saveAllowed": {
            "type": "boolean",
            "description": "Whether this deployment accepts a save over the current revision. `false` exactly when `state` is `UNSUPPORTED_VERSION`. Necessary, not sufficient: a save still needs a current `expectedRevision` and only editable changes."
          }
        },
        "required": [
          "state",
          "recoveryReason",
          "revision",
          "origin",
          "schemaVersion",
          "catalogVersion",
          "savedAt",
          "policy",
          "saveAllowed"
        ]
      },
      "PaymentPolicySettingsResponseDto": {
        "type": "object",
        "properties": {
          "environment": {
            "type": "string",
            "enum": [
              "DEVELOPMENT",
              "PREVIEW",
              "PRODUCTION"
            ],
            "description": "This deployment's environment. Every read and save answers for it alone; Preview and Production are managed through their own deployments and never share a revision."
          },
          "catalog": {
            "$ref": "#/components/schemas/PaymentPolicyCatalogDto"
          },
          "requested": {
            "$ref": "#/components/schemas/PaymentPolicyRequestedDto"
          }
        },
        "required": [
          "environment",
          "catalog",
          "requested"
        ]
      },
      "PaymentPolicyPreviewBasisDto": {
        "type": "object",
        "properties": {
          "requestedRevision": {
            "type": "integer",
            "nullable": true,
            "description": "The requested revision the preview read. `null` when none is saved."
          },
          "requestedSource": {
            "type": "string",
            "enum": [
              "REVISION",
              "CARD_RECOVERY"
            ],
            "nullable": true,
            "description": "`REVISION`: the saved policy applies. `CARD_RECOVERY`: no usable policy is saved, so the audited card-recovery policy applies. `null` exactly when the saved policy uses an unsupported version, which fails closed with no source."
          },
          "recoveryReason": {
            "type": "string",
            "enum": [
              "MISSING",
              "MALFORMED",
              "INVALID"
            ],
            "nullable": true,
            "description": "Why card recovery applies. `null` exactly when `requestedSource` is not `CARD_RECOVERY`."
          },
          "currency": {
            "type": "string",
            "description": "The currency the preview derives for: the one ordinary checkout is priced in, and so every new ordinary hosted session (`usd` today). It is not the tenant's configured currency, which ordinary checkout does not price in. Present even when no derivation ran.",
            "example": "usd"
          },
          "checkoutMode": {
            "type": "string",
            "enum": [
              "PAYMENT"
            ],
            "description": "Always `PAYMENT`: the preview describes an ordinary one-time hosted checkout. Subscription, setup and booking flows are not previewed."
          },
          "paymentMethodConfiguration": {
            "type": "string",
            "enum": [
              "ACCOUNT_DEFAULT"
            ],
            "description": "Always `ACCOUNT_DEFAULT`: the connected account's unique default Stripe payment-method configuration, resolved fresh for this preview."
          }
        },
        "required": [
          "requestedRevision",
          "requestedSource",
          "recoveryReason",
          "currency",
          "checkoutMode",
          "paymentMethodConfiguration"
        ]
      },
      "PaymentPolicyPreviewEntryDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "CARDS",
              "APPLE_PAY",
              "GOOGLE_PAY",
              "LINK",
              "ACH_DIRECT_DEBIT",
              "AFFIRM",
              "KLARNA"
            ],
            "description": "A funding method or card wallet. Never `LINK_PROMOTIONS`, which is reported in `linkPromotions`."
          },
          "requested": {
            "type": "string",
            "enum": [
              "ENABLED",
              "DISABLED",
              "AUTO",
              "NEVER"
            ],
            "description": "The requested value the preview applied: the saved revision's, or the card-recovery policy's when `basis.requestedSource` is `CARD_RECOVERY`."
          },
          "status": {
            "type": "string",
            "enum": [
              "ELIGIBLE",
              "CONDITIONAL",
              "EXCLUDED"
            ],
            "description": "`ELIGIBLE` and `CONDITIONAL` entries form the initial ceiling a new session would freeze; `EXCLUDED` never joins that session. `CONDITIONAL` names unresolved `predicates` that a payable generation must still prove, so it never authorizes payment by itself."
          },
          "reasons": {
            "type": "array",
            "description": "Every applicable reason. Non-empty for every `EXCLUDED` entry; empty for an `ELIGIBLE` entry with nothing to explain.",
            "items": {
              "type": "string",
              "enum": [
                "NOT_REQUESTED",
                "DEPENDENCY_NOT_EFFECTIVE",
                "ENFORCEMENT_PROOF_REQUIRED",
                "METHOD_SAFETY_PROOF_REQUIRED",
                "DELAYED_SETTLEMENT_LIFECYCLE_UNRESOLVED",
                "EXTERNAL_CONTROL_UNVERIFIED",
                "PROVIDER_CAPABILITY_INACTIVE",
                "PROVIDER_METHOD_DISABLED",
                "PROVIDER_EVIDENCE_UNAVAILABLE",
                "ACCOUNT_COUNTRY_UNSUPPORTED",
                "CURRENCY_UNSUPPORTED",
                "AMOUNT_OUTSIDE_METHOD_LIMITS",
                "CHECKOUT_MODE_UNSUPPORTED",
                "DEVICE_ELIGIBILITY_UNRESOLVED",
                "CARD_RECOVERY_POLICY"
              ]
            }
          },
          "predicates": {
            "type": "array",
            "description": "Unresolved predicates. Non-empty exactly when `status` is `CONDITIONAL`.",
            "items": {
              "type": "string",
              "enum": [
                "SHOPPER_COUNTRY_SUPPORTED",
                "TRANSACTION_AMOUNT_SUPPORTED",
                "DEVICE_WALLET_ELIGIBLE"
              ]
            }
          },
          "drift": {
            "type": "string",
            "enum": [
              "NONE",
              "PROVIDER_NARROWED"
            ],
            "description": "`PROVIDER_NARROWED` when the entry is requested but the connected account's current Stripe capability or payment-method configuration excludes it. Requested intent is never changed by drift, and a method the merchant did not request is never added because Stripe enables it."
          }
        },
        "required": [
          "code",
          "requested",
          "status",
          "reasons",
          "predicates",
          "drift"
        ]
      },
      "PaymentPolicyLinkPromotionsDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "UNKNOWN"
            ],
            "description": "Always `UNKNOWN` in catalog 1: cartonium has no verified way to read or control Link promotions, so their state is not guessed."
          },
          "editable": {
            "type": "boolean",
            "description": "Always `false`: no enforceable control exists."
          },
          "externalControlUrl": {
            "type": "string",
            "nullable": true,
            "description": "The verified external setting that controls promotions. Always `null` in catalog 1 because none is verified; never a guessed link."
          },
          "reason": {
            "type": "string",
            "enum": [
              "EXTERNAL_CONTROL_UNVERIFIED"
            ]
          }
        },
        "required": [
          "status",
          "editable",
          "externalControlUrl",
          "reason"
        ]
      },
      "PaymentPolicyObservationDto": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "stripe"
            ]
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the provider constraints were observed for this preview."
          },
          "livemode": {
            "type": "boolean",
            "description": "Whether the observation was made in Stripe live mode. It always matches the environment: live in Production, test elsewhere."
          },
          "stripeAccount": {
            "type": "string",
            "description": "The observed connected account, masked like the payment-account read (prefix and last four characters). Never the full id.",
            "example": "acct_••••1234"
          },
          "paymentMethodConfigurationId": {
            "type": "string",
            "description": "The Stripe payment-method configuration consulted: the account's unique default at observation time.",
            "example": "pmc_123"
          },
          "capabilities": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Observed Stripe capability name → status (`active`, `pending`, `inactive` or `unknown`) for the capabilities the catalog maps. Only `active` can support an entry.",
            "example": {
              "card_payments": "active",
              "link_payments": "inactive"
            }
          }
        },
        "required": [
          "provider",
          "observedAt",
          "livemode",
          "stripeAccount",
          "paymentMethodConfigurationId",
          "capabilities"
        ]
      },
      "PaymentPolicyEffectivePreviewResponseDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "CURRENT_SETTINGS_PREVIEW"
            ],
            "description": "Always `CURRENT_SETTINGS_PREVIEW`: what a NEW ordinary hosted-checkout session created now would freeze as its initial ceiling. It is not an existing session's snapshot, which never changes after creation, and not payable-generation admission, which must still prove every conditional predicate and current constraint at payment handoff."
          },
          "environment": {
            "type": "string",
            "enum": [
              "DEVELOPMENT",
              "PREVIEW",
              "PRODUCTION"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "DERIVED",
              "UNAVAILABLE"
            ],
            "description": "`DERIVED`: fresh provider evidence was observed and combined with the requested policy. `UNAVAILABLE`: no preview could be derived; `unavailableReason` says why. An unavailable preview never falls back to Cards and never implies the requested policy is invalid."
          },
          "unavailableReason": {
            "type": "string",
            "enum": [
              "ACCOUNT_NOT_CONNECTED",
              "UNSUPPORTED_VERSION",
              "RUNTIME_SCOPE_MISMATCH",
              "INPUT_INVALID",
              "PROVIDER_UNAVAILABLE",
              "RATE_LIMITED",
              "IDENTITY_MISMATCH",
              "EVIDENCE_INCOMPLETE",
              "DERIVATION_INVALID"
            ],
            "nullable": true,
            "description": "Why the preview is unavailable; `null` exactly when `outcome` is `DERIVED`. `ACCOUNT_NOT_CONNECTED`: no connected Stripe account. `UNSUPPORTED_VERSION`: the saved policy uses a version this deployment cannot read (fails closed). `PROVIDER_UNAVAILABLE`, `RATE_LIMITED`, `EVIDENCE_INCOMPLETE`: required Stripe evidence could not be established. `IDENTITY_MISMATCH`: the observed account or configuration did not match. `INPUT_INVALID`, `DERIVATION_INVALID` and `RUNTIME_SCOPE_MISMATCH`: an internal consistency check refused the derivation inputs or result."
          },
          "retryable": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the same preview may succeed later with no change to this tenant's settings or the deployment: `true` for provider outages, rate limits and incomplete or mismatched provider evidence; `false` when a configuration, version or consistency problem must be fixed first (for example `ACCOUNT_NOT_CONNECTED` or `UNSUPPORTED_VERSION`). It never promises an immediate retry succeeds. `null` exactly when `outcome` is `DERIVED`."
          },
          "basis": {
            "$ref": "#/components/schemas/PaymentPolicyPreviewBasisDto"
          },
          "payable": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the ceiling names at least one method. `false` is an honest nonpayable result (for example a valid policy requesting nothing): Cards is never added to make it payable. Necessary, not sufficient: a payable generation must still be admitted. `null` exactly when `outcome` is `UNAVAILABLE`."
          },
          "ceiling": {
            "type": "array",
            "description": "The initial ceiling (eligible ∪ conditional funding methods), in catalog order. Empty for a nonpayable derivation AND when `outcome` is `UNAVAILABLE`; `payable` tells the two apart.",
            "items": {
              "type": "string",
              "enum": [
                "CARDS",
                "LINK",
                "ACH_DIRECT_DEBIT",
                "AFFIRM",
                "KLARNA"
              ]
            }
          },
          "entries": {
            "description": "Every funding method and card wallet, in catalog order, when `outcome` is `DERIVED`. Empty exactly when it is `UNAVAILABLE`.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentPolicyPreviewEntryDto"
            }
          },
          "linkPromotions": {
            "nullable": true,
            "description": "Link promotions status, reported separately from Link. `null` exactly when `outcome` is `UNAVAILABLE`.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyLinkPromotionsDto"
              }
            ]
          },
          "observation": {
            "nullable": true,
            "description": "Provenance of the provider evidence this preview used. `null` exactly when `outcome` is `UNAVAILABLE`: nothing was observed that could be shown.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyObservationDto"
              }
            ]
          }
        },
        "required": [
          "kind",
          "environment",
          "outcome",
          "unavailableReason",
          "retryable",
          "basis",
          "payable",
          "ceiling",
          "entries",
          "linkPromotions",
          "observation"
        ]
      },
      "PaymentPolicyHistoryEntryDto": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "The revision this entry created."
          },
          "eventType": {
            "type": "string",
            "enum": [
              "REVISION_SAVED",
              "REVISION_COPIED"
            ],
            "description": "`REVISION_SAVED` for an explicit save, `REVISION_COPIED` for an environment copy."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the revision and its audit fact were recorded."
          },
          "actorKind": {
            "type": "string",
            "enum": [
              "MERCHANT_USER",
              "PLATFORM_USER"
            ],
            "description": "Who saved it: a merchant user or a platform user."
          },
          "actorUserId": {
            "type": "string",
            "description": "The opaque user id of the actor."
          },
          "reasonCode": {
            "type": "string",
            "description": "The bounded audit reason code, for example `EXPLICIT_SAVE`.",
            "example": "EXPLICIT_SAVE"
          },
          "previousRevision": {
            "type": "integer",
            "nullable": true,
            "description": "The revision this one replaced. `null` exactly for the first revision in this environment."
          },
          "sourceEnvironment": {
            "type": "string",
            "enum": [
              "DEVELOPMENT",
              "PREVIEW",
              "PRODUCTION"
            ],
            "nullable": true,
            "description": "For a copy, the environment it was copied from, as attested by the copying server. `null` for an explicit save."
          },
          "sourceRevision": {
            "type": "integer",
            "nullable": true,
            "description": "For a copy, the source revision number in `sourceEnvironment`. `null` for an explicit save."
          },
          "policy": {
            "nullable": true,
            "description": "The requested policy this revision stored (the new value). `null` when this deployment cannot read it: saved under an unsupported version or corrupt.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyDocumentDto"
              }
            ]
          },
          "previousPolicy": {
            "nullable": true,
            "description": "The requested policy of the revision it replaced (the prior value). `null` when there was none (`previousRevision` is `null`) or this deployment cannot read it (`previousRevision` is set).",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyDocumentDto"
              }
            ]
          }
        },
        "required": [
          "revision",
          "eventType",
          "occurredAt",
          "actorKind",
          "actorUserId",
          "reasonCode",
          "previousRevision",
          "sourceEnvironment",
          "sourceRevision",
          "policy",
          "previousPolicy"
        ]
      },
      "PaymentPolicyHistoryPageDto": {
        "type": "object",
        "properties": {
          "environment": {
            "type": "string",
            "enum": [
              "DEVELOPMENT",
              "PREVIEW",
              "PRODUCTION"
            ]
          },
          "items": {
            "description": "Saved and copied revisions, newest first. Empty when this environment has no revision at or below the cursor. Per-session card-recovery facts are session evidence, not settings changes, and are not listed.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentPolicyHistoryEntryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Cursor for the next (older) page. `null` when this page reaches the first revision, so the list is complete."
          }
        },
        "required": [
          "environment",
          "items",
          "nextCursor"
        ]
      },
      "SavePaymentPolicyDto": {
        "type": "object",
        "properties": {
          "environment": {
            "type": "string",
            "enum": [
              "DEVELOPMENT",
              "PREVIEW",
              "PRODUCTION"
            ],
            "description": "The environment the caller intends to save, which must equal this deployment's environment (the `environment` of the read it came from). The environment is never taken from this field: a mismatch is refused with `PAYMENT_POLICY_SAVE_REJECTED` / `ENVIRONMENT_MISMATCH` and nothing is written. It makes every save, especially a Production one, explicit about the environment it changes."
          },
          "expectedRevision": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Compare-and-set expectation: `requested.revision` from the read this save is based on, or `null` when that read found no saved revision. Required; omitting it is a validation error. When it is not the current revision the save is refused with `PAYMENT_POLICY_REVISION_CONFLICT` and nothing is written: re-read, reconcile, and retry explicitly.",
            "example": 3
          },
          "policy": {
            "description": "The complete proposed requested policy. It replaces the current one as a new immutable revision; nothing is merged or defaulted.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyDocumentDto"
              }
            ]
          }
        },
        "required": [
          "environment",
          "expectedRevision",
          "policy"
        ]
      },
      "SavePaymentPolicyResponseDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "SAVED"
            ]
          },
          "environment": {
            "type": "string",
            "enum": [
              "DEVELOPMENT",
              "PREVIEW",
              "PRODUCTION"
            ]
          },
          "previousRevision": {
            "type": "integer",
            "nullable": true,
            "description": "The revision this save replaced. `null` when it created the first revision in this environment."
          },
          "requested": {
            "description": "The revision this save created (`state: USABLE`). It may already have been superseded by a later save; the settings read answers for the current revision. The effective preview is not recomputed here.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentPolicyRequestedDto"
              }
            ]
          }
        },
        "required": [
          "outcome",
          "environment",
          "previousRevision",
          "requested"
        ]
      },
      "CommerceNumberFormatDto": {
        "type": "object",
        "properties": {
          "prefixPattern": {
            "type": "string",
            "nullable": true,
            "description": "Prefix pattern. Literal text `A-Z a-z 0-9 - _` plus the tokens `{sequence}`, `{year}`, `{month}` and `{day}`; `{{` and `}}` are a literal brace. Exactly one `{sequence}` appears across the prefix, main and suffix patterns. At most 32 characters. Null when the number has no prefix.",
            "example": "INV"
          },
          "prefixSeparator": {
            "type": "string",
            "nullable": true,
            "description": "Separator rendered after a non-empty prefix: `-` or `_`, up to 3 characters. Null when none is rendered.",
            "example": "-"
          },
          "mainPattern": {
            "type": "string",
            "description": "Main pattern. Literal text `A-Z a-z 0-9 - _` plus the tokens `{sequence}`, `{year}`, `{month}` and `{day}`; `{{` and `}}` are a literal brace. Exactly one `{sequence}` appears across the prefix, main and suffix patterns. At most 32 characters.",
            "example": "{sequence}"
          },
          "suffixSeparator": {
            "type": "string",
            "nullable": true,
            "description": "Separator rendered before a non-empty suffix: `-` or `_`, up to 3 characters. Null when none is rendered.",
            "example": null
          },
          "suffixPattern": {
            "type": "string",
            "nullable": true,
            "description": "Suffix pattern. Literal text `A-Z a-z 0-9 - _` plus the tokens `{sequence}`, `{year}`, `{month}` and `{day}`; `{{` and `}}` are a literal brace. Exactly one `{sequence}` appears across the prefix, main and suffix patterns. At most 32 characters. Null when the number has no suffix.",
            "example": null
          },
          "padding": {
            "type": "number",
            "minimum": 0,
            "maximum": 8,
            "description": "`{sequence}` is zero-padded to this many digits; 0 renders it unpadded.",
            "example": 0
          },
          "sequenceStartsAt": {
            "type": "number",
            "minimum": 1,
            "maximum": 999999999,
            "description": "The first sequence a counter scope issues. It applies when that scope's counter is created, or when a save moves a provably unissued switch-provisioned counter to it. It can change only while `sequenceStartsAtEditable` is true.",
            "example": 1
          },
          "resetScope": {
            "type": "string",
            "enum": [
              "NEVER",
              "YEAR",
              "MONTH",
              "DAY"
            ],
            "description": "When the sequence restarts: never, or with each new year, month or day. Each scope keeps its own counter, so choosing a scope again resumes its counter; counters never rewind.",
            "example": "NEVER"
          }
        },
        "required": [
          "prefixPattern",
          "prefixSeparator",
          "mainPattern",
          "suffixSeparator",
          "suffixPattern",
          "padding",
          "sequenceStartsAt",
          "resetScope"
        ]
      },
      "CommerceNumberPrefixConflictDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "PREFIX_CONFLICT"
            ]
          },
          "conflictingKind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ],
            "description": "The other kind whose effective prefix compares equal."
          }
        },
        "required": [
          "reason",
          "conflictingKind"
        ]
      },
      "CommerceNumberKindSettingsDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ]
          },
          "configured": {
            "type": "boolean",
            "description": "True when this kind has a stored configuration. False means `format` is the default the first canonical issue would store, and nothing has been saved for this kind. It does not show whether numbers were issued: the protected-base Order allocator issues without storing a configuration. Use `sequenceStartsAtEditable` to tell whether the start can still change."
          },
          "format": {
            "description": "The effective format: the stored configuration, or the default when `configured` is false. While `formatLockedReason` is `ORDER_AUTHORITY_INACTIVE` it numbers only the Orders issued from Sales records; see `formatLockedReason`.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceNumberFormatDto"
              }
            ]
          },
          "formatLockedReason": {
            "type": "string",
            "enum": [
              "ORDER_AUTHORITY_INACTIVE"
            ],
            "nullable": true,
            "description": "Why this kind's format cannot change on this deployment; null when it can (saves still need `writesEnabled`). `ORDER_AUTHORITY_INACTIVE`: Orders created through the Order path, such as checkout and bookings, keep their protected-base numbers (the organization slug, the year and a three-digit sequence, `SAMPLE-SHOP-2026-001`), which the preview shows; `format` applies only to Orders issued from Sales records. A preview with any format override, even one equal to the current value, is refused with 409 `NUMBERING_FORMAT_LOCKED`, and a save with this reason."
          },
          "sequenceStartsAtEditable": {
            "type": "boolean",
            "description": "False once the counter scope this format's reset scope selects now has a counter that decides the next number, because its first issue created it. For ORDER, the numbering switch also provisioned a current-year counter, at 1 or at a floor inherited from earlier numbering, and a protected-base Order issues without creating or moving one. So a current-year ORDER scope whose counter is at 1 or absent stays editable only while the API can prove it never issued a document: no value of that year in the protected-base Order shape under any slug (any text, then `-`, the year, `-` and three or more digits, as in `OLD-NAME-2026-001`), and no number in the scope's current shape. Saving a changed start then moves a switch counter at 1 to the new start, once; an absent counter starts there at its first issue. This proof cannot show a counter above 1, inherited or moved, unissued, so its start stays locked. Without proof, saving a different `sequenceStartsAt` is refused with `SEQUENCE_START_LOCKED`. Also false while `formatLockedReason` is set."
          },
          "conflicts": {
            "description": "Other kinds whose effective prefix already compares equal to this kind's. Empty when there is none. While a conflict exists, saving either involved kind is refused until the prefix differs.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceNumberPrefixConflictDto"
            }
          }
        },
        "required": [
          "kind",
          "configured",
          "format",
          "formatLockedReason",
          "sequenceStartsAtEditable",
          "conflicts"
        ]
      },
      "CommerceNumberSettingsResponseDto": {
        "type": "object",
        "properties": {
          "writesEnabled": {
            "type": "boolean",
            "description": "False while merchant numbering writes are not activated on this deployment: every save is then refused with 503 `NUMBERING_WRITES_UNAVAILABLE`. Reads and previews work either way."
          },
          "kinds": {
            "description": "Always the four kinds, in order: ORDER, QUOTE, INVOICE, CONTRACT (Agreements).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommerceNumberKindSettingsDto"
            }
          }
        },
        "required": [
          "writesEnabled",
          "kinds"
        ]
      },
      "CommerceNumberOccupancyNoticeDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "NEXT_NUMBER_CLAIMED",
              "NEXT_NUMBER_CLAIMED_BEYOND_LOOKAHEAD"
            ],
            "description": "Advisory, never a refusal. `NEXT_NUMBER_CLAIMED`: the next rendered number is already taken, so issuance skips to `valueToReceive`. `NEXT_NUMBER_CLAIMED_BEYOND_LOOKAHEAD`: no free number was found within the bounded lookahead."
          },
          "claimedValue": {
            "type": "string",
            "description": "The next rendered number, which is already taken."
          },
          "valueToReceive": {
            "type": "string",
            "nullable": true,
            "description": "The first free number within the lookahead; null for `NEXT_NUMBER_CLAIMED_BEYOND_LOOKAHEAD`."
          }
        },
        "required": [
          "reason",
          "claimedValue",
          "valueToReceive"
        ]
      },
      "CommerceNumberPreviewResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "live",
              "incomplete"
            ],
            "description": "`live` carries the number the next issue would receive if nothing else issues first; it is never reserved. `incomplete` carries a labelled illustrative shape instead and claims no number."
          },
          "kind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ]
          },
          "resetKey": {
            "type": "string",
            "nullable": true,
            "description": "The counter scope the next issue uses (`default`, `2026`, `2026-10` or `2026-10-22`). Null when `incomplete`."
          },
          "candidate": {
            "type": "string",
            "nullable": true,
            "description": "The next rendered number before any taken number is skipped. Null when `incomplete`."
          },
          "valueToReceive": {
            "type": "string",
            "nullable": true,
            "description": "The number the next issue would receive if nothing else issues first. Null when `incomplete`, or when no free number was found within the lookahead (see `notice`)."
          },
          "notice": {
            "nullable": true,
            "description": "Present when `candidate` is already taken; null when it is free or the preview is `incomplete`.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceNumberOccupancyNoticeDto"
              }
            ]
          },
          "incompleteReason": {
            "type": "string",
            "enum": [
              "DEFAULT_NUMBERING_LOCATION_MISSING"
            ],
            "nullable": true,
            "description": "Why the preview is `incomplete`; null when `live`. No format produces `incomplete` until the `{location}` token exists."
          },
          "illustrative": {
            "type": "string",
            "nullable": true,
            "description": "The labelled illustrative shape when `incomplete`; null when `live`."
          },
          "sequenceStartsAtEditable": {
            "type": "boolean",
            "description": "Whether `sequenceStartsAt` can still change for the previewed format's counter scope (see `CommerceNumberKindSettingsDto.sequenceStartsAtEditable`). When false, a proposed `sequenceStartsAt` is not applied: the preview shows the number the next issue would receive with the start in force, and a save of a different start is refused with `SEQUENCE_START_LOCKED`."
          }
        },
        "required": [
          "status",
          "kind",
          "resetKey",
          "candidate",
          "valueToReceive",
          "notice",
          "incompleteReason",
          "illustrative",
          "sequenceStartsAtEditable"
        ]
      },
      "SaveCommerceNumberSettingsDto": {
        "type": "object",
        "properties": {
          "prefixPattern": {
            "type": "string",
            "nullable": true,
            "description": "Literal text `A-Z a-z 0-9 - _` plus the tokens `{sequence}`, `{year}`, `{month}` and `{day}`; `{{` and `}}` are a literal brace. Exactly one `{sequence}` appears across the prefix, main and suffix patterns. At most 32 characters. Null or empty for no prefix."
          },
          "prefixSeparator": {
            "type": "string",
            "nullable": true,
            "description": "`-` or `_`, up to 3 characters; null or empty for none."
          },
          "mainPattern": {
            "type": "string",
            "description": "Literal text `A-Z a-z 0-9 - _` plus the tokens `{sequence}`, `{year}`, `{month}` and `{day}`; `{{` and `}}` are a literal brace. Exactly one `{sequence}` appears across the prefix, main and suffix patterns. At most 32 characters."
          },
          "suffixSeparator": {
            "type": "string",
            "nullable": true,
            "description": "`-` or `_`, up to 3 characters; null or empty for none."
          },
          "suffixPattern": {
            "type": "string",
            "nullable": true,
            "description": "Literal text `A-Z a-z 0-9 - _` plus the tokens `{sequence}`, `{year}`, `{month}` and `{day}`; `{{` and `}}` are a literal brace. Exactly one `{sequence}` appears across the prefix, main and suffix patterns. At most 32 characters. Null or empty for no suffix."
          },
          "padding": {
            "type": "number",
            "minimum": 0,
            "maximum": 8
          },
          "sequenceStartsAt": {
            "type": "number",
            "minimum": 1,
            "maximum": 999999999,
            "description": "Can differ from the stored value only while `sequenceStartsAtEditable` is true."
          },
          "resetScope": {
            "type": "string",
            "enum": [
              "NEVER",
              "YEAR",
              "MONTH",
              "DAY"
            ]
          }
        },
        "required": [
          "prefixPattern",
          "prefixSeparator",
          "mainPattern",
          "suffixSeparator",
          "suffixPattern",
          "padding",
          "sequenceStartsAt",
          "resetScope"
        ]
      },
      "SaveCommerceNumberSettingsResponseDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER",
              "CONTRACT"
            ]
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "This save attempt's identifier, also recorded in its audit row's `metadata.requestId`."
          },
          "configuration": {
            "description": "The configuration as saved.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceNumberKindSettingsDto"
              }
            ]
          },
          "next": {
            "nullable": true,
            "description": "The next number checked under the save lock. A taken number never blocks the save; `notice` says which number issuance will skip to. It can be stale by the time it is read. Null only when the saved format's counter scope can issue no further number; `nextUnavailableReason` then says so.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommerceNumberPreviewResponseDto"
              }
            ]
          },
          "nextUnavailableReason": {
            "type": "string",
            "enum": [
              "SEQUENCE_EXHAUSTED"
            ],
            "nullable": true,
            "description": "Why `next` is null; null whenever `next` is present. `SEQUENCE_EXHAUSTED`: the counter scope this format selects now has issued its last possible number. The configuration was still saved; choose a different reset scope to keep issuing."
          }
        },
        "required": [
          "kind",
          "requestId",
          "configuration",
          "next",
          "nextUnavailableReason"
        ]
      },
      "StorefrontContextOrganizationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable tenant organization id."
          },
          "slug": {
            "type": "string",
            "description": "URL-safe tenant slug."
          },
          "name": {
            "type": "string",
            "description": "Tenant display name."
          },
          "status": {
            "type": "string",
            "description": "Lifecycle status of the tenant org.",
            "example": "ACTIVE"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, e.g. `USD`."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone, e.g. `America/Denver`."
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "status",
          "currency",
          "timezone"
        ]
      },
      "StorefrontContextApiKeyDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The authenticated key id (non-secret)."
          },
          "name": {
            "type": "string",
            "description": "Operator-assigned key label."
          },
          "scopes": {
            "description": "Scopes granted to this key.",
            "example": [
              "storefront:read"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "name",
          "scopes"
        ]
      },
      "StorefrontContextResponseDto": {
        "type": "object",
        "properties": {
          "organization": {
            "$ref": "#/components/schemas/StorefrontContextOrganizationDto"
          },
          "apiKey": {
            "$ref": "#/components/schemas/StorefrontContextApiKeyDto"
          }
        },
        "required": [
          "organization",
          "apiKey"
        ]
      },
      "StorefrontConsentMarkDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque scoped record identity for ordering responses and qualifying an Allow."
          },
          "incarnation": {
            "type": "string",
            "format": "uuid",
            "description": "Record incarnation. A changed incarnation requires a current lookup before permission can be used."
          },
          "revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Monotone decimal revision. Compare numerically within a binding. It is ordering evidence and grants no access."
          }
        },
        "required": [
          "recordId",
          "incarnation",
          "revision"
        ]
      },
      "StorefrontConsentAllowCommandDto": {
        "type": "object",
        "properties": {
          "operationName": {
            "type": "string",
            "pattern": "^[0-9a-f]{20}$",
            "description": "80 random bits in lowercase hexadecimal. Reuse the name and original click time for exact resends."
          },
          "clickedAtMs": {
            "type": "integer",
            "minimum": 1,
            "description": "Genuine click time in Unix epoch milliseconds."
          },
          "kind": {
            "type": "string",
            "enum": [
              "allow"
            ]
          },
          "expected": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StorefrontConsentMarkDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The binding observed at the control. Null is an expected empty binding for a first choice."
          },
          "supersedes": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9a-f]{20}$"
            },
            "maxItems": 8,
            "description": "Decline names known before the genuine Allow click. Empty means the caller can supersede no named Declines."
          }
        },
        "required": [
          "operationName",
          "clickedAtMs",
          "kind",
          "expected",
          "supersedes"
        ]
      },
      "StorefrontConsentDeclineCommandDto": {
        "type": "object",
        "properties": {
          "operationName": {
            "type": "string",
            "pattern": "^[0-9a-f]{20}$",
            "description": "80 random bits in lowercase hexadecimal. Reuse the name and original click time for exact resends."
          },
          "clickedAtMs": {
            "type": "integer",
            "minimum": 1,
            "description": "Genuine click time in Unix epoch milliseconds."
          },
          "kind": {
            "type": "string",
            "enum": [
              "decline"
            ]
          }
        },
        "required": [
          "operationName",
          "clickedAtMs",
          "kind"
        ]
      },
      "StorefrontDeclineDto": {
        "type": "object",
        "properties": {
          "operationName": {
            "type": "string",
            "pattern": "^[0-9a-f]{20}$",
            "description": "80 random bits in lowercase hexadecimal. Reuse the name and original click time for exact resends."
          },
          "clickedAtMs": {
            "type": "integer",
            "minimum": 1,
            "description": "Genuine click time in Unix epoch milliseconds."
          }
        },
        "required": [
          "operationName",
          "clickedAtMs"
        ]
      },
      "StorefrontConsentResolveDto": {
        "type": "object",
        "properties": {
          "handles": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            },
            "maxItems": 64,
            "description": "All first-party opaque handles for this storefront. An empty list presents no binding. Send in the body only."
          },
          "establishBinding": {
            "type": "boolean",
            "default": false,
            "description": "True to establish an empty binding when no handle resolves and no choice is carried. Omission only resolves existing bindings."
          },
          "declines": {
            "maxItems": 8,
            "description": "Exact pending Declines carried by this request. Empty or omitted means the caller presents none.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StorefrontDeclineDto"
            }
          },
          "unconfirmedDeclineName": {
            "type": "string",
            "pattern": "^[0-9a-f]{20}$",
            "description": "One name from declines when this is the bounded lookup for an otherwise unconfirmed Decline. Omit for routine lookups, including a confirmed Decline."
          }
        },
        "required": [
          "handles"
        ]
      },
      "StorefrontConsentRecordDto": {
        "type": "object",
        "properties": {
          "recordId": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque scoped record identity for ordering responses and qualifying an Allow."
          },
          "incarnation": {
            "type": "string",
            "format": "uuid",
            "description": "Record incarnation. A changed incarnation requires a current lookup before permission can be used."
          },
          "revision": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,18}$",
            "description": "Monotone decimal revision. Compare numerically within a binding. It is ordering evidence and grants no access."
          },
          "choice": {
            "type": "string",
            "enum": [
              "empty",
              "granted",
              "denied"
            ],
            "description": "Current durable choice. Empty is a binding awaiting its first saved choice. Collection requires qualifyingAllow and the caller eligibility checks."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Authoritative expiry in UTC. The record cannot be used after this time."
          },
          "currentDecline": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StorefrontDeclineDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "The current denied choice’s operation name and click time. Null for empty or granted bindings."
          }
        },
        "required": [
          "recordId",
          "incarnation",
          "revision",
          "choice",
          "expiresAt",
          "currentDecline"
        ]
      },
      "StorefrontConsentIssuedHandleDto": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Raw one-time delivery of a 256-bit handle. The storefront server puts it in a new host-only HttpOnly cookie. Treat it as sensitive."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "Maximum cookie expiry in UTC. Each response adds a cookie with its own name."
          }
        },
        "required": [
          "value",
          "expiresAt"
        ]
      },
      "StorefrontConsentQualifyingAllowDto": {
        "type": "object",
        "properties": {
          "operationName": {
            "type": "string",
            "pattern": "^[0-9a-f]{20}$",
            "description": "80 random bits in lowercase hexadecimal. Reuse the name and original click time for exact resends."
          },
          "clickedAtMs": {
            "type": "integer",
            "minimum": 1,
            "description": "Genuine click time in Unix epoch milliseconds."
          },
          "supersededDeclineNames": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9a-f]{20}$"
            },
            "maxItems": 8,
            "description": "Declines superseded by this Allow. Empty means the Allow superseded no named Declines."
          }
        },
        "required": [
          "operationName",
          "clickedAtMs",
          "supersededDeclineNames"
        ]
      },
      "StorefrontConsentOutcomeDto": {
        "type": "object",
        "properties": {
          "operationName": {
            "type": "string",
            "pattern": "^[0-9a-f]{20}$",
            "description": "Exact requested operation name."
          },
          "kind": {
            "type": "string",
            "enum": [
              "allow",
              "decline"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "saved",
              "superseded",
              "unchanged",
              "unconfirmed"
            ],
            "description": "Saved is a committed operation. Superseded is an exact later-Allow disposition. Unchanged is an Allow against an already-granted choice. Unconfirmed supplies no save receipt."
          },
          "revision": {
            "type": "string",
            "nullable": true,
            "description": "Resulting revision of this operation, which can predate the current record revision. Null means the platform cannot confirm the operation."
          }
        },
        "required": [
          "operationName",
          "kind",
          "outcome",
          "revision"
        ]
      },
      "StorefrontConsentResultDto": {
        "type": "object",
        "properties": {
          "configuration": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Ga4ConsentConfigurationDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Current configuration evaluated in this same metered request for a server key with storefront:read and storefront:consent. Absent or unavailable configuration gives no permission and does not invalidate a choice receipt."
          },
          "record": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StorefrontConsentRecordDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Current scoped binding. Null covers absent, unknown, expired and retired handles. It supplies no collection permission."
          },
          "bindingChanged": {
            "type": "boolean",
            "description": "A merge changed the binding during this request. Clients also compare the current mark to their last mark for independently observed identity changes."
          },
          "issuedHandle": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StorefrontConsentIssuedHandleDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Newly issued handle, or null when this request issued none. Existing eligible cookies continue to be presented."
          },
          "outcomes": {
            "description": "Results only for the choices in this request. Empty means no choice was submitted. This is no browsing or choice history.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StorefrontConsentOutcomeDto"
            }
          },
          "qualifyingAllow": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StorefrontConsentQualifyingAllowDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Current qualifying Allow from a lookup. Null means no permission evidence, including every save response. The caller must still apply its binding, currentness, configuration and local Decline checks."
          }
        },
        "required": [
          "record",
          "bindingChanged",
          "issuedHandle",
          "outcomes",
          "qualifyingAllow"
        ]
      },
      "StorefrontConsentSaveDto": {
        "type": "object",
        "properties": {
          "handles": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            },
            "maxItems": 64,
            "description": "All first-party opaque handles for this storefront. An empty list presents no binding. Send in the body only."
          },
          "command": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StorefrontConsentAllowCommandDto"
              },
              {
                "$ref": "#/components/schemas/StorefrontConsentDeclineCommandDto"
              }
            ],
            "description": "One named choice. Retry the original body and operation name."
          }
        },
        "required": [
          "handles",
          "command"
        ]
      },
      "ImportCatalogRowDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ItemType"
              }
            ]
          },
          "sellMode": {
            "description": "How this item may be purchased (default `ONE_TIME`). Authoring contract only — sell-mode enforcement and storefront/BYO filtering ship with subscription checkout (#629). A variant may override this per-variant.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0
          },
          "compareAtPriceInCents": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "Send `null` to clear an existing value; omit to leave it alone."
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "shortDescription": {
            "type": "string",
            "maxLength": 500
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "brand": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "vendor": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "productFamily": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. Positive; must be sent together with `weightUnit`."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true,
            "description": "Longest side, expressed in `dimensionUnit`. Positive."
          },
          "width": {
            "type": "number",
            "nullable": true,
            "description": "Width, expressed in `dimensionUnit`. Positive."
          },
          "height": {
            "type": "number",
            "nullable": true,
            "description": "Height, expressed in `dimensionUnit`. Positive."
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "description": "Packed-item orientation. Omit to keep the saved-face default; ANY_SIDE_RIGHT_ANGLE permits every distinct 90-degree face rotation of reviewed dimensions.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary key/value attributes."
          },
          "channelPublishStatus": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-channel publish status, e.g. `{ \"storefront\": \"published\" }`."
          },
          "target": {
            "type": "string",
            "enum": [
              "product"
            ],
            "description": "Row discriminator — a product upsert row. Optional: an omitted `target` is a product row (the shipped first-vertical shape)."
          },
          "externalId": {
            "type": "string",
            "description": "The source platform's own primary key for this row (e.g. `gid://shopify/Product/123` or a SKU), stored verbatim. Combined with the batch `sourceSystem` it is the idempotency key: the same pair resolves to the same cartonium item on re-import.",
            "minLength": 1,
            "maxLength": 512
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Status/sort mapping — the product's display position within the tenant catalog. Omitted: appends to the end on insert, preserves the stored order on update."
          }
        },
        "required": [
          "name",
          "slug",
          "type",
          "status",
          "priceInCents",
          "externalId"
        ]
      },
      "ImportCatalogCollectionRowDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "image": {
            "type": "object",
            "additionalProperties": true,
            "description": "Image metadata as an open JSON object. Shape will be tightened by Epic 6 (Catalog Media). Send `null` to clear.",
            "nullable": true
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Display order — collections are listed ascending. Defaults to 0."
          },
          "target": {
            "type": "string",
            "enum": [
              "collection"
            ],
            "description": "Row discriminator — a collection upsert row."
          },
          "externalId": {
            "type": "string",
            "description": "The source platform's own primary key for this collection (e.g. `gid://shopify/Collection/123`), stored verbatim. With the batch `sourceSystem` it is the idempotency key: the same pair resolves to the same cartonium collection on re-import.",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "name",
          "slug",
          "status",
          "target",
          "externalId"
        ]
      },
      "ImportCatalogVariantRowDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sku": {
            "type": "string",
            "description": "Inventory-side identifier. Unique within the parent item. Allowed: alphanumerics, `-`, `_`, `.`",
            "minLength": 1,
            "maxLength": 100
          },
          "priceInCents": {
            "type": "number",
            "minimum": 0
          },
          "compareAtPriceInCents": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "Send `null` to clear an existing value; omit to leave it alone."
          },
          "sellMode": {
            "nullable": true,
            "description": "Per-variant override of the item's `sellMode`. Send `null` (or omit) to inherit the parent item default. Authoring contract only — enforcement is subscription checkout (#629).",
            "allOf": [
              {
                "$ref": "#/components/schemas/SellMode"
              }
            ]
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Variant-distinguishing attributes (e.g. `{ \"size\": \"M\", \"color\": \"Red\" }`). Keys and values must both be strings."
          },
          "metafields": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary merchant-side attributes."
          },
          "weight": {
            "type": "number",
            "nullable": true,
            "description": "Physical weight, expressed in `weightUnit`. Positive; must be sent together with `weightUnit`. Overrides the parent item weight."
          },
          "weightUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WeightUnit"
              }
            ]
          },
          "length": {
            "type": "number",
            "nullable": true,
            "description": "Longest side, expressed in `dimensionUnit`. Positive."
          },
          "width": {
            "type": "number",
            "nullable": true,
            "description": "Width, expressed in `dimensionUnit`. Positive."
          },
          "height": {
            "type": "number",
            "nullable": true,
            "description": "Height, expressed in `dimensionUnit`. Positive."
          },
          "dimensionUnit": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/DimensionUnit"
              }
            ]
          },
          "orientationPolicy": {
            "nullable": true,
            "description": "Variant orientation override. Null or omitted inherits the item; otherwise choose saved-face only or every distinct 90-degree face rotation.",
            "allOf": [
              {
                "$ref": "#/components/schemas/OrientationPolicy"
              }
            ]
          },
          "target": {
            "type": "string",
            "enum": [
              "variant"
            ],
            "description": "Row discriminator — a product-variant upsert row."
          },
          "externalId": {
            "type": "string",
            "description": "The source platform's own primary key for this variant (e.g. `gid://shopify/ProductVariant/456`), stored verbatim. With the batch `sourceSystem` it is the idempotency key. Write-once: a variant can never be re-pointed to a different parent product via import.",
            "minLength": 1,
            "maxLength": 512
          },
          "productExternalId": {
            "type": "string",
            "description": "The PARENT PRODUCT's external id in the same sourceSystem (e.g. `gid://shopify/Product/123`). Must resolve to an already-imported product in this tenant — earlier rows in the same batch count.",
            "minLength": 1,
            "maxLength": 512
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Status/sort mapping — the variant's display position within its parent product. Omitted: appends to the end on insert, preserves the stored order on update."
          }
        },
        "required": [
          "name",
          "sku",
          "priceInCents",
          "target",
          "externalId",
          "productExternalId"
        ]
      },
      "ImportCatalogMembershipRowDto": {
        "type": "object",
        "properties": {
          "target": {
            "type": "string",
            "enum": [
              "membership"
            ],
            "description": "Row discriminator — an item↔collection assignment row."
          },
          "externalId": {
            "type": "string",
            "description": "The source platform's own id for the assignment (e.g. a Shopify `Collect` gid) — job-row lineage only, NOT the idempotency key (the resolved collection+item pair is). Omitted: synthesized as `<collectionExternalId>::<itemExternalId>`.",
            "minLength": 1,
            "maxLength": 512
          },
          "collectionExternalId": {
            "type": "string",
            "description": "The COLLECTION's external id in the same sourceSystem. Must resolve to an already-imported collection in this tenant.",
            "minLength": 1,
            "maxLength": 512
          },
          "itemExternalId": {
            "type": "string",
            "description": "The ITEM's external id in the same sourceSystem. Must resolve to an already-imported product in this tenant.",
            "minLength": 1,
            "maxLength": 512
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "description": "Status/sort mapping — the item's display position within the collection. Omitted: appends after the collection tail on insert, preserves the stored position on update."
          }
        },
        "required": [
          "target",
          "collectionExternalId",
          "itemExternalId"
        ]
      },
      "ImportCatalogCompositionComponentDto": {
        "type": "object",
        "properties": {
          "productExternalId": {
            "type": "string",
            "description": "The component product's external id in this batch sourceSystem.",
            "minLength": 1,
            "maxLength": 512
          },
          "variantExternalId": {
            "type": "string",
            "description": "An exact component variant's external id in this batch sourceSystem.",
            "minLength": 1,
            "maxLength": 512,
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647
          },
          "discountBasisPoints": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000
          },
          "capacityMode": {
            "type": "string",
            "enum": [
              "TRACKED",
              "UNTRACKED"
            ]
          },
          "untrackedReason": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "productExternalId",
          "quantity",
          "discountBasisPoints",
          "capacityMode"
        ]
      },
      "ImportCatalogCompositionRowDto": {
        "type": "object",
        "properties": {
          "target": {
            "type": "string",
            "enum": [
              "composition"
            ]
          },
          "externalId": {
            "type": "string",
            "description": "Source identity for this composition row's import ledger entry. It is not a cartonium composition key.",
            "minLength": 1,
            "maxLength": 512
          },
          "productExternalId": {
            "type": "string",
            "description": "The composed parent product's external id in this batch sourceSystem.",
            "minLength": 1,
            "maxLength": 512
          },
          "kind": {
            "type": "string",
            "enum": [
              "PACKAGE",
              "KIT"
            ]
          },
          "expectedRevision": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483646,
            "description": "0 creates the definition; an update supplies its exact current revision. Exact replay of an identical imported definition is idempotent."
          },
          "components": {
            "minItems": 2,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportCatalogCompositionComponentDto"
            }
          }
        },
        "required": [
          "target",
          "externalId",
          "productExternalId",
          "kind",
          "expectedRevision",
          "components"
        ]
      },
      "ImportCatalogBatchDto": {
        "type": "object",
        "properties": {
          "sourceSystem": {
            "type": "string",
            "description": "The origin platform, lowercased and free-form (e.g. `shopify`, `woocommerce`, `custom`). Source-agnostic — Shopify is the reference use case, never the only one. Stamped on every imported row as lineage.",
            "minLength": 1,
            "maxLength": 64,
            "example": "shopify"
          },
          "dryRun": {
            "type": "boolean",
            "description": "Validate-only. When true, every row is parsed/mapped/validated and reported per-row, but NOTHING is written — no item insert/update, no side-effect. Use it to diff a mapping until clean, then flip to false.",
            "default": false
          },
          "idempotencyKey": {
            "type": "string",
            "description": "Optional request-level idempotency key for the JOB SUBMISSION (dedupes a network-retried submit into one job). Orthogonal to the per-row external-ID idempotency, which already makes re-imports safe.",
            "maxLength": 200
          },
          "rows": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ImportCatalogRowDto"
                },
                {
                  "$ref": "#/components/schemas/ImportCatalogCollectionRowDto"
                },
                {
                  "$ref": "#/components/schemas/ImportCatalogVariantRowDto"
                },
                {
                  "$ref": "#/components/schemas/ImportCatalogMembershipRowDto"
                },
                {
                  "$ref": "#/components/schemas/ImportCatalogCompositionRowDto"
                }
              ]
            },
            "description": "The catalog rows to upsert. 1..200 rows run synchronously (terminal job + per-row results in the response); 201..5000 rows are accepted as an async job (202 + `QUEUED`; poll `GET /import/jobs/:id`). A larger batch is rejected with `IMPORT_BATCH_TOO_LARGE` and must be split. Each row is one of the five target shapes, discriminated by `target` (omitted = `product`)."
          }
        },
        "required": [
          "sourceSystem",
          "rows"
        ]
      },
      "ImportFamily": {
        "type": "string",
        "enum": [
          "CATALOG",
          "INVENTORY",
          "CONTENT",
          "PRICING",
          "CUSTOMERS"
        ]
      },
      "ImportJobStatus": {
        "type": "string",
        "enum": [
          "QUEUED",
          "RUNNING",
          "SUCCEEDED",
          "PARTIALLY_SUCCEEDED",
          "FAILED",
          "CANCELLED"
        ]
      },
      "ImportJobRowStatus": {
        "type": "string",
        "enum": [
          "QUEUED",
          "RUNNING",
          "SUCCEEDED",
          "FAILED",
          "SKIPPED"
        ]
      },
      "ImportJobRowResultDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "rowIndex": {
            "type": "number",
            "description": "Position of this row in the submitted batch (0-based)."
          },
          "sourceSystem": {
            "type": "string",
            "description": "The origin platform this row came from."
          },
          "externalId": {
            "type": "string",
            "description": "The source platform's own id for this row."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ImportJobRowStatus"
              }
            ]
          },
          "targetType": {
            "type": "string",
            "nullable": true,
            "description": "The cartonium entity type this row upserted into (e.g. `item`). Null until a successful write, and always null on a dryRun."
          },
          "targetId": {
            "type": "string",
            "nullable": true,
            "description": "The id of the upserted cartonium entity. Null until success / for a dryRun."
          },
          "wouldApply": {
            "type": "string",
            "nullable": true,
            "description": "On a dryRun, whether this row WOULD insert or update its target. Product/collection/variant rows match the external-ID triple; membership and composition rows use their documented resolved domain identity. Null on a real run.",
            "enum": [
              "insert",
              "update"
            ]
          },
          "errorCode": {
            "type": "string",
            "nullable": true,
            "description": "Typed per-row error code (null when the row succeeded)."
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "errorDetails": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "rowIndex",
          "sourceSystem",
          "externalId",
          "status"
        ]
      },
      "ImportJobResultDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "family": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ImportFamily"
              }
            ]
          },
          "sourceSystem": {
            "type": "string"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ImportJobStatus"
              }
            ]
          },
          "dryRun": {
            "type": "boolean",
            "description": "True when this was a validate-only job."
          },
          "totalRows": {
            "type": "number"
          },
          "succeededRows": {
            "type": "number"
          },
          "failedRows": {
            "type": "number"
          },
          "skippedRows": {
            "type": "number"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "finishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportJobRowResultDto"
            }
          }
        },
        "required": [
          "id",
          "family",
          "sourceSystem",
          "status",
          "dryRun",
          "totalRows",
          "succeededRows",
          "failedRows",
          "skippedRows",
          "createdAt",
          "rows"
        ]
      },
      "ImportContentPageRowDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "description": "URL-safe identifier; tenant-scoped unique. Lowercase letters, digits, and hyphens only.",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "PUBLISHED",
              "DRAFT"
            ],
            "description": "Lifecycle status. `ARCHIVED` is reserved for the archive endpoint and is intentionally not accepted here."
          },
          "content": {
            "type": "string",
            "maxLength": 1000000,
            "description": "Page body. Stored as TEXT in Postgres so there is no schema-level length cap; the 1 MB DTO limit is a runtime safety guard."
          },
          "excerpt": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Send `null` to clear an existing excerpt; omit to leave it alone."
          },
          "target": {
            "type": "string",
            "enum": [
              "page"
            ],
            "description": "Row discriminator — a page upsert row. Optional: an omitted `target` is a page row (the only content target today)."
          },
          "externalId": {
            "type": "string",
            "description": "The source platform's own primary key for this row (e.g. `gid://shopify/Page/123` or a CMS slug), stored verbatim. Combined with the batch `sourceSystem` it is the idempotency key: the same pair resolves to the same cartonium page on re-import.",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "title",
          "slug",
          "status",
          "content",
          "externalId"
        ]
      },
      "ImportContentBatchDto": {
        "type": "object",
        "properties": {
          "sourceSystem": {
            "type": "string",
            "description": "The origin platform, lowercased and free-form (e.g. `shopify`, `woocommerce`, `custom`). Source-agnostic. Stamped on every imported row as lineage.",
            "minLength": 1,
            "maxLength": 64,
            "example": "shopify"
          },
          "dryRun": {
            "type": "boolean",
            "description": "Validate-only. When true, every row is parsed/mapped/validated and reported per-row, but NOTHING is written — no page insert/update, no side-effect. Use it to diff a mapping until clean, then flip to false.",
            "default": false
          },
          "idempotencyKey": {
            "type": "string",
            "description": "Optional request-level idempotency key for the JOB SUBMISSION (dedupes a network-retried submit into one job). Orthogonal to the per-row external-ID idempotency, which already makes re-imports safe.",
            "maxLength": 200
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportContentPageRowDto"
            },
            "description": "The content rows to upsert. 1..200 rows run synchronously (terminal job + per-row results in the response); 201..5000 rows are accepted as an async job (202 + `QUEUED`; poll `GET /import/jobs/:id`). A larger batch is rejected with `IMPORT_BATCH_TOO_LARGE` and must be split. **Size, not row count, is usually the binding limit here:** the whole request body is capped at 2 MB, enforced by the JSON parser BEFORE this batch is validated, so an oversized submission returns a plain `413` rather than the typed row-cap error. Because a page body may be up to 1 MB, the reachable row count scales with page size — roughly 1,000 rows of 2 KB pages, ~200 rows of 10 KB pages, and only a couple of very large ones. Chunk submissions by BYTES and keep each under ~2 MB; per-row external-ID idempotency makes the split boundaries harmless."
          }
        },
        "required": [
          "sourceSystem",
          "rows"
        ]
      },
      "BookingServiceResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "itemId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ]
          },
          "deliveryPosture": {
            "type": "string",
            "enum": [
              "PICKUP_ONLY",
              "OPTIONAL",
              "REQUIRED"
            ]
          },
          "periodMode": {
            "type": "string",
            "enum": [
              "EXACT_RANGE",
              "FIXED_DURATION",
              "FIXED_SLOT"
            ]
          },
          "durationMinutes": {
            "type": "number",
            "nullable": true
          },
          "durationOptionsMinutes": {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "fixedSlotTemplate": {
            "type": "object",
            "nullable": true,
            "description": "FIXED_SLOT launch shape: { slots: [{ label, startMinuteOfDay, durationMinutes }] }."
          },
          "timePickerIncrementMinutes": {
            "type": "number"
          },
          "defaultStartMinuteOfDay": {
            "type": "number",
            "nullable": true
          },
          "defaultEndMinuteOfDay": {
            "type": "number",
            "nullable": true
          },
          "bufferBeforeMinutes": {
            "type": "number"
          },
          "bufferAfterMinutes": {
            "type": "number"
          },
          "minPartySize": {
            "type": "number",
            "nullable": true
          },
          "maxPartySize": {
            "type": "number",
            "nullable": true
          },
          "capacity": {
            "type": "number"
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "pricingMode": {
            "type": "string",
            "enum": [
              "FLAT_TIME",
              "FIXED_PRICE",
              "PRICING_STRUCTURE"
            ]
          },
          "basePriceInCents": {
            "type": "number"
          },
          "pricingIntervalMinutes": {
            "type": "number",
            "nullable": true
          },
          "pricingPolicyId": {
            "type": "string",
            "nullable": true
          },
          "pricingBasis": {
            "type": "string",
            "enum": [
              "RESERVED_WINDOW",
              "CHARGED_DURATION",
              "FIXED_PRICE"
            ]
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "PAY_LATER",
              "DEPOSIT_PERCENT",
              "FULL_PAYMENT"
            ]
          },
          "paymentDepositPercent": {
            "type": "number",
            "nullable": true
          },
          "paymentDepositAmountInCents": {
            "type": "number",
            "nullable": true
          },
          "securityDepositMode": {
            "type": "string",
            "enum": [
              "NONE",
              "FIXED_AMOUNT",
              "PERCENTAGE_OF_ORDER",
              "PERCENTAGE_OF_RESOURCE_VALUES"
            ]
          },
          "securityDepositAmountInCents": {
            "type": "number",
            "nullable": true
          },
          "securityDepositPercent": {
            "type": "number",
            "nullable": true
          },
          "approvalMode": {
            "type": "string",
            "enum": [
              "AUTO_CONFIRM",
              "MANUAL_APPROVAL"
            ]
          },
          "leadTimeMinutes": {
            "type": "number"
          },
          "maxAdvanceDays": {
            "type": "number",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "itemId",
          "slug",
          "name",
          "description",
          "status",
          "bookingType",
          "deliveryPosture",
          "periodMode",
          "durationMinutes",
          "durationOptionsMinutes",
          "fixedSlotTemplate",
          "timePickerIncrementMinutes",
          "defaultStartMinuteOfDay",
          "defaultEndMinuteOfDay",
          "bufferBeforeMinutes",
          "bufferAfterMinutes",
          "minPartySize",
          "maxPartySize",
          "capacity",
          "timezone",
          "pricingMode",
          "basePriceInCents",
          "pricingIntervalMinutes",
          "pricingPolicyId",
          "pricingBasis",
          "paymentMode",
          "paymentDepositPercent",
          "paymentDepositAmountInCents",
          "securityDepositMode",
          "securityDepositAmountInCents",
          "securityDepositPercent",
          "approvalMode",
          "leadTimeMinutes",
          "maxAdvanceDays",
          "metadata",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingServiceListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingServiceResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "BookingFixedSlotDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 100,
            "example": "Morning"
          },
          "startMinuteOfDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 1439,
            "example": 540
          },
          "durationMinutes": {
            "type": "number",
            "minimum": 1,
            "maximum": 1440,
            "example": 180
          }
        },
        "required": [
          "label",
          "startMinuteOfDay",
          "durationMinutes"
        ]
      },
      "BookingFixedSlotTemplateDto": {
        "type": "object",
        "properties": {
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingFixedSlotDto"
            }
          }
        },
        "required": [
          "slots"
        ]
      },
      "CreateBookingServiceDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "object",
            "format": "uuid",
            "nullable": true
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 10000
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "ARCHIVED"
            ],
            "default": "DRAFT"
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ]
          },
          "deliveryPosture": {
            "type": "string",
            "enum": [
              "PICKUP_ONLY",
              "OPTIONAL",
              "REQUIRED"
            ],
            "default": "PICKUP_ONLY",
            "description": "Whether this service is pickup-only, optionally deliverable, or requires delivery."
          },
          "periodMode": {
            "type": "string",
            "enum": [
              "EXACT_RANGE",
              "FIXED_DURATION",
              "FIXED_SLOT"
            ]
          },
          "durationMinutes": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "durationOptionsMinutes": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "fixedSlotTemplate": {
            "nullable": true,
            "description": "Stable launch shape for FIXED_SLOT: { slots: [{ label, startMinuteOfDay, durationMinutes }] }.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingFixedSlotTemplateDto"
              }
            ]
          },
          "timePickerIncrementMinutes": {
            "type": "number",
            "minimum": 1,
            "maximum": 1440,
            "default": 30
          },
          "defaultStartMinuteOfDay": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 1439
          },
          "defaultEndMinuteOfDay": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 1440
          },
          "bufferBeforeMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "bufferAfterMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "minPartySize": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "maxPartySize": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "capacity": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "pricingMode": {
            "type": "string",
            "enum": [
              "FLAT_TIME",
              "FIXED_PRICE",
              "PRICING_STRUCTURE"
            ],
            "default": "FLAT_TIME"
          },
          "basePriceInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "pricingIntervalMinutes": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647,
            "default": 60,
            "description": "Minutes represented by one base-price unit for FLAT_TIME pricing. Distinct from the time-picker increment; null for FIXED_PRICE."
          },
          "pricingBasis": {
            "type": "string",
            "enum": [
              "RESERVED_WINDOW",
              "CHARGED_DURATION",
              "FIXED_PRICE"
            ],
            "default": "RESERVED_WINDOW"
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "PAY_LATER",
              "DEPOSIT_PERCENT",
              "FULL_PAYMENT"
            ],
            "default": "FULL_PAYMENT"
          },
          "paymentDepositPercent": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "securityDepositMode": {
            "type": "string",
            "enum": [
              "NONE",
              "FIXED_AMOUNT",
              "PERCENTAGE_OF_ORDER",
              "PERCENTAGE_OF_RESOURCE_VALUES"
            ],
            "default": "NONE"
          },
          "securityDepositAmountInCents": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "securityDepositPercent": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "approvalMode": {
            "type": "string",
            "enum": [
              "AUTO_CONFIRM",
              "MANUAL_APPROVAL"
            ],
            "default": "AUTO_CONFIRM"
          },
          "leadTimeMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "maxAdvanceDays": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "metadata": {
            "type": "object",
            "nullable": true
          }
        },
        "required": [
          "slug",
          "name",
          "bookingType",
          "periodMode"
        ]
      },
      "UpdateBookingServiceDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "object",
            "format": "uuid",
            "nullable": true
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 10000
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "ARCHIVED"
            ],
            "default": "DRAFT"
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ]
          },
          "deliveryPosture": {
            "type": "string",
            "enum": [
              "PICKUP_ONLY",
              "OPTIONAL",
              "REQUIRED"
            ],
            "default": "PICKUP_ONLY",
            "description": "Whether this service is pickup-only, optionally deliverable, or requires delivery."
          },
          "periodMode": {
            "type": "string",
            "enum": [
              "EXACT_RANGE",
              "FIXED_DURATION",
              "FIXED_SLOT"
            ]
          },
          "durationMinutes": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "durationOptionsMinutes": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "fixedSlotTemplate": {
            "nullable": true,
            "description": "Stable launch shape for FIXED_SLOT: { slots: [{ label, startMinuteOfDay, durationMinutes }] }.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingFixedSlotTemplateDto"
              }
            ]
          },
          "timePickerIncrementMinutes": {
            "type": "number",
            "minimum": 1,
            "maximum": 1440,
            "default": 30
          },
          "defaultStartMinuteOfDay": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 1439
          },
          "defaultEndMinuteOfDay": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 1440
          },
          "bufferBeforeMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "bufferAfterMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "minPartySize": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "maxPartySize": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "capacity": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "pricingMode": {
            "type": "string",
            "enum": [
              "FLAT_TIME",
              "FIXED_PRICE",
              "PRICING_STRUCTURE"
            ],
            "default": "FLAT_TIME"
          },
          "basePriceInCents": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "pricingIntervalMinutes": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647,
            "default": 60,
            "description": "Minutes represented by one base-price unit for FLAT_TIME pricing. Distinct from the time-picker increment; null for FIXED_PRICE."
          },
          "pricingBasis": {
            "type": "string",
            "enum": [
              "RESERVED_WINDOW",
              "CHARGED_DURATION",
              "FIXED_PRICE"
            ],
            "default": "RESERVED_WINDOW"
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "PAY_LATER",
              "DEPOSIT_PERCENT",
              "FULL_PAYMENT"
            ],
            "default": "FULL_PAYMENT"
          },
          "paymentDepositPercent": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "securityDepositMode": {
            "type": "string",
            "enum": [
              "NONE",
              "FIXED_AMOUNT",
              "PERCENTAGE_OF_ORDER",
              "PERCENTAGE_OF_RESOURCE_VALUES"
            ],
            "default": "NONE"
          },
          "securityDepositAmountInCents": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "securityDepositPercent": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "approvalMode": {
            "type": "string",
            "enum": [
              "AUTO_CONFIRM",
              "MANUAL_APPROVAL"
            ],
            "default": "AUTO_CONFIRM"
          },
          "leadTimeMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "maxAdvanceDays": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647
          },
          "metadata": {
            "type": "object",
            "nullable": true
          }
        }
      },
      "BookingResourceResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "capacity": {
            "type": "number"
          },
          "allocationMode": {
            "type": "string",
            "enum": [
              "POOLED_QUANTITY",
              "EXACT_UNIT"
            ]
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "slug",
          "resourceType",
          "capacity",
          "allocationMode",
          "timezone",
          "status",
          "userId",
          "metadata",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingResourceListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingResourceResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingResourceDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "capacity": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "allocationMode": {
            "type": "string",
            "enum": [
              "POOLED_QUANTITY",
              "EXACT_UNIT"
            ],
            "default": "POOLED_QUANTITY"
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "nullable": true
          }
        },
        "required": [
          "name",
          "slug",
          "resourceType"
        ]
      },
      "UpdateBookingResourceDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "slug": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ]
          },
          "capacity": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "allocationMode": {
            "type": "string",
            "enum": [
              "POOLED_QUANTITY",
              "EXACT_UNIT"
            ],
            "default": "POOLED_QUANTITY"
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "nullable": true
          }
        }
      },
      "BookingResourceUnitResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid"
          },
          "identifier": {
            "type": "string"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "MAINTENANCE",
              "LOST",
              "RETIRED"
            ]
          },
          "metadata": {
            "type": "object",
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "resourceId",
          "identifier",
          "sku",
          "barcode",
          "status",
          "metadata",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingResourceUnitListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingResourceUnitResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingResourceUnitDto": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sku": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "barcode": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "MAINTENANCE",
              "LOST",
              "RETIRED"
            ],
            "default": "ACTIVE"
          },
          "metadata": {
            "type": "object",
            "nullable": true
          }
        },
        "required": [
          "identifier"
        ]
      },
      "UpdateBookingResourceUnitDto": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sku": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "barcode": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "MAINTENANCE",
              "LOST",
              "RETIRED"
            ],
            "default": "ACTIVE"
          },
          "metadata": {
            "type": "object",
            "nullable": true
          }
        }
      },
      "BookingResourceRequirementResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ],
            "nullable": true
          },
          "quantity": {
            "type": "number"
          },
          "required": {
            "type": "boolean"
          },
          "selectionStrategy": {
            "type": "string",
            "enum": [
              "ANY_AVAILABLE",
              "SPECIFIC_RESOURCE",
              "CUSTOMER_SELECTS",
              "MERCHANT_ASSIGN"
            ]
          },
          "sortOrder": {
            "type": "number"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "serviceId",
          "resourceId",
          "resourceType",
          "quantity",
          "required",
          "selectionStrategy",
          "sortOrder",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingResourceRequirementListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingResourceRequirementResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingResourceRequirementDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ],
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "required": {
            "type": "boolean",
            "default": true
          },
          "selectionStrategy": {
            "type": "string",
            "enum": [
              "ANY_AVAILABLE",
              "SPECIFIC_RESOURCE",
              "CUSTOMER_SELECTS",
              "MERCHANT_ASSIGN"
            ],
            "default": "ANY_AVAILABLE"
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          }
        },
        "required": [
          "serviceId"
        ]
      },
      "UpdateBookingResourceRequirementDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceType": {
            "type": "string",
            "enum": [
              "STAFF",
              "EQUIPMENT",
              "ROOM",
              "LOCATION",
              "VEHICLE",
              "POOL"
            ],
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "default": 1
          },
          "required": {
            "type": "boolean",
            "default": true
          },
          "selectionStrategy": {
            "type": "string",
            "enum": [
              "ANY_AVAILABLE",
              "SPECIFIC_RESOURCE",
              "CUSTOMER_SELECTS",
              "MERCHANT_ASSIGN"
            ],
            "default": "ANY_AVAILABLE"
          },
          "sortOrder": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          }
        }
      },
      "BookingAvailabilityRuleResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "targetType": {
            "type": "string",
            "enum": [
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "weekday": {
            "type": "number"
          },
          "startMinuteOfDay": {
            "type": "number"
          },
          "endMinuteOfDay": {
            "type": "number"
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "effectiveFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "effectiveTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "capacityOverride": {
            "type": "number",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "targetType",
          "serviceId",
          "resourceId",
          "weekday",
          "startMinuteOfDay",
          "endMinuteOfDay",
          "timezone",
          "effectiveFrom",
          "effectiveTo",
          "capacityOverride",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingAvailabilityRuleListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingAvailabilityRuleResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingAvailabilityRuleDto": {
        "type": "object",
        "properties": {
          "targetType": {
            "type": "string",
            "enum": [
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "weekday": {
            "type": "number",
            "minimum": 0,
            "maximum": 6
          },
          "startMinuteOfDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 1439
          },
          "endMinuteOfDay": {
            "type": "number",
            "minimum": 1,
            "maximum": 1440
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "effectiveFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "effectiveTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "capacityOverride": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": [
          "targetType",
          "weekday",
          "startMinuteOfDay",
          "endMinuteOfDay"
        ]
      },
      "UpdateBookingAvailabilityRuleDto": {
        "type": "object",
        "properties": {
          "targetType": {
            "type": "string",
            "enum": [
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "weekday": {
            "type": "number",
            "minimum": 0,
            "maximum": 6
          },
          "startMinuteOfDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 1439
          },
          "endMinuteOfDay": {
            "type": "number",
            "minimum": 1,
            "maximum": 1440
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "effectiveFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "effectiveTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "capacityOverride": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 2147483647
          }
        }
      },
      "BookingBlackoutResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "targetType": {
            "type": "string",
            "enum": [
              "ORGANIZATION",
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "recurrenceRule": {
            "type": "string",
            "nullable": true
          },
          "recurrenceTimezone": {
            "type": "string",
            "nullable": true
          },
          "recurrenceEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdByUserId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "targetType",
          "serviceId",
          "resourceId",
          "startsAt",
          "endsAt",
          "reason",
          "recurrenceRule",
          "recurrenceTimezone",
          "recurrenceEndsAt",
          "createdByUserId",
          "createdAt"
        ]
      },
      "BookingBlackoutListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingBlackoutResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingBlackoutDto": {
        "type": "object",
        "properties": {
          "targetType": {
            "type": "string",
            "enum": [
              "ORGANIZATION",
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "maxLength": 500
          },
          "recurrenceRule": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000
          },
          "recurrenceTimezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "recurrenceEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "targetType",
          "startsAt",
          "endsAt"
        ]
      },
      "UpdateBookingBlackoutDto": {
        "type": "object",
        "properties": {
          "targetType": {
            "type": "string",
            "enum": [
              "ORGANIZATION",
              "SERVICE",
              "RESOURCE"
            ]
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "resourceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "maxLength": 500
          },
          "recurrenceRule": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000
          },
          "recurrenceTimezone": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          },
          "recurrenceEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "BookingPolicyResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "cancelMode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ]
          },
          "cancelCutoffMinutes": {
            "type": "number"
          },
          "rescheduleMode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ]
          },
          "rescheduleCutoffMinutes": {
            "type": "number"
          },
          "refundMode": {
            "type": "string",
            "enum": [
              "FULL",
              "PARTIAL",
              "NONE",
              "MANUAL"
            ]
          },
          "refundPercent": {
            "type": "number",
            "nullable": true
          },
          "requiresApproval": {
            "type": "boolean",
            "description": "Change-policy approval flag; independent of the service initial-confirmation approvalMode."
          },
          "manualDatePolicyOverrideMode": {
            "type": "string",
            "enum": [
              "DISALLOW",
              "REQUIRE_PERMISSION"
            ]
          },
          "manualCapacityConflictMode": {
            "type": "string",
            "enum": [
              "STRICT_BLOCK",
              "CONTROLLED_SHORTAGE_ALLOWED"
            ]
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "serviceId",
          "name",
          "cancelMode",
          "cancelCutoffMinutes",
          "rescheduleMode",
          "rescheduleCutoffMinutes",
          "refundMode",
          "refundPercent",
          "requiresApproval",
          "manualDatePolicyOverrideMode",
          "manualCapacityConflictMode",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingPolicyListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPolicyResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingPolicyDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "cancelMode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ],
            "default": "REQUEST_ONLY"
          },
          "cancelCutoffMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "rescheduleMode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ],
            "default": "REQUEST_ONLY"
          },
          "rescheduleCutoffMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "refundMode": {
            "type": "string",
            "enum": [
              "FULL",
              "PARTIAL",
              "NONE",
              "MANUAL"
            ],
            "default": "MANUAL"
          },
          "refundPercent": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 100
          },
          "requiresApproval": {
            "type": "boolean",
            "default": false,
            "description": "Whether cancellation/reschedule policy actions require merchant approval. Independent of BookingService.approvalMode, which controls initial booking confirmation."
          },
          "manualDatePolicyOverrideMode": {
            "type": "string",
            "enum": [
              "DISALLOW",
              "REQUIRE_PERMISSION"
            ],
            "default": "REQUIRE_PERMISSION"
          },
          "manualCapacityConflictMode": {
            "type": "string",
            "enum": [
              "STRICT_BLOCK",
              "CONTROLLED_SHORTAGE_ALLOWED"
            ],
            "default": "STRICT_BLOCK"
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateBookingPolicyDto": {
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "cancelMode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ],
            "default": "REQUEST_ONLY"
          },
          "cancelCutoffMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "rescheduleMode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ],
            "default": "REQUEST_ONLY"
          },
          "rescheduleCutoffMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647,
            "default": 0
          },
          "refundMode": {
            "type": "string",
            "enum": [
              "FULL",
              "PARTIAL",
              "NONE",
              "MANUAL"
            ],
            "default": "MANUAL"
          },
          "refundPercent": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 100
          },
          "requiresApproval": {
            "type": "boolean",
            "default": false,
            "description": "Whether cancellation/reschedule policy actions require merchant approval. Independent of BookingService.approvalMode, which controls initial booking confirmation."
          },
          "manualDatePolicyOverrideMode": {
            "type": "string",
            "enum": [
              "DISALLOW",
              "REQUIRE_PERMISSION"
            ],
            "default": "REQUIRE_PERMISSION"
          },
          "manualCapacityConflictMode": {
            "type": "string",
            "enum": [
              "STRICT_BLOCK",
              "CONTROLLED_SHORTAGE_ALLOWED"
            ],
            "default": "STRICT_BLOCK"
          }
        }
      },
      "BookingPricingPolicyRevisionSummaryDto": {
        "type": "object",
        "properties": {
          "publishedRevisionNumber": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Revision number of the currently published revision; null when none is published."
          },
          "latestDraftRevisionNumber": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Highest-numbered DRAFT revision; null when the policy carries no draft."
          },
          "hasNewerDraft": {
            "type": "boolean",
            "description": "True when a DRAFT revision is newer than the published one (or exists while nothing is published) — the unpublished-changes signal."
          }
        },
        "required": [
          "publishedRevisionNumber",
          "latestDraftRevisionNumber",
          "hasNewerDraft"
        ]
      },
      "BookingPricingPolicyBandDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Stable band identity. Must be trimmed and unique within the revision.",
            "example": "up-to-2-hours"
          },
          "upperBoundMinutes": {
            "type": "number",
            "minimum": 1,
            "maximum": 527040,
            "description": "Inclusive upper duration bound in minutes. Bounds must strictly increase across the revision.",
            "example": 120
          },
          "factorBasisPoints": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Factor applied to the service base price (10000 = 100%). Factors must be non-decreasing across the revision.",
            "example": 15000
          }
        },
        "required": [
          "id",
          "upperBoundMinutes",
          "factorBasisPoints"
        ]
      },
      "BookingPricingPolicyRevisionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "policyId": {
            "type": "string",
            "format": "uuid"
          },
          "revisionNumber": {
            "type": "number",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "PUBLISHED",
              "SUPERSEDED"
            ]
          },
          "durationBands": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyBandDto"
            }
          },
          "minimumDurationMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 527040
          },
          "graceMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 1440
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "supersededAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "policyId",
          "revisionNumber",
          "status",
          "durationBands",
          "minimumDurationMinutes",
          "graceMinutes",
          "publishedAt",
          "supersededAt",
          "createdAt"
        ]
      },
      "BookingPricingPolicyListRowDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "revisionSummary": {
            "$ref": "#/components/schemas/BookingPricingPolicyRevisionSummaryDto"
          },
          "publishedRevision": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingPricingPolicyRevisionResponseDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "revisionSummary",
          "publishedRevision"
        ]
      },
      "BookingPricingPolicyListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyListRowDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingPricingPolicyDto": {
        "type": "object",
        "properties": {
          "durationBands": {
            "minItems": 1,
            "maxItems": 24,
            "description": "Ordered duration bands: strictly increasing upper bounds, non-decreasing factors, unique trimmed ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyBandDto"
            }
          },
          "minimumDurationMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 527040,
            "description": "Pre-grace minimum charged duration in minutes. Must not exceed the largest band upper bound."
          },
          "graceMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 1440,
            "description": "Grace allowance in minutes subtracted after the minimum is applied. Must stay below the largest band upper bound."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 20000
          }
        },
        "required": [
          "durationBands",
          "minimumDurationMinutes",
          "graceMinutes",
          "name"
        ]
      },
      "BookingPricingPolicyResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "BookingPricingPolicyWithRevisionResponseDto": {
        "type": "object",
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/BookingPricingPolicyResponseDto"
          },
          "revision": {
            "$ref": "#/components/schemas/BookingPricingPolicyRevisionResponseDto"
          }
        },
        "required": [
          "policy",
          "revision"
        ]
      },
      "PreviewBookingPricingPolicyDto": {
        "type": "object",
        "properties": {
          "durationBands": {
            "minItems": 1,
            "maxItems": 24,
            "description": "Ordered duration bands: strictly increasing upper bounds, non-decreasing factors, unique trimmed ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyBandDto"
            }
          },
          "minimumDurationMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 527040,
            "description": "Pre-grace minimum charged duration in minutes. Must not exceed the largest band upper bound."
          },
          "graceMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 1440,
            "description": "Grace allowance in minutes subtracted after the minimum is applied. Must stay below the largest band upper bound."
          },
          "basePriceInCents": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Candidate BookingService base price in integer cents.",
            "example": 10001
          },
          "elapsedMinutesSamples": {
            "minItems": 1,
            "maxItems": 50,
            "description": "Elapsed reserved durations (integer minutes) to evaluate against the candidate revision.",
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "commercialQuantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000000,
            "default": 1,
            "description": "Commercial quantity multiplied into each line total."
          }
        },
        "required": [
          "durationBands",
          "minimumDurationMinutes",
          "graceMinutes",
          "basePriceInCents",
          "elapsedMinutesSamples"
        ]
      },
      "BookingPricingPolicyPreviewSampleDto": {
        "type": "object",
        "properties": {
          "elapsedMinutes": {
            "type": "number",
            "minimum": 1,
            "maximum": 527040
          },
          "effectiveMinutes": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 527040
          },
          "bandId": {
            "type": "string",
            "nullable": true
          },
          "factorBasisPoints": {
            "type": "number",
            "nullable": true,
            "minimum": 1,
            "maximum": 1000000
          },
          "derivedUnitPriceInCents": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 2147483647
          },
          "lineTotalInCents": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 2147483647
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "Machine reason code when this sample could not be priced (for example DURATION_OUTSIDE_POLICY); null when priced."
          },
          "field": {
            "type": "string",
            "nullable": true,
            "description": "Offending input field for a failed sample; null when priced."
          }
        },
        "required": [
          "elapsedMinutes",
          "effectiveMinutes",
          "bandId",
          "factorBasisPoints",
          "derivedUnitPriceInCents",
          "lineTotalInCents",
          "reason",
          "field"
        ]
      },
      "BookingPricingPolicyPreviewResponseDto": {
        "type": "object",
        "properties": {
          "basePriceInCents": {
            "type": "number",
            "minimum": 1,
            "maximum": 2147483647
          },
          "commercialQuantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000000
          },
          "samples": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyPreviewSampleDto"
            }
          }
        },
        "required": [
          "basePriceInCents",
          "commercialQuantity",
          "samples"
        ]
      },
      "BookingPricingPolicyRevisionListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyRevisionResponseDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CreateBookingPricingPolicyRevisionDto": {
        "type": "object",
        "properties": {
          "durationBands": {
            "minItems": 1,
            "maxItems": 24,
            "description": "Ordered duration bands: strictly increasing upper bounds, non-decreasing factors, unique trimmed ids.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingPricingPolicyBandDto"
            }
          },
          "minimumDurationMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 527040,
            "description": "Pre-grace minimum charged duration in minutes. Must not exceed the largest band upper bound."
          },
          "graceMinutes": {
            "type": "number",
            "minimum": 0,
            "maximum": 1440,
            "description": "Grace allowance in minutes subtracted after the minimum is applied. Must stay below the largest band upper bound."
          }
        },
        "required": [
          "durationBands",
          "minimumDurationMinutes",
          "graceMinutes"
        ]
      },
      "AttachBookingPricingPolicyDto": {
        "type": "object",
        "properties": {
          "policyId": {
            "type": "string",
            "format": "uuid",
            "description": "Pricing policy (owned by the active organization) to attach."
          }
        },
        "required": [
          "policyId"
        ]
      },
      "BookingCustomerCommerceDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ]
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Display-only agreement compatibility summary; never a booking or payment gate."
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer"
          },
          "amountPaidInCents": {
            "type": "integer"
          },
          "balanceDueInCents": {
            "type": "integer"
          }
        },
        "required": [
          "type",
          "displayNumber",
          "commercialStatus",
          "paymentStatus",
          "signatureStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "balanceDueInCents"
        ]
      },
      "BookingCustomerActionAvailabilityDto": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "CUSTOMER_ALLOWED",
              "REQUEST_ONLY",
              "MERCHANT_ONLY"
            ]
          },
          "available": {
            "type": "boolean",
            "description": "Whether this customer may submit the corresponding action/request now."
          },
          "cutoffAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Policy cutoff instant, or null when no cutoff applies."
          },
          "reason": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "MERCHANT_ONLY",
              "STATUS",
              "CUTOFF",
              "PENDING_REQUEST",
              "CONSUMED",
              "GROUP_ACTION_REQUIRED"
            ],
            "description": "Stable explanation for the current availability decision."
          }
        },
        "required": [
          "mode",
          "available",
          "cutoffAt",
          "reason"
        ]
      },
      "BookingCustomerActionsDto": {
        "type": "object",
        "properties": {
          "cancel": {
            "$ref": "#/components/schemas/BookingCustomerActionAvailabilityDto"
          },
          "reschedule": {
            "$ref": "#/components/schemas/BookingCustomerActionAvailabilityDto"
          }
        },
        "required": [
          "cancel",
          "reschedule"
        ]
      },
      "BookingCustomerChangeRequestDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "RESCHEDULE",
              "CANCEL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "DECLINED",
              "WITHDRAWN"
            ]
          },
          "requestedStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "requestedEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "reviewReason": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "type",
          "status",
          "requestedStartsAt",
          "requestedEndsAt",
          "reason",
          "reviewReason",
          "createdAt"
        ]
      },
      "BookingCustomerSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ],
            "nullable": true
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "approvalStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "APPROVED",
              "DECLINED"
            ]
          },
          "delivery": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
              }
            ]
          },
          "commerce": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingCustomerCommerceDto"
              }
            ]
          },
          "actions": {
            "$ref": "#/components/schemas/BookingCustomerActionsDto"
          },
          "changeRequest": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingCustomerChangeRequestDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "serviceName",
          "bookingType",
          "startsAt",
          "endsAt",
          "timezone",
          "quantity",
          "status",
          "approvalStatus",
          "delivery",
          "commerce",
          "actions",
          "changeRequest"
        ]
      },
      "CustomerBookingListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingCustomerSummaryDto"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "total": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "data",
          "page",
          "pageSize",
          "total"
        ]
      },
      "BookingCustomerRevisionDto": {
        "type": "object",
        "properties": {
          "revisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "SUPERSEDED",
              "ACCEPTED",
              "VOIDED",
              "EXPIRED"
            ]
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "revisionNumber",
          "status",
          "title",
          "sentAt",
          "acceptedAt",
          "expiresAt"
        ]
      },
      "BookingCustomerDocumentDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "QUOTE",
              "INVOICE",
              "ORDER"
            ]
          },
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "commercialStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "ACCEPTED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "VOIDED",
              "CONVERTED"
            ]
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "UNPAID",
              "PARTIALLY_PAID",
              "PAID",
              "PARTIALLY_REFUNDED",
              "REFUNDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "signatureStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ],
            "deprecated": true,
            "description": "Display-only agreement compatibility summary; never a booking or payment gate."
          },
          "currency": {
            "type": "string"
          },
          "totalInCents": {
            "type": "integer"
          },
          "amountPaidInCents": {
            "type": "integer"
          },
          "balanceDueInCents": {
            "type": "integer"
          },
          "revision": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingCustomerRevisionDto"
              }
            ]
          }
        },
        "required": [
          "type",
          "displayNumber",
          "commercialStatus",
          "paymentStatus",
          "signatureStatus",
          "currency",
          "totalInCents",
          "amountPaidInCents",
          "balanceDueInCents",
          "revision"
        ]
      },
      "BookingCustomerSignatureDto": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "MERCHANT",
              "INTERNAL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "signerName": {
            "type": "string",
            "nullable": true
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "role",
          "status",
          "signerName",
          "signedAt"
        ]
      },
      "BookingCustomerContractDto": {
        "type": "object",
        "properties": {
          "displayNumber": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "SENT",
              "SIGNED",
              "DECLINED",
              "EXPIRED",
              "VOIDED"
            ]
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingCustomerSignatureDto"
            }
          }
        },
        "required": [
          "displayNumber",
          "title",
          "status",
          "sentAt",
          "signedAt",
          "expiresAt",
          "signatures"
        ]
      },
      "BookingCustomerDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "bookingType": {
            "type": "string",
            "enum": [
              "APPOINTMENT",
              "RESOURCE_RENTAL",
              "EVENT",
              "CLASS"
            ],
            "nullable": true
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "CONFIRMED",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED",
              "DRAFT",
              "REQUESTED",
              "PENDING_PAYMENT",
              "DECLINED",
              "EXPIRED"
            ]
          },
          "approvalStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "APPROVED",
              "DECLINED"
            ]
          },
          "delivery": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingDeliverySelectionResponseDto"
              }
            ]
          },
          "commerce": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingCustomerCommerceDto"
              }
            ]
          },
          "actions": {
            "$ref": "#/components/schemas/BookingCustomerActionsDto"
          },
          "changeRequest": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingCustomerChangeRequestDto"
              }
            ]
          },
          "pricingDetails": {
            "nullable": true,
            "description": "Read-only pricing evidence from the persisted current Commerce revision. Historical detail never resolves a live policy or recomputes a price.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PublicBookingPricingPresentationDto"
              }
            ]
          },
          "quote": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/BookingCustomerDocumentDto"
              }
            ]
          },
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingCustomerDocumentDto"
            }
          },
          "contracts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BookingCustomerContractDto"
            }
          },
          "agreements": {
            "description": "Canonical native/external agreement history. Legacy contract packets remain projected separately.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerAgreementHistoryResponseDto"
              }
            ]
          }
        },
        "required": [
          "id",
          "serviceName",
          "bookingType",
          "startsAt",
          "endsAt",
          "timezone",
          "quantity",
          "status",
          "approvalStatus",
          "delivery",
          "commerce",
          "actions",
          "changeRequest",
          "pricingDetails",
          "quote",
          "invoices",
          "contracts",
          "agreements"
        ]
      },
      "CustomerBookingReasonDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          }
        },
        "required": [
          "reason"
        ]
      },
      "BookingChangeRequestResultDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "RESCHEDULE",
              "CANCEL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "DECLINED",
              "WITHDRAWN"
            ]
          },
          "requestedAt": {
            "type": "string",
            "format": "date-time"
          },
          "requiresMerchantReview": {
            "type": "boolean",
            "description": "Launch customer action endpoints submit a policy-checked request for merchant review."
          }
        },
        "required": [
          "type",
          "status",
          "requestedAt",
          "requiresMerchantReview"
        ]
      },
      "BookingChangeRequestResponseDto": {
        "type": "object",
        "properties": {
          "booking": {
            "$ref": "#/components/schemas/BookingCustomerDetailDto"
          },
          "request": {
            "$ref": "#/components/schemas/BookingChangeRequestResultDto"
          }
        },
        "required": [
          "booking",
          "request"
        ]
      },
      "CustomerBookingRescheduleRequestDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "reason",
          "startsAt",
          "endsAt"
        ]
      },
      "BookingGroupRecoveryProofDto": {
        "type": "object",
        "properties": {
          "proofGeneration": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]{0,18})$",
            "description": "Non-authorizing durable proof generation. Hosted cookie names use this generation after the additive handoff migration; its hash must still be API-current. If absent (the additive column is unavailable or unreadable), use the legacy unversioned cookie; absence grants no authority."
          },
          "publicRef": {
            "type": "string",
            "pattern": "^b[a-z0-9]{25}$",
            "description": "Non-authorizing group correlation reference."
          },
          "resumeToken": {
            "type": "string",
            "pattern": "^g[a-z0-9]{25}$",
            "description": "Fresh response-only scoped resume proof. The server persists only its SHA-256 digest."
          },
          "resumeExpiresAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "publicRef",
          "resumeToken",
          "resumeExpiresAt"
        ]
      },
      "CustomerBookingGroupMemberDto": {
        "type": "object",
        "properties": {
          "ordinal": {
            "type": "integer",
            "minimum": 0
          },
          "callerReference": {
            "type": "string"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "serviceName": {
            "type": "string",
            "nullable": true
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "AGREEMENT_REQUIRED",
              "PENDING_REQUEST",
              "REQUESTED",
              "HELD",
              "PENDING_PAYMENT",
              "CONFIRMED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "FAILED"
            ]
          }
        },
        "required": [
          "ordinal",
          "callerReference",
          "serviceId",
          "serviceName",
          "startsAt",
          "endsAt",
          "quantity",
          "status"
        ]
      },
      "CustomerBookingGroupDto": {
        "type": "object",
        "properties": {
          "publicRef": {
            "type": "string",
            "pattern": "^b[a-z0-9]{25}$",
            "description": "Non-authorizing group correlation reference."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "AWAITING_APPROVAL",
              "HELD",
              "AWAITING_PAYMENT",
              "CONFIRMING",
              "RECONCILIATION_REQUIRED",
              "CONFIRMED",
              "DECLINED",
              "EXPIRED",
              "CANCELLED",
              "FAILED"
            ]
          },
          "settlementPosture": {
            "type": "string",
            "enum": [
              "PAY_NOW",
              "APPROVE_THEN_PAY",
              "APPROVE_PAY_LATER"
            ]
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "expiresAt": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerBookingGroupMemberDto"
            }
          }
        },
        "required": [
          "publicRef",
          "status",
          "settlementPosture",
          "currency",
          "expiresAt",
          "createdAt",
          "members"
        ]
      },
      "CustomerBookingGroupListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerBookingGroupDto"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "total": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "data",
          "page",
          "pageSize",
          "total"
        ]
      },
      "ExchangeBookingGroupActionDto": {
        "type": "object",
        "properties": {
          "actionToken": {
            "type": "string",
            "pattern": "^a[a-z0-9]{25}$",
            "description": "Purpose-scoped booking-group recovery action token. It is transported in the request body, never in the URL."
          }
        },
        "required": [
          "actionToken"
        ],
        "additionalProperties": false
      },
      "MerchantScheduledPlanChangeDto": {
        "type": "object",
        "properties": {
          "scheduledChangeRef": {
            "type": "string",
            "description": "Opaque, non-capability identity for this exact scheduled future-intent version. Submit it only in a scheduled-cancel JSON body.",
            "example": "sc_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            "pattern": "^sc_[a-f0-9]{64}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "CADENCE_CHANGE",
              "CANCELLATION"
            ]
          },
          "targetPlan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ]
          },
          "targetCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "nullable": true
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "scheduledChangeRef",
          "kind",
          "targetPlan",
          "targetCadence",
          "effectiveAt"
        ]
      },
      "MerchantPlatformBillingOperationDto": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "description": "Stable merchant-visible operation identity."
          },
          "kind": {
            "type": "string",
            "enum": [
              "CADENCE_CHANGE",
              "PLAN_CHANGE_PREPARATION",
              "CANCEL",
              "REACTIVATE",
              "CANCEL_SCHEDULED_CHANGE"
            ],
            "description": "`PLAN_CHANGE_PREPARATION` is a neutral merchant-safe projection of internal preparation that temporarily blocks another plan change; it does not identify the provider mechanism."
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "AWAITING_PROVIDER_PAYMENT",
              "SUCCEEDED",
              "FAILED",
              "RECONCILIATION_REQUIRED"
            ]
          },
          "targetPlan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ],
            "nullable": true,
            "description": "Requested destination plan, or null for neutral plan-change preparation."
          },
          "targetCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "nullable": true,
            "description": "Requested destination cadence, or null for neutral plan-change preparation."
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "requestedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "operationId",
          "kind",
          "status",
          "targetPlan",
          "targetCadence",
          "effectiveAt",
          "requestedAt",
          "completedAt"
        ]
      },
      "MerchantPlatformBillingTransitionDto": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "CHANGE_CADENCE",
              "CANCEL",
              "REACTIVATE",
              "CANCEL_SCHEDULED_CHANGE"
            ]
          },
          "targetPlan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ],
            "nullable": true
          },
          "targetCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "nullable": true
          },
          "timing": {
            "type": "string",
            "enum": [
              "IMMEDIATE",
              "PERIOD_END"
            ]
          },
          "requiresPreview": {
            "type": "boolean",
            "description": "Whether the action must first obtain a short-lived provider-authored preview and confirmation token."
          }
        },
        "required": [
          "action",
          "targetPlan",
          "targetCadence",
          "timing",
          "requiresPreview"
        ]
      },
      "BillingStateDto": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ],
            "description": "The org's current platform plan."
          },
          "status": {
            "type": "string",
            "enum": [
              "NONE",
              "INCOMPLETE",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "CANCELLED"
            ],
            "description": "Platform billing subscription status. `NONE` when the org has never started a platform subscription."
          },
          "hasSubscription": {
            "type": "boolean",
            "description": "Whether a platform Stripe subscription is linked to this org."
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "Whether the subscription is set to cancel at the end of the current period (access retained until then)."
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "End of the current billing period (ISO 8601), or null when there is no active subscription."
          },
          "currentCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "nullable": true,
            "description": "Cadence of the provider-confirmed current Pro price, or null when the organization has no proved current paid cadence."
          },
          "scheduledChange": {
            "nullable": true,
            "description": "Current provider-confirmed period-end cadence change, or null when no paid transition is scheduled. This is future intent, not entitlement.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantScheduledPlanChangeDto"
              }
            ]
          },
          "latestOperation": {
            "nullable": true,
            "description": "Latest merchant-safe operation projection. Provider correlation ids, staff identities, case notes, and recovery controls are never exposed. A live internal billing-mode migration appears only as neutral plan-change preparation; terminal internal migrations remain hidden.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPlatformBillingOperationDto"
              }
            ]
          },
          "availableTransitions": {
            "description": "Actions admitted by the current merchant-safe projection. Confirmation still performs a fresh, fail-closed provider and address check.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantPlatformBillingTransitionDto"
            }
          },
          "addressReady": {
            "type": "boolean",
            "description": "Whether the current billing-address version is confirmed at the provider and can be used for a confirmable quote."
          }
        },
        "required": [
          "plan",
          "status",
          "hasSubscription",
          "cancelAtPeriodEnd",
          "currentPeriodEnd",
          "currentCadence",
          "scheduledChange",
          "latestOperation",
          "availableTransitions",
          "addressReady"
        ]
      },
      "MerchantPlanChangePreviewRequestDto": {
        "type": "object",
        "properties": {
          "targetCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "example": "yearly",
            "description": "Requested published Pro cadence. The active organization, current subscription, source price, and target price are all resolved server-side; provider identifiers are never accepted from the client."
          }
        },
        "required": [
          "targetCadence"
        ]
      },
      "MerchantPlanChangeTaxDto": {
        "type": "object",
        "properties": {
          "amountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "taxBehavior": {
            "type": "string"
          },
          "taxabilityReason": {
            "type": "string",
            "nullable": true
          },
          "taxableAmountInCents": {
            "type": "integer",
            "format": "int32"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "amountInCents",
          "taxBehavior",
          "taxabilityReason",
          "taxableAmountInCents",
          "type"
        ]
      },
      "MerchantPlanChangeAutomaticTaxDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether Stripe Tax authored this preview."
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "status"
        ]
      },
      "MerchantPlanChangeMoneyDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "subtotalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "totalInCents": {
            "type": "integer",
            "format": "int32"
          },
          "amountDueInCents": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "totalTaxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantPlanChangeTaxDto"
            }
          },
          "automaticTax": {
            "$ref": "#/components/schemas/MerchantPlanChangeAutomaticTaxDto"
          }
        },
        "required": [
          "currency",
          "subtotalInCents",
          "totalInCents",
          "amountDueInCents",
          "totalTaxes",
          "automaticTax"
        ]
      },
      "MerchantPlanChangePreviewDto": {
        "type": "object",
        "properties": {
          "currentPlan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ]
          },
          "currentCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "targetPlan": {
            "type": "string",
            "enum": [
              "FREE_TRIAL",
              "PRO",
              "ENTERPRISE"
            ]
          },
          "targetCadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "IMMEDIATE_MONTHLY_TO_YEARLY",
              "PERIOD_END_YEARLY_TO_MONTHLY"
            ]
          },
          "timing": {
            "type": "string",
            "enum": [
              "IMMEDIATE",
              "PERIOD_END"
            ]
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Provider-fixed instant used for an immediate proration, or null for a period-end transition."
          },
          "renewalAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Existing subscription renewal boundary for a period-end transition, or null for an immediate transition."
          },
          "entitlementTiming": {
            "type": "string",
            "enum": [
              "AFTER_PROVIDER_PAYMENT",
              "AT_PERIOD_END"
            ]
          },
          "automaticRefund": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Whether this ordinary self-serve transition automatically refunds unused time. The supported transition policy is false."
          },
          "money": {
            "nullable": true,
            "description": "Stripe-authored immediate invoice and tax preview. Null for a period-end transition because no immediate invoice is created.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPlanChangeMoneyDto"
              }
            ]
          },
          "quotedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "confirmationToken": {
            "type": "string",
            "pattern": "^q[a-z0-9]{25}$",
            "description": "Short-lived opaque confirmation token. It binds the exact fresh provider preview, subscription generation, scheduled intent, billing address version, authenticated Owner or Admin, and expiry without exposing those internal facts. The same authenticated user must confirm."
          }
        },
        "required": [
          "currentPlan",
          "currentCadence",
          "targetPlan",
          "targetCadence",
          "direction",
          "timing",
          "effectiveAt",
          "renewalAt",
          "entitlementTiming",
          "automaticRefund",
          "money",
          "quotedAt",
          "expiresAt",
          "confirmationToken"
        ]
      },
      "MerchantPlanChangeConfirmRequestDto": {
        "type": "object",
        "properties": {
          "confirmationToken": {
            "type": "string",
            "description": "Short-lived, opaque confirmation token returned by preview. Send it only in this JSON body; never place it in a URL or log. The same authenticated Owner or Admin who requested the preview must confirm it; another user receives the neutral `REQUOTE_REQUIRED` response.",
            "example": "qaaaaaaaaaaaaaaaaaaaaaaaaa",
            "pattern": "^q[a-z0-9]{25}$"
          }
        },
        "required": [
          "confirmationToken"
        ]
      },
      "MerchantScheduledPlanChangeCancelRequestDto": {
        "type": "object",
        "properties": {
          "scheduledChangeRef": {
            "type": "string",
            "description": "Opaque, non-capability reference from the exact scheduled change shown by the latest billing-state response. It identifies one internal future-intent version without exposing provider or mutation coordinates.",
            "example": "sc_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            "pattern": "^sc_[a-f0-9]{64}$"
          },
          "cancellationRequestId": {
            "type": "string",
            "description": "Caller-generated canonical UUID-v4 for this cancellation intent. Reuse the same value only when recovering the same request; a new merchant action must use a new value.",
            "example": "7b7be394-fb9b-4d58-a444-147e15131900",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
          }
        },
        "required": [
          "scheduledChangeRef",
          "cancellationRequestId"
        ]
      },
      "MerchantBillingAddressDto": {
        "type": "object",
        "properties": {
          "address": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "The stored address as-is, unvalidated. `{}` when the org has never set one, and possibly a legacy shape otherwise — read `usable`/`reason` rather than assuming the fields of a complete address are present.",
            "example": {
              "line1": "1120 S Rackham Way",
              "city": "Meridian",
              "state": "ID",
              "zip": "83642",
              "country": "US"
            }
          },
          "usable": {
            "type": "boolean",
            "description": "True when this address is complete and in a supported jurisdiction, i.e. a subscribe would not be refused for tax reasons."
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "BILLING_ADDRESS_REQUIRED",
              "BILLING_ADDRESS_INVALID",
              "COUNTRY_NOT_SUPPORTED"
            ],
            "description": "Why the address is unusable, or `null` when it is usable."
          },
          "supportedCountries": {
            "description": "ISO 3166-1 alpha-2 codes this platform can currently bill. Operator-maintained.",
            "example": [
              "US"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "address",
          "usable",
          "reason",
          "supportedCountries"
        ]
      },
      "UpdateMerchantBillingAddressDto": {
        "type": "object",
        "properties": {
          "address": {
            "$ref": "#/components/schemas/OrganizationAddressDto"
          }
        },
        "required": [
          "address"
        ]
      },
      "SubscribeRequestDto": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "pro"
            ],
            "example": "pro",
            "description": "The self-serve plan to subscribe to. Only `pro` is accepted — Free needs no subscription and Enterprise is handled by sales."
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "example": "monthly",
            "description": "Billing cadence for the subscription."
          },
          "quoteId": {
            "type": "string",
            "description": "Opaque price-version quote from `/public/plan-pricing`. The subscribe mutation revalidates it against the fresh sellable CURRENT row.",
            "example": "ppq_v1_0123456789abcdef0123456789abcdef0123456789a",
            "pattern": "^ppq_v1_[A-Za-z0-9_-]{43}$"
          },
          "currency": {
            "type": "string",
            "description": "Displayed ISO 4217 currency. Must exactly match the quoted CURRENT row.",
            "example": "usd",
            "pattern": "^[a-z]{3}$"
          },
          "unitAmount": {
            "type": "integer",
            "format": "int32",
            "description": "Displayed price in minor currency units. Must exactly match the quoted CURRENT row.",
            "example": 9900,
            "minimum": 1
          }
        },
        "required": [
          "plan",
          "cadence",
          "quoteId",
          "currency",
          "unitAmount"
        ]
      },
      "SelectedPlatformPriceDto": {
        "type": "object",
        "properties": {
          "quoteId": {
            "type": "string",
            "description": "Opaque identity of the selected price version."
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "unitAmount": {
            "type": "integer",
            "format": "int32",
            "example": 9900
          }
        },
        "required": [
          "quoteId",
          "cadence",
          "currency",
          "unitAmount"
        ]
      },
      "PlatformPaymentTermsDto": {
        "type": "object",
        "properties": {
          "amountDue": {
            "type": "integer",
            "format": "int32",
            "description": "Exact amount currently due on the invoice in minor currency units.",
            "example": 9900
          },
          "currency": {
            "type": "string",
            "description": "Invoice currency.",
            "example": "usd"
          },
          "quoteId": {
            "type": "string",
            "nullable": true,
            "description": "Opaque identity of the subscription price when it maps to a known platform price version."
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "nullable": true
          },
          "unitAmount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "amountDue",
          "currency",
          "quoteId",
          "cadence",
          "unitAmount"
        ]
      },
      "SubscribeResponseDto": {
        "type": "object",
        "properties": {
          "flow": {
            "type": "string",
            "enum": [
              "new_subscription",
              "resume_payment"
            ],
            "description": "The explicit contract used. Recovery never adopts a newly selected cadence or public offer."
          },
          "status": {
            "type": "string",
            "enum": [
              "NONE",
              "INCOMPLETE",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "CANCELLED"
            ],
            "description": "Platform billing status after the call. Typically `INCOMPLETE` until the first payment is confirmed (then the webhook advances it)."
          },
          "stripeSubscriptionId": {
            "type": "string",
            "description": "The platform Stripe subscription id."
          },
          "clientSecret": {
            "type": "string",
            "nullable": true,
            "description": "Stripe client secret for the first invoice — render the Payment Element against this. Null when there is nothing to confirm (a subscription was already active, or a $0 trial with no payment due). Forwarded to the browser only; never stored."
          },
          "publishableKey": {
            "type": "string",
            "nullable": true,
            "description": "Browser-safe platform Stripe publishable key to initialize Stripe.js with (platform account — no `stripeAccount`). Null when there is no client secret to confirm. This is not a secret.",
            "example": "pk_test_123"
          },
          "alreadyActive": {
            "type": "boolean",
            "description": "True when an active/trialing subscription already existed and was reused (no new subscription created, no payment needed)."
          },
          "selectedPrice": {
            "nullable": true,
            "description": "Freshly validated CURRENT quote for a new sale. Null for recovery and for an already-active idempotent response.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/SelectedPlatformPriceDto"
              }
            ]
          },
          "paymentTerms": {
            "nullable": true,
            "description": "Authoritative current invoice terms shown before Payment Element is mounted. Null when there is no payment to confirm.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/PlatformPaymentTermsDto"
              }
            ]
          }
        },
        "required": [
          "flow",
          "status",
          "stripeSubscriptionId",
          "clientSecret",
          "publishableKey",
          "alreadyActive",
          "selectedPrice",
          "paymentTerms"
        ]
      },
      "BillingCancellationDto": {
        "type": "object",
        "properties": {
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "Whether the subscription is now scheduled to end at the current period's end. True after cancel, false after resume."
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "End of the current billing period (ISO 8601) — the date access ends when `cancelAtPeriodEnd` is true. Null when Stripe reported no period end."
          },
          "status": {
            "type": "string",
            "enum": [
              "NONE",
              "INCOMPLETE",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "CANCELLED"
            ],
            "description": "Platform billing status. Scheduling a cancellation does NOT change this — the subscription remains ACTIVE until the period boundary."
          },
          "unchanged": {
            "type": "boolean",
            "description": "MIRROR-DELTA: true when the state Stripe reported back matches what the local mirror held when the request started — i.e. nothing differs from the state you last read. It is NOT a provider-delta: establishing that would require retrieving the subscription before every update, doubling the Stripe calls on a money path for a cosmetic flag. Concretely: if the MIRROR already held the value you asked for while Stripe differed, this reads `true` even though the provider row did change. It can never mean \"we silently failed to apply your change\" — Stripe is always called, and a failure surfaces as 4xx/503 instead."
          }
        },
        "required": [
          "cancelAtPeriodEnd",
          "currentPeriodEnd",
          "status",
          "unchanged"
        ]
      },
      "StartPaymentMethodUpdateDto": {
        "type": "object",
        "properties": {
          "setupIntentId": {
            "type": "string",
            "description": "SetupIntent id to pass back to the confirm route once the Payment Element reports success."
          },
          "clientSecret": {
            "type": "string",
            "nullable": true,
            "description": "Payment Element client secret for confirming the new card. A bearer credential for this SetupIntent — do not log it or place it in a shared cache."
          },
          "publishableKey": {
            "type": "string",
            "nullable": true,
            "description": "The PLATFORM account's publishable key. The Payment Element renders WITHOUT a `stripeAccount`, because this card pays cartonium rather than the tenant's own connected account."
          }
        },
        "required": [
          "setupIntentId",
          "clientSecret",
          "publishableKey"
        ]
      },
      "ConfirmPaymentMethodUpdateRequestDto": {
        "type": "object",
        "properties": {
          "setupIntentId": {
            "type": "string",
            "description": "The SetupIntent id returned when the update was started. The server retrieves it from Stripe and refuses unless it succeeded AND belongs to this organization's own billing customer — the id alone proves nothing."
          }
        },
        "required": [
          "setupIntentId"
        ]
      },
      "ConfirmPaymentMethodUpdateDto": {
        "type": "object",
        "properties": {
          "paymentMethodId": {
            "type": "string",
            "description": "The payment method now set as the subscription default. Renewals bill this card from here on."
          }
        },
        "required": [
          "paymentMethodId"
        ]
      },
      "BillingInvoiceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stripe invoice id (`in_…`)."
          },
          "status": {
            "type": "string",
            "nullable": true,
            "description": "Stripe invoice status — `draft`, `open`, `paid`, `uncollectible`, or `void`."
          },
          "amountDueInCents": {
            "type": "number",
            "nullable": true,
            "description": "Amount due in minor units."
          },
          "amountPaidInCents": {
            "type": "number",
            "nullable": true,
            "description": "Amount actually paid in minor units."
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "description": "ISO 4217 code."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Invoice creation time (ISO 8601)."
          },
          "periodStart": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Start of the period this invoice covers (ISO 8601)."
          },
          "periodEnd": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "End of the period this invoice covers (ISO 8601)."
          },
          "hostedInvoiceUrl": {
            "type": "string",
            "nullable": true,
            "description": "Stripe-hosted invoice page. A SIGNED, UNAUTHENTICATED URL — treat it as a credential: do not log it, embed it in a shared cache, or expose it to anyone but this merchant. Null for a draft invoice."
          },
          "invoicePdfUrl": {
            "type": "string",
            "nullable": true,
            "description": "Stripe-hosted PDF receipt. Same signed-URL handling as `hostedInvoiceUrl`. Null for a draft invoice."
          }
        },
        "required": [
          "id",
          "status",
          "amountDueInCents",
          "amountPaidInCents",
          "currency",
          "createdAt",
          "periodStart",
          "periodEnd",
          "hostedInvoiceUrl",
          "invoicePdfUrl"
        ]
      },
      "BillingInvoiceListDto": {
        "type": "object",
        "properties": {
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingInvoiceDto"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether more invoices exist after this page."
          },
          "nextStartingAfter": {
            "type": "string",
            "nullable": true,
            "description": "Pass as `startingAfter` to fetch the next page. Null when the history is complete or Stripe returned no safe cursor."
          }
        },
        "required": [
          "invoices",
          "hasMore",
          "nextStartingAfter"
        ]
      },
      "MerchantPurchasePriceSelectionDto": {
        "type": "object",
        "properties": {
          "quoteId": {
            "type": "string",
            "pattern": "^(ppq|pcq)_v1_[A-Za-z0-9_-]{43}$",
            "description": "Opaque selection from public plan pricing or the exact Custom offer. The server verifies the corresponding commercial source."
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ],
            "description": "Displayed currency, which must match the selected price."
          },
          "unitAmount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Displayed price in cents, which must match the selected price."
          }
        },
        "required": [
          "quoteId",
          "currency",
          "unitAmount"
        ]
      },
      "MerchantPurchaseBeginDto": {
        "type": "object",
        "properties": {
          "purchaseOperationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable client-generated purchase key. Keep all three operation keys for exact recovery after a lost response."
          },
          "preparationOperationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable client-generated preparation key for this begin request."
          },
          "quoteOperationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable client-generated tax quote key for this begin request."
          },
          "plan": {
            "type": "string",
            "enum": [
              "pro",
              "enterprise"
            ],
            "description": "Pro uses its public price. enterprise requires customOfferId identifying an exact accepted Custom offer."
          },
          "customOfferId": {
            "type": "string",
            "format": "uuid",
            "description": "Exact accepted Custom offer for ENTERPRISE. Omit for Pro. An offer or browser return alone never grants paid access."
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "selection": {
            "$ref": "#/components/schemas/MerchantPurchasePriceSelectionDto"
          }
        },
        "required": [
          "purchaseOperationKey",
          "preparationOperationKey",
          "quoteOperationKey",
          "plan",
          "cadence",
          "selection"
        ]
      },
      "MerchantPurchaseRefDto": {
        "type": "object",
        "properties": {
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Local purchase reference returned by begin or exact recover-begin."
          },
          "quoteId": {
            "type": "string",
            "format": "uuid",
            "description": "Local tax quote reference returned with this purchase."
          },
          "purchaseGeneration": {
            "type": "integer",
            "description": "Exact generation required by subsequent routes."
          },
          "attemptGeneration": {
            "type": "integer",
            "description": "Exact quote attempt generation required by subsequent routes."
          }
        },
        "required": [
          "purchaseId",
          "quoteId",
          "purchaseGeneration",
          "attemptGeneration"
        ]
      },
      "MerchantPurchaseQuoteDto": {
        "type": "object",
        "properties": {
          "ref": {
            "$ref": "#/components/schemas/MerchantPurchaseRefDto"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "PENDING",
              "HANDED_OFF",
              "NOT_STARTED",
              "UNRESOLVED",
              "CALCULATED",
              "EXPIRED"
            ]
          },
          "fingerprint": {
            "type": "string",
            "description": "Exact fingerprint required when accepting consent."
          },
          "retiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Retirement time, or null when not retired. Null alone does not establish current eligibility."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Original tax quote expiry, or null until a verified calculation exists. Recovery never extends this expiry."
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "subtotal": {
            "type": "integer",
            "description": "Frozen plan subtotal in cents."
          },
          "tax": {
            "type": "integer",
            "nullable": true,
            "description": "Verified tax in cents, or null before a valid tax calculation is retained."
          },
          "total": {
            "type": "integer",
            "nullable": true,
            "description": "Verified total in cents, or null before a valid tax calculation is retained. Never infer zero from null."
          }
        },
        "required": [
          "ref",
          "outcome",
          "fingerprint",
          "retiredAt",
          "expiresAt",
          "currency",
          "cadence",
          "subtotal",
          "tax",
          "total"
        ]
      },
      "MerchantPurchaseOperationRefDto": {
        "type": "object",
        "properties": {
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Local purchase reference returned by begin or exact recover-begin."
          },
          "quoteId": {
            "type": "string",
            "format": "uuid",
            "description": "Local tax quote reference returned with this purchase."
          },
          "purchaseGeneration": {
            "type": "integer",
            "description": "Exact generation required by subsequent routes."
          },
          "attemptGeneration": {
            "type": "integer",
            "description": "Exact quote attempt generation required by subsequent routes."
          },
          "operationId": {
            "type": "string",
            "format": "uuid",
            "description": "Local operation identifier for correlation only; stage recovery uses the enclosing purchase/quote reference."
          }
        },
        "required": [
          "purchaseId",
          "quoteId",
          "purchaseGeneration",
          "attemptGeneration",
          "operationId"
        ]
      },
      "MerchantPurchaseOperationDto": {
        "type": "object",
        "properties": {
          "ref": {
            "$ref": "#/components/schemas/MerchantPurchaseOperationRefDto"
          },
          "stage": {
            "type": "string",
            "enum": [
              "SETUP",
              "PAYMENT_ATTENDED"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "PENDING",
              "HANDED_OFF",
              "NOT_STARTED",
              "UNRESOLVED",
              "OBSERVED"
            ]
          },
          "state": {
            "type": "string",
            "nullable": true,
            "description": "Retained provider outcome, or null when no verified observation exists. Payment success alone does not establish plan activation."
          },
          "retiredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Retirement time, or null when not retired. Historical outcomes remain readable after retirement."
          }
        },
        "required": [
          "ref",
          "stage",
          "outcome",
          "state",
          "retiredAt"
        ]
      },
      "MerchantPurchaseActivationPeriodDto": {
        "type": "object",
        "properties": {
          "periodNumber": {
            "type": "integer",
            "description": "Zero-based original-calendar period number; 0 is the first full cycle from verified activation."
          },
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "description": "The one local activation instant; the first period starts here (ISO 8601)."
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "description": "First original anniversary from the activation anchor (ISO 8601), exclusive."
          }
        },
        "required": [
          "periodNumber",
          "startsAt",
          "endsAt"
        ]
      },
      "MerchantPurchaseActivationDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "RESERVED",
              "ABANDONED",
              "ACTIVATED",
              "ACTIVATION_HELD"
            ],
            "description": "ACTIVATED only after the one local activation transaction committed. ACTIVATION_HELD retains a succeeded payment that a protected change kept from activating; it grants nothing and awaits reconciliation."
          },
          "activatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The local activation instant, or null until activated. Provider success time is a separate fact and is not published here."
          },
          "period": {
            "nullable": true,
            "description": "The first original-calendar period fixed at activation, or null.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseActivationPeriodDto"
              }
            ]
          },
          "nextDueAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Stored next-due projection of the recurring agreement (the first anniversary), or null until activated."
          },
          "holdCode": {
            "type": "string",
            "nullable": true,
            "description": "Why activation is held, or null."
          }
        },
        "required": [
          "status",
          "activatedAt",
          "period",
          "nextDueAt",
          "holdCode"
        ]
      },
      "MerchantPurchaseStatusDto": {
        "type": "object",
        "properties": {
          "quote": {
            "$ref": "#/components/schemas/MerchantPurchaseQuoteDto"
          },
          "setup": {
            "nullable": true,
            "description": "Retained setup operation, or null if no setup was reserved for this exact quote. Local status never contains a client secret.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseOperationDto"
              }
            ]
          },
          "payment": {
            "nullable": true,
            "description": "Retained initial-payment operation, or null if no payment was reserved for this exact quote. Null does not authorize starting a replacement payment.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseOperationDto"
              }
            ]
          },
          "activation": {
            "nullable": true,
            "description": "The purchase’s activation state, or null when no activation projection is available. Payment success alone never implies activation.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseActivationDto"
              }
            ]
          }
        },
        "required": [
          "quote",
          "setup",
          "payment",
          "activation"
        ]
      },
      "MerchantPurchaseClientHandoffDto": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "SETUP",
              "PAYMENT_ATTENDED"
            ]
          },
          "clientSecret": {
            "type": "string",
            "description": "Transient credential for this exact operation. Use only in the matching Stripe confirmation; never log, persist or cache it."
          },
          "publishableKey": {
            "type": "string",
            "description": "Publishable key corroborated with the admitted platform account and mode for this handoff."
          }
        },
        "required": [
          "stage",
          "clientSecret",
          "publishableKey"
        ]
      },
      "MerchantPurchaseResultDto": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/MerchantPurchaseStatusDto"
          },
          "handoff": {
            "description": "Present only when the exact current operation requires browser confirmation and its credential was just corroborated. Omission means no browser handoff is available; read status/review or recover the retained stage.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseClientHandoffDto"
              }
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "MerchantPurchaseOperationKeysDto": {
        "type": "object",
        "properties": {
          "purchaseOperationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable client-generated purchase key. Keep all three operation keys for exact recovery after a lost response."
          },
          "preparationOperationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable client-generated preparation key for this begin request."
          },
          "quoteOperationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable client-generated tax quote key for this begin request."
          }
        },
        "required": [
          "purchaseOperationKey",
          "preparationOperationKey",
          "quoteOperationKey"
        ]
      },
      "MerchantPurchaseReservationDto": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "PRO",
              "ENTERPRISE"
            ],
            "description": "Plan of the retained reservation."
          },
          "customOfferId": {
            "type": "string",
            "format": "uuid",
            "description": "Exact Custom source to retain when resuming begin. Omitted for Pro."
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid",
            "description": "Local purchase reference of the one live reservation."
          },
          "purchaseGeneration": {
            "type": "integer",
            "description": "Exact retained purchase generation."
          },
          "status": {
            "type": "string",
            "enum": [
              "RESERVED",
              "ACTIVATED",
              "ACTIVATION_HELD"
            ],
            "description": "Lifecycle state of the current purchase. RESERVED continues through begin; ACTIVATED is the active agreement; ACTIVATION_HELD retains a succeeded payment awaiting reconciliation."
          },
          "activatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The local activation instant, or null until activated."
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "description": "Cadence frozen when the purchase was reserved."
          },
          "selection": {
            "description": "Exact price selection frozen when the purchase was reserved; replaying begin must send it unchanged.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchasePriceSelectionDto"
              }
            ]
          }
        },
        "required": [
          "plan",
          "purchaseId",
          "purchaseGeneration",
          "status",
          "activatedAt",
          "cadence",
          "selection"
        ]
      },
      "MerchantPurchaseCurrentDto": {
        "type": "object",
        "properties": {
          "current": {
            "nullable": true,
            "description": "The latest retained quote status of the live reservation, or null when the reservation has no retained quote yet or no purchase is reserved. Null does not mean a purchase can be started; reservation, availability and begin decide that.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseStatusDto"
              }
            ]
          },
          "reservation": {
            "nullable": true,
            "description": "The organization’s one live reservation, present even before its first retained quote exists (for example after a begin whose preparation or quote did not complete). Null means no live reservation. Replaying begin with the original purchase and preparation keys continues it; recover-begin needs all three original keys.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseReservationDto"
              }
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "CONTEXT_UNAVAILABLE",
              "CONTEXT_MISMATCH"
            ],
            "description": "Whether the admitted provider context is usable for a new purchase or provider action. AVAILABLE does not prove provider acceptance; retained status and recovery never require it."
          }
        },
        "required": [
          "current",
          "reservation",
          "availability"
        ]
      },
      "MerchantPurchaseInvoiceOfferDto": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "PRO",
              "ENTERPRISE"
            ],
            "description": "Plan frozen when the purchase was reserved."
          },
          "planName": {
            "type": "string",
            "nullable": true,
            "description": "Custom plan name retained with the original quote or renewal terms, never the current catalog name. Null before a Custom quote is retained or when no retained name is available; omitted for Pro and older responses. Use a generic plan label when absent or null."
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "unitAmountInCents": {
            "type": "integer",
            "description": "Tax-exclusive price in cents frozen when the purchase was reserved."
          }
        },
        "required": [
          "plan",
          "cadence",
          "currency",
          "unitAmountInCents"
        ]
      },
      "MerchantPurchaseAddressDto": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "description": "Frozen billing address used for this tax quote."
          },
          "line2": {
            "type": "string",
            "description": "Second address line; absent when none was supplied."
          },
          "city": {
            "type": "string",
            "description": "City; absent when none was supplied."
          },
          "state": {
            "type": "string",
            "description": "State or region; absent when none was supplied."
          },
          "postalCode": {
            "type": "string",
            "description": "Postal code; absent when none was supplied."
          },
          "country": {
            "type": "string"
          }
        },
        "required": [
          "line1",
          "country"
        ]
      },
      "MerchantPurchaseInvoicePartyDto": {
        "type": "object",
        "properties": {
          "legalName": {
            "type": "string",
            "description": "The party the invoice is issued to: the organization’s legal name retained when the invoice was reserved. Later profile changes never re-render it."
          },
          "address": {
            "description": "Billing address snapshot frozen with the tax calculation; later address changes never reprice this invoice.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseAddressDto"
              }
            ]
          }
        },
        "required": [
          "legalName",
          "address"
        ]
      },
      "MerchantPurchaseInvoiceTermsDto": {
        "type": "object",
        "properties": {
          "acceptedAt": {
            "type": "string",
            "description": "When the recurring-use consent for this attempt was accepted (ISO 8601)."
          },
          "consentPolicyVersion": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "recurringUse": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "startRule": {
            "type": "string",
            "enum": [
              "FULL_CYCLE_FROM_VERIFIED_ACTIVATION"
            ]
          },
          "calendarPolicy": {
            "type": "string",
            "enum": [
              "UTC_ORIGINAL_ANNIVERSARY_CLAMP_V1"
            ]
          },
          "debtPolicy": {
            "type": "string",
            "enum": [
              "ONE_UNRESOLVED_RENEWAL_NO_BACKBILLING_V1"
            ]
          },
          "recoveryPolicy": {
            "type": "string",
            "enum": [
              "CURRENT_PERIOD_REMAINDER_OR_NORMAL_ANNIVERSARY_V1"
            ]
          }
        },
        "required": [
          "acceptedAt",
          "consentPolicyVersion",
          "recurringUse",
          "startRule",
          "calendarPolicy",
          "debtPolicy",
          "recoveryPolicy"
        ]
      },
      "MerchantPurchaseInvoiceLineDto": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string",
            "description": "Server-owned line reference."
          },
          "amountInCents": {
            "type": "integer"
          },
          "quantity": {
            "type": "integer"
          },
          "taxAmountInCents": {
            "type": "integer"
          },
          "taxCode": {
            "type": "string",
            "description": "Tax code applied to the line."
          }
        },
        "required": [
          "reference",
          "amountInCents",
          "quantity",
          "taxAmountInCents",
          "taxCode"
        ]
      },
      "MerchantPurchaseInvoiceEconomicsDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "subtotalInCents": {
            "type": "integer"
          },
          "taxAmountInCents": {
            "type": "integer"
          },
          "totalInCents": {
            "type": "integer"
          }
        },
        "required": [
          "currency",
          "subtotalInCents",
          "taxAmountInCents",
          "totalInCents"
        ]
      },
      "MerchantPurchaseInvoiceTaxEvidenceDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "CALCULATED",
              "EXPIRED"
            ],
            "description": "EXPIRED means the retained calculation can no longer admit a new charge; a payment already handed off keeps it as its original evidence."
          },
          "calculatedAt": {
            "type": "string",
            "description": "When the tax calculation was quoted (ISO 8601)."
          },
          "taxDate": {
            "type": "string",
            "description": "The tax date the calculation applies to (ISO 8601)."
          },
          "expiresAt": {
            "type": "string",
            "description": "When the quote stopped admitting a new charge (ISO 8601)."
          }
        },
        "required": [
          "outcome",
          "calculatedAt",
          "taxDate",
          "expiresAt"
        ]
      },
      "MerchantPurchaseInvoicePaymentDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Authoritatively observed provider status of this invoice’s payment, for example succeeded, processing or requires_action. Never a browser result."
          },
          "amountReceivedInCents": {
            "type": "integer",
            "nullable": true,
            "description": "Amount the provider reports as received, in cents, or null when none is reported yet."
          },
          "observedAt": {
            "type": "string",
            "description": "When cartonium observed this status (ISO 8601); not the provider’s success time."
          }
        },
        "required": [
          "status",
          "amountReceivedInCents",
          "observedAt"
        ]
      },
      "MerchantPurchaseInvoiceTaxRecordingDto": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "PENDING",
              "IN_PROGRESS",
              "RECORDED",
              "UNRESOLVED",
              "FAILED"
            ],
            "description": "Durable E7 tax-recording state against the original calculation. RECORDED retains the provider transaction; UNRESOLVED and FAILED are visible reconciliation obligations and never imply a replacement calculation."
          },
          "recordedAt": {
            "type": "object",
            "nullable": true,
            "description": "When the recording was retained (ISO 8601), or null."
          }
        },
        "required": [
          "outcome",
          "recordedAt"
        ]
      },
      "MerchantPurchaseInvoicePeriodDto": {
        "type": "object",
        "properties": {
          "startsAt": {
            "type": "string",
            "description": "Service period start (ISO 8601)."
          },
          "endsAt": {
            "type": "string",
            "description": "Service period end (ISO 8601)."
          }
        },
        "required": [
          "startsAt",
          "endsAt"
        ]
      },
      "MerchantPurchaseInvoiceDto": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "purchaseId": {
            "type": "string",
            "format": "uuid"
          },
          "purchaseGeneration": {
            "type": "integer"
          },
          "attemptGeneration": {
            "type": "integer",
            "nullable": true,
            "description": "The retained attempt this rendering is based on, or null before any tax calculation was retained."
          },
          "state": {
            "type": "string",
            "enum": [
              "RESERVED",
              "PAYMENT_OBSERVED",
              "FINALIZED"
            ],
            "description": "RESERVED: identity reserved, no authoritative payment. PAYMENT_OBSERVED: payment was authoritatively observed as succeeded; activation or settlement is pending and no paid access is implied. FINALIZED: the activation or renewal settlement transaction finalized this invoice; its originals are immutable."
          },
          "createdAt": {
            "type": "string",
            "description": "When the invoice identity was reserved (ISO 8601)."
          },
          "offer": {
            "$ref": "#/components/schemas/MerchantPurchaseInvoiceOfferDto"
          },
          "party": {
            "nullable": true,
            "description": "Null until a tax calculation froze the billing address and the party name retained at reservation is available.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoicePartyDto"
              }
            ]
          },
          "terms": {
            "nullable": true,
            "description": "Accepted recurring terms for the rendered attempt, or null before consent.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoiceTermsDto"
              }
            ]
          },
          "lines": {
            "nullable": true,
            "description": "Exact calculated lines, or null before a tax calculation was retained.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantPurchaseInvoiceLineDto"
            }
          },
          "economics": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoiceEconomicsDto"
              }
            ]
          },
          "taxEvidence": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoiceTaxEvidenceDto"
              }
            ]
          },
          "payment": {
            "nullable": true,
            "description": "Null until this invoice’s payment was authoritatively observed.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoicePaymentDto"
              }
            ]
          },
          "taxRecording": {
            "nullable": true,
            "description": "Null until activation or renewal settlement enqueued durable tax recording.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoiceTaxRecordingDto"
              }
            ]
          },
          "period": {
            "nullable": true,
            "description": "Null until the invoice is FINALIZED.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseInvoicePeriodDto"
              }
            ]
          }
        },
        "required": [
          "invoiceId",
          "purchaseId",
          "purchaseGeneration",
          "attemptGeneration",
          "state",
          "createdAt",
          "offer",
          "party",
          "terms",
          "lines",
          "economics",
          "taxEvidence",
          "payment",
          "taxRecording",
          "period"
        ]
      },
      "MerchantPurchaseInvoiceListDto": {
        "type": "object",
        "properties": {
          "invoices": {
            "description": "Newest reservation first. An empty list is a truthful empty history, not an error.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantPurchaseInvoiceDto"
            }
          }
        },
        "required": [
          "invoices"
        ]
      },
      "MerchantPurchaseCustomLimitsDto": {
        "type": "object",
        "properties": {
          "storefronts": {
            "type": "integer",
            "minimum": 0
          },
          "staffSeats": {
            "type": "integer",
            "minimum": 0
          },
          "catalogItems": {
            "type": "integer",
            "minimum": 0
          },
          "storageBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "apiCallsPerDay": {
            "type": "integer",
            "minimum": 0
          },
          "webhooksPerDay": {
            "type": "integer",
            "minimum": 0
          },
          "hostedPageApiCallsPerDay": {
            "type": "integer",
            "minimum": 0
          },
          "emailSendsPerDay": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "storefronts",
          "staffSeats",
          "catalogItems",
          "storageBytes",
          "apiCallsPerDay",
          "webhooksPerDay",
          "hostedPageApiCallsPerDay",
          "emailSendsPerDay"
        ]
      },
      "MerchantPurchaseCustomOfferDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact accepted offer used for this purchase."
          },
          "commercialRevisionId": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable commercial revision, retained for correlation."
          },
          "termsFingerprint": {
            "type": "string",
            "description": "Fingerprint of the exact saved commercial terms."
          },
          "name": {
            "type": "string"
          },
          "limits": {
            "description": "Exact saved values. Only ACTIVE categories grant limits after verified payment; SOON categories remain configuration.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseCustomLimitsDto"
              }
            ]
          },
          "limitAvailability": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "SOON"
              ]
            },
            "description": "Exact availability of each saved limit. Storefronts, email and webhooks remain Soon."
          }
        },
        "required": [
          "id",
          "commercialRevisionId",
          "termsFingerprint",
          "name",
          "limits",
          "limitAvailability"
        ]
      },
      "MerchantPurchaseMethodPolicyDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "description": "Version of the proposed or accepted payment-method policy."
          },
          "paymentMethodTypes": {
            "description": "Admitted method types for these terms. Never empty when a policy is present; method availability still requires provider confirmation.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "returnUrl": {
            "type": "string",
            "description": "Approved return destination for this purchase flow, without caller-supplied navigation."
          }
        },
        "required": [
          "version",
          "paymentMethodTypes",
          "returnUrl"
        ]
      },
      "MerchantPurchaseRecurringTermsDto": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "PRO",
              "ENTERPRISE"
            ],
            "description": "Plan frozen in the original quote; ENTERPRISE identifies a Custom offer."
          },
          "customOffer": {
            "description": "Exact Custom terms frozen in the tax quote. Omitted for Pro.",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseCustomOfferDto"
              }
            ]
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "subtotal": {
            "type": "integer",
            "description": "Plan subtotal in cents."
          },
          "tax": {
            "type": "integer",
            "nullable": true,
            "description": "Tax in cents, or null before a verified calculation exists."
          },
          "total": {
            "type": "integer",
            "nullable": true,
            "description": "Total in cents, or null before a verified calculation exists; null is not zero."
          },
          "consentPolicyVersion": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "recurringUse": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "These terms require explicit recurring-use consent; reading them does not accept them."
          },
          "startRule": {
            "type": "string",
            "enum": [
              "FULL_CYCLE_FROM_VERIFIED_ACTIVATION"
            ]
          },
          "calendarPolicy": {
            "type": "string",
            "enum": [
              "UTC_ORIGINAL_ANNIVERSARY_CLAMP_V1"
            ]
          },
          "debtPolicy": {
            "type": "string",
            "enum": [
              "ONE_UNRESOLVED_RENEWAL_NO_BACKBILLING_V1"
            ]
          },
          "recoveryPolicy": {
            "type": "string",
            "enum": [
              "CURRENT_PERIOD_REMAINDER_OR_NORMAL_ANNIVERSARY_V1"
            ]
          },
          "policy": {
            "nullable": true,
            "description": "Proposed or immutable accepted method/return policy. Null means no admitted proposed context exists; accepted consent retains its original policy.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseMethodPolicyDto"
              }
            ]
          }
        },
        "required": [
          "plan",
          "cadence",
          "currency",
          "subtotal",
          "tax",
          "total",
          "consentPolicyVersion",
          "recurringUse",
          "startRule",
          "calendarPolicy",
          "debtPolicy",
          "recoveryPolicy",
          "policy"
        ]
      },
      "MerchantPurchaseAcceptedConsentDto": {
        "type": "object",
        "properties": {
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Time the exact immutable consent was accepted."
          },
          "terms": {
            "$ref": "#/components/schemas/MerchantPurchaseRecurringTermsDto"
          }
        },
        "required": [
          "acceptedAt",
          "terms"
        ]
      },
      "MerchantPurchaseEligibilityDto": {
        "type": "object",
        "properties": {
          "consent": {
            "type": "boolean",
            "description": "Necessary local consent conditions currently hold; context and transactional revalidation are still required."
          },
          "setup": {
            "type": "boolean",
            "description": "Necessary local setup conditions currently hold; context and transactional revalidation are still required."
          },
          "payment": {
            "type": "boolean",
            "description": "Necessary local initial-payment conditions currently hold; context and transactional revalidation are still required."
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "SOURCE_CHANGED",
              "QUOTE_INELIGIBLE",
              "PAYMENT_EXCLUDED",
              "METHOD_UNVERIFIED",
              "BUSY"
            ],
            "description": "Local eligibility limitation, or null when no local limitation was found. Null does not guarantee a provider action is available."
          }
        },
        "required": [
          "consent",
          "setup",
          "payment",
          "reason"
        ]
      },
      "MerchantPurchaseReviewDto": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/MerchantPurchaseStatusDto"
          },
          "address": {
            "$ref": "#/components/schemas/MerchantPurchaseAddressDto"
          },
          "terms": {
            "$ref": "#/components/schemas/MerchantPurchaseRecurringTermsDto"
          },
          "consent": {
            "nullable": true,
            "description": "Immutable accepted consent for this quote, or null if none has been accepted. A new quote requires new consent.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantPurchaseAcceptedConsentDto"
              }
            ]
          },
          "eligibility": {
            "$ref": "#/components/schemas/MerchantPurchaseEligibilityDto"
          },
          "providerReadiness": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "CONTEXT_UNAVAILABLE",
              "CONTEXT_MISMATCH"
            ],
            "description": "Whether admitted provider context is usable. AVAILABLE does not prove provider acceptance or authorize an action by itself; local eligibility and final checks still apply."
          }
        },
        "required": [
          "status",
          "address",
          "terms",
          "consent",
          "eligibility",
          "providerReadiness"
        ]
      },
      "MerchantPurchaseConsentDto": {
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable key for this exact consent. Repeating it recovers the original accepted consent."
          },
          "quoteFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Fingerprint of the exact tax quote shown for consent."
          },
          "recurringUse": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicit agreement to the recurring-use terms returned by review. Must be true."
          }
        },
        "required": [
          "operationKey",
          "quoteFingerprint",
          "recurringUse"
        ]
      },
      "MerchantPurchaseActionDto": {
        "type": "object",
        "properties": {}
      },
      "MerchantPurchaseRecoveryDto": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "TAX",
              "SETUP",
              "PAYMENT_ATTENDED"
            ],
            "description": "Recover the exact retained stage; this does not create a replacement purchase or payment."
          }
        },
        "required": [
          "stage"
        ]
      },
      "MerchantAgreementRefDto": {
        "type": "object",
        "properties": {
          "agreementId": {
            "type": "string",
            "format": "uuid"
          },
          "purchaseGeneration": {
            "type": "integer"
          }
        },
        "required": [
          "agreementId",
          "purchaseGeneration"
        ]
      },
      "MerchantAgreementCancellationStatusDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer"
          },
          "cancelAtPeriodEnd": {
            "type": "boolean"
          },
          "effectiveAt": {
            "type": "object",
            "nullable": true
          }
        },
        "required": [
          "version",
          "cancelAtPeriodEnd",
          "effectiveAt"
        ]
      },
      "MerchantRenewalRefDto": {
        "type": "object",
        "properties": {
          "agreementId": {
            "type": "string",
            "format": "uuid"
          },
          "purchaseGeneration": {
            "type": "integer"
          },
          "obligationId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "agreementId",
          "purchaseGeneration",
          "obligationId"
        ]
      },
      "MerchantRenewalInvoiceDto": {
        "type": "object",
        "properties": {
          "fingerprint": {
            "type": "string"
          },
          "partyLegalName": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/MerchantPurchaseAddressDto"
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "subtotalInCents": {
            "type": "integer"
          },
          "taxAmountInCents": {
            "type": "integer"
          },
          "totalInCents": {
            "type": "integer"
          },
          "finalizedAt": {
            "type": "string"
          }
        },
        "required": [
          "fingerprint",
          "partyLegalName",
          "address",
          "currency",
          "subtotalInCents",
          "taxAmountInCents",
          "totalInCents",
          "finalizedAt"
        ]
      },
      "MerchantRenewalAttemptDto": {
        "type": "object",
        "properties": {
          "attemptId": {
            "type": "string",
            "format": "uuid"
          },
          "attemptGeneration": {
            "type": "integer"
          },
          "stage": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "7",
              "14",
              "ATTENDED"
            ]
          },
          "taxOutcome": {
            "type": "string",
            "enum": [
              "PENDING",
              "HANDED_OFF",
              "NOT_STARTED",
              "UNRESOLVED",
              "CALCULATED",
              "EXPIRED"
            ]
          },
          "paymentOutcome": {
            "type": "string",
            "enum": [
              "PENDING",
              "HANDED_OFF",
              "NOT_STARTED",
              "UNRESOLVED",
              "OBSERVED"
            ]
          },
          "paymentStatus": {
            "type": "object",
            "nullable": true
          }
        },
        "required": [
          "attemptId",
          "attemptGeneration",
          "stage",
          "taxOutcome",
          "paymentOutcome",
          "paymentStatus"
        ]
      },
      "MerchantRenewalCoverageDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "PAID_PERIOD",
              "COMPLIMENTARY_REMAINDER",
              "ANNIVERSARY_DUE"
            ]
          },
          "periodNumber": {
            "type": "integer"
          },
          "startsAt": {
            "type": "string"
          },
          "endsAt": {
            "type": "string"
          },
          "recoveredAt": {
            "type": "string"
          },
          "nextDueAt": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "periodNumber",
          "startsAt",
          "endsAt",
          "recoveredAt",
          "nextDueAt"
        ]
      },
      "MerchantRenewalDto": {
        "type": "object",
        "properties": {
          "ref": {
            "$ref": "#/components/schemas/MerchantRenewalRefDto"
          },
          "invoiceId": {
            "type": "string",
            "format": "uuid"
          },
          "periodNumber": {
            "type": "integer"
          },
          "dueAt": {
            "type": "string"
          },
          "periodEndsAt": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OWED",
              "SETTLED"
            ]
          },
          "lifecycle": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PAST_DUE",
              "FREE",
              "RECOVERED",
              "HELD"
            ]
          },
          "invoice": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantRenewalInvoiceDto"
              }
            ]
          },
          "attempt": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantRenewalAttemptDto"
              }
            ]
          },
          "coverage": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantRenewalCoverageDto"
              }
            ]
          },
          "settledAt": {
            "type": "object",
            "nullable": true
          },
          "holdCode": {
            "type": "object",
            "nullable": true,
            "description": "Fixed local reconciliation reason; settlement never overwrites a later plan change."
          }
        },
        "required": [
          "ref",
          "invoiceId",
          "periodNumber",
          "dueAt",
          "periodEndsAt",
          "status",
          "lifecycle",
          "invoice",
          "attempt",
          "coverage",
          "settledAt",
          "holdCode"
        ]
      },
      "MerchantAgreementDto": {
        "type": "object",
        "properties": {
          "ref": {
            "$ref": "#/components/schemas/MerchantAgreementRefDto"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CANCELLED"
            ]
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ]
          },
          "originalAnchorAt": {
            "type": "string"
          },
          "activatedAt": {
            "type": "string"
          },
          "currentPeriodNumber": {
            "type": "integer"
          },
          "nextDueAt": {
            "type": "string"
          },
          "currentPlan": {
            "type": "string",
            "description": "Current authoritative organization plan, independent of historical payment or activation evidence."
          },
          "purchasedPlan": {
            "type": "string",
            "enum": [
              "PRO",
              "ENTERPRISE"
            ],
            "description": "Plan purchased by this agreement, including after cancellation or nonpayment."
          },
          "planName": {
            "type": "string",
            "nullable": true,
            "description": "Name of the exact accepted Custom catalog revision; null for a standard agreement."
          },
          "cancellation": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantAgreementCancellationStatusDto"
              }
            ]
          },
          "renewal": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantRenewalDto"
              }
            ]
          }
        },
        "required": [
          "ref",
          "status",
          "cadence",
          "originalAnchorAt",
          "activatedAt",
          "currentPeriodNumber",
          "nextDueAt",
          "currentPlan",
          "purchasedPlan",
          "planName",
          "cancellation",
          "renewal"
        ]
      },
      "MerchantAgreementCurrentDto": {
        "type": "object",
        "properties": {
          "current": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantAgreementDto"
              }
            ]
          }
        },
        "required": [
          "current"
        ]
      },
      "MerchantAgreementCancellationDto": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Current cancellation version, or zero when no intent exists."
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "Change the future period-end intent; never an immediate refund or immediate cancellation."
          }
        },
        "required": [
          "expectedVersion",
          "cancelAtPeriodEnd"
        ]
      },
      "MerchantRenewalMethodDto": {
        "type": "object",
        "properties": {
          "methodId": {
            "type": "string",
            "format": "uuid"
          },
          "methodGeneration": {
            "type": "integer"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "PENDING",
              "HANDED_OFF",
              "NOT_STARTED",
              "UNRESOLVED",
              "OBSERVED"
            ]
          },
          "status": {
            "type": "object",
            "nullable": true,
            "description": "Authoritatively retrieved setup status. No provider identifier is returned."
          }
        },
        "required": [
          "methodId",
          "methodGeneration",
          "outcome",
          "status"
        ]
      },
      "MerchantRenewalHandoffDto": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "SETUP",
              "PAYMENT"
            ]
          },
          "clientSecret": {
            "type": "string",
            "description": "Transient mutation-only confirmation credential. Never persist or log."
          },
          "publishableKey": {
            "type": "string"
          },
          "returnUrl": {
            "type": "string",
            "description": "Exact server-retained return URL for this confirmation. Never append query or fragment state."
          }
        },
        "required": [
          "stage",
          "clientSecret",
          "publishableKey",
          "returnUrl"
        ]
      },
      "MerchantRenewalResultDto": {
        "type": "object",
        "properties": {
          "renewal": {
            "nullable": true,
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantRenewalDto"
              }
            ]
          },
          "method": {
            "$ref": "#/components/schemas/MerchantRenewalMethodDto"
          },
          "handoff": {
            "$ref": "#/components/schemas/MerchantRenewalHandoffDto"
          }
        },
        "required": [
          "renewal"
        ]
      },
      "MerchantAgreementOperationDto": {
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable key for this exact action. Preserve for replay after a lost response."
          }
        },
        "required": [
          "operationKey"
        ]
      },
      "MerchantAgreementActionDto": {
        "type": "object",
        "properties": {}
      },
      "MerchantRenewalPrepareDto": {
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable key for this exact action. Preserve for replay after a lost response."
          },
          "methodId": {
            "type": "string",
            "format": "uuid"
          },
          "methodGeneration": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "invoiceFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Exact retained invoice fingerprint shown for recovery."
          }
        },
        "required": [
          "operationKey",
          "methodId",
          "methodGeneration",
          "invoiceFingerprint"
        ]
      },
      "MerchantRenewalConfirmDto": {
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "maxLength": 2048,
            "description": "Stable key for this exact action. Preserve for replay after a lost response."
          },
          "invoiceFingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "confirm": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicit confirmation of the separate recovery payment. Saving a method does not imply this action."
          }
        },
        "required": [
          "operationKey",
          "invoiceFingerprint",
          "confirm"
        ]
      },
      "PlanCatalogLimitsDto": {
        "type": "object",
        "properties": {
          "storefronts": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "staffSeats": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "catalogItems": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "storageBytes": {
            "type": "number",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "apiCallsPerDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "webhooksPerDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "hostedPageApiCallsPerDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          },
          "emailSendsPerDay": {
            "type": "number",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "required": [
          "storefronts",
          "staffSeats",
          "catalogItems",
          "storageBytes",
          "apiCallsPerDay",
          "webhooksPerDay",
          "hostedPageApiCallsPerDay",
          "emailSendsPerDay"
        ]
      },
      "MerchantCustomOfferSelectionDto": {
        "type": "object",
        "properties": {
          "quoteId": {
            "type": "string",
            "description": "Server-derived selection identity for purchases/begin. It grants no acceptance or payment authority."
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "unitAmount": {
            "type": "number",
            "minimum": 1,
            "description": "Exact saved base price in USD cents, before checkout tax."
          }
        },
        "required": [
          "quoteId",
          "currency",
          "unitAmount"
        ]
      },
      "MerchantCustomOfferDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "organizationId": {
            "type": "string",
            "description": "Owning organization, matching the authenticated organization header."
          },
          "plan": {
            "type": "string",
            "enum": [
              "ENTERPRISE"
            ]
          },
          "commercialRevisionId": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable tenant commercial revision identity; use the offer ID for offer routes."
          },
          "sourceCatalogRevisionId": {
            "type": "string",
            "description": "Immutable saved catalog revision that supplied this offer."
          },
          "termsFingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "name": {
            "type": "string"
          },
          "unitAmount": {
            "type": "number",
            "minimum": 1,
            "description": "USD cents per full billing cycle before tax. No discount is applied."
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "cadence": {
            "type": "string",
            "enum": [
              "MONTHLY",
              "YEARLY"
            ]
          },
          "limits": {
            "description": "Saved limits. Only dimensions marked ACTIVE become effective after verified paid activation; SOON values are saved and not active.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PlanCatalogLimitsDto"
              }
            ]
          },
          "limitAvailability": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "SOON"
              ]
            },
            "description": "Availability for each saved limit. Five active dimensions; multiple storefronts, email and webhooks remain Soon."
          },
          "status": {
            "type": "string",
            "enum": [
              "ISSUED",
              "ACCEPTED",
              "WITHDRAWN"
            ],
            "description": "Commercial acceptance state. ACCEPTED does not mean paid or activated; read purchases/current for activation."
          },
          "issuedAt": {
            "type": "string",
            "format": "date-time"
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Merchant acceptance time, or null when these exact terms have not been accepted."
          },
          "selection": {
            "$ref": "#/components/schemas/MerchantCustomOfferSelectionDto"
          }
        },
        "required": [
          "id",
          "organizationId",
          "plan",
          "commercialRevisionId",
          "sourceCatalogRevisionId",
          "termsFingerprint",
          "name",
          "unitAmount",
          "currency",
          "cadence",
          "limits",
          "limitAvailability",
          "status",
          "issuedAt",
          "acceptedAt",
          "selection"
        ]
      },
      "MerchantCustomOfferCurrentDto": {
        "type": "object",
        "properties": {
          "offer": {
            "nullable": true,
            "description": "Latest issued or accepted offer for this organization, or null when none exists. Withdrawn offers remain readable by exact ID.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantCustomOfferDto"
              }
            ]
          }
        },
        "required": [
          "offer"
        ]
      },
      "MerchantCustomOfferResponseDto": {
        "type": "object",
        "properties": {
          "offer": {
            "$ref": "#/components/schemas/MerchantCustomOfferDto"
          }
        },
        "required": [
          "offer"
        ]
      },
      "AcceptMerchantCustomOfferDto": {
        "type": "object",
        "properties": {
          "termsFingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Fingerprint of the exact commercial terms the merchant reviewed."
          }
        },
        "required": [
          "termsFingerprint"
        ]
      },
      "CustomerSubscriptionPlanSummaryDto": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "description": "Customer-facing plan slug. This is not a database id."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "planType": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "MEMBERSHIP",
              "SERVICE_ACCESS"
            ]
          },
          "requiresShipping": {
            "type": "boolean",
            "description": "Whether recurring fulfillment needs a shipping address."
          }
        },
        "required": [
          "slug",
          "name",
          "description",
          "planType",
          "requiresShipping"
        ]
      },
      "CustomerSubscriptionSummaryDto": {
        "type": "object",
        "properties": {
          "publicRef": {
            "type": "string",
            "pattern": "^s[0-9a-f]{32}$",
            "example": "s0123456789abcdef0123456789abcdef",
            "description": "Opaque customer-safe subscription handle."
          },
          "status": {
            "type": "string",
            "enum": [
              "INCOMPLETE",
              "INCOMPLETE_EXPIRED",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "PAUSED",
              "CANCEL_AT_PERIOD_END",
              "CANCELED",
              "UNPAID"
            ]
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "True when the subscription remains active through its current period and then ends."
          },
          "currentPeriodStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "currentPeriodEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "trialStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "trialEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "pausedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "canceledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextRenewalAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "gracePeriodEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSubscriptionPlanSummaryDto"
            }
          }
        },
        "required": [
          "publicRef",
          "status",
          "cancelAtPeriodEnd",
          "currentPeriodStartsAt",
          "currentPeriodEndsAt",
          "trialStartsAt",
          "trialEndsAt",
          "pausedAt",
          "canceledAt",
          "endedAt",
          "nextRenewalAt",
          "gracePeriodEndsAt",
          "createdAt",
          "updatedAt",
          "plans"
        ]
      },
      "CustomerSubscriptionListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSubscriptionSummaryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "pattern": "^s[0-9a-f]{32}$",
            "description": "Opaque cursor for the next page, or null on the final page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CustomerSubscriptionPriceDto": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "usd",
            "description": "Lowercase ISO 4217 currency code."
          },
          "unitAmountInCents": {
            "type": "integer",
            "minimum": 0,
            "description": "Recurring unit amount in the currency minor unit."
          },
          "interval": {
            "type": "string",
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ]
          },
          "intervalCount": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "currency",
          "unitAmountInCents",
          "interval",
          "intervalCount"
        ]
      },
      "CustomerSubscriptionItemDto": {
        "type": "object",
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/CustomerSubscriptionPlanSummaryDto"
          },
          "price": {
            "$ref": "#/components/schemas/CustomerSubscriptionPriceDto"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "plan",
          "price",
          "quantity"
        ]
      },
      "CustomerSubscriptionRenewalAddressDto": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "description": "Uppercase ISO 3166-1 alpha-2 country code.",
            "example": "US"
          },
          "company": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "postalCode": {
            "type": "string",
            "nullable": true
          },
          "line1": {
            "type": "string",
            "nullable": true
          },
          "line2": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "country",
          "company",
          "state",
          "city",
          "postalCode",
          "line1",
          "line2"
        ]
      },
      "CustomerSubscriptionPaymentRecoverySummaryDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PAYMENT_FAILED",
              "RETRY_SCHEDULED",
              "ACTION_REQUIRED",
              "RECOVERED",
              "EXHAUSTED"
            ]
          },
          "attemptCount": {
            "type": "integer",
            "minimum": 0
          },
          "nextRetryAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "customerMessage": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe explanation. Raw provider failure text is never exposed."
          },
          "needsCustomerAction": {
            "type": "boolean",
            "description": "Whether the current normalized recovery state can benefit from customer action."
          },
          "resolvedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "status",
          "attemptCount",
          "nextRetryAt",
          "customerMessage",
          "needsCustomerAction",
          "resolvedAt"
        ]
      },
      "CustomerSubscriptionDetailDto": {
        "type": "object",
        "properties": {
          "publicRef": {
            "type": "string",
            "pattern": "^s[0-9a-f]{32}$",
            "example": "s0123456789abcdef0123456789abcdef",
            "description": "Opaque customer-safe subscription handle."
          },
          "status": {
            "type": "string",
            "enum": [
              "INCOMPLETE",
              "INCOMPLETE_EXPIRED",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "PAUSED",
              "CANCEL_AT_PERIOD_END",
              "CANCELED",
              "UNPAID"
            ]
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "True when the subscription remains active through its current period and then ends."
          },
          "currentPeriodStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "currentPeriodEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "trialStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "trialEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "pausedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "canceledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextRenewalAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "gracePeriodEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSubscriptionPlanSummaryDto"
            }
          },
          "items": {
            "description": "Active recurring items only.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSubscriptionItemDto"
            }
          },
          "renewalShippingAddress": {
            "nullable": true,
            "description": "Sanitized subscription-specific shipping snapshot.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerSubscriptionRenewalAddressDto"
              }
            ]
          },
          "renewalBillingAddress": {
            "nullable": true,
            "description": "Sanitized subscription-specific billing snapshot.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerSubscriptionRenewalAddressDto"
              }
            ]
          },
          "latestPaymentRecovery": {
            "nullable": true,
            "description": "Latest normalized payment-recovery cycle, when one exists. Use the dedicated recovery API for the complete projection.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoverySummaryDto"
              }
            ]
          }
        },
        "required": [
          "publicRef",
          "status",
          "cancelAtPeriodEnd",
          "currentPeriodStartsAt",
          "currentPeriodEndsAt",
          "trialStartsAt",
          "trialEndsAt",
          "pausedAt",
          "canceledAt",
          "endedAt",
          "nextRenewalAt",
          "gracePeriodEndsAt",
          "createdAt",
          "updatedAt",
          "plans",
          "items",
          "renewalShippingAddress",
          "renewalBillingAddress",
          "latestPaymentRecovery"
        ]
      },
      "CustomerSubscriptionReactivationDto": {
        "type": "object",
        "properties": {
          "publicRef": {
            "type": "string",
            "pattern": "^s[0-9a-f]{32}$",
            "example": "s0123456789abcdef0123456789abcdef",
            "description": "Opaque customer-safe subscription handle."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "TRIALING"
            ],
            "description": "The restored provider-backed lifecycle state."
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Always false after the scheduled period-end cancellation is cleared."
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this response replays an already-completed idempotent command."
          },
          "message": {
            "type": "string",
            "example": "Your subscription will renew as scheduled."
          }
        },
        "required": [
          "publicRef",
          "status",
          "cancelAtPeriodEnd",
          "completedAt",
          "replayed",
          "message"
        ]
      },
      "CustomerSubscriptionBillingPeriodDto": {
        "type": "object",
        "properties": {
          "publicRef": {
            "type": "string",
            "pattern": "^h[0-9a-f]{32}$",
            "example": "h0123456789abcdef0123456789abcdef",
            "description": "Opaque customer-safe billing-period handle."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PAID",
              "FAILED",
              "VOID",
              "CREDITED"
            ]
          },
          "periodStartsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "periodEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "amountDueInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "amountPaidInCents": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "publicRef",
          "status",
          "periodStartsAt",
          "periodEndsAt",
          "amountDueInCents",
          "amountPaidInCents",
          "currency",
          "createdAt",
          "updatedAt"
        ]
      },
      "CustomerSubscriptionBillingPeriodListResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSubscriptionBillingPeriodDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "pattern": "^h[0-9a-f]{32}$",
            "description": "Opaque cursor for the next page, or null on the final page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "ExchangeSubscriptionPaymentRecoveryActionDto": {
        "type": "object",
        "properties": {
          "actionToken": {
            "type": "string",
            "pattern": "^a[a-z0-9]{25}$",
            "description": "Opaque action from the URL fragment. It is exchanged in a POST body and never belongs in a route or query string."
          }
        },
        "required": [
          "actionToken"
        ]
      },
      "SubscriptionPaymentRecoveryProofDto": {
        "type": "object",
        "properties": {
          "recoveryId": {
            "type": "string",
            "description": "Local recovery-cycle correlation id."
          },
          "paymentToken": {
            "type": "string",
            "pattern": "^p[a-z0-9]{25}$",
            "description": "Short-lived scoped proof. Hosted clients place it in an httpOnly cookie and never render or persist it."
          },
          "paymentTokenExpiresAt": {
            "type": "string"
          }
        },
        "required": [
          "recoveryId",
          "paymentToken",
          "paymentTokenExpiresAt"
        ]
      },
      "CustomerSubscriptionPaymentRecoveryResendRequestDto": {
        "type": "object",
        "properties": {
          "actionToken": {
            "type": "string",
            "pattern": "^a[a-z0-9]{25}$",
            "description": "Opaque action from the prior URL fragment. It authorizes only a neutral resend request and never belongs in a route or query string."
          }
        },
        "required": [
          "actionToken"
        ]
      },
      "CustomerSubscriptionPaymentRecoveryResendDto": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string",
            "description": "Neutral confirmation shared by eligible, unknown, malformed, expired, revoked, consumed, exhausted, wrong-purpose, terminal, and cross-tenant actions."
          }
        },
        "required": [
          "ok",
          "message"
        ]
      },
      "SubscriptionPaymentRecoverySubscriptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Local subscription id."
          },
          "status": {
            "type": "string",
            "enum": [
              "INCOMPLETE",
              "INCOMPLETE_EXPIRED",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "PAUSED",
              "CANCEL_AT_PERIOD_END",
              "CANCELED",
              "UNPAID"
            ]
          },
          "planNames": {
            "description": "Display names of the plans on this subscription.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "currentPeriodEndsAt": {
            "type": "string",
            "nullable": true
          },
          "nextRenewalAt": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "status",
          "planNames",
          "currentPeriodEndsAt",
          "nextRenewalAt"
        ]
      },
      "SubscriptionPaymentRecoveryBillingPeriodDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "PAID",
              "FAILED",
              "VOID",
              "CREDITED"
            ]
          },
          "amountDueInCents": {
            "type": "number",
            "nullable": true
          },
          "amountPaidInCents": {
            "type": "number",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd"
          },
          "periodStartsAt": {
            "type": "string",
            "nullable": true
          },
          "periodEndsAt": {
            "type": "string",
            "nullable": true
          },
          "fulfillmentEligible": {
            "type": "boolean",
            "description": "True only after authoritative invoice payment. A confirmed physical-renewal fulfillment must not be created or presented when false."
          }
        },
        "required": [
          "status",
          "amountDueInCents",
          "amountPaidInCents",
          "currency",
          "periodStartsAt",
          "periodEndsAt",
          "fulfillmentEligible"
        ]
      },
      "CustomerSubscriptionPaymentRecoveryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Local payment-recovery cycle id."
          },
          "status": {
            "type": "string",
            "enum": [
              "PAYMENT_FAILED",
              "RETRY_SCHEDULED",
              "ACTION_REQUIRED",
              "RECOVERED",
              "EXHAUSTED"
            ]
          },
          "terminalAction": {
            "type": "string",
            "enum": [
              "UNPAID",
              "CANCEL",
              "SUSPEND",
              "MANUAL_RECOVERY"
            ],
            "nullable": true,
            "description": "Effective exhausted-recovery result. Null until a terminal decision is selected."
          },
          "terminalEntitlementBehavior": {
            "type": "string",
            "enum": [
              "LAPSE_IMMEDIATELY",
              "FREEZE_BALANCES"
            ],
            "nullable": true,
            "description": "Snapshotted terminal balance treatment. It never grants unpaid access."
          },
          "terminalSelfServeRecovery": {
            "type": "boolean",
            "nullable": true,
            "description": "Snapshotted tenant opt-in for customer self-serve terminal revival."
          },
          "terminalActionAppliedAt": {
            "type": "string",
            "nullable": true
          },
          "subscription": {
            "$ref": "#/components/schemas/SubscriptionPaymentRecoverySubscriptionDto"
          },
          "billingPeriod": {
            "$ref": "#/components/schemas/SubscriptionPaymentRecoveryBillingPeriodDto"
          },
          "attemptCount": {
            "type": "number",
            "minimum": 0
          },
          "nextRetryAt": {
            "type": "string",
            "nullable": true
          },
          "failureVersion": {
            "type": "string",
            "nullable": true,
            "description": "Opaque replay-stable version for the currently projected failure."
          },
          "customerMessage": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe explanation; raw provider text is never projected here."
          },
          "needsCustomerAction": {
            "type": "boolean",
            "description": "Whether the current recovery state can benefit from customer action."
          },
          "resolvedAt": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "terminalAction",
          "terminalEntitlementBehavior",
          "terminalSelfServeRecovery",
          "terminalActionAppliedAt",
          "subscription",
          "billingPeriod",
          "attemptCount",
          "nextRetryAt",
          "failureVersion",
          "customerMessage",
          "needsCustomerAction",
          "resolvedAt",
          "createdAt",
          "updatedAt"
        ]
      },
      "SubscriptionPaymentRecoveryActionResponseDto": {
        "type": "object",
        "properties": {
          "recovery": {
            "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoveryDto"
          }
        },
        "required": [
          "recovery"
        ]
      },
      "SubscriptionPaymentRecoveryHandoffDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "PAYMENT",
              "WAITING",
              "RECOVERED"
            ]
          },
          "clientSecret": {
            "type": "string",
            "nullable": true,
            "description": "Existing failed-invoice PaymentIntent client secret. Never persisted."
          },
          "publishableKey": {
            "type": "string",
            "nullable": true
          },
          "stripeAccountId": {
            "type": "string",
            "nullable": true,
            "description": "Persisted connected-account id required when initializing Stripe.js."
          },
          "amountInCents": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "example": "usd"
          },
          "failureVersion": {
            "type": "string",
            "nullable": true,
            "description": "Opaque failure version captured before this confirmation attempt."
          }
        },
        "required": [
          "type",
          "clientSecret",
          "publishableKey",
          "stripeAccountId",
          "amountInCents",
          "currency",
          "failureVersion"
        ]
      },
      "SubscriptionPaymentRecoveryPaymentResponseDto": {
        "type": "object",
        "properties": {
          "recovery": {
            "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoveryDto"
          },
          "handoff": {
            "$ref": "#/components/schemas/SubscriptionPaymentRecoveryHandoffDto"
          }
        },
        "required": [
          "recovery",
          "handoff"
        ]
      },
      "CustomerSubscriptionPaymentRecoveryListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerSubscriptionPaymentRecoveryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page, or null when this is the final page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "MerchantResendSubscriptionPaymentRecoveryDto": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 200,
            "description": "Stable client-generated key. Retrying with the same key replays the original outcome and sends no second reminder; reusing it for a different recovery returns 409."
          }
        },
        "required": [
          "idempotencyKey"
        ]
      },
      "MerchantSubscriptionPaymentRecoveryResendDto": {
        "type": "object",
        "properties": {
          "recoveryId": {
            "type": "string"
          },
          "notificationGeneration": {
            "type": "number",
            "description": "Delivery generation this command queued (or replayed)."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this request replayed an earlier one and no new reminder was sent."
          },
          "lastNotifiedAt": {
            "type": "string",
            "nullable": true
          },
          "resendsRemainingInWindow": {
            "type": "number",
            "description": "Staff resends still allowed inside the current rolling window."
          },
          "resendAvailableAt": {
            "type": "string",
            "nullable": true,
            "description": "When another resend becomes available; null when one is available now."
          }
        },
        "required": [
          "recoveryId",
          "notificationGeneration",
          "replayed",
          "lastNotifiedAt",
          "resendsRemainingInWindow",
          "resendAvailableAt"
        ]
      },
      "MerchantPaymentRecoveryCustomerDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Local customer id."
          },
          "email": {
            "type": "string",
            "example": "customer@example.com"
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "email",
          "name"
        ]
      },
      "MerchantSubscriptionPaymentRecoveryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Local payment-recovery cycle id."
          },
          "status": {
            "type": "string",
            "enum": [
              "PAYMENT_FAILED",
              "RETRY_SCHEDULED",
              "ACTION_REQUIRED",
              "RECOVERED",
              "EXHAUSTED"
            ]
          },
          "terminalAction": {
            "type": "string",
            "enum": [
              "UNPAID",
              "CANCEL",
              "SUSPEND",
              "MANUAL_RECOVERY"
            ],
            "nullable": true,
            "description": "Effective exhausted-recovery result. Null until a terminal decision is selected."
          },
          "terminalEntitlementBehavior": {
            "type": "string",
            "enum": [
              "LAPSE_IMMEDIATELY",
              "FREEZE_BALANCES"
            ],
            "nullable": true,
            "description": "Snapshotted terminal balance treatment. It never grants unpaid access."
          },
          "terminalSelfServeRecovery": {
            "type": "boolean",
            "nullable": true,
            "description": "Snapshotted tenant opt-in for customer self-serve terminal revival."
          },
          "terminalActionAppliedAt": {
            "type": "string",
            "nullable": true
          },
          "subscription": {
            "$ref": "#/components/schemas/SubscriptionPaymentRecoverySubscriptionDto"
          },
          "billingPeriod": {
            "$ref": "#/components/schemas/SubscriptionPaymentRecoveryBillingPeriodDto"
          },
          "attemptCount": {
            "type": "number",
            "minimum": 0
          },
          "nextRetryAt": {
            "type": "string",
            "nullable": true
          },
          "failureVersion": {
            "type": "string",
            "nullable": true,
            "description": "Opaque replay-stable version for the currently projected failure."
          },
          "customerMessage": {
            "type": "string",
            "nullable": true,
            "description": "Customer-safe explanation; raw provider text is never projected here."
          },
          "needsCustomerAction": {
            "type": "boolean",
            "description": "Whether the current recovery state can benefit from customer action."
          },
          "resolvedAt": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/MerchantPaymentRecoveryCustomerDto"
          },
          "failureCode": {
            "type": "string",
            "nullable": true,
            "description": "Latest bounded provider failure code for merchant diagnostics."
          },
          "failureMessage": {
            "type": "string",
            "nullable": true,
            "description": "Latest bounded provider failure message for merchant diagnostics."
          },
          "terminalConfiguredAction": {
            "type": "string",
            "enum": [
              "UNPAID",
              "CANCEL",
              "SUSPEND",
              "MANUAL_RECOVERY"
            ],
            "nullable": true,
            "description": "Terminal action configured by the tenant before provider precedence is applied."
          },
          "terminalActionSource": {
            "type": "string",
            "enum": [
              "TENANT_POLICY",
              "PROVIDER_PREEMPTED"
            ],
            "nullable": true,
            "description": "Whether tenant policy applied or an irreversible provider result pre-empted it."
          },
          "terminalActionClaimedAt": {
            "type": "string",
            "nullable": true
          },
          "terminalActionAttemptCount": {
            "type": "number",
            "minimum": 0
          },
          "terminalActionLastAttemptAt": {
            "type": "string",
            "nullable": true
          },
          "terminalActionLastError": {
            "type": "string",
            "nullable": true,
            "description": "Latest bounded terminal-application failure for operators."
          },
          "lastNotifiedAt": {
            "type": "string",
            "nullable": true,
            "description": "When the customer was last successfully sent a reminder."
          },
          "resendsRemainingInWindow": {
            "type": "number",
            "description": "Staff resends still allowed inside the current rolling window. Automatic reminders never consume it."
          },
          "resendAvailableAt": {
            "type": "string",
            "nullable": true,
            "description": "When another staff resend becomes available; null when one is available now."
          },
          "resendBlockedReason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "COOLDOWN",
              "RECOVERY_NOT_OPEN"
            ],
            "description": "Why a resend is currently unavailable, or null when it is available."
          }
        },
        "required": [
          "id",
          "status",
          "terminalAction",
          "terminalEntitlementBehavior",
          "terminalSelfServeRecovery",
          "terminalActionAppliedAt",
          "subscription",
          "billingPeriod",
          "attemptCount",
          "nextRetryAt",
          "failureVersion",
          "customerMessage",
          "needsCustomerAction",
          "resolvedAt",
          "createdAt",
          "updatedAt",
          "customer",
          "failureCode",
          "failureMessage",
          "terminalConfiguredAction",
          "terminalActionSource",
          "terminalActionClaimedAt",
          "terminalActionAttemptCount",
          "terminalActionLastAttemptAt",
          "terminalActionLastError",
          "lastNotifiedAt",
          "resendsRemainingInWindow",
          "resendAvailableAt",
          "resendBlockedReason"
        ]
      },
      "MerchantSubscriptionPaymentRecoveryListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantSubscriptionPaymentRecoveryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page, or null when this is the final page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CustomerAccountEntitlementSubscriptionSummaryDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "INCOMPLETE",
              "INCOMPLETE_EXPIRED",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "PAUSED",
              "CANCEL_AT_PERIOD_END",
              "CANCELED",
              "UNPAID"
            ]
          },
          "posture": {
            "type": "string",
            "enum": [
              "active",
              "grace",
              "frozen",
              "expired",
              "terminal",
              "never_activated",
              "no_window"
            ],
            "description": "Why this subscription does (or does not) contribute honored entitlements right now, derived from lifecycle status + tenant policy."
          },
          "windowKey": {
            "type": "string",
            "nullable": true,
            "description": "Deterministic identity of the current grant window."
          },
          "currentPeriodStart": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "graceUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Honor boundary when the posture is `grace`."
          },
          "publicRef": {
            "type": "string",
            "pattern": "^s[0-9a-f]{32}$",
            "example": "s0123456789abcdef0123456789abcdef",
            "description": "Opaque customer-safe subscription handle. Correlation only; not authorization."
          }
        },
        "required": [
          "status",
          "posture",
          "windowKey",
          "currentPeriodStart",
          "currentPeriodEnd",
          "graceUntil",
          "publicRef"
        ]
      },
      "CustomerAccountEntitlementEntryDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Plan-authored capability key."
          },
          "entitlementType": {
            "type": "string",
            "enum": [
              "ACCESS",
              "DISCOUNT",
              "ALLOWANCE",
              "SERVICE_CREDIT",
              "LIMIT_OVERRIDE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "GRACE",
              "EXPIRED",
              "REVOKED",
              "FROZEN"
            ],
            "description": "The status this grant EFFECTIVELY has right now, derived from live subscription state + tenant policy (the projection converges the stored row onto the same answer)."
          },
          "honored": {
            "type": "boolean",
            "description": "True only for ACTIVE / GRACE — the sole statuses a caller may honor. Display truth, never authorization for a mutation."
          },
          "windowKey": {
            "type": "string",
            "description": "Grant window identity."
          },
          "effectiveFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "effectiveTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "graceUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "percentOff": {
            "type": "number",
            "nullable": true
          },
          "amountOffInCents": {
            "type": "number",
            "nullable": true
          },
          "unitLabel": {
            "type": "string",
            "nullable": true
          },
          "unitsGranted": {
            "type": "number",
            "nullable": true,
            "description": "Window balance fields — ALLOWANCE / SERVICE_CREDIT only."
          },
          "unitsConsumed": {
            "type": "number",
            "nullable": true
          },
          "unitsRemaining": {
            "type": "number",
            "nullable": true
          },
          "limitKey": {
            "type": "string",
            "nullable": true
          },
          "limitValue": {
            "type": "number",
            "nullable": true
          },
          "issue": {
            "type": "string",
            "nullable": true,
            "enum": [
              "invalid_config",
              "rollover_policy_unset"
            ],
            "description": "Fail-closed reason this entry cannot be honored (mirrors the projection’s operator-actionable reconciliation states)."
          },
          "subscriptionPublicRef": {
            "type": "string",
            "pattern": "^s[0-9a-f]{32}$",
            "example": "s0123456789abcdef0123456789abcdef",
            "description": "Opaque customer-safe handle for the subscription that produced this grant. Correlation only; not authorization."
          }
        },
        "required": [
          "key",
          "entitlementType",
          "status",
          "honored",
          "windowKey",
          "effectiveFrom",
          "effectiveTo",
          "graceUntil",
          "percentOff",
          "amountOffInCents",
          "unitLabel",
          "unitsGranted",
          "unitsConsumed",
          "unitsRemaining",
          "limitKey",
          "limitValue",
          "issue",
          "subscriptionPublicRef"
        ]
      },
      "EntitlementDiscountDto": {
        "type": "object",
        "properties": {
          "percentOff": {
            "type": "number",
            "nullable": true,
            "description": "Discount in basis points (1–10000), when percentage-based."
          },
          "amountOffInCents": {
            "type": "number",
            "nullable": true,
            "description": "Fixed discount in cents, when amount-based."
          }
        },
        "required": [
          "percentOff",
          "amountOffInCents"
        ]
      },
      "EffectiveEntitlementDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Plan-authored capability key."
          },
          "entitlementType": {
            "type": "string",
            "enum": [
              "ACCESS",
              "DISCOUNT",
              "ALLOWANCE",
              "SERVICE_CREDIT",
              "LIMIT_OVERRIDE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "GRACE"
            ],
            "description": "Honor ceiling across sources: ACTIVE beats GRACE."
          },
          "graceUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Latest honor boundary when every source is in GRACE."
          },
          "discounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntitlementDiscountDto"
            }
          },
          "unitsRemaining": {
            "type": "number",
            "nullable": true,
            "description": "Remaining units summed across honored windows."
          },
          "unitLabel": {
            "type": "string",
            "nullable": true
          },
          "limitKey": {
            "type": "string",
            "nullable": true
          },
          "limitValue": {
            "type": "number",
            "nullable": true,
            "description": "Highest honored override for the key."
          }
        },
        "required": [
          "key",
          "entitlementType",
          "status",
          "graceUntil",
          "discounts",
          "unitsRemaining",
          "unitLabel",
          "limitKey",
          "limitValue"
        ]
      },
      "CustomerAccountEntitlementsResponseDto": {
        "type": "object",
        "properties": {
          "evaluatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAccountEntitlementSubscriptionSummaryDto"
            }
          },
          "entries": {
            "description": "Every current-window grant, honored or not.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerAccountEntitlementEntryDto"
            }
          },
          "effective": {
            "description": "Only honored capabilities, rolled up per key.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EffectiveEntitlementDto"
            }
          }
        },
        "required": [
          "evaluatedAt",
          "subscriptions",
          "entries",
          "effective"
        ]
      },
      "EntitlementSubscriptionSummaryDto": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "string",
            "description": "Local subscription identifier for merchant and server-to-server reads."
          },
          "status": {
            "type": "string",
            "enum": [
              "INCOMPLETE",
              "INCOMPLETE_EXPIRED",
              "TRIALING",
              "ACTIVE",
              "PAST_DUE",
              "PAUSED",
              "CANCEL_AT_PERIOD_END",
              "CANCELED",
              "UNPAID"
            ]
          },
          "posture": {
            "type": "string",
            "enum": [
              "active",
              "grace",
              "frozen",
              "expired",
              "terminal",
              "never_activated",
              "no_window"
            ],
            "description": "Why this subscription does (or does not) contribute honored entitlements right now, derived from lifecycle status + tenant policy."
          },
          "windowKey": {
            "type": "string",
            "nullable": true,
            "description": "Deterministic identity of the current grant window."
          },
          "currentPeriodStart": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "graceUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Honor boundary when the posture is `grace`."
          }
        },
        "required": [
          "subscriptionId",
          "status",
          "posture",
          "windowKey",
          "currentPeriodStart",
          "currentPeriodEnd",
          "graceUntil"
        ]
      },
      "EntitlementEntryDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Plan-authored capability key."
          },
          "entitlementType": {
            "type": "string",
            "enum": [
              "ACCESS",
              "DISCOUNT",
              "ALLOWANCE",
              "SERVICE_CREDIT",
              "LIMIT_OVERRIDE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "GRACE",
              "EXPIRED",
              "REVOKED",
              "FROZEN"
            ],
            "description": "The status this grant EFFECTIVELY has right now, derived from live subscription state + tenant policy (the projection converges the stored row onto the same answer)."
          },
          "honored": {
            "type": "boolean",
            "description": "True only for ACTIVE / GRACE — the sole statuses a caller may honor. Display truth, never authorization for a mutation."
          },
          "subscriptionId": {
            "type": "string",
            "description": "Local subscription identifier for merchant and server-to-server reads."
          },
          "windowKey": {
            "type": "string",
            "description": "Grant window identity."
          },
          "effectiveFrom": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "effectiveTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "graceUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "percentOff": {
            "type": "number",
            "nullable": true
          },
          "amountOffInCents": {
            "type": "number",
            "nullable": true
          },
          "unitLabel": {
            "type": "string",
            "nullable": true
          },
          "unitsGranted": {
            "type": "number",
            "nullable": true,
            "description": "Window balance fields — ALLOWANCE / SERVICE_CREDIT only."
          },
          "unitsConsumed": {
            "type": "number",
            "nullable": true
          },
          "unitsRemaining": {
            "type": "number",
            "nullable": true
          },
          "limitKey": {
            "type": "string",
            "nullable": true
          },
          "limitValue": {
            "type": "number",
            "nullable": true
          },
          "issue": {
            "type": "string",
            "nullable": true,
            "enum": [
              "invalid_config",
              "rollover_policy_unset"
            ],
            "description": "Fail-closed reason this entry cannot be honored (mirrors the projection’s operator-actionable reconciliation states)."
          }
        },
        "required": [
          "key",
          "entitlementType",
          "status",
          "honored",
          "subscriptionId",
          "windowKey",
          "effectiveFrom",
          "effectiveTo",
          "graceUntil",
          "percentOff",
          "amountOffInCents",
          "unitLabel",
          "unitsGranted",
          "unitsConsumed",
          "unitsRemaining",
          "limitKey",
          "limitValue",
          "issue"
        ]
      },
      "CustomerEntitlementsResponseDto": {
        "type": "object",
        "properties": {
          "evaluatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntitlementSubscriptionSummaryDto"
            }
          },
          "entries": {
            "description": "Every current-window grant, honored or not.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntitlementEntryDto"
            }
          },
          "effective": {
            "description": "Only honored capabilities, rolled up per key.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EffectiveEntitlementDto"
            }
          }
        },
        "required": [
          "evaluatedAt",
          "subscriptions",
          "entries",
          "effective"
        ]
      },
      "EntitlementCheckResponseDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The checked entitlement key."
          },
          "honored": {
            "type": "boolean",
            "description": "Authoritative live answer — true only when the key is honored for this customer at this instant."
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          },
          "matches": {
            "description": "Every honored compatible-definition rollup for the key (keys are plan-local — one key can name several distinct definitions). Empty when not honored.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EffectiveEntitlementDto"
            }
          }
        },
        "required": [
          "key",
          "honored",
          "checkedAt",
          "matches"
        ]
      },
      "ConsumeEntitlementDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Plan-authored entitlement key to consume from.",
            "example": "monthly-washes"
          },
          "units": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Units to consume from the current window."
          },
          "idempotencyKey": {
            "type": "string",
            "description": "Caller-chosen replay key, scoped to the customer. Retrying with the same key returns the recorded outcome without consuming again — even after windows advanced or the entitlement stopped being honored; reusing it with a different request is rejected (409 ENTITLEMENT_NOT_CONSUMABLE / IDEMPOTENCY_CONFLICT).",
            "minLength": 1,
            "maxLength": 200
          },
          "entitlementType": {
            "type": "string",
            "enum": [
              "ALLOWANCE",
              "SERVICE_CREDIT"
            ],
            "description": "Disambiguator: keys are plan-local, so one key may name several distinct balance definitions. Required (with or `unitLabel`) when the request would otherwise be ambiguous (409 AMBIGUOUS_DEFINITION)."
          },
          "unitLabel": {
            "type": "string",
            "maxLength": 40,
            "description": "Disambiguator: restricts consumption to the definition carrying this unit label."
          }
        },
        "required": [
          "key",
          "units",
          "idempotencyKey"
        ]
      },
      "EntitlementConsumptionResponseDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "entitlementType": {
            "type": "string",
            "enum": [
              "ALLOWANCE",
              "SERVICE_CREDIT"
            ]
          },
          "subscriptionId": {
            "type": "string"
          },
          "windowKey": {
            "type": "string"
          },
          "unitsConsumed": {
            "type": "number",
            "description": "Units THIS request consumed (0 on a replayed request)."
          },
          "unitsGranted": {
            "type": "number"
          },
          "unitsConsumedTotal": {
            "type": "number",
            "description": "Total consumed on the window after this request."
          },
          "unitsRemaining": {
            "type": "number"
          },
          "consumedAt": {
            "type": "string",
            "format": "date-time"
          },
          "replayed": {
            "type": "boolean",
            "description": "True when the idempotency key had already consumed — the recorded outcome was returned and no new units were spent."
          }
        },
        "required": [
          "key",
          "entitlementType",
          "subscriptionId",
          "windowKey",
          "unitsConsumed",
          "unitsGranted",
          "unitsConsumedTotal",
          "unitsRemaining",
          "consumedAt",
          "replayed"
        ]
      },
      "EntitlementDisplayTokenResponseDto": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Signed JWS compact token (alg EdDSA / Ed25519) over the customer’s effective entitlements. READ/DISPLAY ONLY — the API never accepts it as authorization; verify against the published JWKS."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "kid": {
            "type": "string",
            "description": "Key id the token was signed with."
          },
          "algorithm": {
            "type": "string",
            "enum": [
              "EdDSA"
            ]
          },
          "jwksPath": {
            "type": "string",
            "description": "Where the verification keys are published.",
            "example": "/api/v1/public/entitlement-tokens/jwks"
          }
        },
        "required": [
          "token",
          "expiresAt",
          "kid",
          "algorithm",
          "jwksPath"
        ]
      },
      "EntitlementTokenJwkDto": {
        "type": "object",
        "properties": {
          "kty": {
            "type": "string",
            "enum": [
              "OKP"
            ]
          },
          "crv": {
            "type": "string",
            "enum": [
              "Ed25519"
            ]
          },
          "x": {
            "type": "string",
            "description": "base64url raw Ed25519 public key."
          },
          "kid": {
            "type": "string"
          },
          "alg": {
            "type": "string",
            "enum": [
              "EdDSA"
            ]
          },
          "use": {
            "type": "string",
            "enum": [
              "sig"
            ]
          }
        },
        "required": [
          "kty",
          "crv",
          "x",
          "kid",
          "alg",
          "use"
        ]
      },
      "EntitlementTokenJwksResponseDto": {
        "type": "object",
        "properties": {
          "keys": {
            "description": "Empty when token signing is not configured in this environment (verifiers fail closed).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntitlementTokenJwkDto"
            }
          }
        },
        "required": [
          "keys"
        ]
      },
      "Plan": {
        "type": "string",
        "enum": [
          "FREE_TRIAL",
          "PRO",
          "ENTERPRISE"
        ],
        "description": "Plan to price. Only PRO is self-serve priceable today."
      },
      "PublishedPlanPriceDto": {
        "type": "object",
        "properties": {
          "plan": {
            "description": "The platform plan this price is for.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Plan"
              }
            ]
          },
          "cadence": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "description": "Billing cadence."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, lowercase.",
            "example": "usd"
          },
          "unitAmount": {
            "type": "integer",
            "format": "int32",
            "description": "Price in the currency's smallest (minor) unit — e.g. 9900 = $99.00 for USD cents. Do not assume a fixed /100 divisor: zero-decimal currencies (e.g. JPY) have no minor unit; apply the currency's own decimal rules.",
            "example": 9900
          },
          "displayLabel": {
            "type": "string",
            "description": "Optional human-readable label for the price.",
            "nullable": true
          },
          "quoteId": {
            "type": "string",
            "description": "Opaque identity of this exact published price version. Not a Stripe or database id. Send it back with amount/currency when subscribing; stale quotes are rejected before any subscription mutation.",
            "example": "ppq_v1_0123456789abcdef0123456789abcdef0123456789a",
            "pattern": "^ppq_v1_[A-Za-z0-9_-]{43}$"
          }
        },
        "required": [
          "plan",
          "cadence",
          "currency",
          "unitAmount",
          "displayLabel",
          "quoteId"
        ]
      },
      "ApiSchemaIdentityDto": {
        "type": "object",
        "properties": {
          "schemaDigest": {
            "type": "string",
            "description": "Content digest of the public OpenAPI document this build was generated from, as `sha256:<64 lowercase hex>`. Identical to `info.version` in the published API reference when that reference describes this runtime. Computed over the whole generated document except `servers` (environment presentation, rewritten per publication target) and `info.version` itself. Compare the two strings verbatim — the value is opaque and carries no ordering, so \"newer\" and \"older\" are not decidable from it.",
            "example": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        },
        "required": [
          "schemaDigest"
        ]
      },
      "SandboxStatusDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether this tenant has an initialized, empty-by-default Sandbox."
          },
          "storefrontUrl": {
            "type": "string",
            "nullable": true,
            "description": "Sandbox storefront origin, or null when none is configured. Domain ownership must still be verified."
          },
          "checkoutUrl": {
            "type": "string",
            "description": "Hosted cartonium checkout origin for Sandbox sessions only."
          },
          "stripeConfigured": {
            "type": "boolean",
            "description": "Whether the platform has the test-only Stripe credentials needed for Sandbox checkout."
          }
        },
        "required": [
          "enabled",
          "storefrontUrl",
          "checkoutUrl",
          "stripeConfigured"
        ]
      },
      "UpdateSandboxDto": {
        "type": "object",
        "properties": {
          "storefrontUrl": {
            "type": "string",
            "nullable": true,
            "description": "HTTPS origin of the Sandbox storefront; null clears it. Must differ from every live storefront domain."
          }
        },
        "required": [
          "storefrontUrl"
        ]
      },
      "SearchSupportProviderCatalogDto": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Customer product-discovery query. With variant_name, identify one product by exact public name or slug; without it, an exact unambiguous variant name or combined variant-and-product name or slug words in either order can select a variant. Short multi-word queries can discover products across public catalog fields, but generic or ambiguous matches remain item-level results. Tenant and audience are resolved from the connection credential, never from this body.",
            "minLength": 1,
            "maxLength": 200,
            "example": "natural deodorant for sensitive skin"
          },
          "variant_name": {
            "type": "string",
            "description": "Optional exact live variant name within the product identified by query. Empty means a generic query. A null selected_variant means no variant was selected; do not use product-level price, availability, or URL as facts about the requested variant.",
            "maxLength": 200,
            "example": "Unscented"
          }
        },
        "required": [
          "query"
        ]
      },
      "SupportProviderCatalogSelectedVariantDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The exact live variant name selected by this query."
          },
          "price_in_cents": {
            "type": "number",
            "description": "Current effective price of this selected variant, in the product currency minor unit."
          },
          "availability": {
            "type": "string",
            "enum": [
              "IN_STOCK",
              "OUT_OF_STOCK",
              "AVAILABLE",
              "CHECK_REQUIRED"
            ],
            "description": "Availability of this selected variant only. CHECK_REQUIRED means stock is not established by this read, including when its inventory row is absent; no quantity or reservation data is exposed."
          }
        },
        "required": [
          "name",
          "price_in_cents",
          "availability"
        ]
      },
      "SupportProviderCatalogProductDto": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "description": "Tenant-scoped public product slug."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "Bounded public storefront description. No metadata, staff fields, or private customer data is included."
          },
          "product_type": {
            "type": "string",
            "enum": [
              "SALE",
              "RENTAL",
              "SERVICE"
            ]
          },
          "minimum_price_in_cents": {
            "type": "number",
            "description": "Lowest current public item/variant price, in the tenant currency minor unit."
          },
          "maximum_price_in_cents": {
            "type": "number",
            "description": "Highest current public item/variant price, in the tenant currency minor unit."
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "availability": {
            "type": "string",
            "enum": [
              "IN_STOCK",
              "OUT_OF_STOCK",
              "AVAILABLE",
              "CHECK_REQUIRED"
            ],
            "description": "Public availability summary. Inventory quantities, thresholds, reservations, and capacity remain private."
          },
          "selected_variant": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SupportProviderCatalogSelectedVariantDto"
              },
              {
                "type": "object",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            ],
            "description": "Exact live variant selected by an unambiguous product-plus-variant match or a tenant-unique variant-name query. Null for generic, ambiguous, missing, or stale matches; when a variant was requested, null does not authorize claims about that variant from product-level aggregates. When present, use its price and availability for claims about the named variant; the product price range and availability above remain aggregates."
          },
          "image_url": {
            "type": "string",
            "nullable": true
          },
          "product_url": {
            "type": "string",
            "description": "Environment-correct tenant product page link. An unambiguous product-plus-variant match or tenant-unique variant-name query selects that variant with ?variant=<id>; generic or ambiguous queries use the item page. A parent item link is not a link to a requested but unselected variant. When a variant is selected, use selected_variant for its price and availability, not the product-level summaries. The tenant storefront origin is resolved at query time when configured, else the cartonium redirect is used."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "slug",
          "name",
          "description",
          "product_type",
          "minimum_price_in_cents",
          "maximum_price_in_cents",
          "currency",
          "availability",
          "selected_variant",
          "image_url",
          "product_url",
          "updated_at"
        ]
      },
      "SupportProviderCatalogSearchResponseDto": {
        "type": "object",
        "properties": {
          "catalog_status": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "NO_MATCHES"
            ]
          },
          "audience": {
            "type": "string",
            "enum": [
              "PUBLIC_STOREFRONT"
            ]
          },
          "freshness": {
            "type": "string",
            "enum": [
              "LIVE_QUERY"
            ]
          },
          "refreshed_at": {
            "type": "string",
            "format": "date-time"
          },
          "fallback_message": {
            "type": "string",
            "nullable": true
          },
          "products": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportProviderCatalogProductDto"
            }
          }
        },
        "required": [
          "catalog_status",
          "audience",
          "freshness",
          "refreshed_at",
          "fallback_message",
          "products"
        ]
      }
    }
  }
}
