PDF templates / Receipt

Retail Receipt

Standard A4 retail receipt with centered store header, itemised SKU table, member-savings line, tax breakdown, tender + change panel and loyalty footer.

First page of the Retail Receipt template, rendered with its sample data
receipt-retail.pdfpage 1 of 2

DSL source

The whole template. Learn the language in the template DSL guide.

js
const cols = [
  ["SKU", "auto"],
  ["Item", "1fr"],
  ["Qty", "auto", "right"],
  ["Price", "auto", "right"],
  ["Total", "auto", "right"],
];

const template = doc(
  { size: "A4", title: "Receipt {{receiptNumber}}", padding: [24, 28, 24, 28] },

  // Store header — retail style, centered
  col(
    r({ align: "center" }, s({ "font-size": 20, "font-weight": "bold", color: "#1f4d2b" }, "{{store.name}}")),
    r({ align: "center", margin: [2, 0, 0, 0] }, s({ "font-size": 9, color: "#555" }, "{{store.branch}}")),
    r({ align: "center", margin: [2, 0, 0, 0] }, s({ "font-size": 9, color: "#555" }, "{{store.address}}")),
    r({ align: "center", margin: [2, 0, 0, 0] },
      s({ "font-size": 9, color: "#555" }, "{{store.phone}}  •  {{store.website}}"),
    ),
    r({ align: "center", margin: [1, 0, 0, 0] }, s({ "font-size": 8, color: "#888" }, "Tax ID: {{store.taxId}}")),
  ),

  hr(8, "#1f4d2b"),

  // Receipt meta
  r(
    col("50%",
      r(s({ "font-size": 14, "font-weight": "bold", color: "#1f4d2b" }, "SALES RECEIPT")),
      r({ margin: [3, 0, 0, 0] }, s({ "font-size": 9, color: "#333" }, "Receipt #: "), s({ "font-size": 9, "font-weight": "bold" }, "{{receiptNumber}}")),
      r({ margin: [1, 0, 0, 0] }, s({ "font-size": 9, color: "#333" }, "Transaction: "), s({ "font-size": 9 }, "{{transactionId}}")),
    ),
    col("50%", { align: "right" },
      r({ align: "right" }, s({ "font-size": 9, color: "#333" }, "{{date}}  at  {{time}}")),
      r({ align: "right", margin: [2, 0, 0, 0] }, s({ "font-size": 9, color: "#555" }, "Cashier: {{cashier}}  •  Register: {{register}}")),
    ),
  ),

  gap(10),

  // Customer / loyalty block
  r({ "background-color": "#f4f8f1", padding: [8, 10, 8, 10], "border-radius": 4 },
    col("55%",
      r(s({ "font-size": 8, color: "#1f4d2b", "font-weight": "bold" }, "MEMBER")),
      r({ margin: [2, 0, 0, 0] }, s({ "font-size": 10, "font-weight": "bold" }, "{{customer.name}}")),
      r({ margin: [1, 0, 0, 0] }, s({ "font-size": 8, color: "#555" }, "Loyalty ID: {{customer.loyaltyId}}  •  Member since {{customer.memberSince}}")),
    ),
    col("22%", { align: "right" },
      r({ align: "right" }, s({ "font-size": 8, color: "#1f4d2b", "font-weight": "bold" }, "POINTS EARNED")),
      r({ align: "right", margin: [2, 0, 0, 0] }, s({ "font-size": 12, "font-weight": "bold", color: "#1f4d2b" }, "+{{customer.pointsEarned}}")),
    ),
    col("23%", { align: "right" },
      r({ align: "right" }, s({ "font-size": 8, color: "#1f4d2b", "font-weight": "bold" }, "POINTS BALANCE")),
      r({ align: "right", margin: [2, 0, 0, 0] }, s({ "font-size": 12, "font-weight": "bold", color: "#1f4d2b" }, "{{customer.pointsBalance}}")),
    ),
  ),

  gap(10),

  // Items table
  table(cols, "item in items", [
    ["{{item.sku}}", "auto"],
    ["{{item.description}}", "1fr"],
    ["{{item.qty}} {{item.unit}}", "auto", "right"],
    ["${{item.unitPrice}}", "auto", "right"],
    ["${{item.total}}", "auto", "right"],
  ]),

  gap(4),
  r({ align: "right" }, s({ "font-size": 8, color: "#666", "font-style": "italic" }, "{{itemCount}} items sold")),

  gap(6),

  // Totals
  totals(
    [
      ["Subtotal", "${{subtotal}}"],
      ["{{discountLabel}}", "−${{discountAmount}}"],
      ["Taxable amount", "${{taxableAmount}}"],
      ["{{taxLabel}}", "${{taxAmount}}"],
      ["TOTAL", "${{total}}", true],
    ],
    cols,
  ),

  gap(10),

  // Payment / tender block
  r({ "background-color": "#1f4d2b", padding: [10, 12, 10, 12], "border-radius": 4 },
    col("60%",
      r(s({ "font-size": 8, color: "#c8dfc8", "font-weight": "bold" }, "PAYMENT")),
      r({ margin: [3, 0, 0, 0] },
        s({ "font-size": 11, "font-weight": "bold", color: "#ffffff" }, "{{tender.method}}"),
        s({ "font-size": 10, color: "#c8dfc8" }, "  •••• {{tender.cardLast4}}"),
      ),
      r({ margin: [2, 0, 0, 0] }, s({ "font-size": 8, color: "#c8dfc8" }, "Auth code: {{tender.authCode}}")),
    ),
    col("40%", { align: "right" },
      r({ align: "right" }, s({ "font-size": 8, color: "#c8dfc8" }, "Amount Tendered")),
      r({ align: "right", margin: [1, 0, 0, 0] }, s({ "font-size": 11, "font-weight": "bold", color: "#ffffff" }, "${{tender.amountTendered}}")),
      r({ align: "right", margin: [3, 0, 0, 0] }, s({ "font-size": 8, color: "#c8dfc8" }, "Change: ${{tender.change}}")),
    ),
  ),

  gap(12),

  // Barcode block
  col({ align: "center" },
    r({ align: "center" }, barcode("{{barcode}}", { format: "code128", width: 220, height: 44, "show-text": true, alt: "Receipt code {{barcode}}" })),
  ),

  gap(10),

  // Return policy & footer message
  r({ border: [1, 0, 0, 0], "border-color": "#ddd", padding: [8, 0, 0, 0] },
    col(
      r(s({ "font-size": 8, "font-weight": "bold", color: "#1f4d2b" }, "RETURN POLICY")),
      r({ margin: [2, 0, 0, 0] }, s({ "font-size": 8, color: "#555", "line-height": 1.35 }, "{{returnPolicy}}")),
    ),
  ),

  gap(10),

  r({ align: "center" },
    s({ "font-size": 10, "font-style": "italic", color: "#1f4d2b" }, "{{footerMessage}}"),
  ),

  ftrPages("{{store.name}} — {{store.website}}"),
);

