{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/freeport-gg/json-schema/freeport-gg-order-schema.json",
  "title": "Order",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/freeport-gg-api-openapi.json#/components/schemas/Order",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "A prefixed ULID"
    },
    "state": {
      "type": "string",
      "enum": [
        "paid",
        "accepted",
        "delivering",
        "delivered",
        "disputed",
        "completed",
        "cancelled",
        "expired",
        "refunded",
        "partially_refunded"
      ]
    },
    "state_updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "last_event_seq": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The newest event's seq, so a poller can tell whether the webhooks it holds are behind the order it is looking at."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "listing": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "A prefixed ULID"
        },
        "external_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "title": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "external_id",
        "title"
      ],
      "additionalProperties": false
    },
    "boost": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "offer_id": {
          "type": "string",
          "description": "A prefixed ULID"
        },
        "config": {
          "type": [
            "object",
            "null"
          ]
        }
      },
      "required": [
        "offer_id",
        "config"
      ],
      "additionalProperties": false
    },
    "game": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "slug",
        "name"
      ],
      "additionalProperties": false
    },
    "server": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "faction": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "slug",
        "name",
        "faction"
      ],
      "additionalProperties": false
    },
    "category_kind": {
      "type": [
        "string",
        "null"
      ]
    },
    "quantity": {
      "type": "integer",
      "format": "int64"
    },
    "unit_label": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "The listing description as the buyer bought it. Null on an order placed before 2026-10-03."
    },
    "attributes": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "The facts the listing carried when it was bought: an account’s rank, an item’s type. Null on an order placed before 2026-10-03."
    },
    "price_per_qty": {
      "type": "integer",
      "format": "int64"
    },
    "unit_price": {
      "type": "string",
      "pattern": "^\\d+(\\.\\d+)?$",
      "description": "A decimal string in the row's currency. Never a float."
    },
    "subtotal": {
      "type": "string",
      "pattern": "^\\d+(\\.\\d+)?$",
      "description": "The price: what you are paid from."
    },
    "seller_fee": {
      "type": "string",
      "pattern": "^\\d+(\\.\\d+)?$",
      "description": "Your commission on the price, after any commission coupon of yours."
    },
    "commission_discount": {
      "type": "string",
      "pattern": "^\\d+(\\.\\d+)?$",
      "description": "What a commission coupon of yours took off the commission on this order: zero when none did. The coupon is claimed when the order is paid."
    },
    "payout_fee": {
      "type": "string",
      "pattern": "^\\d+(\\.\\d+)?$",
      "description": "The payout fee on the price, taken with your commission, which makes your withdrawals to your bank free. No coupon changes it. Zero on an order placed before the payout fee existed."
    },
    "currency": {
      "type": "string",
      "minLength": 3,
      "maxLength": 3
    },
    "buyer": {
      "type": "object",
      "properties": {
        "handle": {
          "type": [
            "string",
            "null"
          ]
        },
        "character_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The character to deliver to in the game. Null where the order needs none: an account, a gift card, or a top up that is not handed over in the game."
        },
        "player_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The player ID to load, for a top up loaded by one. As the buyer typed it. Null on every other order."
        },
        "zone_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The zone or server number that goes with the player ID, for a top up whose delivery method is UID + Zone ID. Null on every other order."
        }
      },
      "required": [
        "handle",
        "character_name",
        "player_id",
        "zone_id"
      ],
      "additionalProperties": false
    },
    "delivery_methods": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "How the seller offered to hand the currency over, copied from the listing at checkout. The buyer picks one in the order chat. Null when the listing is not currency or its game has no method list."
    },
    "deadlines": {
      "type": "object",
      "properties": {
        "accept_by": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "deliver_by": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "auto_confirm_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "accept_by",
        "deliver_by",
        "auto_confirm_at"
      ],
      "additionalProperties": false
    },
    "payout": {
      "type": "object",
      "properties": {
        "release_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When this order’s proceeds become withdrawable. Decided when the order completes and never brought forward afterwards. Null until then, and on an order that ended without a sale."
        },
        "hold_days": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The days that date was worked out from: the longer of what your track record and the order’s category asked for on the day it completed."
        }
      },
      "required": [
        "release_at",
        "hold_days"
      ],
      "additionalProperties": false
    },
    "fee_schedule_ids": {
      "type": "object",
      "properties": {
        "seller": {
          "type": [
            "string",
            "null"
          ],
          "description": "The published schedule row your commission was priced by."
        },
        "payout": {
          "type": [
            "string",
            "null"
          ],
          "description": "The published schedule row your payout fee was priced by. Null where the standard rate priced it, as on every order placed before the payout fee existed."
        }
      },
      "required": [
        "seller",
        "payout"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "id",
    "state",
    "state_updated_at",
    "last_event_seq",
    "created_at",
    "listing",
    "boost",
    "game",
    "server",
    "category_kind",
    "quantity",
    "unit_label",
    "description",
    "attributes",
    "price_per_qty",
    "unit_price",
    "subtotal",
    "seller_fee",
    "commission_discount",
    "payout_fee",
    "currency",
    "buyer",
    "delivery_methods",
    "deadlines",
    "payout",
    "fee_schedule_ids"
  ],
  "additionalProperties": false
}