Skip to content
CastPDF

Send a PDF receipt after every sale

A receipt PDF generator turns each sale into a receipt your customer can keep. Your checkout sends the items and prices once payment succeeds, and CastPDF returns a finished PDF with the VAT worked out. It runs on the same engine as our invoice PDF API, sized like a till slip.

  • Updated October 2026
  • 100 free PDFs a month
A real PDF made by CastPDF from the receipt template and its sample data.

Who sends receipts this way

Anyone who takes a payment and wants the customer to have proof of it, without printing anything. Three common setups:

  • An online shop emails a receipt the moment the card payment succeeds. The order confirmation links to the PDF, and the customer can download it again later.
  • A café or a market stall with a tablet till shows a QR code or emails the receipt instead of printing paper slips. The narrow layout reads well on a phone.
  • A booking or membership app sends a receipt for each renewal, so members have something to hand to their own accounts team.

In each case the receipt describes a sale your business really made. Use your own shop’s name and details: CastPDF is not a tool for making receipts for other stores.

What a good receipt includes

  • Your business name, address and, if you charge VAT, your VAT number.
  • A receipt number and the date and time of the sale.
  • Each item with its quantity and price, so the customer can match it to what they bought.
  • The VAT rate and the VAT amount, shown apart from the net total.
  • The total paid and how it was paid, for example the last four digits of the card.
  • Your returns rule in one line, so nobody has to ask.

Rules differ by country. In the UK, for example, a simplified VAT receipt is allowed for smaller sales. Check what your country asks for with your accountant; this page is general information, not tax advice.

Send it from your checkout

The pattern is the same whatever your stack. When your payment provider confirms a payment, your server builds the receipt data from the order and asks CastPDF for the PDF.

  1. Pick the receipt template. Sign up free, choose the receipt starter, and change the shop details, colours and wording in the editor.
  2. Map your order to the fields. Your order already has the items, quantities and prices. Copy them into the same shape as the sample data below.
  3. Request the PDF after payment. Send template_id and data to POST /v1/pdf with "response": "url". Use the order number as the Idempotency-Key, so a retry never makes a second receipt.
  4. Send the link. Put the returned url in your confirmation email, or store the PDF. The link works without an API key until it expires.

Prefer to start by hand? Fill in the sample data in the dashboard and press Generate PDF. It is the same template, so nothing changes when you automate it later.

The awkward cases, handled

  • Prices that include VAT. The template treats each price as VAT-inclusive and works out the net amount and the VAT from the rate you send. You never round on your side.
  • Other currencies. Send currency and locale, such as GBP and en-GB or EUR and de-DE. Amounts are written the local way, with the right symbol.
  • Long item names. A name such as "Ethiopia Guji, 250 g, whole bean" wraps onto a second line instead of running off the slip.
  • A big basket. The slip is 80 mm wide. When the items run past the bottom, the receipt continues on a second slip and no row is cut in half. Add the class keep-together to the totals block to keep the subtotal, VAT and total on one slip.
  • Notes on a line. Add a short note to an item, such as "Oat milk", and it prints under the item name in a smaller size.

When you need an invoice instead

A receipt says a sale is paid. An invoice asks for payment, with a due date and bank details. Business customers often want an invoice even after paying, so many shops send both. Start from the invoice template for that, or read the receipt template page for every field this one fills.

Test PDFs are free and unlimited. Live receipts count one PDF each, whatever their length, and the Free plan includes 100 a month with no card needed.

The data it needs, and one request

This is the real sample data of the receipt template. Save your template in the dashboard, copy its ID, and send data in this shape. The reply is the finished PDF.

curl
curl https://api.castpdf.com/v1/pdf \
  -H "Authorization: Bearer $CASTPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d @request.json \
  --output receipt.pdf
request.json
{
  "template_id": "YOUR_TEMPLATE_ID",
  "data": {
    "currency": "GBP",
    "locale": "en-GB",
    "shop": {
      "name": "Copper Kettle Roasters",
      "tagline": "Coffee & bakery",
      "street": "14 Chandos Place",
      "city": "Bristol BS1 4HQ",
      "phone": "0117 496 0381",
      "vat_number": "GB 284 7713 05"
    },
    "receipt": {
      "number": "CK-104582",
      "date": "2026-09-30",
      "time": "08:42",
      "served_by": "Tomasz",
      "vat_rate": 20,
      "thanks": "Thank you, see you again soon.",
      "returns": "Keep this receipt for returns and exchanges within 14 days."
    },
    "payment": {
      "method": "Visa debit •••• 4417",
      "auth_code": "0K7Q21"
    },
    "items": [
      {
        "name": "Flat white",
        "note": "Oat milk",
        "quantity": 2,
        "price": 3.6
      },
      {
        "name": "Cardamom bun",
        "quantity": 2,
        "price": 3.25
      },
      {
        "name": "Ethiopia Guji, 250 g",
        "note": "Whole bean",
        "quantity": 1,
        "price": 11.5
      },
      {
        "name": "Sourdough loaf",
        "quantity": 1,
        "price": 4.8
      },
      {
        "name": "Keep cup, 12 oz",
        "quantity": 1,
        "price": 14
      }
    ]
  }
}
FAQ

Common questions

Can I send a PDF receipt automatically after each online payment?

Yes. When your payment provider confirms the payment, your server sends the order data to CastPDF and gets the receipt back as a file or a private download link. Put the link in your confirmation email.

Does the receipt work out the VAT for me?

Yes. Prices are treated as including VAT. The template takes the rate you send and prints the net amount, the VAT and the total, so the figures always add up.

What size is the receipt PDF?

The starter is 80 mm wide, the width of a till slip, so it reads well on a phone and prints on receipt paper. You can change the page size in the template settings for an A4 receipt.

Can a customer download the receipt again later?

The download link works until it expires, which depends on your plan’s storage time. To keep receipts longer, save the PDF in your own storage when you receive it, or make it again from the order.

Can I use this to make a receipt for a purchase in another shop?

No. Use it only for sales your own business made, with your own business details. Making receipts for purchases from other stores is not an acceptable use of CastPDF.

Make your first PDF in 5 minutes

Pick a template, add your details and download your PDF. You get 100 free PDFs every month, and you don’t need a card.