const sampleData = {
  receiptNumber: "R-2026-004188",
  transactionId: "TXN-880423117",
  date: "18 April 2026",
  time: "14:32:07",
  store: {
    name: "Greenfield Market",
    branch: "Store #042 — Capitol Hill",
    address: "1820 Broadway Ave E\nSeattle, WA 98122",
    phone: "(206) 555-0182",
    website: "greenfieldmarket.example.com",
    taxId: "WA-UBI 602-341-887",
  },
  cashier: "Avery M.",
  register: "POS-03",
  customer: {
    name: "Jordan Rivera",
    loyaltyId: "GM-7788-2241",
    memberSince: "14 August 2022",
    pointsEarned: 58,
    pointsBalance: "2,416.00",
  },
  items: [
    { sku: "4011", description: "Bananas, organic (per lb)", qty: 2.14, unit: "lb", unitPrice: "0.89", total: "1.90" },
    { sku: "094118", description: "Sourdough boule — bakery", qty: 1, unit: "ea", unitPrice: "6.50", total: "6.50" },
    { sku: "041800", description: "Free-range eggs (dozen)", qty: 2, unit: "ea", unitPrice: "7.25", total: "14.50" },
    { sku: "871223", description: "Cold-brew coffee, 32 oz", qty: 1, unit: "ea", unitPrice: "9.99", total: "9.99" },
    { sku: "204501", description: "Whole milk, 1 gal", qty: 1, unit: "ea", unitPrice: "5.79", total: "5.79" },
    { sku: "667210", description: "Greek yogurt, vanilla (6-pack)", qty: 1, unit: "ea", unitPrice: "8.49", total: "8.49" },
    { sku: "330118", description: "Avocados, hass (bag of 4)", qty: 1, unit: "ea", unitPrice: "6.99", total: "6.99" },
    { sku: "552019", description: "Dark chocolate, 70% (bar)", qty: 3, unit: "ea", unitPrice: "3.75", total: "11.25" },
  ],
  itemCount: 12,
  subtotal: "65.41",
  discountLabel: "Member savings",
  discountAmount: "3.27",
  taxableAmount: "62.14",
  taxRate: 0.101,
  taxLabel: "WA Sales Tax (10.1%)",
  taxAmount: "6.28",
  total: "68.42",
  tender: {
    method: "Visa Credit",
    cardLast4: "4821",
    authCode: "118-73A",
    amountTendered: "68.42",
    change: 0,
  },
  barcode: "0046007700488412007",
  returnPolicy: "Returns accepted within 30 days with receipt. Perishables final sale.",
  footerMessage: "Thank you for shopping at Greenfield Market — see you again soon!",
};

