5 min integration
PDF Output
Transform your billing data into professional PDF invoices with our Liquid template API. Perfect for SaaS platforms, e-commerce sites, and any business that needs automated invoice generation.
<!-- Invoice Template Example -->
<div class="invoice-header">
<h1>INVOICE #{{ invoice.number }}</h1>
<p>Date: {{ invoice.date | date: "%B %d, %Y" }}</p>
</div>
<div class="billing-info">
<div class="from">
<h3>{{ company.name }}</h3>
<p>{{ company.address }}</p>
<p>{{ company.city }}, {{ company.country }}</p>
</div>
<div class="to">
<h3>Bill To:</h3>
<p>{{ customer.name }}</p>
<p>{{ customer.address }}</p>
<p>{{ customer.email }}</p>
</div>
</div>
<table class="invoice-items">
<thead>
<tr>
<th>Description</th>
<th>Quantity</th>
<th>Rate</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
{% for item in invoice.items %}
<tr>
<td>{{ item.description }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.rate | currency }}</td>
<td>{{ item.total | currency }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="3">Subtotal</td>
<td>{{ invoice.subtotal | currency }}</td>
</tr>
<tr>
<td colspan="3">Tax ({{ invoice.tax_rate }}%)</td>
<td>{{ invoice.tax | currency }}</td>
</tr>
<tr class="total">
<td colspan="3">Total</td>
<td>{{ invoice.total | currency }}</td>
</tr>
</tfoot>
</table>
"We reduced our invoice generation time from hours to seconds. The API integrates perfectly with our existing CRUD operations, and the PDF quality is exceptional."
- Sarah Chen, CTO at CloudBilling
// Generate invoice after successful payment
const generateInvoice = async (orderId) => {
// Fetch order data from your database
const order = await db.orders.findOne({ id: orderId });
// Call our API to generate PDF
const response = await fetch('https://api.liquidrender.com/v1/render', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template_id: 'invoice-template',
data: {
invoice: {
number: order.invoice_number,
date: order.created_at,
items: order.items,
subtotal: order.subtotal,
tax_rate: order.tax_rate,
tax: order.tax_amount,
total: order.total
},
customer: order.customer,
company: companyDetails
},
output: 'pdf'
})
});
const { pdf_url } = await response.json();
// Save PDF URL to your database
await db.invoices.create({
order_id: orderId,
pdf_url: pdf_url,
created_at: new Date()
});
return pdf_url;
};
Your invoice PDFs are generated and stored securely in our German data centers for 7 days, giving you time to download or forward them to customers. After 7 days, all data is automatically deleted to ensure privacy.