Payment Invoice
The Payment Invoice, also known as Electronic Payment Receipt (EPR) or simply payment complement, is used to provide fiscal proof that the organization has received a payment for goods or services delivered in the past.
To issue a Payment Invoice, there must be an Income Invoice that is created at the time of delivery of the goods or services and whose payment method is registered with the value "PPD"
(Partial or Deferred Payment).
Examples
Below are some common use cases.
To fully understand all the available options when creating a Payment Invoice, detailed descriptions of each field, and the most commonly used catalogs, please refer to the Create Invoice method reference, and then click on the Payment invoice type.
Full payment of a pending invoice
In this example, a single payment is received to fully settle a pending invoice for $345.60 MXN.
- Node.js
- C#
- PHP
- cURL
const Facturapi = require('facturapi');
const facturapi = new Facturapi('sk_test_API_KEY');
const invoice = await facturapi.invoices.create({
type: 'P',
customer: {
legal_name: 'Dunder Mifflin',
email: 'email@example.com',
tax_id: 'ABC101010111',
tax_system: '601',
address: {
zip: '85900'
}
},
complements: [
{
type: 'pago',
data: {
payment_form: '28', // Tarjeta de Crédito
related_documents: [
{
uuid: '39c85a3f-275b-4341-b259-e8971d9f8a94',
amount: 345.60,
installment: 1,
last_balance: 345.60,
taxes: [
{
base: 297.93,
type: 'IVA',
rate: 0.16
}
]
}
]
}
}
]
});
var facturapi = new FacturapiClient("sk_test_API_KEY");
var invoice = await facturapi.Invoice.CreateAsync(new Dictionary<string, object>
{
["type"] = "P",
["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"
}
},
["complements"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["type"] = "pago",
["data"] = new Dictionary<string, object>
{
["payment_form"] = "28", // Tarjeta de Crédito
["related_documents"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["uuid"] = "39c85a3f-275b-4341-b259-e8971d9f8a94",
["amount"] = 345.60,
["installment"] = 1,
["last_balance"] = 345.60,
["taxes"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["base"] = 297.93,
["type"] = "IVA",
["rate"] = 0.16
}
}
}
}
}
}
}
});
$facturapi = new Facturapi( "sk_test_API_KEY" );
$invoice = $facturapi->Invoices->create([
"type" => "P",
"customer" => [
"legal_name" => "Dunder Mifflin",
"email" => "email@example.com",
"tax_id" => "ABC101010111",
"tax_system" => "601",
"address" => [
"zip" => "85900"
]
],
"complements" => [
[
"type" => "pago",
"data" => [
"payment_form" => "28", // Tarjeta de Crédito
"related_documents" => [
[
"uuid" => "39c85a3f-275b-4341-b259-e8971d9f8a94",
"amount" => 345.60,
"installment" => 1,
"last_balance" => 345.60,
"taxes" => [
[
"base" => 297.93,
"type" => "IVA",
"rate" => 0.16
]
]
]
]
]
]
]
]);
curl https://www.facturapi.io/v2/invoices \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "P",
"customer": {
"legal_name": "Dunder Mifflin",
"email": "email@example.com",
"tax_id": "ABC101010111",
"tax_system": "601",
"address": {
"zip": "85900"
}
},
"complements": [
{
"type": "pago",
"data": {
"payment_form": "28", // Tarjeta de Crédito
"related_documents": [
{
"uuid": "39c85a3f-275b-4341-b259-e8971d9f8a94",
"amount": 345.60,
"installment": 1,
"last_balance": 345.60,
"taxes": [
{
"base": 297.93,
"type": "IVA",
"rate": 0.16
}
]
}
]
}
}
]
}'
Partial payment of a pending invoice
In this example, $100 MXN is received as payment for the second installment of a pending invoice with a total of $345.60 MXN. It is assumed that $100 MXN was also paid in the first installment.
- Node.js
- C#
- PHP
- cURL
const Facturapi = require('facturapi');
const facturapi = new Facturapi('sk_test_API_KEY');
const invoice = await facturapi.invoices.create({
type: 'P',
customer: {
legal_name: 'Dunder Mifflin',
email: 'email@example.com',
tax_id: 'ABC101010111',
tax_system: '601',
address: {
zip: '85900'
}
},
complements: [
{
type: 'pago',
data: {
payment_form: '28', // Tarjeta de Crédito
related_documents: [
{
uuid: '39c85a3f-275b-4341-b259-e8971d9f8a94',
amount: 100, // Monto de la factura relacionada que se paga en la presente parcialidad
installment: 2, // Esta es la segunda parcialidad
last_balance: 245.60, // Saldo insoluto de la primera parcialidad
taxes: [
{
base: 86.21, // Base de IVA de la segunda parcialidad
type: 'IVA',
rate: 0.16
}
]
}
]
}
}
]
});
var facturapi = new FacturapiClient("sk_test_API_KEY");
var invoice = await facturapi.Invoice.CreateAsync(new Dictionary<string, object>
{
["type"] = "P",
["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"
}
},
["complements"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["type"] = "pago",
["data"] = new Dictionary<string, object>
{
["payment_form"] = "28", // Tarjeta de Crédito
["related_documents"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["uuid"] = "39c85a3f-275b-4341-b259-e8971d9f8a94",
["amount"] = 100, // Monto de la factura relacionada que se paga en la presente parcialidad
["installment"] = 2, // Esta es la segunda parcialidad
["last_balance"] = 245.60, // Saldo insoluto de la primera parcialidad
["taxes"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["base"] = 86.21, // Base de IVA de la segunda parcialidad
["type"] = "IVA",
["rate"] = 0.16
}
}
}
}
}
}
}
});
$facturapi = new Facturapi( "sk_test_API_KEY" );
$invoice = $facturapi->Invoices->create([
"type" => "P",
"customer" => [
"legal_name" => "Dunder Mifflin",
"email" => "email@example.com",
"tax_id" => "ABC101010111",
"tax_system" => "601",
"address" => [
"zip" => "85900"
]
],
"complements" => [
[
"type" => "pago",
"data" => [
"payment_form" => "28", // Tarjeta de Crédito
"related_documents" => [
[
"uuid" => "39c85a3f-275b-4341-b259-e8971d9f8a94",
"amount" => 100, // Monto de la factura relacionada que se paga en la presente parcialidad
"installment" => 2, // Esta es la segunda parcialidad
"last_balance" => 245.60, // Saldo insoluto de la primera parcialidad
"taxes" => [
[
"base" => 86.21, // Base de IVA de la segunda parcialidad
"type" => "IVA",
"rate" => 0.16
]
]
]
]
]
]
]
]);
curl https://www.facturapi.io/v2/invoices \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "P",
"customer": {
"legal_name": "Dunder Mifflin",
"email": "email@example.com",
"tax_id": "ABC101010111",
"tax_system": "601",
"address": {
"zip": "85900"
}
},
"complements": [
{
"type": "pago",
"data": {
"payment_form": "28", // Tarjeta de Crédito
"related_documents": [
{
"uuid": "39c85a3f-275b-4341-b259-e8971d9f8a94",
"amount": 100, // Monto de la factura relacionada que se paga en la presente parcialidad
"installment": 2, // Esta es la segunda parcialidad
"last_balance": 245.60, // Saldo insoluto de la primera parcialidad
"taxes": [
{
"base": 86.21, // Base de IVA de la segunda parcialidad
"type": "IVA",
"rate": 0.16
}
]
}
]
}
}
]
}'