Add finance app with Stripe Checkout subscriptions (#21) #23

Merged
westfarn merged 1 commits from feature/finance-stripe-21 into master 2026-07-26 17:35:07 -07:00
Owner

Summary

  • Closes #21 — new Django finance app with Stripe as payment provider
  • Subscription price defaults to $10 USD / month via SUBSCRIPTION_PRICE_AMOUNT_CENTS = 1000 in settings.py (env-overridable)
  • Persists Invoice and Payment rows; both registered in Django admin (with payment inline on invoices)
  • Checkout Session API redirects users to Stripe hosted payment; webhook verifies signatures and upserts ledger idempotently

API

  • POST /api/finance/checkout/ — JWT auth → { checkout_url, session_id }
  • GET /api/finance/invoices/ / GET /api/finance/payments/ — own records
  • POST /api/finance/webhooks/stripe/ — Stripe signature-verified webhook

Config

Documented in .env.example / .env.prod.example:
STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET, optional STRIPE_PRICE_ID, FRONTEND_BASE_URL

Test plan

  • uv run python manage.py test finance (17 tests)
  • Set Stripe test keys locally; create checkout session; complete payment in Stripe test mode
  • Confirm Invoice/Payment appear in /admin/
  • Point Stripe webhook to /api/finance/webhooks/stripe/ and verify checkout.session.completed / invoice.paid
## Summary - Closes #21 — new Django `finance` app with Stripe as payment provider - Subscription price defaults to **$10 USD / month** via `SUBSCRIPTION_PRICE_AMOUNT_CENTS = 1000` in `settings.py` (env-overridable) - Persists **Invoice** and **Payment** rows; both registered in Django admin (with payment inline on invoices) - Checkout Session API redirects users to Stripe hosted payment; webhook verifies signatures and upserts ledger idempotently ## API - `POST /api/finance/checkout/` — JWT auth → `{ checkout_url, session_id }` - `GET /api/finance/invoices/` / `GET /api/finance/payments/` — own records - `POST /api/finance/webhooks/stripe/` — Stripe signature-verified webhook ## Config Documented in `.env.example` / `.env.prod.example`: `STRIPE_SECRET_KEY`, `STRIPE_PUBLISHABLE_KEY`, `STRIPE_WEBHOOK_SECRET`, optional `STRIPE_PRICE_ID`, `FRONTEND_BASE_URL` ## Test plan - [x] `uv run python manage.py test finance` (17 tests) - [ ] Set Stripe test keys locally; create checkout session; complete payment in Stripe test mode - [ ] Confirm Invoice/Payment appear in `/admin/` - [ ] Point Stripe webhook to `/api/finance/webhooks/stripe/` and verify `checkout.session.completed` / `invoice.paid`
westfarn added 1 commit 2026-07-26 17:16:40 -07:00
Add finance app with Stripe Checkout subscriptions (#21)
CI / test (pull_request) Successful in 9s
Unit Tests / test (pull_request) Successful in 10s
f92bd268b3
Introduce Invoice/Payment ledger models, $10/mo settings-backed pricing,
hosted Checkout + signed webhooks, Django admin, and authenticated list APIs.
westfarn merged commit ad44359804 into master 2026-07-26 17:35:07 -07:00
westfarn deleted branch feature/finance-stripe-21 2026-07-26 17:35:07 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#23