feat(integrations): push Stripe payment, subscription, and uninstall events by webhook

Abierto
#423 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
playwright, typescript

Línea de trabajo

Start with docs/providers/stripe.md (the Webhooks table and "Timeline events by polling") and the closed adapter work in src/lib/adapters/stripe/, then read the webhook contract, route and deduplication key from #28 — this issue cannot be picked up until that lands. Implementation touches the handler, the allowlist schemas and sanitized fixtures under src/lib/adapters/stripe/, reusing polling's (connection, event id) dedup key and signature verification from the shared route. Done means npm run lint, npm run typecheck, npm test and the Playwright simulated-delivery spec pass, with no raw payload stored or logged.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area: integrations blocked enhancement impact: high priority: P1 size: S

Context

The Stripe adapter (#111, closed) polls GET /v1/events hourly. Eddie's decision on #28 (2026-11-14): webhooks first, polling as the backfill, and webhooks are in the MVP. Stripe can push without a new permission: a webhook endpoint on DevMacro's own Stripe account that listens to events on connected accounts receives events from every install, and the app already holds event_read.

Webhooks also close a gap polling cannot: /v1/events only goes back 30 days, so a connection that has not synced for longer loses events (docs/providers/stripe.md, "Timeline events by polling").

From docs/providers/stripe.md, "Webhooks (Post-MVP)":

Item Value
Where the endpoint lives One endpoint on DevMacro's Stripe account with Listen to events on Connected accounts. Events arrive with account set to the installing account
Signature Stripe-Signature: t=<timestamp>,v1=<signature>: HMAC SHA-256 of <t>.<raw body> keyed with the endpoint's whsec_ secret. Ignore schemes other than v1, compare in constant time, reject timestamps outside a tolerance (5 minutes, never 0)
Timeline events The six the adapter polls: payment_intent.succeeded, payment_intent.payment_failed, customer.created, customer.subscription.created, customer.subscription.deleted, charge.refunded, plus the charge.succeeded and charge.failed the adapter reads for payments
Uninstall apps.install.deleted, account.application.deauthorized
Not pushed as a total Fees and balance figures stay polled

Plan

  1. Implement the Stripe webhook declaration from the contract #28 adds: verify Stripe-Signature with a new STRIPE_WEBHOOK_SECRET (and a test mode secret, matching how the adapter handles test mode), deduplicate on the Stripe event id with the same (connection, event id) key polling uses.
  2. Map account to the connection. Unknown accounts are acknowledged and dropped.
  3. Parse data.object with the same allowlist schemas polling uses and drop the raw payload at once. It carries personal data and is never logged.
  4. Events render in the API version current when they were created, not the pinned version, so the schemas accept only the fields listed in the provider page.
  5. apps.install.deleted and account.application.deauthorized mark the connection as needing a reconnect at once.
  6. Docs: docs/providers/stripe.md (rename the section to "Webhooks", update "Disconnect and uninstall" and self-hosted setup), docs/operations/oauth-apps.md, docs/operations/deploy.md for the new variables.

Acceptance criteria

  • A signed payment_intent.succeeded delivery reaches the timeline within a minute, without waiting for a sync.
  • An event seen by webhook and by polling shows once.
  • Unsigned, wrongly signed, stale, or repeated deliveries are rejected or ignored, and logged without their body.
  • An uninstall marks the connection as needing a reconnect.
  • No raw event payload is stored or logged.
  • Polling still runs and still fills in fees, balances, and any missed delivery.
  • Unit tests on recorded, sanitized payloads built from Stripe's documented samples. No live calls in CI.
  • Playwright e2e: a signed delivery for the simulated Stripe provider appears on the timeline.

Files and areas

  • src/lib/adapters/stripe/ (webhook handler, schemas, fixtures, tests), the webhook route from #28, docs/providers/stripe.md, docs/operations/oauth-apps.md, docs/operations/deploy.md.
  • Non-goals: new Stripe App permissions, and DevMacro's own billing webhooks (#83), which are a different Stripe account and endpoint.

Verification

  • npm run lint, npm run typecheck, npm test
  • The Playwright spec for the simulated delivery.

Depends on

  • #28 Ingest provider webhooks (contract, route, deduplication)
  • #111 Add the Stripe adapter (closed)

Branch: <issue-number>-stripe-webhooks
Closes with a Closes #<issue-number> footer on the commit or pull request.

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

Lenguaje dominante
TypeScript
Estrellas
1
Forks
1
Merge medio
6 h 56 min
PR fusionados (30 d)
136

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eddiejaoude/StackDash

Todos los issues de eddiejaoude/StackDash

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.