{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/toku/json-schema/toku-billing-document-response-schema.json",
  "title": "BillingDocumentResponse",
  "description": "Billing document emitido, con sus datos fiscales y los enlaces a su PDF y su XML.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/toku-facturaci-n-api-openapi.yml#/components/schemas/BillingDocumentResponse",
  "properties": {
    "billing_address": {
      "title": "Billing Address",
      "type": "string"
    },
    "billing_email": {
      "title": "Billing Email",
      "type": "string"
    },
    "checkout_session_id": {
      "title": "Checkout Session Id",
      "type": "string"
    },
    "discount": {
      "title": "Discount",
      "type": "number"
    },
    "fiscal_billing_id": {
      "title": "Fiscal Billing Id",
      "type": "string"
    },
    "folio": {
      "title": "Folio",
      "type": "string"
    },
    "id_account": {
      "title": "Id Account",
      "type": "string"
    },
    "id_billing_document": {
      "title": "Id Billing Document",
      "type": "string"
    },
    "id_customer": {
      "title": "Id Customer",
      "type": "string"
    },
    "id_invoice": {
      "title": "Id Invoice",
      "type": "string"
    },
    "id_transaction": {
      "title": "Id Transaction",
      "type": "string"
    },
    "issue_date": {
      "format": "date-time",
      "title": "Issue Date",
      "type": "string"
    },
    "pdf_url": {
      "title": "Pdf Url",
      "type": "string"
    },
    "provider_external_id": {
      "title": "Provider External Id",
      "type": "string"
    },
    "public_pdf_url": {
      "title": "Public Pdf Url",
      "type": "string"
    },
    "public_xml_url": {
      "title": "Public Xml Url",
      "type": "string"
    },
    "related_fiscal_billing_id": {
      "title": "Related Fiscal Billing Id",
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/BillingDocumentStatus"
    },
    "sub_total": {
      "title": "Sub Total",
      "type": "number"
    },
    "tax_id": {
      "title": "Tax Id",
      "type": "string"
    },
    "tax_regime": {
      "title": "Tax Regime",
      "type": "string"
    },
    "tax_zip_code": {
      "title": "Tax Zip Code",
      "type": "string"
    },
    "total": {
      "title": "Total",
      "type": "number"
    },
    "type": {
      "$ref": "#/$defs/BillingDocumentType"
    },
    "xml_url": {
      "title": "Xml Url",
      "type": "string"
    }
  },
  "required": [
    "id_billing_document",
    "id_account",
    "folio",
    "issue_date",
    "sub_total",
    "discount",
    "total",
    "pdf_url",
    "xml_url",
    "provider_external_id",
    "fiscal_billing_id",
    "tax_id",
    "tax_regime",
    "tax_zip_code"
  ],
  "type": "object",
  "$defs": {
    "BillingDocumentStatus": {
      "description": "Estado de un comprobante fiscal mexicano ante el SAT. Nace `ISSUED`, que es el documento ya timbrado y vigente. Pedir su cancelación lo deja en `PENDING_CANCELLATION` mientras el receptor la acepta, y el documento sigue vigente durante esa espera: pasa a `CANCELLED` si la acepta, y vuelve a `ISSUED` si la ventana de aceptación vence sin respuesta.\n\n`FAILED` está declarado pero ningún flujo lo emite: el comprobante se registra solo después de timbrarse, así que un timbrado fallido no deja documento.",
      "enum": [
        "ISSUED",
        "FAILED",
        "CANCELLED",
        "PENDING_CANCELLATION"
      ],
      "title": "BillingDocumentStatus"
    },
    "BillingDocumentType": {
      "description": "Clase de comprobante fiscal mexicano (CFDI) que se emitió: `INVOICE` es la factura de ingreso que documenta la venta, `COMPLEMENT` el complemento de pago que acusa el pago de una factura PPD ya emitida, y `CREDIT_NOTE` la nota de crédito que rebaja o revierte un comprobante anterior, relacionada al CFDI original.",
      "enum": [
        "INVOICE",
        "CREDIT_NOTE",
        "COMPLEMENT"
      ],
      "title": "BillingDocumentType"
    }
  }
}