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

オープン
#423 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
playwright, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
1
フォーク
1
平均マージ
6時間 56分
マージ済み PR(30日)
136

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eddiejaoude/StackDash のほかの issue

eddiejaoude/StackDash の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。