better-auth-flutterwave 0.4.3 → 1.0.1
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.
- package/README.es-ES.md +73 -346
- package/README.fr-FR.md +76 -346
- package/README.md +93 -344
- package/dist/client.d.mts +5 -6
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +2 -3
- package/dist/client.mjs.map +1 -1
- package/dist/{index-BqoHQ7eU.d.mts → index-CWQ-yaXU.d.mts} +17 -151
- package/dist/index-CWQ-yaXU.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +33 -46
- package/dist/index.mjs.map +1 -1
- package/dist/{version-eSGk9I11.mjs → version-CvBysHjX.mjs} +4 -6
- package/dist/{version-eSGk9I11.mjs.map → version-CvBysHjX.mjs.map} +1 -1
- package/package.json +15 -17
- package/skills/better-auth-flutterwave-setup/SKILL.md +15 -14
- package/skills/better-auth-flutterwave-setup/agents/openai.yaml +1 -1
- package/skills/flutterwave-billing-flows/SKILL.md +19 -12
- package/skills/flutterwave-billing-flows/agents/openai.yaml +1 -1
- package/skills/flutterwave-catalog-limits/SKILL.md +15 -9
- package/skills/flutterwave-catalog-limits/agents/openai.yaml +1 -1
- package/skills/flutterwave-client-api/SKILL.md +16 -12
- package/skills/flutterwave-client-api/agents/openai.yaml +1 -1
- package/skills/flutterwave-local-subscriptions/SKILL.md +16 -17
- package/skills/flutterwave-local-subscriptions/agents/openai.yaml +1 -1
- package/skills/flutterwave-organization-billing/SKILL.md +14 -9
- package/skills/flutterwave-organization-billing/agents/openai.yaml +1 -1
- package/skills/flutterwave-schema-migrations/SKILL.md +16 -16
- package/skills/flutterwave-schema-migrations/agents/openai.yaml +1 -1
- package/skills/flutterwave-tanstack-start/SKILL.md +15 -17
- package/skills/flutterwave-tanstack-start/agents/openai.yaml +1 -1
- package/skills/flutterwave-testing-fixtures/SKILL.md +17 -11
- package/skills/flutterwave-testing-fixtures/agents/openai.yaml +1 -1
- package/skills/flutterwave-webhooks-events/SKILL.md +17 -13
- package/skills/flutterwave-webhooks-events/agents/openai.yaml +1 -1
- package/dist/index-BqoHQ7eU.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/metadata.ts
|
|
2
2
|
function isMetadataRecord(value) {
|
|
3
3
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4
4
|
}
|
|
@@ -64,10 +64,8 @@ function createRenewalMetadata(input) {
|
|
|
64
64
|
referenceId: input.referenceId
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const PACKAGE_VERSION = "0.4.3";
|
|
70
|
-
//#endregion
|
|
67
|
+
// src/version.ts
|
|
68
|
+
const PACKAGE_VERSION = "1.0.1";
|
|
71
69
|
export { getMetadataBoolean as a, hasFlutterwaveMetadata as c, createRenewalMetadata as i, parseFlutterwaveMetadata as l, createCheckoutMetadata as n, getMetadataNumber as o, createProrationMetadata as r, getMetadataString as s, PACKAGE_VERSION as t, stringifyFlutterwaveMetadata as u };
|
|
72
70
|
|
|
73
|
-
//# sourceMappingURL=version-
|
|
71
|
+
//# sourceMappingURL=version-CvBysHjX.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-
|
|
1
|
+
{"version":3,"file":"version-CvBysHjX.mjs","names":[],"sources":["../src/metadata.ts","../src/version.ts"],"sourcesContent":["export type FlutterwaveMetadata = Record<string, unknown>;\n\nexport interface CheckoutMetadataInput {\n referenceId: string;\n userId: string;\n plan?: string;\n groupId?: string | null;\n product?: string;\n extra?: FlutterwaveMetadata;\n trial: {\n isTrial: boolean;\n requested: boolean;\n granted: boolean;\n deniedReason?: \"already_used\";\n endsAt?: Date;\n };\n}\n\nexport interface ProrationMetadataInput {\n subscriptionId: string;\n referenceId: string;\n newPlan: string;\n oldPlan: string;\n newSeatCount: number;\n remainingDays: number;\n}\n\nexport interface RenewalMetadataInput {\n subscriptionId: string;\n referenceId: string;\n}\n\nfunction isMetadataRecord(value: unknown): value is FlutterwaveMetadata {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function parseFlutterwaveMetadata(value: unknown): FlutterwaveMetadata {\n if (value === undefined || value === null || value === \"\") return {};\n\n if (typeof value === \"string\") {\n try {\n const parsed: unknown = JSON.parse(value);\n return isMetadataRecord(parsed) ? parsed : {};\n } catch {\n return {};\n }\n }\n\n return isMetadataRecord(value) ? value : {};\n}\n\nexport function stringifyFlutterwaveMetadata(value: unknown): string | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n return JSON.stringify(parseFlutterwaveMetadata(value));\n}\n\nexport function hasFlutterwaveMetadata(value: unknown): boolean {\n return Object.keys(parseFlutterwaveMetadata(value)).length > 0;\n}\n\nexport function getMetadataString(metadata: FlutterwaveMetadata, key: string): string | undefined {\n const value = metadata[key];\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\n\nexport function getMetadataNumber(metadata: FlutterwaveMetadata, key: string): number | undefined {\n const value = metadata[key];\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nexport function getMetadataBoolean(metadata: FlutterwaveMetadata, key: string): boolean {\n const value = metadata[key];\n return value === true || value === \"true\";\n}\n\nexport function createCheckoutMetadata(input: CheckoutMetadataInput): FlutterwaveMetadata {\n return {\n referenceId: input.referenceId,\n userId: input.userId,\n plan: input.plan,\n groupId: input.groupId,\n product: input.product,\n ...input.extra,\n isTrial: input.trial.isTrial,\n trialRequested: input.trial.requested,\n trialGranted: input.trial.granted,\n trialDeniedReason: input.trial.deniedReason,\n trialEnd: input.trial.endsAt?.toISOString(),\n };\n}\n\nexport function createProrationMetadata(input: ProrationMetadataInput): FlutterwaveMetadata {\n return {\n type: \"proration\",\n subscriptionId: input.subscriptionId,\n referenceId: input.referenceId,\n newPlan: input.newPlan,\n oldPlan: input.oldPlan,\n newSeatCount: input.newSeatCount,\n remainingDays: input.remainingDays,\n };\n}\n\nexport function createRenewalMetadata(input: RenewalMetadataInput): FlutterwaveMetadata {\n return {\n type: \"renewal\",\n subscriptionId: input.subscriptionId,\n referenceId: input.referenceId,\n };\n}\n","export const PACKAGE_VERSION = \"1.0.1\"; // x-release-please-version\n"],"mappings":";AAgCA,SAAS,iBAAiB,OAA8C;CACtE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,yBAAyB,OAAqC;CAC5E,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI,OAAO,CAAC;CAEnE,IAAI,OAAO,UAAU,UACnB,IAAI;EACF,MAAM,SAAkB,KAAK,MAAM,KAAK;EACxC,OAAO,iBAAiB,MAAM,IAAI,SAAS,CAAC;CAC9C,QAAQ;EACN,OAAO,CAAC;CACV;CAGF,OAAO,iBAAiB,KAAK,IAAI,QAAQ,CAAC;AAC5C;AAEA,SAAgB,6BAA6B,OAAoC;CAC/E,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI,OAAO,KAAA;CAClE,OAAO,KAAK,UAAU,yBAAyB,KAAK,CAAC;AACvD;AAEA,SAAgB,uBAAuB,OAAyB;CAC9D,OAAO,OAAO,KAAK,yBAAyB,KAAK,CAAC,CAAC,CAAC,SAAS;AAC/D;AAEA,SAAgB,kBAAkB,UAA+B,KAAiC;CAChG,MAAM,QAAQ,SAAS;CACvB,OAAO,OAAO,UAAU,YAAY,UAAU,KAAK,QAAQ,KAAA;AAC7D;AAEA,SAAgB,kBAAkB,UAA+B,KAAiC;CAChG,MAAM,QAAQ,SAAS;CACvB,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;AAEA,SAAgB,mBAAmB,UAA+B,KAAsB;CACtF,MAAM,QAAQ,SAAS;CACvB,OAAO,UAAU,QAAQ,UAAU;AACrC;AAEA,SAAgB,uBAAuB,OAAmD;CACxF,OAAO;EACL,aAAa,MAAM;EACnB,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,SAAS,MAAM;EACf,GAAG,MAAM;EACT,SAAS,MAAM,MAAM;EACrB,gBAAgB,MAAM,MAAM;EAC5B,cAAc,MAAM,MAAM;EAC1B,mBAAmB,MAAM,MAAM;EAC/B,UAAU,MAAM,MAAM,QAAQ,YAAY;CAC5C;AACF;AAEA,SAAgB,wBAAwB,OAAoD;CAC1F,OAAO;EACL,MAAM;EACN,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,SAAS,MAAM;EACf,SAAS,MAAM;EACf,cAAc,MAAM;EACpB,eAAe,MAAM;CACvB;AACF;AAEA,SAAgB,sBAAsB,OAAkD;CACtF,OAAO;EACL,MAAM;EACN,gBAAgB,MAAM;EACtB,aAAa,MAAM;CACrB;AACF;;AC7GA,MAAa,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth-flutterwave",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Production-ready Flutterwave billing plugin for Better Auth. Supports subscriptions, one-time payments, organization billing, secure webhooks and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"africa",
|
|
@@ -67,25 +67,23 @@
|
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"better-
|
|
71
|
-
"zod": "^4.6.
|
|
70
|
+
"@better-fetch/fetch": "^1.3.3",
|
|
71
|
+
"zod": "^4.6.7"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"
|
|
79
|
-
"better-auth": "^1.7.7",
|
|
75
|
+
"@tanstack/intent": "^0.5.6",
|
|
76
|
+
"@types/node": "^26.6.11",
|
|
77
|
+
"@vitest/coverage-v8": "5.1.1",
|
|
78
|
+
"better-auth": "1.7.28",
|
|
80
79
|
"publint": "^0.3.25",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"vite": "
|
|
84
|
-
"
|
|
85
|
-
"vitest": "5.0.3"
|
|
80
|
+
"typescript": "7.0.2",
|
|
81
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001",
|
|
82
|
+
"vite-plus": "1.8.0",
|
|
83
|
+
"vitest": "5.1.1"
|
|
86
84
|
},
|
|
87
85
|
"peerDependencies": {
|
|
88
|
-
"better-auth": "
|
|
86
|
+
"better-auth": ">=1.4.22 <2"
|
|
89
87
|
},
|
|
90
88
|
"engines": {
|
|
91
89
|
"node": ">=22.0.0"
|
|
@@ -99,8 +97,8 @@
|
|
|
99
97
|
"lint": "vp lint src",
|
|
100
98
|
"lint:package": "publint run --strict",
|
|
101
99
|
"lint:types": "node scripts/lint-types-packed.mjs",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
100
|
+
"creator:pack": "node scripts/pack-creator.mjs",
|
|
101
|
+
"starter:export": "node scripts/export-starter.mjs",
|
|
102
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
105
103
|
}
|
|
106
104
|
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: better-auth-flutterwave-setup
|
|
3
|
-
description: Set up
|
|
3
|
+
description: Set up Flutterwave payments in Better Auth by registering the server and browser plugins, configuring credentials, and applying the initial database schema.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# Set up Flutterwave payments with Better Auth
|
|
11
11
|
|
|
12
|
-
Install `better-auth
|
|
12
|
+
Install `better-auth-flutterwave`, connect the server handler and browser client, and apply the database schema before accepting payments.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
`
|
|
16
|
-
from the
|
|
14
|
+
1. Install `better-auth` and `better-auth-flutterwave`. The default provider transport uses built-in fetch.
|
|
15
|
+
2. Add `flutterwave({ publicKey, secretKey, secretHash })` to the server's Better Auth plugins.
|
|
16
|
+
Read credentials from server configuration and use the dashboard webhook secret hash for `secretHash`.
|
|
17
|
+
3. Register `flutterwaveClient()` from `better-auth-flutterwave/client` in the application auth client.
|
|
18
|
+
Mount the Better Auth handler under the same base path used by the client.
|
|
19
|
+
4. Generate and apply the plugin schema using the CLI for the installed Better Auth version and
|
|
20
|
+
the application's database migration workflow. Confirm the auth handler and a signed-in catalog
|
|
21
|
+
request work before starting provider checkout.
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
organization: billing ownership is local and Flutterwave billing identity is an email.
|
|
21
|
-
|
|
22
|
-
The upstream SDK is untyped CommonJS, performs always-on telemetry, and may use an OS temporary
|
|
23
|
-
file. The plugin’s validated adapter uses Promise APIs only.
|
|
23
|
+
Inject `fetch` or `flutterwaveClient` for a custom provider transport. Billing belongs to a local
|
|
24
|
+
user or organization; the server resolves the provider billing email from that authorized reference.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Setup"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Flutterwave payment setup for Better Auth"
|
|
4
4
|
default_prompt: "Use $better-auth-flutterwave-setup to configure the Better Auth Flutterwave server and client plugins."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-billing-flows
|
|
3
|
-
description: Build
|
|
3
|
+
description: Build Flutterwave hosted checkout and server-side transaction verification with Better Auth. Use for one-time payments, callback handling, and native subscription enrollment.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave
|
|
10
|
+
# Flutterwave checkout and payment verification with Better Auth
|
|
11
11
|
|
|
12
|
-
Initialize
|
|
13
|
-
`authClient.flutterwave.transaction.initialize`. The plugin generates `txRef`. Complete the flow
|
|
14
|
-
with `.verify({ transactionId, txRef })`; never fulfill from a redirect alone.
|
|
12
|
+
Initialize Flutterwave checkout for a signed-in payer, verify the transaction on the server after the callback, and enroll card checkout in a native subscription when applicable.
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`
|
|
14
|
+
1. For a signed-in user, call `authClient.flutterwave.transaction.initialize` with an absolute
|
|
15
|
+
`redirectUrl` and either `plan`, `product`, or explicit `amount` and `currency`. The server
|
|
16
|
+
resolves the payer email and establishes the local `txRef`. Configured catalog pricing takes precedence.
|
|
17
|
+
2. Redirect to the returned checkout `url`. On return, pass exactly one of numeric `transactionId`
|
|
18
|
+
or `txRef` to `authClient.flutterwave.transaction.verify`.
|
|
19
|
+
3. Grant value after server verification confirms the successful status, expected `txRef`, amount,
|
|
20
|
+
and currency. A browser redirect supplies identifiers to verify.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
A native subscription starts with card checkout carrying a numeric `paymentPlanId`. Omit
|
|
23
|
+
`paymentPlanId` for local renewals. The v3 checkout rejects plans configured with a no-charge trial.
|
|
24
|
+
|
|
25
|
+
Use `createFlutterwaveV4Adapter` for direct v4 charges in trusted server code. Use Flutterwave-encrypted
|
|
26
|
+
card fields for card inputs. Reuse idempotency keys on retries and verify the charge against your
|
|
27
|
+
pending order. The Better Auth checkout and
|
|
28
|
+
subscription routes use v3.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Billing Flows"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Hosted checkout and transaction verification"
|
|
4
4
|
default_prompt: "Use $flutterwave-billing-flows to build verified Flutterwave transaction and subscription flows."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-catalog-limits
|
|
3
|
-
description: Configure Flutterwave payment plans and
|
|
3
|
+
description: Configure Flutterwave payment plans and fixed-price products with Better Auth. Use for subscription seat pricing, team limits, and organization entitlements.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave
|
|
10
|
+
# Flutterwave payment plans, products, and seat limits
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
plans using local products, seats, groups, and limits.
|
|
12
|
+
Configure Better Auth catalog pricing, sync provider payment plans, and enforce seat or team limits from application mutations.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
Choose a server-configured plan or product for fixed-price checkout. A plan's base price includes
|
|
15
|
+
the first seat and each additional seat adds `seatAmount`. A product's price is multiplied by
|
|
16
|
+
`quantity`. The server uses the configured price and currency when a catalog item is supplied.
|
|
17
|
+
|
|
18
|
+
A numeric `paymentPlanId` selects provider-managed recurring billing. Plans without it use local
|
|
19
|
+
renewals. Use local product records for products and inventory. `syncFlutterwavePlans` synchronizes
|
|
20
|
+
provider payment plans from an authorized server, while products remain application-owned.
|
|
21
|
+
|
|
22
|
+
Call `checkSeatLimit` or `checkTeamLimit` from the relevant membership or team mutation. Use
|
|
23
|
+
`getOrganizationEntitlements` for read-only entitlement decisions scoped to the organization.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Catalog"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Payment plans, product prices, and seat limits"
|
|
4
4
|
default_prompt: "Use $flutterwave-catalog-limits to configure Flutterwave products, subscription plans, seat billing, and resource limits."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-client-api
|
|
3
|
-
description:
|
|
3
|
+
description: Wire the Better Auth Flutterwave browser client for payment initialization, transaction verification, catalog reads, and subscription actions.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave client API
|
|
10
|
+
# Flutterwave browser client API for Better Auth
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
`authClient.flutterwave.transaction.initialize`, `.verify`, and `.list`.
|
|
14
|
-
The canonical subscription actions are `authClient.subscription.create`, `.upgrade`, `.cancel`,
|
|
15
|
-
`.restore`, and `.list`.
|
|
12
|
+
Register the Flutterwave client plugin and use typed browser actions for payments, subscriptions, and catalog queries.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
Register `flutterwaveClient()` through the package's `/client` export. Use
|
|
15
|
+
`authClient.flutterwave.transaction.initialize`, `.verify`, and `.list` for payments and
|
|
16
|
+
`authClient.subscription.create`, `.upgrade`, `.cancel`, `.restore`, and `.list` for subscriptions.
|
|
17
|
+
|
|
18
|
+
Read the configured catalog with `authClient.flutterwave.config()`, `.listPlans()`, or
|
|
19
|
+
`.listProducts()`. Await `{ data, error }` by default or pass `{ throw: true }` to supported
|
|
20
|
+
actions and handle rejected requests. Use one locator when verifying a transaction.
|
|
21
|
+
|
|
22
|
+
Keep local `referenceId`, payment `txRef`, provider `transactionId` and `flwRef`, and recurring
|
|
23
|
+
`paymentPlanId` and `subscriptionId` distinct. Renewal, reconciliation, refunds, and plan sync
|
|
24
|
+
belong in independently authorized server workflows.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Client API"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Flutterwave browser payment and subscription API"
|
|
4
4
|
default_prompt: "Use $flutterwave-client-api to wire or review authClient Flutterwave, transaction, and subscription browser APIs."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-local-subscriptions
|
|
3
|
-
description: Implement
|
|
3
|
+
description: Implement application-managed Flutterwave subscriptions with Better Auth. Use for tokenized recurring payments, renewal retries, and period-end cancellation.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave
|
|
10
|
+
# Flutterwave subscription renewals and cancellations
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
period state, and encrypted reusable token. Automated trials, scheduled changes, and proration are
|
|
14
|
-
not available in the initial release.
|
|
12
|
+
Schedule application-managed Flutterwave renewals, reconcile retry outcomes, and cancel subscriptions at the paid period boundary.
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
Omit `paymentPlanId` for a locally renewed subscription. Preserve its billing reference, group,
|
|
15
|
+
seats, paid period, and limits. Use the configured base price for the first seat and `seatAmount`
|
|
16
|
+
for additional seats. Keep reusable payment tokens encrypted and outside client output and logs.
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
Call `chargeSubscriptionRenewal` from an authorized server. Supply a stable `renewalId` and reuse it
|
|
19
|
+
for every retry of the same billing operation. The plugin prefers an encrypted reusable token and
|
|
20
|
+
falls back to hosted checkout while verification is pending. After a dispatch attempt, reconcile that
|
|
21
|
+
same transaction reference before deciding how to handle a provider rejection or missing result.
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
`
|
|
26
|
-
`
|
|
27
|
-
|
|
23
|
+
Schedule period-end cancellation only with a known paid `periodEnd`. Run
|
|
24
|
+
`processScheduledFlutterwaveCancellations` from an authorized scheduler, inspect the returned
|
|
25
|
+
`failed` IDs, and retry failures. Process another batch when `hasMore` is true. A cancellation can
|
|
26
|
+
be withdrawn while the local paid period is active. Start a new checkout to replace an ended local subscription.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Local Subs"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Tokenized renewals and period-end cancellation"
|
|
4
4
|
default_prompt: "Use $flutterwave-local-subscriptions to implement or debug local-managed Flutterwave subscription lifecycle behavior."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-organization-billing
|
|
3
|
-
description: Configure
|
|
3
|
+
description: Configure Flutterwave billing for Better Auth organizations. Use for organization checkout, billing permissions, or marketplace splits with approved subaccounts.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave organization billing
|
|
10
|
+
# Flutterwave organization billing and marketplace splits
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Bill a Better Auth organization through an authorized local reference and configure Flutterwave subaccounts when the checkout requires a split.
|
|
13
|
+
|
|
14
|
+
Enable the Better Auth organization plugin and set `organization.enabled` for Flutterwave. Pass
|
|
15
|
+
the local organization ID as `referenceId`. Owners and admins can bill by default; use
|
|
16
|
+
`organization.billingRoles` or `subscription.authorizeReference` when your application needs a
|
|
17
|
+
different authorization policy. Keep the billing email used for provider-native enrollment on its
|
|
18
|
+
subscription record.
|
|
15
19
|
|
|
16
20
|
Configure marketplace splits separately with `marketplace.allowedSubaccountIds` and optional
|
|
17
|
-
`defaultSplit`.
|
|
18
|
-
|
|
21
|
+
`defaultSplit`. Use existing KYC-approved Flutterwave subaccounts. Keep organization IDs and
|
|
22
|
+
provider subaccount IDs separate, and apply the same reference authorization to checkout, listing,
|
|
23
|
+
and subscription actions.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Org Billing"
|
|
3
|
-
short_description: "Organization billing
|
|
3
|
+
short_description: "Organization billing roles and marketplace splits"
|
|
4
4
|
default_prompt: "Use $flutterwave-organization-billing to configure Flutterwave billing for Better Auth organizations, seats, and admin access."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-schema-migrations
|
|
3
|
-
description:
|
|
3
|
+
description: Generate and migrate the Better Auth Flutterwave database schema. Use for new installs, schema changes, webhook event uniqueness, and Cloudflare D1 migrations.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave schema migrations
|
|
10
|
+
# Better Auth Flutterwave database schema and migrations
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
`flutterwavePlan`, `flutterwaveWebhookEvent`, and `flutterwaveRefund`. Keep provider IDs, expected
|
|
14
|
-
and charged amounts, currency, lifecycle state, periods, local ownership, and reconciliation
|
|
15
|
-
timestamps distinct.
|
|
12
|
+
Apply the Flutterwave billing schema with the Better Auth CLI and confirm that your database can claim webhook deliveries uniquely.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
Generate the schema using the CLI for your installed Better Auth version and apply it using the
|
|
15
|
+
application database's migration workflow. Review changes to `flutterwaveTransaction`,
|
|
16
|
+
`flutterwaveSubscription`, `flutterwaveProduct`, `flutterwavePlan`, `flutterwaveWebhookEvent`,
|
|
17
|
+
and `flutterwaveRefund`. Keep local ownership, provider IDs, expected and charged amounts, dates,
|
|
18
|
+
and reusable credentials distinct.
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
Check the deployed database has a unique `flutterwaveWebhookEvent.eventId` constraint before
|
|
21
|
+
relying on concurrent webhook claims. Reusable payment tokens stay encrypted and out of
|
|
22
|
+
client-visible projections. Provider billing email belongs on the subscription record.
|
|
23
|
+
|
|
24
|
+
The TanStack example ships an initial D1 migration and `db:billing:check`. Use that migration on a
|
|
25
|
+
fresh D1 database. Apply reviewed incremental migrations to an existing database.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Schema"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Flutterwave billing schema and D1 migrations"
|
|
4
4
|
default_prompt: "Use $flutterwave-schema-migrations to review or change Better Auth Flutterwave schema and migration behavior."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-tanstack-start
|
|
3
|
-
description: Integrate Better Auth
|
|
3
|
+
description: Integrate Flutterwave payments into TanStack Start with Better Auth. Use for authenticated checkout, callback verification, and scheduled billing on Cloudflare D1.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave
|
|
10
|
+
# Flutterwave payments in TanStack Start with Better Auth
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
server-only environment bindings. Register `flutterwaveClient` in the browser auth client.
|
|
12
|
+
Run Flutterwave checkout in a TanStack Start app and add Cloudflare D1 when billing records and scheduled renewals need to persist.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
1. Attach Better Auth to a server route and keep payment credentials in server-only bindings.
|
|
15
|
+
Register `flutterwaveClient()` in the browser and wait for hydration before enabling interactive auth controls.
|
|
16
|
+
2. Start checkout from an authenticated session and pass an absolute `redirectUrl`. On return,
|
|
17
|
+
validate the numeric `transaction_id` or read `tx_ref`, then verify with exactly one locator.
|
|
18
|
+
Show payment success after the server confirms verification.
|
|
19
|
+
3. Keep privileged billing operations inside independently authorized server functions or jobs.
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
binding for requests and `processScheduledFlutterwaveCancellations`; run it with `build:billing`
|
|
24
|
-
or `dev:billing` after applying the reviewed migration. Its default memory demo cannot reliably
|
|
25
|
-
process schedules across isolates and has no Cron Trigger. Do not expose the processor as an
|
|
26
|
-
unauthenticated HTTP or browser action.
|
|
21
|
+
To run this package's example from its repository root, run `vp install`, `vp pack`, and
|
|
22
|
+
`vp -C examples/tanstack run dev`. For persistent billing, use its D1 binding and Worker scheduled
|
|
23
|
+
handler. Apply the reviewed migration before starting `dev:billing`. Use the same configured
|
|
24
|
+
database for HTTP and scheduled work. The default memory demo is for interactive checkout tests.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave TanStack Start"
|
|
3
|
-
short_description: "TanStack Start
|
|
3
|
+
short_description: "TanStack Start checkout and Cloudflare D1 billing"
|
|
4
4
|
default_prompt: "Use $flutterwave-tanstack-start to integrate Better Auth Flutterwave in a TanStack Start application."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flutterwave-testing-fixtures
|
|
3
|
-
description:
|
|
3
|
+
description: Test Better Auth Flutterwave checkout, signed webhooks, renewals, and reconciliation. Use provider fixtures, Cloudflare D1 tests, or Flutterwave sandbox integration tests.
|
|
4
4
|
metadata:
|
|
5
5
|
library: "better-auth-flutterwave"
|
|
6
|
-
|
|
7
|
-
compatibility: "Node.js >=22
|
|
6
|
+
library_version: "1.0.1" # x-release-please-version
|
|
7
|
+
compatibility: "Node.js >=22 and Better Auth >=1.4.22 <2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Flutterwave
|
|
10
|
+
# Test Flutterwave payments and webhooks with Better Auth
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
untyped SDK response through the same Zod schemas used in production.
|
|
12
|
+
Use Flutterwave response fixtures and signed webhook payloads to check transaction verification, duplicate events, and renewal behavior.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
Use injected `fetch` or a typed `flutterwaveClient` fixture for deterministic unit tests. Match
|
|
15
|
+
the production response shape and exercise the real validation code. Verify the expected `txRef`,
|
|
16
|
+
amount, currency, and status before fulfillment. Include retries, malformed payloads, duplicate and
|
|
17
|
+
out-of-order events, concurrent updates, encrypted token renewal, and hosted checkout fallback as
|
|
18
|
+
they relate to the change.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
Sign test webhook payloads over their exact bytes using HMAC-SHA256 and the test `secretHash`.
|
|
21
|
+
Compare the valid case with an invalid signature or altered body. Use the real migrated D1 test
|
|
22
|
+
fixture for scheduled cancellations and uniqueness when testing the persistent demo.
|
|
23
|
+
|
|
24
|
+
From the package repository run `vp test` for the local suite. Set `RUN_INTEGRATION_TESTS=true` for
|
|
25
|
+
the optional provider suite and use sandbox credentials. Treat skipped integration cases and
|
|
26
|
+
simulated provider checkout as distinct from live provider evidence.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Better Auth Flutterwave Tests"
|
|
3
|
-
short_description: "
|
|
3
|
+
short_description: "Checkout, webhook, and renewal test fixtures"
|
|
4
4
|
default_prompt: "Use $flutterwave-testing-fixtures to choose tests, fixtures, and verification commands for Better Auth Flutterwave changes."
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|