Admin invoices + Stripe: one-off + monthly recurring (customers pay us), pay-link emails #23

Closed
opened 2026-07-31 04:15:45 -07:00 by westfarn · 0 comments
Owner

Context / current state

Stripe is not integrated today. Mentions of Stripe only appear in marketing/pricing copy (web design add-on catalog). There is:

  • No stripe (or dj-stripe) dependency in pyproject.toml
  • No Stripe API keys / webhook secrets in .env.example or .env.prod.example
  • No invoice, payment, or customer billing models/views in financial

financial today covers contracts, charge numbers, timekeeping, employees, and user profiles. Access control already has financial_admin_required (superuser) and related helpers in financial/permissions.py.

There is an invoice PDF template at company_site/Inoivce Template.pdf that can inform layout/branding.

Email (SMTP2GO) is already configured via env — usable for pay-link notifications.


Goal

When logged in as an admin, be able to:

  1. Create one-off invoices (customer pays us)
  2. Create monthly recurring invoices / subscriptions (customer pays us on a schedule)
  3. On create: email the customer a payment link
  4. View invoices / payment status / history in the logged-in admin UI
  5. Track payment status via Stripe (paid / open / past due / failed, etc.)

All create/list/detail surfaces are admin-only (reuse financial_admin_required / superuser).

Money direction (decided)

Inbound only: customers pay us. One-off and monthly recurring both collect payment from the customer. Not vendor payouts / AP.


Requirements

Auth & UI

  • Admin-only invoice dashboard (list + filters: status, customer, date)
  • Create one-off invoice form (customer, line items, amount, due date, notes)
  • Create monthly recurring invoice / subscription form (customer, amount, cadence, start date)
  • Invoice/payment detail page with Stripe status, pay link, email history
  • Link from financial nav (admin only)

Stripe

  • Add Stripe SDK dependency + env vars (STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET)
  • Create Stripe Invoice / Payment Link (or Checkout Session) for one-off invoices
  • Create Stripe Subscription (or recurring Invoice) for monthly customer payments
  • Webhook endpoint to sync payment status into local models
  • Store Stripe IDs on local records (customer, invoice, subscription, payment intent)

Email

  • On invoice / subscription create: send email with payment link (SMTP2GO already wired)
  • Optional: remind / failure emails later (out of scope unless easy)

Data model (suggested)

  • Invoice (or reuse Stripe objects + thin local mirror): amount, currency, status, customer, stripe ids, created_by, due_date
  • Customer contact (email required for pay link)
  • RecurringInvoice / subscription mirror for monthly customer payments

Acceptance criteria

  1. Non-admin users cannot see or create invoices/payments.
  2. Admin can create a one-off invoice → Stripe object created → email sent with pay link → admin can open detail and see status.
  3. Admin can set up a monthly recurring customer payment → Stripe subscription/recurring invoice created → email with pay link → admin can view status/history.
  4. Stripe webhook updates local status when paid/failed/canceled.
  5. Secrets only in env; documented in .env.example / .env.prod.example.

Notes

  • Reuse Inoivce Template.pdf branding where useful for PDF export (nice-to-have; pay link is MVP).
## Context / current state **Stripe is not integrated today.** Mentions of Stripe only appear in marketing/pricing copy (web design add-on catalog). There is: - No `stripe` (or dj-stripe) dependency in `pyproject.toml` - No Stripe API keys / webhook secrets in `.env.example` or `.env.prod.example` - No invoice, payment, or customer billing models/views in `financial` `financial` today covers contracts, charge numbers, timekeeping, employees, and user profiles. Access control already has `financial_admin_required` (superuser) and related helpers in `financial/permissions.py`. There is an invoice PDF template at `company_site/Inoivce Template.pdf` that can inform layout/branding. Email (SMTP2GO) is already configured via env — usable for pay-link notifications. --- ## Goal When logged in as an **admin**, be able to: 1. **Create one-off invoices** (customer pays us) 2. **Create monthly recurring invoices / subscriptions** (customer pays us on a schedule) 3. On create: **email the customer a payment link** 4. **View** invoices / payment status / history in the logged-in admin UI 5. Track payment status via **Stripe** (paid / open / past due / failed, etc.) All create/list/detail surfaces are **admin-only** (reuse `financial_admin_required` / superuser). ### Money direction (decided) **Inbound only:** customers pay us. One-off and monthly recurring both collect payment from the customer. Not vendor payouts / AP. --- ## Requirements ### Auth & UI - [ ] Admin-only invoice dashboard (list + filters: status, customer, date) - [ ] Create one-off invoice form (customer, line items, amount, due date, notes) - [ ] Create monthly recurring invoice / subscription form (customer, amount, cadence, start date) - [ ] Invoice/payment detail page with Stripe status, pay link, email history - [ ] Link from financial nav (admin only) ### Stripe - [ ] Add Stripe SDK dependency + env vars (`STRIPE_SECRET_KEY`, `STRIPE_PUBLISHABLE_KEY`, `STRIPE_WEBHOOK_SECRET`) - [ ] Create Stripe Invoice / Payment Link (or Checkout Session) for one-off invoices - [ ] Create Stripe Subscription (or recurring Invoice) for monthly customer payments - [ ] Webhook endpoint to sync payment status into local models - [ ] Store Stripe IDs on local records (customer, invoice, subscription, payment intent) ### Email - [ ] On invoice / subscription create: send email with payment link (SMTP2GO already wired) - [ ] Optional: remind / failure emails later (out of scope unless easy) ### Data model (suggested) - [ ] `Invoice` (or reuse Stripe objects + thin local mirror): amount, currency, status, customer, stripe ids, created_by, due_date - [ ] `Customer` contact (email required for pay link) - [ ] `RecurringInvoice` / subscription mirror for monthly customer payments --- ## Acceptance criteria 1. Non-admin users cannot see or create invoices/payments. 2. Admin can create a one-off invoice → Stripe object created → email sent with pay link → admin can open detail and see status. 3. Admin can set up a monthly recurring customer payment → Stripe subscription/recurring invoice created → email with pay link → admin can view status/history. 4. Stripe webhook updates local status when paid/failed/canceled. 5. Secrets only in env; documented in `.env.example` / `.env.prod.example`. --- ## Notes - Reuse `Inoivce Template.pdf` branding where useful for PDF export (nice-to-have; pay link is MVP).
westfarn changed title from Admin invoices + Stripe: one-off invoices, vendor recurring payments, pay-link emails to Admin invoices + Stripe: one-off + monthly recurring (customers pay us), pay-link emails 2026-07-31 04:20:03 -07:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/company_site#23