Saltar a contenido

Sign invoice


title: Sign (stamp) an invoice

Stamp (timbrar) a draft invoice through the PAC. When billing is on this debits the stamp price from the caller's credit first (see get_account_credit): a credit that does not cover it answers insufficient_balance and nothing is stamped; a failed stamp is credited back. The deployment, not an argument, decides whether stamps are real CFDIs or PAC test stamps; every successful result reports which in ambiente ("produccion" or "prueba"). expected_version is the version last read; a stale version answers a conflict with the current version. A type I draft without a Receptor cannot be signed (invalid_argument, receptor_missing). A Fecha more than 72 hours old is replaced by the current Mexico City time. The stored amounts are signed exactly as saved. Drafts only, invoices and payment complements alike (signing a complement locks the paid PPD invoices and revalidates their balance: a stale one answers invalid_argument with payment_balance). Returns the signed invoice in the get_invoice shape (timbre.uuid and timbre.fecha_timbrado set) plus ambiente, or a needs_csd status if the issuer has no CSD.

Alcance (scope): invoices:write · Características: Destructiva, Interactúa con el mundo exterior

Parámetros

Parámetro Tipo Obligatorio Descripción
invoice_id string Sí
expected_version integer Sí
issuer string Sí Id of the issuer the call acts for, from list_issuers.

Esquema de entrada (JSON Schema)

{
  "type": "object",
  "properties": {
    "invoice_id": {
      "type": "string"
    },
    "expected_version": {
      "type": "integer",
      "minimum": 1
    },
    "issuer": {
      "type": "string",
      "format": "uuid",
      "description": "Id of the issuer the call acts for, from list_issuers."
    }
  },
  "required": [
    "invoice_id",
    "expected_version",
    "issuer"
  ]
}