---
title: "Receipt Image API: Render Order Receipt PNGs from JSON"
description: "Render compact order receipts with the Receipt Image API. POST line items and totals, get an 800x1200 PNG for email or an A4 PDF for expense filing."
url: "https://html2img.com/templates/receipt-image/"
---

# Receipt Image Generator API

Send order rows and totals as JSON, get back an 800x1200 PNG receipt for the confirmation email.

Direct-to-consumer brands and order-management platforms use the Receipt Image API to confirm purchases with a single inline image rather than a downloaded PDF. The vertical 80mm proportions match the thermal receipts customers already recognize, so the artwork feels native in confirmation emails and order-history thumbnails. You post the order rows, totals, and a footer message, and the response holds an 800x1200 PNG hosted on i.html2img.com. For buyers who file expenses, the same payload with format: "pdf" returns the receipt as an A4 document with searchable totals.

## At a glance

- **Template slug:** `receipt-image`
- **Category:** business
- **Endpoint:** `POST https://app.html2img.com/api/v1/templates/receipt-image`
- **Authentication:** `X-API-Key` header
- **Cost:** one credit per render, PNG or PDF
- **Page:** https://html2img.com/templates/receipt-image/

## Fields

| Field | Type | Required | Description | Example |
| --- | --- | --- | --- | --- |
| `business_name` | string | Yes |  | Studio Ink |
| `logo_url` | url | No |  |  |
| `order_number` | string | Yes |  | #A8421-9032 |
| `order_date` | string | No |  | Apr 30, 2026 |
| `customer_name` | string | No |  | Jamie Park |
| `customer_email` | string | No |  | jamie@northwind.studio |
| `items` | array | Yes | Object shape: name (string), qty (string), amount (string). | [{"name":"Botanical print, A2","qty":"2","amount":"$58.00"},{"name":"Hand-bound notebook","qty":"1","amount":"$24.00"},… |
| `subtotal` | string | No |  | $118.00 |
| `shipping` | string | No |  | $8.00 |
| `tax_amount` | string | No |  | $10.40 |
| `total` | string | Yes |  | $136.40 |
| `thank_you_message` | string | No |  | Thanks for supporting independent makers. |
| `accent_color` | string | No |  | #B45309 |

## Defaults

| Field | Default |
| --- | --- |
| `width` | 800 |
| `height` | 1200 |

## Example request

```bash
curl -X POST https://app.html2img.com/api/v1/templates/receipt-image \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"business_name":"Studio Ink","order_number":"#A8421-9032","order_date":"Apr 30, 2026","customer_name":"Jamie Park","customer_email":"jamie@northwind.studio","items":[{"name":"Botanical print, A2","qty":"2","amount":"$58.00"},{"name":"Hand-bound notebook","qty":"1","amount":"$24.00"},{"name":"Letterpress card pack","qty":"3","amount":"$36.00"}],"subtotal":"$118.00","shipping":"$8.00","tax_amount":"$10.40","total":"$136.40","thank_you_message":"Thanks for supporting independent makers.","accent_color":"#B45309"}'
```

## In your language

### PHP

```php
<?php
$response = \Illuminate\Support\Facades\Http::withHeaders([
    'X-API-Key' => 'YOUR_API_KEY',
])->post('https://app.html2img.com/api/v1/templates/receipt-image', ['business_name' => 'Studio Ink', 'order_number' => '#A8421-9032', 'order_date' => 'Apr 30, 2026', 'customer_name' => 'Jamie Park', 'customer_email' => 'jamie@northwind.studio', 'items' => ['0' => ['name' => 'Botanical print, A2', 'qty' => '2', 'amount' => '$58.00'], '1' => ['name' => 'Hand-bound notebook', 'qty' => '1', 'amount' => '$24.00'], '2' => ['name' => 'Letterpress card pack', 'qty' => '3', 'amount' => '$36.00']], 'subtotal' => '$118.00', 'shipping' => '$8.00', 'tax_amount' => '$10.40', 'total' => '$136.40', 'thank_you_message' => 'Thanks for supporting independent makers.', 'accent_color' => '#B45309']);

$url = $response->json('url');
```

### Node.js

```javascript
const response = await fetch('https://app.html2img.com/api/v1/templates/receipt-image', {
  method: 'POST',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "business_name": "Studio Ink",
    "order_number": "#A8421-9032",
    "order_date": "Apr 30, 2026",
    "customer_name": "Jamie Park",
    "customer_email": "jamie@northwind.studio",
    "items": [
        {
            "name": "Botanical print, A2",
            "qty": "2",
            "amount": "$58.00"
        },
        {
            "name": "Hand-bound notebook",
            "qty": "1",
            "amount": "$24.00"
        },
        {
            "name": "Letterpress card pack",
            "qty": "3",
            "amount": "$36.00"
        }
    ],
    "subtotal": "$118.00",
    "shipping": "$8.00",
    "tax_amount": "$10.40",
    "total": "$136.40",
    "thank_you_message": "Thanks for supporting independent makers.",
    "accent_color": "#B45309"
}),
});

const { url } = await response.json();
```

### Python

```python
import requests

response = requests.post(
    'https://app.html2img.com/api/v1/templates/receipt-image',
    headers={'X-API-Key': 'YOUR_API_KEY'},
    json={'business_name': 'Studio Ink', 'order_number': '#A8421-9032', 'order_date': 'Apr 30, 2026', 'customer_name': 'Jamie Park', 'customer_email': 'jamie@northwind.studio', 'items': {'0': {'name': 'Botanical print, A2', 'qty': '2', 'amount': '$58.00'}, '1': {'name': 'Hand-bound notebook', 'qty': '1', 'amount': '$24.00'}, '2': {'name': 'Letterpress card pack', 'qty': '3', 'amount': '$36.00'}}, 'subtotal': '$118.00', 'shipping': '$8.00', 'tax_amount': '$10.40', 'total': '$136.40', 'thank_you_message': 'Thanks for supporting independent makers.', 'accent_color': '#B45309'},
)

url = response.json()['url']
```

## What it is for

### Order confirmation email body for Northwind Studio

Drop the rendered URL into the receipt email so customers see the totals before scrolling. Most ESPs render remote images on first open, so the buyer reads the receipt without expanding an attachment. The vertical layout reads well in the narrow email body width that mobile clients use, and the file size lands under 80 KB so even slow connections render fast. Cart abandonment recovery sees a measurable lift when the email includes the styled receipt rather than a plain HTML table.

### In-app order history thumbnails

The order history tab of a customer dashboard benefits from one image per order rather than a full HTML table per row. Render each order to a PNG when it ships, store the URL on the order record, and let the dashboard display the cached image. Page loads stay fast because the browser caches one asset per order, and the receipts maintain visual continuity with the email artwork. Riverside Bakery uses this for its 11,000-strong customer base and reports a 30 percent drop in support tickets asking "what was on this order?".

### Refund confirmation artwork

When you process a refund, send a fresh receipt that mirrors the original, with negative line amounts and a "REFUNDED" stamp via accent_color. The customer gets visual closure that matches their mental model of the original purchase. Wren Analytics uses this pattern across its retail clients, and refund-related support volume drops because the customer can see exactly which items were credited.

### Gift order forwarding

Gift purchases benefit from a second receipt that the recipient can open without seeing the price. Render two PNGs: one with prices for the buyer, one without for the recipient, by toggling the price-visibility flag in your code. The recipient receives a clean confirmation of what arrived without any awkward sticker-shock moments. Halberd Software ships this pattern in its e-commerce connector for shops that need gift-friendly receipts.

### Marketplace transaction record

Two-sided marketplaces need a transaction record that reads as authoritative for both buyer and seller. Render one canonical receipt per transaction, store the URL on both ledger rows, and link from each side's dashboard. Both parties see identical artwork, which reduces dispute volume because there is one source of truth instead of two HTML tables that may have diverged through later edits.

## Output

- **Dimensions:** 800x1200
- **Colour space:** sRGB
- **Transparency:** Not supported
- **Typical file size:** 30 KB to 80 KB
- **Platform specification:** [80mm thermal-style proportional layout adapted for screen](https://escpos.readthedocs.io/en/latest/)

## Common mistakes

### Vertical layout overflows with too many items

Orders with more than 18 line items push the totals block off the bottom of the canvas. Truncate to the first 15 items with a "+N more" line, or render the long orders to a 600x1500 variant by overriding height in the request.

### Monetary alignment drifts with mixed digit counts

A receipt that mixes "$8.00" and "$1,290.00" in the same column ends up visually staggered when amounts are different lengths. Right-align the amount column and pad the smaller values, which the template handles automatically when amounts are passed as strings.

### Tax line omitted when subtotal already includes tax

EU shops that quote tax-inclusive prices accidentally double-count VAT by sending both subtotal and tax_amount. Decide once whether your subtotal is gross or net, and only send tax_amount in the net case so the receipt math reconciles.

## Questions

### Is this a thermal-printable receipt?

The 800x1200 layout matches 80mm thermal proportions and prints cleanly on inkjet too. For true thermal print, set the printer to fit-to-width and supply a high-contrast accent_color. For a desk-printer copy, request format: "pdf" instead and the receipt arrives centred on an A4 page with selectable text.

### Can I add a tip line?

Yes, pass tip_amount with a pre-formatted string like "$3.50". Omit the field for non-hospitality orders and the row will not render. The total should already include the tip if you want it reflected, since the template treats every monetary string as display-only.

### What goes in the footer?

Pass footer_text with your business address, a return policy summary, or a simple thank-you note up to 200 characters. The template wraps text automatically and centers it under the totals block. Most stores use this slot for a return-window reminder or a short loyalty-program nudge.

### How is currency formatted?

You pre-format every amount on your side as a string. The renderer prints "$1,290.00", "€1.290,00", or any other localized format exactly as written. This keeps the rendering layer free of locale logic and avoids drift between your checkout and the displayed receipt.

### Can I add a barcode?

Not in this template. If you need a scannable code on the receipt for in-store returns, switch to the event-ticket template which has a dedicated QR slot. Most e-commerce flows do not need a code on the receipt itself.

### How does this differ from invoice-image?

Receipts confirm a completed transaction in compact 80mm form, while invoices request payment and live on A4. Use receipt-image for thank-you emails and order history, and invoice-image when the document needs party-to-party details, payment terms, and a multi-line tax breakdown.

## Preview

![Receipt Image Generator API example render](https://i.html2img.com/image-1777560082974-435933.png)

## Related templates

- [invoice-image](https://html2img.com/templates/invoice-image/)
- [event-ticket](https://html2img.com/templates/event-ticket/)
- [product-card](https://html2img.com/templates/product-card/)

## See also

- [Every template](https://html2img.com/templates/)
- [Templates API reference](https://html2img.com/docs/templates/)
- [OpenAPI specification](https://html2img.com/openapi.json)
