Comprobante de Egreso
El comprobante fiscal de tipo Egreso, o Nota de crédito, se utiliza para registrar fiscalmente salidas de dinero como devoluciones, descuentos y bonificaciones. La función principal de este tipo de comprobantes es la deductibilidad ya que se utilizan para corregir o restar montos de comprobantes de ingresos emitidos con anterioridad.
Para emitor este tipo de comprobante deberás usar el valor "E" en la propiedad type
al crear la factura.
Cuando el descuento aplicado se hace sobre una venta que ya fue facturada, el comprobante debe relacionarse con uno o varios comprobantes de Ingreso utilizando la clave de relación correspondiente y el UUID de la factura de Ingreso.
Es importante mencionar que un comprobante de Egreso no sirve para cancelar un comprobante de Ingreso.
Ejemplos
A continuación se listan algunos casos de uso comunes.
Para conocer a fondo todas las opciones disponibles al crear una factura, descripciiones detalladas de cada campo y los catálogos más utilizados consulta la referencia del método Crear Factura.
Descuento por una venta ya facturada
En este ejemplo, se recibió un pago de $3,600.00 pesos por un producto con el 10% descuento que tiene un valor de $4,000.00 pesos, los $400.00 pesos descontados se amparan emitiendo un CFDI de egreso.
- Node.js
- C#
- PHP
- cURL
const Facturapi = require('facturapi');
const facturapi = new Facturapi('sk_test_API_KEY');
const invoice = await facturapi.invoices.create({
type: "E",
customer: {
legal_name: 'Dunder Mifflin',
email: 'email@example.com',
tax_id: 'ABC101010111',
tax_system: '601',
address: {
zip: '85900'
}
},
items: [{
product: {
description: 'Descuento',
price: 400,
taxes: [
{
type: 'IVA',
rate: 0.16
}
]
}
}],
payment_form: "28", // "Tarjeta de débito"
related_documents: [
{
relationship: "01", // "Nota de crédito de los documentos relacionados"
documents: "UUID_DEL_CFDI_DE_INGRESO"
}
]
});
var facturapi = new FacturapiClient("sk_test_API_KEY");
var invoice = await facturapi.Invoice.CreateAsync(new Dictionary<string, object>
{
["type"] = "E",
["customer"] = new Dictionary<string, object>
{
["legal_name"] = "Dunder Mifflin",
["email"] = "email@example.com",
["tax_id"] = "ABC101010111",
["tax_system"] = "601",
["address"] = new Dictionary<string, object>
{
["zip"] = "85900"
}
},
["items"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["product"] = new Dictionary<string, object>
{
["description"] = "Descuento",
["price"] = 400,
["taxes"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["type"] = "IVA",
["rate"] = 0.16
}
}
}
}
},
["payment_form"] = "28", // "Tarjeta de débito",
["related_documents"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["relationship"] = "01", // "Nota de crédito de los documentos relacionados"
["documents"] = "UUID_DEL_CFDI_DE_INGRESO"
}
}
});
$facturapi = new Facturapi( "sk_test_API_KEY" );
$invoice = $facturapi->Invoices->create([
"type" => "E",
"customer" => [
"legal_name" => "Dunder Mifflin",
"email" => "email@example.com",
"tax_id" => "ABC101010111",
"tax_system" => "601",
"address" => [
"zip" => "85900"
]
],
"items" => [
[
"product" => [
"description" => "Descuento",
"price" => 400,
"taxes" => [
[
"type" => "IVA",
"rate" => 0.16
]
]
]
]
],
"payment_form" => "28", // "Tarjeta de débito",
"related_documents" => [
[
"relationship" => "01", // "Nota de crédito de los documentos relacionados"
"documents" => "UUID_DEL_CFDI_DE_INGRESO"
]
]
]);
curl https://www.facturapi.io/v2/invoices \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "E",
"customer": {
"legal_name": "Dunder Mifflin",
"email": "email@example.com",
"tax_id": "ABC101010111",
"tax_system": "601",
"address": {
"zip": "85900"
}
},
"items": [
{
"product": {
"description": "Descuento",
"price": 400,
"taxes": [
{
"type": "IVA",
"rate": 0.16
}
]
}
}
],
"payment_form": "28", // "Tarjeta de débito"
"related_documents": [
{
"relationship": "01", // "Nota de crédito de los documentos relacionados"
"documents": "UUID_DEL_CFDI_DE_INGRESO"
}
]
}'
Devolución de mercancía
Para este escenario, se emite un comprobante de egreso por $5000.00 pesos para anular el monto total de un CFDI de ingreso previo con el mismo monto.
- Node.js
- C#
- PHP
- cURL
const Facturapi = require('facturapi');
const facturapi = new Facturapi('sk_test_API_KEY');
const invoice = await facturapi.invoices.create({
type: "E",
customer: {
legal_name: 'Dunder Mifflin',
email: 'email@example.com',
tax_id: 'ABC101010111',
tax_system: '601',
address: {
zip: '85900'
}
},
items: [{
product: {
description: 'Devolución total de mercancía',
price: 5000,
taxes: [
{
type: 'IVA',
rate: 0.16
}
]
}
}],
payment_form: "28", // "Tarjeta de débito"
related_documents: [
{
relationship: "01", // "Nota de crédito de los documentos relacionados"
documents: "UUID_DEL_CFDI_DE_INGRESO"
}
]
});
var facturapi = new FacturapiClient("sk_test_API_KEY");
var invoice = await facturapi.Invoice.CreateAsync(new Dictionary<string, object>
{
["type"] = "E",
["customer"] = new Dictionary<string, object>
{
["legal_name"] = "Dunder Mifflin",
["email"] = "email@example.com",
["tax_id"] = "ABC101010111",
["tax_system"] = "601",
["address"] = new Dictionary<string, object>
{
["zip"] = "85900"
}
},
["items"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["product"] = new Dictionary<string, object>
{
["description"] = "Devolución total de mercancía",
["price"] = 5000,
["taxes"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["type"] = "IVA",
["rate"] = 0.16
}
}
}
}
},
["payment_form"] = "28", // "Tarjeta de débito",
["related_documents"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["relationship"] = "01", // "Nota de crédito de los documentos relacionados"
["documents"] = "UUID_DEL_CFDI_DE_INGRESO"
}
}
});
$facturapi = new Facturapi( "sk_test_API_KEY" );
$invoice = $facturapi->Invoices->create([
"type" => "E",
"customer" => [
"legal_name" => "Dunder Mifflin",
"email" => "email@example.com",
"tax_id" => "ABC101010111",
"tax_system" => "601",
"address" => [
"zip" => "85900"
]
],
"items" => [
[
"product" => [
"description" => "Devolución total de mercancía",
"price" => 5000,
"taxes" => [
[
"type" => "IVA",
"rate" => 0.16
]
]
]
]
],
"payment_form" => "28", // "Tarjeta de débito",
"related_documents" => [
[
"relationship" => "01", // "Nota de crédito de los documentos relacionados"
"documents" => "UUID_DEL_CFDI_DE_INGRESO"
]
]
]);
curl https://www.facturapi.io/v2/invoices \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "E",
"customer": {
"legal_name": "Dunder Mifflin",
"email": "email@example.com",
"tax_id": "ABC101010111",
"tax_system": "601",
"address": {
"zip": "85900"
}
},
"items": [
{
"product": {
"description": "Devolución total de mercancía",
"price": 5000,
"taxes": [
{
"type": "IVA",
"rate": 0.16
}
]
}
}
],
"payment_form": "28", // "Tarjeta de débito"
"related_documents": [
{
"relationship": "01", // "Nota de crédito de los documentos relacionados"
"documents": "UUID_DEL_CFDI_DE_INGRESO"
}
]
}'
Bonificación a una venta futura
Es posible ofrecer bonificaciones a ventas por realizarse de forma anticipada. En este ejemplo se emite un CFDI de egreso por $400.00 pesos para amparar un bono que será aplicado a una venta por 2,000.00 pesos.
- Node.js
- C#
- PHP
- cURL
const Facturapi = require('facturapi');
const facturapi = new Facturapi('sk_test_API_KEY');
const invoice = await facturapi.invoices.create({
type: "E",
customer: {
legal_name: 'Dunder Mifflin',
email: 'email@example.com',
tax_id: 'ABC101010111',
tax_system: '601',
address: {
zip: '85900'
}
},
items: [{
product: {
description: 'Bonificación a venta futura',
price: 400,
taxes: [
{
type: 'IVA',
rate: 0.16
}
]
}
}],
payment_form: "23" // "Novación"
});
var facturapi = new FacturapiClient("sk_test_API_KEY");
var invoice = await facturapi.Invoice.CreateAsync(new Dictionary<string, object>
{
["type"] = "E",
["customer"] = new Dictionary<string, object>
{
["legal_name"] = "Dunder Mifflin",
["email"] = "email@example.com",
["tax_id"] = "ABC101010111",
["tax_system"] = "601",
["address"] = new Dictionary<string, object>
{
["zip"] = "85900"
}
},
["items"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["product"] = new Dictionary<string, object>
{
["description"] = "Bonificación a venta futura",
["price"] = 400,
["taxes"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["type"] = "IVA",
["rate"] = 0.16
}
}
}
}
},
["payment_form"] = "23" // "Novación"
});
$facturapi = new Facturapi( "sk_test_API_KEY" );
$invoice = $facturapi->Invoices->create([
"type" => "E",
"customer" => [
"legal_name" => "Dunder Mifflin",
"email" => "email@example.com",
"tax_id" => "ABC101010111",
"tax_system" => "601",
"address" => [
"zip" => "85900"
]
],
"items" => [
[
"product" => [
"description" => "Bonificación a venta futura",
"price" => 400,
"taxes" => [
[
"type" => "IVA",
"rate" => 0.16
]
]
]
]
],
"payment_form" => "23" // "Novación"
]);
curl https://www.facturapi.io/v2/invoices \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "E",
"customer": {
"legal_name": "Dunder Mifflin",
"email": "email@example.com",
"tax_id": "ABC101010111",
"tax_system": "601",
"address": {
"zip": "85900"
}
},
"items": [
{
"product": {
"description": "Descuento",
"price": 400,
"taxes": [
{
"type": "IVA",
"rate": 0.16
}
]
}
}
],
"payment_form": "23" // "Novación"
}'