Skip to content

feat(stripe): add Fastify Stripe plugin with tests and docs#1112

Open
premsgr wants to merge 22 commits into
mainfrom
feat/stripe-package
Open

feat(stripe): add Fastify Stripe plugin with tests and docs#1112
premsgr wants to merge 22 commits into
mainfrom
feat/stripe-package

Conversation

@premsgr

@premsgr premsgr commented May 12, 2026

Copy link
Copy Markdown
Contributor

feat(stripe): add Fastify Stripe plugin with tests and docs

Tasks completed

  • Added @prefabs.tech/fastify-stripe: Stripe client helpers, raw body parsing for webhooks, and verifyStripeSignature middleware.
  • Implemented webhook registration via controller/handler and a Fastify plugin with typed configuration (Zod).
  • Documented the package with README.md plus ANALYSIS.md, FEATURES.md, and GUIDE.md for maintainers.
  • Added a Vitest suite (56 tests) with Istanbul coverage for plugin behavior, webhook flow, signature verification, helpers, and public exports.
  • Wired package tooling (Vite build, ESLint, test scripts) and ignored /coverage like sibling packages.
  • Refreshed pnpm-lock.yaml for new dependencies.

BashisthaSudeep and others added 14 commits January 15, 2026 13:52
Refresh workspace dependencies and lockfiles.
Align ESLint/config package metadata.
Improve error-handler and shared type definitions with updated docs and tests.
Add ANALYSIS/FEATURES/GUIDE, ignore coverage output, tune vite and lockfile for tests.
… unused deps

- Route checkout metadata to the data block matching the session mode
  (payment_intent_data / subscription_data / setup_intent_data) so Stripe
  no longer rejects subscription/setup sessions.
- Reuse the static Stripe.webhooks.constructEvent instead of constructing
  a new Stripe client per webhook request.
- Tag raw-body JSON parse errors with statusCode 400 so Fastify responds
  400 instead of 500.
- Declare request.stripeEvent via module augmentation; drop inline casts.
- Remove redundant enablePaymentWebhook guard inside the webhook controller.
- Drop unused zod dependency and unused supertokens-node peer/dev dependency.
- Sync ANALYSIS, FEATURES, GUIDE, README, and tests with new behavior.
…backs

Treat config.stripe as optional in ApiConfig and guard every consumer
(StripeClient, webhook controller, verifyStripeSignature) so the plugin
is safe to load without a Stripe block. Default webhook handler now logs
an error and resolves instead of throwing, so missing handler config no
longer triggers infinite Stripe retries; the controller also warns at
registration time and replies 500 (rather than throwing) if a verified
event is somehow absent. Only populate session/mode-specific metadata
when metadata is actually provided. Updates tests, ANALYSIS/FEATURES/
GUIDE/README accordingly, documents the raw-body parser's plugin-scope
contract, and trims unused rollup globals.
- Add structured "ours vs theirs" classification with 36 custom logic items
- Document all framework constructs (module augmentations, plugin, routes)
- Detail conditional branches and default values
- Include completeness checklist
Comment thread packages/stripe/GUIDE.md Outdated
premsgr added 6 commits May 14, 2026 13:24
…lback

Prefer plugin register options; fall back to fastify.config.stripe with a recommendation warning.

Pass resolved config into webhook controller and createVerifyStripeSignature.

Update package docs and tests.
Move stripe to peerDependencies; keep it in devDependencies for package tests.

Throw when plugin options or webhook { stripeConfig } is missing.

Tighten Fastify plugin typings; bundle externals from peers only in Vite.

Update stripe docs, tests, and lockfile.
- Add stripe as a direct dependency; remove from peerDependencies
- Externalize dependencies in stripe Vite build alongside peers
- Remove README; update ANALYSIS, FEATURES, and GUIDE
Warn when register omits options or passes {}, use fastify.config.stripe
when present, update ANALYSIS/FEATURES/GUIDE, and extend plugin tests.
Remove fastify.config.stripe fallback when options are omitted or empty.

Update ANALYSIS, FEATURES, GUIDE, and plugin tests accordingly.
@premsgr premsgr requested a review from uddhab May 15, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants