Credit note PDF generator API
A credit note against an earlier invoice, with the reason, credited items, tax and the total credit due.
Just need one? Fill it in and download it freeA credit note reduces what a customer owes on an invoice you have already issued, so it needs to point back to that invoice and show exactly what was credited and why. This template covers the number, the original invoice reference, the reason, the credited lines and the tax.
Connect it to your billing system and every refund or partial cancellation can produce its own numbered PDF, so accounts stay reconciled without anyone building documents by hand.
Generate a Credit Note PDF via the API
POST your data to /api/v1/generate and get a PDF back. Copy-paste an example, swap in your API key, and loop over a list to render thousands — one credit note per record.
curl -X POST https://pdfgen.com/api/v1/generate \-H "Authorization: Bearer pdfg_live_xxx" \-H "Content-Type: application/json" \-d '{"data": {"seller": {"name": "Northwind Studio","address": "120 Market St\nSan Francisco, CA 94103"},"customer": {"name": "Acme Corp","address": "88 Industrial Way\nAustin, TX 78701"},"creditNoteNumber": "CN-2026-007","date": "2026-06-20","originalInvoiceNumber": "INV-2026-014","originalInvoiceDate": "2026-06-01","reason": "One revision round was billed twice.","currency": "USD","items": [{"description": "Revision rounds","quantity": 1,"unitPrice": 150,"amount": 150}],"subtotal": 150,"taxRate": 8.5,"tax": 12.75,"total": 162.75,"notes": "This amount will be deducted from your next invoice or refunded on request."},"format": "A4","engine": "handlebars","html": "<div style=\"max-width:760px;margin:0 auto;padding:48px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:36px;\">\n <div>\n {{#if logo}}<img src=\"{{logo}}\" alt=\"\" style=\"display:block;max-width:200px;max-height:56px;margin:0 0 10px;\">{{/if}}\n <h1 style=\"font-size:22px;font-weight:800;margin:0;\">{{seller.name}}</h1>\n <p style=\"color:#6b7280;margin:6px 0 0;font-size:13px;white-space:pre-line;\">{{seller.address}}</p>\n </div>\n <div style=\"text-align:right;\">\n <h2 style=\"font-size:26px;letter-spacing:2px;color:#be123c;margin:0;font-weight:800;\">CREDIT NOTE</h2>\n <p style=\"margin:8px 0 0;color:#6b7280;font-size:13px;\">#{{creditNoteNumber}}</p>\n <p style=\"margin:2px 0 0;color:#6b7280;font-size:13px;\">{{formatDate date}}</p>\n </div>\n </div>\n <div style=\"display:flex;justify-content:space-between;margin-bottom:24px;\">\n <div>\n <p style=\"font-size:11px;text-transform:uppercase;letter-spacing:1.5px;color:#9ca3af;font-weight:700;margin:0 0 8px;\">Credit to</p>\n <p style=\"margin:0;font-weight:600;\">{{customer.name}}</p>\n <p style=\"margin:2px 0 0;color:#6b7280;font-size:13px;white-space:pre-line;\">{{customer.address}}</p>\n </div>\n <div style=\"text-align:right;\">\n <p style=\"font-size:11px;text-transform:uppercase;letter-spacing:1.5px;color:#9ca3af;font-weight:700;margin:0 0 8px;\">Against invoice</p>\n <p style=\"margin:0;font-weight:600;\">{{originalInvoiceNumber}}</p>\n {{#if originalInvoiceDate}}<p style=\"margin:2px 0 0;color:#6b7280;font-size:13px;\">{{formatDate originalInvoiceDate}}</p>{{/if}}\n </div>\n </div>\n {{#if reason}}<p style=\"margin:0 0 24px;font-size:13px;background:#fff1f2;border-left:3px solid #be123c;padding:10px 14px;color:#374151;white-space:pre-line;\"><strong>Reason:</strong> {{reason}}</p>{{/if}}\n <table style=\"width:100%;border-collapse:collapse;font-size:14px;line-height:inherit;\">\n <thead>\n <tr style=\"background:#fff1f2;text-align:left;\">\n <th style=\"padding:12px;border-bottom:1px solid #fecdd3;\">Description</th>\n <th style=\"padding:12px;border-bottom:1px solid #fecdd3;text-align:center;\">Qty</th>\n <th style=\"padding:12px;border-bottom:1px solid #fecdd3;text-align:right;\">Unit</th>\n <th style=\"padding:12px;border-bottom:1px solid #fecdd3;text-align:right;\">Amount</th>\n </tr>\n </thead>\n <tbody>\n {{#each items}}\n <tr>\n <td style=\"padding:12px;border-bottom:1px solid #f3f4f6;\">{{description}}</td>\n <td style=\"padding:12px;border-bottom:1px solid #f3f4f6;text-align:center;\">{{quantity}}</td>\n <td style=\"padding:12px;border-bottom:1px solid #f3f4f6;text-align:right;\">{{formatCurrency unitPrice ../currency}}</td>\n <td style=\"padding:12px;border-bottom:1px solid #f3f4f6;text-align:right;\">{{formatCurrency amount ../currency}}</td>\n </tr>\n {{/each}}\n </tbody>\n </table>\n <table style=\"font-size:14px;line-height:inherit;min-width:240px;margin:20px 0 0 auto;\">\n <tr><td style=\"padding:4px 0;color:#6b7280;\">Subtotal</td><td style=\"padding:4px 0;text-align:right;\">{{formatCurrency subtotal currency}}</td></tr>\n {{#if taxRate}}<tr><td style=\"padding:4px 0;color:#6b7280;\">Tax ({{taxRate}}%)</td><td style=\"padding:4px 0;text-align:right;\">{{formatCurrency tax currency}}</td></tr>{{/if}}\n <tr><td style=\"padding:12px 0 0;font-weight:800;font-size:16px;\">Total credit</td><td style=\"padding:12px 0 0;text-align:right;font-weight:800;font-size:16px;color:#be123c;\">{{formatCurrency total currency}}</td></tr>\n </table>\n {{#if notes}}<p style=\"margin-top:40px;font-size:12px;color:#6b7280;border-top:1px solid #f3f4f6;padding-top:16px;white-space:pre-line;\">{{notes}}</p>{{/if}}\n</div>"}' --output credit-note.pdf
Working in another language? Follow a full guide for your stack:
What you can build
- Issuing a credit note whenever a refund goes through your payment provider
- Correcting an overbilled line without cancelling the whole invoice
- Crediting returned goods from your order management system
- Bulk-generating credit notes after a pricing correction
Frequently asked questions
- What is the difference between a credit note and a refund?
- A credit note is the document that reduces the amount on an invoice. A refund is the money going back. A credit can be refunded or held against a future invoice, and the note records which invoice it relates to either way.
- Can I generate a credit note automatically after a refund?
- Yes. Listen for the refund event in your billing system, then send the original invoice number, credited lines and amounts to /api/v1/generate. The response is the finished PDF.
- Can I change the layout or add my branding?
- Yes. It is an editable HTML and Handlebars template, so you can change it by hand or ask the AI editor to match your invoice design.