{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tgpaycrypto-com/json-schema/tgpaycrypto-com-invoice-schema.json",
  "title": "Invoice",
  "description": "The invoice object — API results and invoice webhook payloads.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tgpaycrypto-com-openapi.json#/components/schemas/Invoice",
  "type": "object",
  "properties": {
    "invoice_id": {
      "type": "integer"
    },
    "hash": {
      "type": "string",
      "description": "Public ID (also inside pay_url)."
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paid",
        "expired"
      ]
    },
    "currency_type": {
      "type": "string",
      "enum": [
        "crypto",
        "fiat"
      ]
    },
    "asset": {
      "type": [
        "string",
        "null"
      ],
      "description": "Crypto invoice: the fixed asset. Fiat invoice: always null here (see paid_asset)."
    },
    "fiat": {
      "type": [
        "string",
        "null"
      ]
    },
    "accepted_assets": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Fiat invoices: the assets the payer may pay with; null for crypto invoices."
    },
    "amount": {
      "type": [
        "string",
        "null"
      ],
      "description": "Face amount: fiat units for fiat invoices, crypto units otherwise. Null for an unpaid open-amount invoice."
    },
    "amount_minor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Crypto amount in minor units (string); null while a fiat/open-amount invoice is unpaid."
    },
    "paid_asset": {
      "type": [
        "string",
        "null"
      ],
      "description": "Once paid: the asset the payer chose on a fiat invoice, or the asset sent on a crypto invoice paid by a transfer in another asset; null otherwise."
    },
    "paid_amount": {
      "type": [
        "string",
        "null"
      ],
      "description": "Once paid, in the same cases as paid_asset: the crypto amount actually paid."
    },
    "paid_fiat_rate": {
      "type": [
        "string",
        "null"
      ],
      "description": "Fiat invoices, once paid: the fiat-per-asset rate used."
    },
    "paid_usd_rate": {
      "type": [
        "string",
        "null"
      ],
      "description": "USD price of the paid asset stamped at pay time."
    },
    "fee_asset": {
      "type": [
        "string",
        "null"
      ]
    },
    "fee_amount": {
      "type": [
        "string",
        "null"
      ],
      "description": "Platform fee, charged to the merchant's leg — the authoritative number for reconciliation."
    },
    "fee": {
      "type": [
        "string",
        "null"
      ],
      "deprecated": true,
      "description": "Deprecated alias of fee_amount."
    },
    "usd_rate": {
      "type": [
        "string",
        "null"
      ],
      "deprecated": true,
      "description": "Deprecated alias of paid_usd_rate."
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "hidden_message": {
      "type": [
        "string",
        "null"
      ]
    },
    "payload": {
      "type": [
        "string",
        "null"
      ]
    },
    "allow_comments": {
      "type": "boolean"
    },
    "allow_anonymous": {
      "type": "boolean"
    },
    "comment": {
      "type": [
        "string",
        "null"
      ],
      "description": "The payer's comment (only if allowed)."
    },
    "paid_anonymously": {
      "type": "boolean"
    },
    "is_anonymous": {
      "type": "boolean",
      "description": "Alias of paid_anonymously."
    },
    "paid_btn_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "paid_btn_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "swap_to": {
      "type": [
        "string",
        "null"
      ]
    },
    "is_swapped": {
      "type": "boolean"
    },
    "is_swap_pending": {
      "type": "boolean",
      "description": "The swap_to conversion could not run at payment time and is retried until it runs; the receipt stays in the paid asset meanwhile."
    },
    "swapped_uid": {
      "type": [
        "string",
        "null"
      ]
    },
    "swapped_to": {
      "type": [
        "string",
        "null"
      ]
    },
    "swapped_rate": {
      "type": [
        "string",
        "null"
      ]
    },
    "swapped_output": {
      "type": [
        "string",
        "null"
      ]
    },
    "swapped_usd_rate": {
      "type": [
        "string",
        "null"
      ]
    },
    "swapped_usd_amount": {
      "type": [
        "string",
        "null"
      ]
    },
    "pay_url": {
      "type": "string",
      "description": "t.me deep link the payer opens."
    },
    "bot_invoice_url": {
      "type": "string",
      "description": "Alias of pay_url."
    },
    "mini_app_invoice_url": {
      "type": "string",
      "description": "Alias of pay_url."
    },
    "web_app_invoice_url": {
      "type": "string",
      "description": "Alias of pay_url, except while the app accepts payment by a transfer to an address — then the invoice's public payment page, which opens in any browser."
    },
    "paid_by_user_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The payer's Telegram ID — null when the payer paid anonymously or by a transfer to an address."
    },
    "open_amount": {
      "type": "boolean",
      "description": "This is an open-amount (donation) invoice."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "paid_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "refunded_amount": {
      "type": [
        "string",
        "null"
      ],
      "description": "Cumulative refunded crypto amount in the settlement asset, including for fiat-priced invoices."
    },
    "refunded_minor": {
      "type": [
        "string",
        "null"
      ],
      "description": "The same in minor units (string)."
    },
    "refunded_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Stamped once fully refunded (status stays paid)."
    },
    "rate_lock_until": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Rate-lock deadline; null when no lock was requested."
    },
    "rate_lock_rates": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "{asset_code: rate_string} stamped at creation — the exact rates quoted while the lock is live."
    },
    "expiration_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Alias of expiration_date."
    },
    "client_invoice_id": {
      "type": "string",
      "description": "Present only on an invoice created with client_invoice_id."
    },
    "max_payments": {
      "type": "integer",
      "description": "Present only on a multi-payment invoice (created with max_payments above 1)."
    },
    "payments_count": {
      "type": "integer",
      "description": "Payments taken so far; present with max_payments."
    },
    "parent_invoice_id": {
      "type": "integer",
      "description": "Present only on one payment of a multi-payment invoice — the link's invoice_id."
    },
    "cancel_url": {
      "type": "string",
      "description": "Present only on an invoice created with cancel_url."
    },
    "customer": {
      "type": "object",
      "description": "Present only on an invoice created with customer; never shown to the payer.",
      "properties": {
        "id": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "telegram_id": {
          "type": "string"
        },
        "telegram_username": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "invoice_id",
    "hash",
    "status",
    "currency_type",
    "asset",
    "fiat",
    "accepted_assets",
    "amount",
    "amount_minor",
    "paid_asset",
    "paid_amount",
    "paid_fiat_rate",
    "paid_usd_rate",
    "fee_asset",
    "fee_amount",
    "fee",
    "usd_rate",
    "description",
    "hidden_message",
    "payload",
    "allow_comments",
    "allow_anonymous",
    "comment",
    "paid_anonymously",
    "is_anonymous",
    "paid_btn_name",
    "paid_btn_url",
    "swap_to",
    "is_swapped",
    "is_swap_pending",
    "swapped_uid",
    "swapped_to",
    "swapped_rate",
    "swapped_output",
    "swapped_usd_rate",
    "swapped_usd_amount",
    "pay_url",
    "bot_invoice_url",
    "mini_app_invoice_url",
    "web_app_invoice_url",
    "paid_by_user_id",
    "open_amount",
    "created_at",
    "paid_at",
    "refunded_amount",
    "refunded_minor",
    "refunded_at",
    "rate_lock_until",
    "rate_lock_rates",
    "expiration_date",
    "expires_at"
  ]
}