Use Case

Send receipt and invoice emails with Postkit

Deliver transactional receipts and invoices after every purchase. Postkit ensures exactly-once delivery and provides a paper trail via delivery webhooks.

Get Started Free

The problem

Financial emails must arrive reliably — and only once. A duplicate receipt looks like a double charge. A missing receipt triggers a support ticket.

The Postkit solution

Postkit's idempotency keys (keyed on order ID) guarantee one email per transaction. Handlebars templates let you personalize line items, totals, and tax details. Delivery webhooks give you a verifiable record.

send-receipt.ts
await fetch("https://api.postkit.eu/v1/emails", {
  method: "POST",
  headers: {
    Authorization: "Bearer pk_live_...",
    "Content-Type": "application/json",
    "Idempotency-Key": `receipt-${orderId}`,
  },
  body: JSON.stringify({
    from: "billing@yourapp.eu",
    to: customer.email,
    subject: `Receipt for order #${orderId}`,
    template_id: "tmpl_receipt",
    data: {
      customerName: customer.name,
      orderId,
      items: order.items,
      total: order.total,
      currency: "EUR",
    },
  }),
});

Template example

Use a Handlebars template to keep your email content separate from your application code.

template.hbs
<h2>Receipt for order #{{orderId}}</h2>
<p>Hi {{customerName}}, thanks for your purchase.</p>
{{#each items}}
<p>{{this.name}} — {{this.price}} {{../currency}}</p>
{{/each}}
<p><strong>Total: {{total}} {{currency}}</strong></p>

Start sending in under 5 minutes

Free plan. No credit card required.

Get Started Free