Stripe webhook to branded invoice PDF: a Cloudflare Worker recipe that keeps the file on your side
A Stripe payment lands, and someone wants a PDF invoice that looks like your product: your logo, your brand color, your layout, saved where you keep records. Stripe already hosts its own invoice PDF ( invoice_pdf on the invoice). This recipe is for when you want your own template and your own copy. Status note: Slipmint is a side project in development. Free API keys go out by invite to waitlist…
A Stripe payment triggers an invoice PDF via a Cloudflare Worker. The Worker verifies the webhook signature using Stripe's SDK, maps the Stripe invoice onto a template with JSON data, and stores the generated PDF on a Cloudflare R2 bucket. The template requires fields such as company name, invoice number, issue date, and customer name, along with optional branding details and optional status badge.
The tax calculation is handled accurately to match Stripe's output, and any discrepancies result in an error. The handler checks for duplicate deliveries and uses waitUntil to ensure the response is processed before complex logic runs.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.