Monetization app + RevenueCat webhooks (store IAP ledger) (#69)
## Summary - Rename `finance` → **`monetization`** Django app (keep `finance_*` tables via `label = "finance"`) - Add `services/stripe.py` + `services/revenuecat.py`; RevenueCat webhook upserts **subscription + Invoice/Payment** (billing history parity with Stripe) - Mount `/api/monetization/` + keep `/api/finance/` alias - Extend `Source`/`Provider` with `revenuecat`; product→plan mapping via `revenuecat_product_id` / `REVENUECAT_PRODUCT_PLAN_MAP` Closes #68. Companion to [chat_web_app#100](ai_ml_operations/chat_web_app#100). ## Test plan - [x] `manage.py test monetization.tests` (54 OK) - [x] Smoke `chat_backend.tests.test_views_documents` + `test_oauth` - [ ] Deploy: set `REVENUECAT_WEBHOOK_SECRET`; point RC webhook at `/api/finance/webhooks/revenuecat/` - [ ] Map store product IDs on `SubscriptionPlan.revenuecat_product_id` (or env JSON map) - [ ] Sandbox INITIAL_PURCHASE → subscription `source=revenuecat` + invoice in `/finance/invoices/`Reviewed-on: #69
This commit was merged in pull request #69.
This commit is contained in:
+5
-1
@@ -76,13 +76,17 @@ OAUTH_CALLBACK_BASE_URL=http://127.0.0.1:8001
|
||||
# POST {OAUTH_CALLBACK_BASE_URL}/api/drive/webhooks/microsoft/
|
||||
# Worker sync: `python manage.py sync_drive_connections [--connection-id N]`
|
||||
|
||||
# Stripe / finance (optional local — required for checkout + webhooks)
|
||||
# Stripe / monetization (optional local — required for checkout + webhooks)
|
||||
STRIPE_SECRET_KEY=
|
||||
STRIPE_PUBLISHABLE_KEY=
|
||||
STRIPE_WEBHOOK_SECRET=
|
||||
# Optional: pre-created Stripe Price ID for Founders. When empty, Checkout uses
|
||||
# SubscriptionPlan.price_cents / SUBSCRIPTION_PRICE_* ($10 USD / month Founders).
|
||||
STRIPE_PRICE_ID=
|
||||
# RevenueCat webhook Authorization bearer secret (store IAP).
|
||||
REVENUECAT_WEBHOOK_SECRET=
|
||||
# Optional JSON map of store product id → plan slug, e.g.
|
||||
# REVENUECAT_PRODUCT_PLAN_MAP={"hesychia_founders_monthly":"founders"}
|
||||
# SUBSCRIPTION_PRICE_AMOUNT_CENTS=1000
|
||||
# SUBSCRIPTION_PRICE_CURRENCY=usd
|
||||
# SUBSCRIPTION_PRICE_INTERVAL=month
|
||||
|
||||
Reference in New Issue
Block a user