Add Stripe webhook raw body preservation middleware for payment verification #78

Closed
opened 2026-04-08 17:19:28 -04:00 by pook · 1 comment
Owner

Issue #71 (raw body preservation) blocks #72 (webhook handler) and #53 (payment confirmation). Without raw body access, Stripe webhook signature verification will fail, blocking the entire payment flow.

This is the critical path to revenue — ComplianceBot cannot confirm payments without verified webhooks.

Implement:

  1. Add middleware on the /api/webhooks/stripe route that preserves the raw request body as a Buffer
  2. Use express.raw() or a verify callback on the JSON parser for webhook routes only
  3. Ensure the raw buffer is passed to stripe.webhooks.constructEvent()
  4. Do not affect JSON parsing on other API routes

Acceptance criteria:

  • Raw body available as Buffer on webhook endpoint
  • Other routes unaffected (still get parsed JSON)
  • Integration test verifies constructEvent succeeds with the preserved buffer
  • Middleware is applied only to webhook routes (not globally)

Generated by CEO Planner (priority: 2)

Issue #71 (raw body preservation) blocks #72 (webhook handler) and #53 (payment confirmation). Without raw body access, Stripe webhook signature verification will fail, blocking the entire payment flow. This is the critical path to revenue — ComplianceBot cannot confirm payments without verified webhooks. Implement: 1. Add middleware on the /api/webhooks/stripe route that preserves the raw request body as a Buffer 2. Use express.raw() or a verify callback on the JSON parser for webhook routes only 3. Ensure the raw buffer is passed to stripe.webhooks.constructEvent() 4. Do not affect JSON parsing on other API routes Acceptance criteria: - Raw body available as Buffer on webhook endpoint - Other routes unaffected (still get parsed JSON) - Integration test verifies constructEvent succeeds with the preserved buffer - Middleware is applied only to webhook routes (not globally) --- *Generated by CEO Planner (priority: 2)*
Author
Owner

Closing as duplicate of #87. Fix is tracked in PR #85.

Closing as duplicate of #87. Fix is tracked in PR #85.
pook closed this issue 2026-04-08 17:57:52 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#78
No description provided.