feat(sponsor): Stripe-based voluntary sponsoring with Sponsor badge (Gitea #22)
Replaces the (never-launched) ad business direction with a freiwilliger Beitrag/Community-Abo model: owners can support PawFeed via Stripe with a one-time payment or a monthly SEPA/card subscription (2 EUR minimum), declared as Sponsoring/Community-Abo, not a tax-deductible donation. The Sponsor badge (only perk, no feature unlocks) is Owner-scoped and shows on every post of every one of their pets, plus their profile. - Schema: Owner.stripeCustomerId/sponsorSince/sponsorPeriodEnd/ sponsorSubscriptionId/sponsorSubscriptionStatus, new SponsorContribution model (payment history) - src/lib/stripe.ts (singleton client, mux.ts pattern) + src/lib/sponsor.ts (isActiveSponsor: one-time givers keep the badge permanently, subscribers through sponsorPeriodEnd even after cancelling -- no mid-period cliff) - src/trpc/routers/sponsor.ts: getStatus, createCheckoutSession (SEPA + card for subscriptions, card for one-time, price_data since amounts are user-chosen), cancelSubscription (cancel_at_period_end, no hard stop) - src/app/api/webhooks/stripe: checkout.session.completed, invoice.paid, customer.subscription.updated/deleted (mux webhook route pattern) - src/app/(app)/unterstuetzen: amount chips (3/5/10 EUR) prefilling an editable field, one-time/subscription toggle, status + contribution history, in-app cancel button (no Stripe-hosted portal, per requirement) - Badge surfaced in feed/explore postInclude + PostCard, and on the pet profile page next to the existing isVerified badge - Nutzungsbedingungen Sec. 12 (draft, needs sign-off before launch) + Stripe added to the Datenschutzerklaerung's Auftragsverarbeiter list - src/__tests__/sponsor.test.ts (7 tests), Stripe client fully mocked STRIPE_WEBHOOK_SECRET intentionally not yet configured -- the webhook endpoint can only be registered in the Stripe dashboard once this is deployed and reachable at https://pawfeed.org/api/webhooks/stripe. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5f788b38c
commit
c6ffc1336e
21 files changed
+786
-6
No files matched your search
@@ -25,6 +25,15 @@ SUPABASE_SERVICE_ROLE_KEY="eyJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_xxxxxxxxxxxxxxxxxxxx"
|
||||
CLERK_SECRET_KEY="sk_test_xxxxxxxxxxxxxxxxxxxx"
|
||||
|
||||
# ── Stripe (Sponsoring, Gitea #22) ──────────────────────────
|
||||
# Stripe Dashboard → Developers → API keys
|
||||
STRIPE_SECRET_KEY="sk_test_xxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
# Stripe Dashboard → Developers → Webhooks → Add endpoint → copy Signing Secret
|
||||
# Endpoint must point at https://<your-domain>/api/webhooks/stripe
|
||||
# Subscribe to: checkout.session.completed, invoice.paid,
|
||||
# customer.subscription.updated, customer.subscription.deleted
|
||||
STRIPE_WEBHOOK_SECRET="whsec_xxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
|
||||
# ── Mux (Video) ──────────────────────────────────────────────
|
||||
# Mux Dashboard → Settings → Access Tokens → Create Token (Mux Video)
|
||||
MUX_TOKEN_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
|
||||
Reference in new issue
Block a user