Egress invoice
The fiscal document of type Egreso, or Credit Note, is used to record money outflows for returns, discounts, and bonuses. The main function of this type of document is deductibility, as it is used to correct or subtract amounts from previously issued income documents.
To issue this type of document, you should use the value "E" in the type
property when creating the invoice.
When the applied discount is made on a sale that has already been invoiced, the document must be related to one or more Ingreso documents using the corresponding relationship key and the UUID of the Ingreso invoice.
It is important to mention that an Egreso document does not serve to cancel an Ingreso document.
Examples
Below are some common use cases.
To fully understand all the available options when creating an invoice, detailed descriptions of each field, and the most commonly used catalogs, please refer to the Create Invoice method reference.
Discount for an already invoiced sale
In this example, a payment of $3,600.00 pesos was received for a product with a 10% discount that has a value of $4,000.00 pesos. The discounted amount of $400.00 pesos is covered by issuing an egress CFDI.
- 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", // "Debit card"
related_documents: [
{
relationship: "01", // SAT code for "Credit note for the related document"
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", // "Debit card",
["related_documents"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["relationship"] = "01", // SAT code for "Credit note for the related document"
["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", // "Debit card",
"related_documents" => [
[
"relationship" => "01", // SAT code for "Credit note for the related document"
"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", // "Debit card"
"related_documents": [
{
"relationship": "01", // SAT code for "Credit note for the related document"
"documents": "UUID_DEL_CFDI_DE_INGRESO"
}
]
}'
Merchandise return
For this scenario, an Egress invoice is issued for $5,000.00 pesos to cancel the total amount of a previous income CFDI with the same amount.
- 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", // "Debit card"
related_documents: [
{
relationship: "01", // SAT code for "Credit note for the related document"
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", // "Debit card",
["related_documents"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["relationship"] = "01", // SAT code for "Credit note for the related document"
["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", // "Debit card",
"related_documents" => [
[
"relationship" => "01", // SAT code for "Credit note for the related document"
"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", // "Debit card"
"related_documents": [
{
"relationship": "01", // SAT code for "Credit note for the related document"
"documents": "UUID_DEL_CFDI_DE_INGRESO"
}
]
}'
Advance Discount on a Future Sale
It is possible to offer discounts on future sales. In this example, an expense CFDI for $400.00 pesos is issued to cover a bonus that will be applied to a sale for $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" // "Novatió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" // "Novation"
});
$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" // "Novation"
]);
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" // "Novation"
}'