OOOC Fête Finder receives partner activation payments through Stripe Payment Links. The webhook integration processesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/KingPsychopath/oooc-fete-finder/llms.txt
Use this file to discover all available pages before exploring further.
checkout.session.completed events, verifies signatures, extracts custom fields, and enqueues activations in the admin panel.
Configuration
Environment variables
Get webhook secret
Create webhook endpoint
- Go to Stripe Dashboard
- Click Add endpoint
- Enter your webhook URL:
https://your-domain.com/api/webhooks/stripe - Select event:
checkout.session.completed
Copy signing secret
After creating the endpoint, Stripe displays the signing secret starting with
whsec_.Copy this value.Webhook endpoint
The webhook is handled byPOST /api/webhooks/stripe (app/api/webhooks/stripe/route.ts:10-50):
Process event
If event type is
checkout.session.completed, extract session details and enqueue activation.Response codes
- 200 OK: Webhook processed successfully
- 400 Bad Request: Invalid signature
- 500 Internal Server Error: Processing failed
- 503 Service Unavailable: Webhook not configured
Signature verification
Stripe signs webhooks using HMAC SHA256 with the webhook secret (features/partners/stripe-webhook.ts:51-75).Signature format
Thestripe-signature header contains:
t: Unix timestamp of the eventv1: HMAC SHA256 signature(s)
Verification algorithm
Check timestamp
Verify event is within 5 minutes (300 seconds) of current time to prevent replay attacks.
Session data extraction
The integration extracts data from thecheckout.session.completed event (features/partners/stripe-webhook.ts:150-201):
Custom fields
Stripe custom fields are extracted with fallback key matching:Custom field extraction supports text, dropdown, and numeric field types. Field keys are case-insensitive.
Payment link ID mapping
The system maps payment link IDs to package keys for admin queue organization:| Payment Link Env Var | Package Key |
|---|---|
STRIPE_PAYMENT_LINK_ID_SPOTLIGHT_STANDARD | spotlight-standard |
STRIPE_PAYMENT_LINK_ID_SPOTLIGHT_TAKEOVER | spotlight-takeover |
STRIPE_PAYMENT_LINK_ID_PROMOTED | promoted-listing |
STRIPE_PAYMENT_LINK_ID_ADDON_WHATSAPP | addon-whatsapp |
STRIPE_PAYMENT_LINK_ID_ADDON_NEWSLETTER | addon-newsletter |
If payment link ID doesn’t match any configured mapping,
packageKey is null and the admin must manually categorize the activation.Extracted fields
The following fields are extracted from the session:Database storage
The webhook handler enqueues activations in thepartner_activations table via enqueueFromStripe (features/partners/stripe-webhook.ts:203-233):
Idempotency
ThesourceEventId (Stripe event ID) ensures idempotency. If the same event is received multiple times, only the first insert succeeds.
The database schema includes a unique constraint on
source_event_id to prevent duplicate processing.Admin panel workflow
After webhook processing:- Activation appears in Admin > Partners > Queue
- Admin reviews customer details, event info, and package
- Admin manually activates the event or requests more information
- Activation is marked as complete or rejected
Error handling
The integration handles errors at multiple levels:Webhook endpoint errors
Payload validation
If the payload is missing required fields, the webhook returns{handled: false}:
- Missing event type
- Missing event ID
- Missing or invalid session object
Database errors
If the database is not configured or insert fails, the webhook throws an error and returns HTTP 500. Stripe will retry the webhook.Testing webhooks
Local testing with Stripe CLI
Install Stripe CLI
Download from stripe.com/docs/stripe-cli
Forward webhooks to localhost
whsec_. Use this for STRIPE_WEBHOOK_SECRET during local development.Manual testing
Use Stripe Dashboard to send test webhooks:- Go to Stripe Dashboard > Webhooks
- Select your webhook endpoint
- Click Send test webhook
- Choose
checkout.session.completed - Optionally edit JSON payload
- Click Send test webhook
Security considerations
- Signature verification: Always verify webhook signature before processing
- Timing-safe comparison: Use
timingSafeEqualto prevent timing attacks - Timestamp validation: Reject events older than 5 minutes
- HTTPS only: Never expose webhook endpoints over HTTP
- Secret rotation: Rotate webhook secret if compromised
Event types
Currently, the integration only processes:checkout.session.completed- Customer completed checkout
To process additional event types (e.g.,
payment_intent.succeeded), extend the handleStripeWebhookPayload function in features/partners/stripe-webhook.ts:235-261.Monitoring
Monitor webhook health in Stripe Dashboard:- Go to Developers > Webhooks
- Click on your endpoint
- View Recent events and Response codes
- Check for failed deliveries