> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.supay.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.supay.dev/_mcp/server.

# 47 · Nota Crédito Débito Descuentos

Descuentos posteriores por DocumentoAjuste. Exige `reference_invoice_id` del
mismo tenant y cliente, con **detalle par** (original + devuelto). Ver también:
[24 · Nota Crédito-Débito](/sectores/documentos-de-ajuste/24-nota-credito-debito).

## Cabecera (`data`)

| Campo                            | Tipo       | Obligatorio | Qué significa                        |
| -------------------------------- | ---------- | ----------- | ------------------------------------ |
| `monto_total_devuelto`           | number     | Ver perfil  | Total devuelto                       |
| `monto_descuento_credito_debito` | number     | Ver perfil  | Descuento del ajuste                 |
| `monto_efectivo_credito_debito`  | number     | No          | Override del crédito calculado (13%) |
| `numero_nota_credito_debito`     | string/int | Ver perfil  | Número del documento                 |

## Detalle (`items[].data`)

Detalle par: conserva importes originales y devueltos en grupos distintos.

#### SDK TypeScript

```typescript
const nota = await supay.invoices.emit({
  point_of_sale_id: pos.id,
  customer: {
    document_type: "CI",
    document_number: "9971522",
    name: "Ramiro",
  },

  // Descuento posterior sobre la factura original
  invoice_type: "credit_note",
  sector: "47",
  reference_invoice_id: "b61d67ed-7962-4989-958f-8ccc01979d64",

  // SKU de la factura ORIGINAL
  items: [
    {
      sku: "PROD-001",
      quantity: 1,
      price: 1250,
      discount: 0,
    },
  ],

});
```

#### REST API

```bash
curl -s -X POST "$BASE/v1/invoices/emit" \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "point_of_sale_id": "'$POS'",
    "customer": {
      "document_type": "CI",
      "document_number": "9971522",
      "name": "Ramiro"
    },
    "invoice_type": "credit_note",
    "sector": "47",
    "reference_invoice_id": "b61d67ed-7962-4989-958f-8ccc01979d64",
    "items": [
      {
        "sku": "PROD-001",
        "quantity": 1,
        "price": 1250,
        "discount": 0
      }
    ]
  }' | jq '{id, status}'
```

## Errores típicos

| Situación                  | Respuesta              |
| -------------------------- | ---------------------- |
| Sin `reference_invoice_id` | `400 VALIDATION_ERROR` |
| Referencia de otro tenant  | `404`                  |