Skip to content

E-invoices for apps that charge through Stripe

Every Stripe payment becomes a ZUGFeRD invoice — with one edge function and one API call.

You built your app with an AI app builder or by hand, and Stripe Checkout takes the money. The payment is to become an e-invoice with a structured record. You do not need a second service with its own order model for that: an edge function listens for the payment event, builds the invoice data and calls one endpoint. Back comes a PDF that also contains the XML invoice.

What comes in

The Stripe event checkout.session.completed with buyer and amount

The session's line items, fetched from Stripe

Your invoice number, set as metadata when the session is created

Your company data: name, address, VAT ID, bank details

What this solves

01

One call, no order model

You send the invoice data as JSON and get the file in the same response. There is nothing to reconcile and nothing to poll.

02

Code that has run

We ran the edge function in the recipe unchanged against the real API. What was real and what was simulated is stated below the code.

03

Your AI can read the spec

The OpenAPI file is public. Hand it to your app builder or assistant: it lists fields, mandatory details and error codes.

04

You detect duplicate events yourself

Stripe may deliver an event more than once. The response carries payloadHash: same invoice data, same value. Store the file under this value, and a second delivery creates no second file.

One real example

An excerpt from the recipe “Turn a Stripe payment into an e-invoice” — the fields the function derives from the payment.

json
{
"invoice": {
"invoiceNumber": "RE-2026-0042",
"buyer": {
"name": "Beispiel AG",
"street": "Beispielweg 42",
"postalCode": "80331",
"city": "München",
"countryCode": "DE"
},
"taxSummary": [
{
"taxRate": 19,
"netAmount": 250,
"taxAmount": 47.5
}
],
"total": 297.5
}
}

POST /api/v1/invoice/DE/zugferd/generate

Response: a Base64-encoded PDF/A-3 with embedded EN 16931 XML for €297.50, plus filename and payloadHash.

The full recipe

The endpoints involved

Compared to the alternative

The alternative is a finished application such as Rechnungskit, which handles invoicing, archiving and DATEV export for German shops. That fits if you do not want to build anything. If you only need the invoice document and keep the rest in your own hands, the one call is enough.

Read the comparison

How it runs

  1. 1

    Create the checkout session with metadata.invoice_number and a required billing address.

  2. 2

    Register the edge function from the recipe as the Stripe webhook for checkout.session.completed.

  3. 3

    The function calls POST /api/v1/invoice/DE/zugferd/generate; you store the PDF and send it to the buyer.

What it costs at this volume

Around 200 invoices per month fit the Starter plan at 23 € per month.

All prices net, plus VAT · 20 % off when billed annually · Free tier without a credit card

All plans

Limits

  • Your app assigns invoice numbers. The API does not check whether a number is already taken.
  • There is no archive on our side yet (Archive API planned 2027). Until then you store the invoice yourself.
  • The example derives the tax rate from Stripe's amounts. For sales to other EU countries, reverse charge or several rates per line you need the details from Stripe Tax or from your own logic.
  • Credit notes and cancellations for refunds are separate calls; the example covers only the paid order.
  • We have not built the function inside a particular app builder ourselves. It is checked as a Supabase Edge Function outside Supabase, with the real call to our API.

Frequently asked questions

Does this work in Lovable, Bolt or another AI app builder?

We have not built it there ourselves and therefore do not claim it. The code is an ordinary Supabase Edge Function. If your app builder uses Supabase Edge Functions and Stripe webhooks, that is where it belongs; you store the secrets in your Supabase project settings.

Is the invoice from Stripe not enough?

An e-invoice under EN 16931 needs a structured record, that is XML, alone or embedded in the PDF. Whether and from when you must issue such invoices in German B2B depends on your turnover: from 2027 above €800,000 prior-year turnover, from 2028 everyone else; exceptions such as small-amount invoices remain.

What does it cost with few invoices?

Up to 20 invoices a month, nothing. Above that, the calculator on the pricing page works out your case; all prices net, plus VAT.

The payment becomes the e-invoice — with one call.