Prompt
How to send receipt and invoice emails from your SaaS
Latest observation
To send receipt and invoice emails from your SaaS, you need two things:
- A way to generate the documents/data
- An email delivery system to send them reliably
Here’s the practical setup.
1. Decide what email type you need
Receipt
Send immediately after a successful payment. Usually includes:
- Payment amount
- Date
- Transaction ID
- Product/subscription purchased
- Billing period
- Tax breakdown
- Link to view/download receipt
Invoice
Send when:
- A subscription renews
- You bill manually
- You need a formal bill before/after payment
- A customer uses invoicing instead of card auto-charge
Usually includes:
- Invoice number
- Issue date
- Due date
- Line items
- Taxes
- Total
- Payment status
- Payment instructions
2. Use a payment provider webhook
If you use Stripe, Paddle, Chargebee, etc., don’t send these emails directly from the checkout page.
Instead, listen for events like:
payment_intent.succeededinvoice.paidinvoice.finalizedcheckout.session.completedsubscription.createdsubscription.renewed
This ensures emails are sent only after the payment is confirmed.
3. Generate the receipt/invoice data
Store or compute:
- Customer name/email
- Billing address
- Plan name
- Amount
- Currency
- Tax/VAT
- Invoice number
- Payment date
- Line items
You can either:
- Use your payment processor’s invoice objects
Best if you want less custom work - Generate your own PDF/email content
Best if you need custom branding or special formatting
4. Send emails via a transactional email service
Use a provider built for transactional email, such as:
- SendGrid
- Postmark
- Amazon SES
- Mailgun
- Resend
These are better than regular marketing tools because they offer:
- High deliverability
- Webhooks and logs
- Templates
- Attachments
- Bounce handling
5. Use templates for receipts and invoices
Create separate templates for:
- Payment receipt
- Invoice issued
- Invoice paid
- Failed payment / overdue notice
Template variables might include:
{{customer_name}}{{invoice_number}}{{amount_paid}}{{billing_period}}{{download_link}}
Keep the template clean and include a clear CTA:
- “View invoice”
- “Download receipt”
- “Update billing details”
6. Send PDF attachments or secure links
You have two options:
Option A: Attach PDF
Good for simple cases, but can increase email size and hurt deliverability.
Option B: Include a secure download link
Usually better.
Host the PDF in your app or object storage and generate a signed URL that expires.
This is often the preferred SaaS pattern.
7. Handle legal and tax requirements
Depending on where you operate, invoices may need:
- Business name and address
- Tax ID/VAT number
- Invoice number sequence
- Currency
- Tax details
- Customer billing info
If you sell internationally, verify compliance with local tax laws.
8. Make sure the emails are triggered exactly once
To avoid duplicate receipts:
- Use idempotency keys
- Store an “email sent” flag in your database
- Deduplicate by payment/invoice ID
- Retry safely if the email provider fails
Example logic:
- Webhook received
- Verify signature
- Check if receipt already sent for
payment_id - If not, generate and send email
- Mark as sent
9. Recommended architecture
Flow:
- Customer pays
- Payment provider sends webhook
- Your backend validates webhook
- Backend creates receipt/invoice record
- Backend renders email template
- Backend sends email through transactional provider
- Optional: generate PDF and store it
- Email includes link or attachment
10. Example implementation stack
A common SaaS stack:
- Payments: Stripe
- Backend: Node.js / Python / Ruby / Go
- Email: Postmark or Resend
- PDF generation: Puppeteer, WeasyPrint, or PDFKit
- Storage: S3 or R2
- Webhook processing: Background jobs/queue
11. Example webhook logic
Pseudo-flow:
Stripe webhook: invoice.paid
→ verify webhook signature
→ find customer
→ check if invoice email already sent
→ render invoice HTML/PDF
→ upload PDF
→ send email with receipt/invoice link
→ mark invoice as emailed
12. Best practices
- Send from a branded domain like
billing@yourapp.com - Set up SPF, DKIM, and DMARC
- Use clear subject lines:
- “Your receipt from Acme”
- “Invoice #1042 from Acme”
- Include support/contact info
- Make it easy to view past invoices in-app
- Don’t rely on frontend-only email triggers
- Log every send event
13. If you use Stripe
Stripe can generate invoices and receipts automatically, but many SaaS products still customize the email experience. You can either:
- Use Stripe’s built-in email receipts
- Or disable/limit them and send your own via webhook for full branding control
If you want your own branded billing email flow, Stripe webhooks are the usual route.
If you want, I can also give you:
- a Stripe + Node.js example
- a Stripe + Python example
- a ready-to-use email template for receipts and invoices
Observation history
Unlock observation history
Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.
How did Obsurfable measure this prompt?
Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.
Which AI systems does Obsurfable collect answers from?
OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.