better-auth-flutterwave 0.0.0 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +307 -0
  3. package/dist/client.d.mts +96 -0
  4. package/dist/client.d.mts.map +1 -0
  5. package/dist/client.mjs +75 -0
  6. package/dist/client.mjs.map +1 -0
  7. package/dist/index-Dcwl_2fw.d.mts +927 -0
  8. package/dist/index-Dcwl_2fw.d.mts.map +1 -0
  9. package/dist/index.d.mts +2 -0
  10. package/dist/index.mjs +1752 -0
  11. package/dist/index.mjs.map +1 -0
  12. package/dist/version-CzIALUmS.mjs +73 -0
  13. package/dist/version-CzIALUmS.mjs.map +1 -0
  14. package/package.json +119 -8
  15. package/skills/better-auth-flutterwave-setup/SKILL.md +23 -0
  16. package/skills/better-auth-flutterwave-setup/agents/openai.yaml +6 -0
  17. package/skills/flutterwave-billing-flows/SKILL.md +21 -0
  18. package/skills/flutterwave-billing-flows/agents/openai.yaml +6 -0
  19. package/skills/flutterwave-catalog-limits/SKILL.md +17 -0
  20. package/skills/flutterwave-catalog-limits/agents/openai.yaml +6 -0
  21. package/skills/flutterwave-client-api/SKILL.md +20 -0
  22. package/skills/flutterwave-client-api/agents/openai.yaml +6 -0
  23. package/skills/flutterwave-local-subscriptions/SKILL.md +18 -0
  24. package/skills/flutterwave-local-subscriptions/agents/openai.yaml +6 -0
  25. package/skills/flutterwave-organization-billing/SKILL.md +18 -0
  26. package/skills/flutterwave-organization-billing/agents/openai.yaml +6 -0
  27. package/skills/flutterwave-schema-migrations/SKILL.md +19 -0
  28. package/skills/flutterwave-schema-migrations/agents/openai.yaml +6 -0
  29. package/skills/flutterwave-tanstack-start/SKILL.md +20 -0
  30. package/skills/flutterwave-tanstack-start/agents/openai.yaml +6 -0
  31. package/skills/flutterwave-testing-fixtures/SKILL.md +20 -0
  32. package/skills/flutterwave-testing-fixtures/agents/openai.yaml +6 -0
  33. package/skills/flutterwave-webhooks-events/SKILL.md +17 -0
  34. package/skills/flutterwave-webhooks-events/agents/openai.yaml +6 -0
  35. package/index.js +0 -1
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: flutterwave-catalog-limits
3
+ description: Configure Flutterwave payment plans and local products, limits, seats, and inventory.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; better-auth ^1.6; flutterwave-node-v3 1.4.x"
8
+ ---
9
+
10
+ # Flutterwave catalog and limits
11
+
12
+ Use numeric `paymentPlanId` for Flutterwave-native recurring plans. Omit it for locally renewed
13
+ plans using local products, seats, groups, and limits.
14
+
15
+ Products and inventory are local records because Flutterwave does not provide a matching remote
16
+ product catalog. Only Flutterwave payment plans and subscriptions may be synchronized. Catalog
17
+ sync and renewal operations remain trusted-server APIs.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Catalog"
3
+ short_description: "Products, plans, seats, and limits"
4
+ default_prompt: "Use $flutterwave-catalog-limits to configure Flutterwave products, subscription plans, seat billing, and resource limits."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: flutterwave-client-api
3
+ description: Use the typed browser client exposed by better-auth-flutterwave.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; better-auth ^1.6"
8
+ ---
9
+
10
+ # Flutterwave client API
11
+
12
+ The canonical transaction actions are
13
+ `authClient.flutterwave.transaction.initialize`, `.verify`, and `.list`.
14
+ The canonical subscription actions are `authClient.subscription.create`, `.upgrade`, `.cancel`,
15
+ `.restore`, and `.list`.
16
+
17
+ Use `txRef`, `transactionId`, `flwRef`, `paymentPlanId`, `subscriptionId`, and `subaccountId`.
18
+ Do not invent remote customer records, billing portals, or management links that Flutterwave does
19
+ not provide. Privileged reconciliation, renewal, refund, and sync operations are not browser
20
+ actions.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Client API"
3
+ short_description: "Browser client methods and return contracts"
4
+ default_prompt: "Use $flutterwave-client-api to wire or review authClient Flutterwave, transaction, and subscription browser APIs."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: flutterwave-local-subscriptions
3
+ description: Implement local subscription lifecycle and tokenized Flutterwave renewal.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; better-auth ^1.6; flutterwave-node-v3 1.4.x"
8
+ ---
9
+
10
+ # Flutterwave local subscriptions
11
+
12
+ A plan without `paymentPlanId` is locally renewed. Better Auth stores its group, seats, limits,
13
+ period state, and encrypted reusable token. Automated trials, scheduled changes, and proration are
14
+ not available in the initial release.
15
+
16
+ Persist reusable Flutterwave payment tokens encrypted with a key derived from the Better Auth
17
+ secret. Never return or log a token. Trusted-server renewal prefers the token; if none exists,
18
+ create hosted checkout and leave renewal pending until verification.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Local Subs"
3
+ short_description: "Local subscriptions and renewals"
4
+ default_prompt: "Use $flutterwave-local-subscriptions to implement or debug local-managed Flutterwave subscription lifecycle behavior."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: flutterwave-organization-billing
3
+ description: Configure local organization ownership and marketplace splits for Flutterwave billing.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; better-auth ^1.6"
8
+ ---
9
+
10
+ # Flutterwave organization billing
11
+
12
+ Enable `organization.enabled` and use billing roles or `authorizeReference` to authorize members.
13
+ The organization ID is the local billing owner; it is not a Flutterwave customer or subaccount.
14
+ Store the immutable billing email on the native subscription.
15
+
16
+ Configure marketplace splits separately with `marketplace.allowedSubaccountIds` and optional
17
+ `defaultSplit`. Only existing KYC-approved IDs may be used. Per-checkout overrides must be
18
+ authorized and allowlisted. The plugin does not provision subaccounts.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Org Billing"
3
+ short_description: "Organization billing, seats, and access"
4
+ default_prompt: "Use $flutterwave-organization-billing to configure Flutterwave billing for Better Auth organizations, seats, and admin access."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: flutterwave-schema-migrations
3
+ description: Review or migrate the namespaced Better Auth Flutterwave persistence schema.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; better-auth ^1.6"
8
+ ---
9
+
10
+ # Flutterwave schema migrations
11
+
12
+ Provider records are `flutterwaveTransaction`, `flutterwaveSubscription`, `flutterwaveProduct`,
13
+ `flutterwavePlan`, `flutterwaveWebhookEvent`, and `flutterwaveRefund`. Keep provider IDs, expected
14
+ and charged amounts, currency, lifecycle state, periods, local ownership, and reconciliation
15
+ timestamps distinct.
16
+
17
+ Do not add Flutterwave customer fields to `user` or `organization`. Store the immutable native
18
+ subscription email on its record. Reusable payment tokens must be encrypted and never selected into
19
+ client-visible output. Verify coexistence with other billing-provider schemas after migrations.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Schema"
3
+ short_description: "Database schema and migration guidance"
4
+ default_prompt: "Use $flutterwave-schema-migrations to review or change Better Auth Flutterwave schema and migration behavior."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: flutterwave-tanstack-start
3
+ description: Integrate Better Auth Flutterwave into a TanStack Start application.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; TanStack Start; better-auth ^1.6"
8
+ ---
9
+
10
+ # Flutterwave with TanStack Start
11
+
12
+ Create the server plugin with `publicKey`, `secretKey`, and `secretHash`; keep all three in
13
+ server-only environment bindings. Register `flutterwaveClient` in the browser auth client.
14
+
15
+ Initialize checkout with amount, currency, email, and an absolute `redirectUrl`. On the callback
16
+ route, read `transaction_id`, `tx_ref`, and `status`, then call the typed verification action.
17
+ Render success only after server verification.
18
+
19
+ Keep reconciliation, renewal, refund, plan sync, and subaccount administration in server functions
20
+ that independently authorize the current user.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave TanStack Start"
3
+ short_description: "TanStack Start integration patterns"
4
+ default_prompt: "Use $flutterwave-tanstack-start to integrate Better Auth Flutterwave in a TanStack Start application."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: flutterwave-testing-fixtures
3
+ description: Create accurate Flutterwave adapter, checkout, webhook, subscription, and reconciliation tests.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; Vitest; flutterwave-node-v3 1.4.x"
8
+ ---
9
+
10
+ # Flutterwave testing fixtures
11
+
12
+ Inject the SDK-shaped client and `fetch`; do not call the network in unit tests. Validate every
13
+ untyped SDK response through the same Zod schemas used in production.
14
+
15
+ Cover exact `txRef`, amount, currency, and status verification; malformed responses; duplicate and
16
+ out-of-order deliveries; numeric plan/subscription IDs; token encryption; hosted-checkout renewal
17
+ fallback; asynchronous refunds; and provider coexistence.
18
+
19
+ Webhook fixtures use HMAC-SHA256 over the exact raw bytes with `flutterwave-signature` and
20
+ `secretHash`. Include tampered-body and invalid-signature cases.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Tests"
3
+ short_description: "Focused tests, mocks, and verification"
4
+ default_prompt: "Use $flutterwave-testing-fixtures to choose tests, fixtures, and verification commands for Better Auth Flutterwave changes."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: flutterwave-webhooks-events
3
+ description: Implement secure and idempotent Flutterwave webhook handling.
4
+ metadata:
5
+ library: "better-auth-flutterwave"
6
+ version: "0.1.5" # x-release-please-version
7
+ compatibility: "Node.js >=22; better-auth ^1.6"
8
+ ---
9
+
10
+ # Flutterwave webhooks and events
11
+
12
+ Read the exact raw body. Compute HMAC-SHA256 with the separately configured `secretHash`, compare
13
+ it to `flutterwave-signature` in constant time, persist idempotency, and acknowledge quickly.
14
+
15
+ Re-verify transactions before granting value. Expect duplicate, delayed, and out-of-order events.
16
+ Use polling/reconciliation for pending transactions, subscriptions, and refunds. Never substitute
17
+ the API secret key for `secretHash` or reserialize JSON before signature verification.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Better Auth Flutterwave Webhooks"
3
+ short_description: "Webhook signatures, events, and reconciliation"
4
+ default_prompt: "Use $flutterwave-webhooks-events to implement, debug, or test Flutterwave webhook event processing."
5
+ policy:
6
+ allow_implicit_invocation: true
package/index.js DELETED
@@ -1 +0,0 @@
1
- // Placeholder