Sample data

json
{
  "receiptNumber": "R-2026-004188",
  "transactionId": "TXN-880423117",
  "date": "18 April 2026",
  "time": "14:32:07",
  "store": {
    "name": "Greenfield Market",
    "branch": "Store #042 — Capitol Hill",
    "address": "1820 Broadway Ave E\nSeattle, WA 98122",
    "phone": "(206) 555-0182",
    "website": "greenfieldmarket.example.com",
    "taxId": "WA-UBI 602-341-887"
  },
  "cashier": "Avery M.",
  "register": "POS-03",
  "customer": {
    "name": "Jordan Rivera",
    "loyaltyId": "GM-7788-2241",
    "memberSince": "14 August 2022",
    "pointsEarned": 58,
    "pointsBalance": "2,416.00"
  },
  "items": [
    {
      "sku": "4011",
      "description": "Bananas, organic (per lb)",
      "qty": 2.14,
      "unit": "lb",
      "unitPrice": "0.89",
      "total": "1.90"
    },
    {
      "sku": "094118",
      "description": "Sourdough boule — bakery",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "6.50",
      "total": "6.50"
    },
    {
      "sku": "041800",
      "description": "Free-range eggs (dozen)",
      "qty": 2,
      "unit": "ea",
      "unitPrice": "7.25",
      "total": "14.50"
    },
    {
      "sku": "871223",
      "description": "Cold-brew coffee, 32 oz",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "9.99",
      "total": "9.99"
    },
    {
      "sku": "204501",
      "description": "Whole milk, 1 gal",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "5.79",
      "total": "5.79"
    },
    {
      "sku": "667210",
      "description": "Greek yogurt, vanilla (6-pack)",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "8.49",
      "total": "8.49"
    },
    {
      "sku": "330118",
      "description": "Avocados, hass (bag of 4)",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "6.99",
      "total": "6.99"
    },
    {
      "sku": "552019",
      "description": "Dark chocolate, 70% (bar)",
      "qty": 3,
      "unit": "ea",
      "unitPrice": "3.75",
      "total": "11.25"
    }
  ],
  "itemCount": 12,
  "subtotal": "65.41",
  "discountLabel": "Member savings",
  "discountAmount": "3.27",
  "taxableAmount": "62.14",
  "taxRate": 0.101,
  "taxLabel": "WA Sales Tax (10.1%)",
  "taxAmount": "6.28",
  "total": "68.42",
  "tender": {
    "method": "Visa Credit",
    "cardLast4": "4821",
    "authCode": "118-73A",
    "amountTendered": "68.42",
    "change": 0
  },
  "barcode": "0046007700488412007",
  "returnPolicy": "Returns accepted within 30 days with receipt. Perishables final sale.",
  "footerMessage": "Thank you for shopping at Greenfield Market — see you again soon!"
}

Render it with your data

Any API key can render this template by its ID. This call uses the sample data; add a data object to use your own. See the API reference.

bash
curl -X POST https://makespdf.com/api/v1/render \
  -H "Authorization: Bearer $MAKESPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"templateId": "receipt-retail"}' \
  -o output.pdf