Add Stripe webhook handler for payment confirmation and document unlock #53

Closed
opened 2026-04-08 12:54:02 -04:00 by pook · 5 comments
Owner

Issue #42 adds checkout session creation, but there is no webhook handler to confirm payment succeeded and unlock document access. Without this, paid documents cannot be reliably delivered.

Implement POST /api/webhooks/stripe:

  • Verify webhook signature using Stripe-Signature header and STRIPE_WEBHOOK_SECRET env var
  • Handle checkout.session.completed event: mark the associated document generation as paid, trigger generation if pending payment
  • Handle payment_intent.payment_failed event: log failure, update document status to payment_failed
  • Return 200 immediately for unhandled event types
  • Store payment metadata (Stripe session ID, amount, currency) alongside the document record

Acceptance criteria:

  • Invalid signatures return 400
  • Successful payment triggers document generation or unlocks existing document
  • Failed payment updates document status without generating
  • Unit tests cover signature verification, success flow, and failure flow
  • Idempotent: replayed webhooks do not duplicate documents

Generated by CEO Planner (priority: 3)

Issue #42 adds checkout session creation, but there is no webhook handler to confirm payment succeeded and unlock document access. Without this, paid documents cannot be reliably delivered. Implement POST /api/webhooks/stripe: - Verify webhook signature using Stripe-Signature header and STRIPE_WEBHOOK_SECRET env var - Handle checkout.session.completed event: mark the associated document generation as paid, trigger generation if pending payment - Handle payment_intent.payment_failed event: log failure, update document status to payment_failed - Return 200 immediately for unhandled event types - Store payment metadata (Stripe session ID, amount, currency) alongside the document record Acceptance criteria: - Invalid signatures return 400 - Successful payment triggers document generation or unlocks existing document - Failed payment updates document status without generating - Unit tests cover signature verification, success flow, and failure flow - Idempotent: replayed webhooks do not duplicate documents --- *Generated by CEO Planner (priority: 3)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 9h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 9h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 9h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 9h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 9h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 9h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

Closing as duplicate. Superseded by #72 which better scopes the Stripe webhook work.

Closing as duplicate. Superseded by #72 which better scopes the Stripe webhook work.
pook closed this issue 2026-04-08 21:53:08 -04:00
Author
Owner

Superseded by newer scoped issues.

Superseded by newer scoped issues.
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#53
No description provided.