Skip to main content

Invoice Customization

You can add custom HTML using the pdf_custom_section field in the invoices request.

Allowed Tags​

TagAllowed Attributes
h1—
h2—
h3—
h4—
h5—
h6—
div—
ahref, title, target
p—
span—
small—
br—
b—
i—
ul—
ol—
li—
strong—
table—
thead—
tbody—
tfoot—
tr—
thcolspan, align
tdcolspan, align

Example​

The following example shows how to send the pdf_custom_section field in the invoice creation request.

import Facturapi from 'facturapi'
const facturapi = new Facturapi('sk_test_API_KEY');

const invoice = await facturapi.invoices.create({
customer: {
legal_name: 'Dunder Mifflin',
email: 'email@example.com',
tax_id: 'ABC101010111',
tax_system: '601',
address: {
zip: '85900'
}
},
items: [{
quantity: 2,
product: {
description: 'Ukelele',
product_key: '60131324', // ClaveProdServ del SAT
price: 345.60,
taxes: [
{
type: 'IVA',
rate: 0.16
}
]
}
}],
use: 'G01',
payment_form: "28" // "Tarjeta de débito",
pdf_custom_section: '<h1>PDF Custom Section with h1</h1> <h2>Generado con <strong>Facturapi</strong></h2> <p>Detalles de la factura mediante tabla:</p> <table> <thead> <tr><th colspan="1" align="center">¡Concepto encerrado en thead!</th><th colspan="1" align="right">Importe</th></tr> </thead> <tbody> <tr><td><b>Servicio de Consultoría</b></td><td colspan="1" align="right" >$5,000.00</td></tr> </tbody> <tfoot> <tr><td align="left"><small>Total</small></td><td align="right"><strong>$5,000.00</strong></td></tr> </tfoot> </table> <p><i>Consulta y descarga tu CFDI en el siguiente enlace:</i></p> <a href="https://www.facturapi.io" target="_blank">Ver factura</a> <p><strong>Opciones de pago:</strong></p> <ul> <li>Transferencia bancaria</li> <li>Pago con tarjeta</li> </ul> <span><strong>Pasos para validar tu CFDI:</strong></span> <ol> <li>Accede al SAT</li> <li>Ingresa tu RFC y UUID</li> <li>Verifica la autenticidad</li> </ol> <br> <div>Si tienes dudas, contacta a soporte de <span>Facturapi</span>.</div>'
});