Skip to content

feat(billing): add Stripe-style inbound webhook pipeline for subscrip… - #73

Merged
aji70 merged 2 commits into
MyFanss:mainfrom
devoclan:feature/billing-webhooks
Jul 29, 2026
Merged

feat(billing): add Stripe-style inbound webhook pipeline for subscrip…#73
aji70 merged 2 commits into
MyFanss:mainfrom
devoclan:feature/billing-webhooks

Conversation

@devoclan

Copy link
Copy Markdown
Contributor

closes #59

this Pr Implemented a robust billing webhook pipeline to automate subscription lifecycle updates.

What Changed
Added POST /api/v1/webhooks/billing with raw body support and HMAC signature verification.
Implemented idempotent webhook event processing using a persistent BillingWebhookEvent store.
Added transactional handling for:
subscription.activated
subscription.cancelled
payment.failed
Gracefully ignored and recorded unsupported webhook events.
Added external billing ID mapping, structured audit logs, failure metadata, and processing latency tracking.
Enforced webhook security with payload size limits, environment-based secret validation, and isolated rate limiting.
Added comprehensive tests covering valid events, idempotency, invalid signatures, rollback behavior, concurrent deliveries, and missing ID mappings

devoclan added 2 commits July 30, 2026 00:20
…tions

Replaces manual subscription toggling with a real webhook pipeline:
HMAC-verified POST /api/v1/webhooks/billing, an idempotent
BillingWebhookEvent store (unique eventId short-circuits replays and
concurrent duplicate deliveries via the DB unique constraint),
transactional subscription.activated/cancelled/payment.failed handling
with a BillingCustomerMap side table to resolve external IDs, structured
audit logging per transition, and a read-only admin listing endpoint.
Unknown event types and downstream mutation failures are recorded and
still return 200 rather than 500. Dev mode allows an unset webhook
secret with a loud warning; production refuses to boot without one.

Also fixes a pre-existing build break: gdpr.service.ts referenced
AuditAction.GDPR_DATA_EXPORTED/USER_SELF_DELETED, which were never
added to the enum.
@aji70
aji70 merged commit 315f942 into MyFanss:main Jul 29, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Production-Shaped Inbound Subscription Billing Webhook Stub (Hard)

2 participants