Create credit note draft
title: Create a credit note draft¶
Build a draft credit note (nota de crédito, comprobante type E with CfdiRelacionados TipoRelacion 01) that reduces or reverses an invoice, without writing the document by hand. The invoice is named by exactly one of invoice_id (the id of one of your signed invoices, PUE or PPD; a draft, canceled or non-invoice document is refused) or folio_fiscal (its UUID; also valid for an invoice issued elsewhere). For your own invoice the server takes Receptor and, when conceptos is omitted, the concepts from it (a full credit); for an invoice issued elsewhere receptor ({Rfc, Nombre, DomicilioFiscalReceptor, RegimenFiscalReceptor, UsoCFDI?}) and conceptos are required, and nothing about that invoice is checked here. Other arguments: fecha (the note's own Fecha, YYYY-MM-DDTHH:MM:SS, required: the server never picks the clock), forma_pago (SAT c_FormaPago key, never 99: the note is PUE), uso_cfdi (default G02) and conceptos, the concepts to credit in the same shape as the document's Conceptos (ClaveProdServ, Cantidad, ClaveUnidad, Descripcion, ValorUnitario, ObjetoImp, Impuestos). moneda (SAT c_Moneda key) and tipo_cambio (required for a currency other than MXN) default to your invoice's own, or MXN for one issued elsewhere. informacion_global ({Periodicidad, Meses, Año}) is required exactly when the receptor is XAXX010101000 (público en general); for your own invoice it is copied from it when omitted. The server computes every amount and tax; the result is the stored draft in the get_invoice shape, an ordinary draft that update_invoice_draft replaces and sign_invoice stamps. The total credited across one of your invoices' signed notes cannot exceed its Total (credit_exceeds_total says what is left). Validation problems answer invalid_argument with the per-field errors. Returns a needs_csd status instead of a draft if the issuer has no CSD. An invoice with signed credit notes cannot be canceled until they are.
Alcance (scope): invoices:write · Características: —
Parámetros¶
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
invoice_id |
string | No | Id of one of your signed invoices |
folio_fiscal |
string | No | UUID of the invoice credited |
fecha |
string | Sí | YYYY-MM-DDTHH:MM:SS |
forma_pago |
string | Sí | SAT c_FormaPago key of the note, not 99 |
uso_cfdi |
string | No | SAT c_UsoCFDI key, default G02 |
receptor |
object | No | Required for an invoice issued elsewhere; overrides the invoice's receptor otherwise. |
conceptos |
array de object | No | Concept inputs as in the document; when omitted the whole invoice is credited. |
moneda |
string | No | SAT c_Moneda key; default the invoice's, else MXN |
tipo_cambio |
string | No | Exchange rate to MXN, up to 6 decimals; not for MXN |
informacion_global |
object | No | {Periodicidad, Meses, Año}; only for the generic public receptor, copied from your own invoice when omitted. |
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",
"description": "Id of one of your signed invoices"
},
"folio_fiscal": {
"type": "string",
"description": "UUID of the invoice credited"
},
"fecha": {
"type": "string",
"description": "YYYY-MM-DDTHH:MM:SS"
},
"forma_pago": {
"type": "string",
"description": "SAT c_FormaPago key of the note, not 99"
},
"uso_cfdi": {
"type": "string",
"description": "SAT c_UsoCFDI key, default G02"
},
"receptor": {
"type": "object",
"description": "Required for an invoice issued elsewhere; overrides the invoice's receptor otherwise."
},
"conceptos": {
"type": "array",
"minItems": 1,
"items": {
"type": "object"
},
"description": "Concept inputs as in the document; when omitted the whole invoice is credited."
},
"moneda": {
"type": "string",
"description": "SAT c_Moneda key; default the invoice's, else MXN"
},
"tipo_cambio": {
"type": "string",
"description": "Exchange rate to MXN, up to 6 decimals; not for MXN"
},
"informacion_global": {
"type": "object",
"description": "{Periodicidad, Meses, Año}; only for the generic public receptor, copied from your own invoice when omitted."
},
"issuer": {
"type": "string",
"format": "uuid",
"description": "Id of the issuer the call acts for, from list_issuers."
}
},
"required": [
"fecha",
"forma_pago",
"issuer"
]
}