> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdfdyno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Receipt / Ticket

> A compact receipt or event ticket with QR code support.

<Frame>
  <img src="https://mintcdn.com/pdf-dyno/pat72jpBFeHUuLAU/images/templates/receipt.png?fit=max&auto=format&n=pat72jpBFeHUuLAU&q=85&s=007c5e1ca49a56fb02aa363e6fa566d4" alt="Receipt/Ticket Preview" width="376" height="707" data-path="images/templates/receipt.png" />
</Frame>

This compact format is ideal for point-of-sale (POS) receipts or event tickets.

<CodeGroup>
  ```typst template.typ theme={null}

  // Compact format (Receipt Style)
  #set page(width: 8cm, height: auto, margin: 0.5cm)
  #set text(font: "Helvetica", size: 10pt)

  // CHANGE BRAND COLOR HERE
  #let brand-color = rgb("#334155")

  #align(center)[
    #text(size: 16pt, weight: "bold", fill: brand-color)[#data.brand_name] \
    #text(size: 8pt)[#data.brand_slogan]
  ]

  #v(0.5cm)
  #line(length: 100%, stroke: 1pt + luma(200))
  #v(0.5cm)

  #grid(
    columns: (1fr, auto),
    [*Ticket ID:*], [#data.ticket_id],
    [*Date:*], [#data.date]
  )

  #v(0.5cm)
  #line(length: 100%, stroke: (paint: luma(200), thickness: 1pt, dash: "dashed"))
  #v(0.5cm)

  *Items:*
  #for item in data.items [
    #grid(
      columns: (1fr, auto),
      [#item.name], [#item.price]
    )
    #v(2pt)
  ]

  #v(0.5cm)
  #line(length: 100%, stroke: 1pt + luma(200))
  #v(0.5cm)

  #align(right)[
    *Total:* #text(size: 14pt, weight: "bold")[#data.total]
  ]

  #v(1cm)

  #align(center)[
    // Placeholder for a QR code
    // RENDER QR CODE OR BARCODE HERE
    #rect(width: 3cm, height: 3cm, fill: black)[
      #align(center + horizon)[
        #text(fill: white, size: 8pt)[SCAN ME]
      ]
    ]
    #v(5pt)
    #text(size: 8pt, style: "italic")[Please present this at the entrance.]
  ]
  ```

  ```json data.json theme={null}
  {
    "brand_name": "DevConf 2026",
    "brand_slogan": "The Future of Serverless",
    "ticket_id": "TCK-998811",
    "date": "2026-10-12 09:00 AM",
    "items": [
      { "name": "VIP Admission", "price": "$199.00" },
      { "name": "Workshop Add-on", "price": "$50.00" }
    ],
    "total": "$249.00"
  }
  ```

  ```bash cURL (Try It) theme={null}
  # 1. Save the Typst code from the tab above as 'template.typ'
  # 2. Save the JSON data from the tab above as 'data.json'

  # 3. Combine them and call the API (requires jq)
  jq -n \
    --arg t "$(cat template.typ)" \
    --argjson d "$(<data.json)" \
    '{ "data": $d, "template": $t }' > request.json

  curl -X POST https://api.pdfdyno.com/v1/pdf/generate \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d @request.json \
    --output receipt.pdf
  ```
</CodeGroup>
