Finance

Payment receipt PDF API

A compact paid receipt confirming a transaction — perfect to auto-send after every checkout.

Turn every successful payment into a branded receipt PDF with a single API call. Pass the merchant, line items, total and payment method, and PDFgen returns a clean, compact receipt you can email instantly or attach to an order.

Because it renders from a reusable template, the same code produces a correct receipt for every transaction — no per-order formatting, no headless browser to operate.

Generate a Payment Receipt 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 payment receipt per record.

curl -X POST https://pdfgen.com/api/v1/generate \
-H "Authorization: Bearer pdfg_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"html": "<div style=\"max-width:420px;margin:0 auto;padding:40px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"text-align:center;margin-bottom:28px;\">\n <div style=\"width:52px;height:52px;border-radius:50%;background:#dcfce7;color:#16a34a;font-size:28px;line-height:52px;margin:0 auto 12px;\">&#10003;</div>\n <h1 style=\"font-size:20px;font-weight:800;margin:0;\">{{merchant.name}}</h1>\n <p style=\"margin:4px 0 0;color:#6b7280;font-size:13px;\">Payment received</p>\n </div>\n <div style=\"display:flex;justify-content:space-between;font-size:13px;color:#6b7280;border-top:1px dashed #e5e7eb;border-bottom:1px dashed #e5e7eb;padding:12px 0;margin-bottom:16px;\">\n <span>Receipt {{receiptNumber}}</span>\n <span>{{formatDate paidDate}}</span>\n </div>\n <table style=\"width:100%;border-collapse:collapse;font-size:14px;\">\n {{#each items}}\n <tr>\n <td style=\"padding:8px 0;\">{{name}}</td>\n <td style=\"padding:8px 0;text-align:right;\">{{formatCurrency price ../currency}}</td>\n </tr>\n {{/each}}\n </table>\n <div style=\"display:flex;justify-content:space-between;border-top:2px solid #111827;margin-top:12px;padding-top:12px;font-weight:800;font-size:18px;\">\n <span>Total paid</span><span>{{formatCurrency total currency}}</span>\n </div>\n <p style=\"margin-top:24px;text-align:center;font-size:12px;color:#9ca3af;\">Paid with {{paymentMethod}}</p>\n</div>",
"engine": "handlebars",
"format": "A5",
"data": {
"merchant": {
"name": "Blue Bottle Coffee"
},
"receiptNumber": "R-58210",
"paidDate": "2026-06-27",
"currency": "USD",
"items": [
{
"name": "Single-origin beans (12oz)",
"price": 22
},
{
"name": "Pour-over dripper",
"price": 28
},
{
"name": "Shipping",
"price": 6
}
],
"total": 56,
"paymentMethod": "Visa •••• 4242"
}
}' --output receipt.pdf

Working in another language? Follow a full guide for your stack:

What you can build

  • Sending an emailed receipt the moment a payment clears
  • Attaching receipts to e-commerce order confirmations
  • Generating proof-of-payment for refunds or disputes
  • Letting customers re-download past receipts from your app

Frequently asked questions

Can I trigger a receipt automatically after checkout?
Yes — call /api/v1/generate from your payment webhook (Stripe, PayPal, etc.) with the order data and attach the returned PDF to your confirmation email.
What data does a receipt need?
Merchant name, a receipt number, the paid date, the purchased items with prices, the total and the payment method. You can add or remove fields by editing the template.
Can receipts match my brand?
Absolutely. Edit the HTML/Handlebars template to use your logo, colours and wording, then render every receipt from that version.

Related templates

Ship your payment receipt PDF endpoint today

Generate this template with AI, tweak it to match your brand, then render at scale with a single API call — no headless browsers to babysit.