better-auth-flutterwave 0.1.10 → 0.3.0
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.md +53 -16
- package/dist/client.d.mts +7 -6
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +1 -1
- package/dist/client.mjs.map +1 -1
- package/dist/{index-C1tdrA3c.d.mts → index-zC8Dbzqo.d.mts} +57 -40
- package/dist/index-zC8Dbzqo.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +429 -185
- package/dist/index.mjs.map +1 -1
- package/dist/{version-BKseik7h.mjs → version-mllGPygP.mjs} +2 -2
- package/dist/{version-BKseik7h.mjs.map → version-mllGPygP.mjs.map} +1 -1
- package/package.json +16 -32
- package/skills/better-auth-flutterwave-setup/SKILL.md +1 -1
- package/skills/flutterwave-billing-flows/SKILL.md +1 -1
- package/skills/flutterwave-catalog-limits/SKILL.md +1 -1
- package/skills/flutterwave-client-api/SKILL.md +1 -1
- package/skills/flutterwave-local-subscriptions/SKILL.md +10 -1
- package/skills/flutterwave-organization-billing/SKILL.md +1 -1
- package/skills/flutterwave-schema-migrations/SKILL.md +7 -1
- package/skills/flutterwave-tanstack-start/SKILL.md +7 -1
- package/skills/flutterwave-testing-fixtures/SKILL.md +1 -1
- package/skills/flutterwave-webhooks-events/SKILL.md +6 -1
- package/dist/index-C1tdrA3c.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -8,10 +8,10 @@ webhooks, refunds, and reconciliation.
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install better-auth better-auth-flutterwave
|
|
11
|
+
npm install better-auth better-auth-flutterwave
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Node.js 22 or newer is required.
|
|
14
|
+
Node.js 22.22.2 or newer is required. Development and CI use Node 22.23.3, pinned in `.node-version`, and pnpm 12.10.1. The current jsdom test environment sets the minimum Node 22 patch level.
|
|
15
15
|
|
|
16
16
|
## Configure
|
|
17
17
|
|
|
@@ -62,9 +62,9 @@ export const auth = betterAuth({
|
|
|
62
62
|
});
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
The plugin calls Flutterwave's v3 API with Node's built-in `fetch`; you do not need a separate
|
|
66
|
+
Flutterwave SDK dependency. Inject `flutterwaveClient` for a custom provider boundary or `fetch` for
|
|
67
|
+
tests and controlled transports.
|
|
68
68
|
|
|
69
69
|
Configure the client plugin:
|
|
70
70
|
|
|
@@ -96,6 +96,11 @@ browser supplies the amount and currency directly or selects a configured plan/p
|
|
|
96
96
|
resolves billing email from the authenticated user or authorized organization owner. The plugin
|
|
97
97
|
generates a unique `txRef`.
|
|
98
98
|
|
|
99
|
+
For a configured plan or product, its server-side currency and price always take precedence over
|
|
100
|
+
browser overrides. A plan's base amount includes the first seat; each additional seat adds
|
|
101
|
+
`seatAmount`. Product prices are multiplied by `quantity`. Explicit browser amount/currency values
|
|
102
|
+
apply only to a payment without a configured plan or product.
|
|
103
|
+
|
|
99
104
|
```ts
|
|
100
105
|
const checkout = await authClient.flutterwave.transaction.initialize(
|
|
101
106
|
{
|
|
@@ -168,6 +173,11 @@ configured `secretHash`. It compares signatures in constant time, records idempo
|
|
|
168
173
|
re-verifies payment transactions before granting value. Keep custom `onEvent` work short so the
|
|
169
174
|
endpoint can acknowledge within Flutterwave's timeout.
|
|
170
175
|
|
|
176
|
+
Callback and reconciliation failures return a retryable HTTP 503. Webhook processing uses a
|
|
177
|
+
database claim to prevent simultaneous callbacks for the same event, and an abandoned claim can
|
|
178
|
+
be retried after five minutes. `onEvent` must still be idempotent: a crash after its external work
|
|
179
|
+
but before recording completion can cause a later retry to execute it again.
|
|
180
|
+
|
|
171
181
|
Do not parse and reserialize the request before signature verification. Do not use the API
|
|
172
182
|
`secretKey` as the webhook secret hash.
|
|
173
183
|
|
|
@@ -181,6 +191,7 @@ Privileged operations are exported from the server entry point:
|
|
|
181
191
|
```ts
|
|
182
192
|
import {
|
|
183
193
|
chargeSubscriptionRenewal,
|
|
194
|
+
processScheduledFlutterwaveCancellations,
|
|
184
195
|
reconcileFlutterwaveRefunds,
|
|
185
196
|
reconcileFlutterwaveTransaction,
|
|
186
197
|
refundFlutterwaveTransaction,
|
|
@@ -198,6 +209,36 @@ jobs:
|
|
|
198
209
|
- `refundFlutterwaveTransaction` starts a full or partial asynchronous refund.
|
|
199
210
|
- `reconcileFlutterwaveTransaction` polls and verifies a pending transaction.
|
|
200
211
|
- `reconcileFlutterwaveRefunds` refreshes pending refund records.
|
|
212
|
+
- `processScheduledFlutterwaveCancellations` executes due cancellation requests, canceling native
|
|
213
|
+
subscriptions through Flutterwave if needed and ending local subscriptions. New native
|
|
214
|
+
cancellation requests stop provider billing immediately while preserving access until the paid
|
|
215
|
+
period ends; withdrawing that request reactivates provider billing. Run the processor from your
|
|
216
|
+
scheduler at period end, inspect returned `failed` IDs, and retry failures. Each
|
|
217
|
+
invocation processes up to 100 requests by default (maximum 1,000); `hasMore` indicates that
|
|
218
|
+
another batch may be needed. Scheduling requires a known paid `periodEnd`; legacy records must
|
|
219
|
+
be reconciled first or canceled immediately.
|
|
220
|
+
|
|
221
|
+
Cancellation and restoration accept either the local subscription `id` or a numeric Flutterwave
|
|
222
|
+
`subscriptionId`. A scheduled local cancellation can be withdrawn while its paid period is still
|
|
223
|
+
active. A local subscription that has already ended requires a new checkout. Renewal calculates
|
|
224
|
+
the same seat price as checkout and rejects canceled or provider-managed subscriptions.
|
|
225
|
+
|
|
226
|
+
## Release and downstream updates
|
|
227
|
+
|
|
228
|
+
Release Please opens the version/change-log PR after reviewed changes reach `main`. Merging that
|
|
229
|
+
release PR creates the version tag and triggers the tag-pinned npm trusted-publishing workflow.
|
|
230
|
+
The npm trusted publisher must reference this repository and `.github/workflows/release-please.yml`.
|
|
231
|
+
The workflow requires Node 22.23.3, the locked pnpm version, library tests, a package build, package/type
|
|
232
|
+
lint, and the downstream example/schema checks. A branch push or ordinary application build does
|
|
233
|
+
not publish this package.
|
|
234
|
+
|
|
235
|
+
Consumers must use a release containing the new scheduled-cancellation export before importing
|
|
236
|
+
it; the previously published 0.2.1 release does not include these changes. The example uses
|
|
237
|
+
`workspace:*` and therefore follows the library in this checkout. External consumers must update
|
|
238
|
+
their dependency and lockfile after publication, review billing schema constraints, and wire the
|
|
239
|
+
processor into their authorized scheduler. See [the persistent example setup](examples/tanstack/README.md)
|
|
240
|
+
for the D1 migration and Cron Trigger configuration. This repository does not automatically
|
|
241
|
+
upgrade or deploy external applications.
|
|
201
242
|
|
|
202
243
|
## Packaged agent skills
|
|
203
244
|
|
|
@@ -279,21 +320,17 @@ provider exposes the other's customer or subscription identifiers.
|
|
|
279
320
|
Public identifiers use Flutterwave-native names: `txRef`, `transactionId`, `flwRef`,
|
|
280
321
|
`paymentPlanId`, `subscriptionId`, `secretHash`, and `subaccountId`.
|
|
281
322
|
|
|
282
|
-
##
|
|
323
|
+
## Provider transport
|
|
283
324
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
The SDK performs always-on telemetry and may write telemetry data through an operating-system
|
|
289
|
-
temporary file. This behavior comes from the upstream SDK, not Better Auth or this plugin. Review
|
|
290
|
-
the SDK and your deployment environment’s privacy, filesystem, and serverless constraints before
|
|
291
|
-
adopting it. Injecting a compatible client helps with tests but does not change upstream behavior
|
|
292
|
-
when the official SDK is used.
|
|
325
|
+
Provider requests use Flutterwave's v3 HTTP API with bearer authentication and validate response
|
|
326
|
+
envelopes before returning data to the plugin. The adapter accepts injected `fetch` and
|
|
327
|
+
`flutterwaveClient` implementations for tests and custom transports.
|
|
293
328
|
|
|
294
329
|
## Development
|
|
295
330
|
|
|
296
|
-
This repository uses [Vite+](https://viteplus.dev)
|
|
331
|
+
This repository uses [Vite+](https://viteplus.dev). `vp check` uses its native TypeScript checker. Declaration builds still require the compiler API provided by the maintained `@typescript/typescript6` compatibility package; Vite+ 1.1.0 explicitly rejects the TypeScript 7 compiler API for this mode.
|
|
332
|
+
|
|
333
|
+
Commands:
|
|
297
334
|
|
|
298
335
|
```bash
|
|
299
336
|
vp install
|
package/dist/client.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as FlutterwaveInitializeResult, M as FlutterwavePlan, N as FlutterwaveProduct, R as FlutterwaveTransaction, p as FlutterwaveMetadata, q as Subscription, t as flutterwave, x as parseFlutterwaveMetadata, z as FlutterwaveTransactionResponse } from "./index-zC8Dbzqo.mjs";
|
|
2
2
|
import { BetterFetch, BetterFetchOption, BetterFetchResponse } from "@better-fetch/fetch";
|
|
3
3
|
import { BetterAuthClientPlugin } from "better-auth/client";
|
|
4
4
|
//#region src/client.d.ts
|
|
5
|
-
type FetchResult<T, O extends BetterFetchOption | undefined> = O extends {
|
|
5
|
+
export type FetchResult<T, O extends BetterFetchOption | undefined> = O extends {
|
|
6
6
|
throw: true;
|
|
7
7
|
} ? T : BetterFetchResponse<T>;
|
|
8
|
-
interface FlutterwaveProviderActions {
|
|
8
|
+
export interface FlutterwaveProviderActions {
|
|
9
9
|
transaction: {
|
|
10
10
|
initialize: <O extends BetterFetchOption | undefined = undefined>(data: {
|
|
11
11
|
amount?: number;
|
|
@@ -15,6 +15,7 @@ interface FlutterwaveProviderActions {
|
|
|
15
15
|
referenceId?: string;
|
|
16
16
|
plan?: string;
|
|
17
17
|
product?: string;
|
|
18
|
+
quantity?: number;
|
|
18
19
|
paymentOptions?: string;
|
|
19
20
|
subaccounts?: {
|
|
20
21
|
id: string;
|
|
@@ -73,7 +74,7 @@ interface FlutterwaveProviderActions {
|
|
|
73
74
|
products: FlutterwaveProduct[];
|
|
74
75
|
}>>;
|
|
75
76
|
}
|
|
76
|
-
interface FlutterwaveClientActions {
|
|
77
|
+
export interface FlutterwaveClientActions {
|
|
77
78
|
flutterwave: FlutterwaveProviderActions;
|
|
78
79
|
subscription: FlutterwaveProviderActions["subscription"];
|
|
79
80
|
}
|
|
@@ -88,9 +89,9 @@ type FlutterwaveClientPluginInstance = Omit<BetterAuthClientPlugin, "id" | "$Inf
|
|
|
88
89
|
$InferServerPlugin: ReturnType<typeof flutterwave>;
|
|
89
90
|
getActions: ($fetch: BetterFetch) => FlutterwaveClientActions;
|
|
90
91
|
};
|
|
91
|
-
declare const flutterwaveClient: (_options?: {
|
|
92
|
+
export declare const flutterwaveClient: (_options?: {
|
|
92
93
|
subscription?: boolean;
|
|
93
94
|
}) => FlutterwaveClientPluginInstance;
|
|
94
95
|
//#endregion
|
|
95
|
-
export {
|
|
96
|
+
export { type FlutterwaveMetadata, parseFlutterwaveMetadata };
|
|
96
97
|
//# sourceMappingURL=client.d.mts.map
|
package/dist/client.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":["flutterwaveServer"],"sources":["../src/client.ts"],"mappings":";;;;YAgBY,YAAY,GAAG,UAAU,iCAAiC;EAAY;IAC9E,IACA,oBAAoB;iBAEP;EACf;IACE,aAAa,UAAU,2CACrB;MACE;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;QACE;QACA;QACA;QACA;;OAGJ,UAAU,MACP,QAAQ,YAAY,6BAA6B;IACtD,SAAS,UAAU,2CACjB;MAAQ;MAAiC;MAAgB;OACzD,UAAU,MACP,QACH;MAAc;MAAgB;MAAe,MAAM;OAAkC;IAEvF,OAAO,UAAU,2CACf;MAAS;QAAU;;OACnB,UAAU,MACP,QAAQ;MAAc,cAAc;OAA4B;;EAEvE;IACE,QAAQ;IACR,SAAS;IACT,SAAS,UAAU,2CACjB;MAAQ;MAAiC;OACzC,UAAU,MACP,QAAQ;MAAc;OAAkB;IAC7C,UAAU,UAAU,2CAClB;MAAQ;OACR,UAAU,MACP,QAAQ;MAAc;OAAkB;IAC7C,OAAO,UAAU,2CACf;MAAS;QAAU;;OACnB,UAAU,MACP,QAAQ;MAAc,eAAe;OAAkB;;EAE9D,cAAc,QACZ;IAAsB,OAAO;IAAmB,UAAU;;EAE5D,iBAAiB,QAAQ;IAAsB,OAAO;;EACtD,oBAAoB,QAAQ;IAAsB,UAAU;;;iBAG7C;EACf,aAAa;EACb,cAAc;;;YAIJ;IACR,aAAa;IACb,cAAc;;;KAIb,kCAAkC,KACrC;EAGA;EACA,oBAAoB,kBAAkBA;EACtC,aAAa,QAAQ,gBAAgB;;qBAG1B,oBAAqB;EAChC;MACE"}
|
package/dist/client.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as parseFlutterwaveMetadata, t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { l as parseFlutterwaveMetadata, t as PACKAGE_VERSION } from "./version-mllGPygP.mjs";
|
|
2
2
|
//#region src/client.ts
|
|
3
3
|
const flutterwaveClient = (_options) => ({
|
|
4
4
|
id: "flutterwave-client",
|
package/dist/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterFetch, BetterFetchOption, BetterFetchResponse } from \"@better-fetch/fetch\";\nimport type { BetterAuthClientPlugin } from \"better-auth/client\";\nimport type {\n FlutterwaveInitializeResult,\n FlutterwavePlan,\n FlutterwaveProduct,\n FlutterwaveTransaction,\n FlutterwaveTransactionResponse,\n Subscription,\n} from \"./types\";\nimport type { flutterwave as flutterwaveServer } from \"./index\";\nimport { PACKAGE_VERSION } from \"./version\";\n\nexport { parseFlutterwaveMetadata } from \"./metadata\";\nexport type { FlutterwaveMetadata } from \"./metadata\";\n\nexport type FetchResult<T, O extends BetterFetchOption | undefined> = O extends { throw: true }\n ? T\n : BetterFetchResponse<T>;\n\nexport interface FlutterwaveProviderActions {\n transaction: {\n initialize: <O extends BetterFetchOption | undefined = undefined>(\n data: {\n amount?: number;\n currency?: string;\n redirectUrl: string;\n txRef?: string;\n referenceId?: string;\n plan?: string;\n product?: string;\n paymentOptions?: string;\n subaccounts?: {\n id: string;\n transactionSplitRatio?: number;\n transactionChargeType?: \"flat\" | \"percentage\" | \"flat_subaccount\";\n transactionCharge?: number;\n }[];\n },\n options?: O,\n ) => Promise<FetchResult<FlutterwaveInitializeResult, O>>;\n verify: <O extends BetterFetchOption | undefined = undefined>(\n data: { transactionId?: string | number; txRef?: string; referenceId?: string },\n options?: O,\n ) => Promise<\n FetchResult<{ status: string; txRef: string; data: FlutterwaveTransactionResponse }, O>\n >;\n list: <O extends BetterFetchOption | undefined = undefined>(\n data?: { query?: { referenceId?: string } },\n options?: O,\n ) => Promise<FetchResult<{ transactions: FlutterwaveTransaction[] }, O>>;\n };\n subscription: {\n create: FlutterwaveProviderActions[\"transaction\"][\"initialize\"];\n upgrade: FlutterwaveProviderActions[\"transaction\"][\"initialize\"];\n cancel: <O extends BetterFetchOption | undefined = undefined>(\n data: { subscriptionId: string | number; atPeriodEnd?: boolean },\n options?: O,\n ) => Promise<FetchResult<{ status: string }, O>>;\n restore: <O extends BetterFetchOption | undefined = undefined>(\n data: { subscriptionId: string | number },\n options?: O,\n ) => Promise<FetchResult<{ status: string }, O>>;\n list: <O extends BetterFetchOption | undefined = undefined>(\n data?: { query?: { referenceId?: string } },\n options?: O,\n ) => Promise<FetchResult<{ subscriptions: Subscription[] }, O>>;\n };\n config: () => Promise<\n BetterFetchResponse<{ plans: FlutterwavePlan[]; products: FlutterwaveProduct[] }>\n >;\n listPlans: () => Promise<BetterFetchResponse<{ plans: FlutterwavePlan[] }>>;\n listProducts: () => Promise<BetterFetchResponse<{ products: FlutterwaveProduct[] }>>;\n}\n\nexport interface FlutterwaveClientActions {\n flutterwave: FlutterwaveProviderActions;\n subscription: FlutterwaveProviderActions[\"subscription\"];\n}\n\ndeclare module \"better-auth/client\" {\n interface BetterAuthClient {\n flutterwave: FlutterwaveProviderActions;\n subscription: FlutterwaveProviderActions[\"subscription\"];\n }\n}\n\ntype FlutterwaveClientPluginInstance = Omit<\n BetterAuthClientPlugin,\n \"id\" | \"$InferServerPlugin\" | \"getActions\"\n> & {\n id: \"flutterwave-client\";\n $InferServerPlugin: ReturnType<typeof flutterwaveServer>;\n getActions: ($fetch: BetterFetch) => FlutterwaveClientActions;\n};\n\nexport const flutterwaveClient = (_options?: {\n subscription?: boolean;\n}): FlutterwaveClientPluginInstance => ({\n id: \"flutterwave-client\",\n version: PACKAGE_VERSION,\n $InferServerPlugin: {} as ReturnType<typeof flutterwaveServer>,\n pathMethods: {\n \"/flutterwave/transaction/initialize\": \"POST\",\n \"/flutterwave/transaction/verify\": \"POST\",\n \"/flutterwave/subscription/create\": \"POST\",\n \"/flutterwave/subscription/upgrade\": \"POST\",\n \"/flutterwave/subscription/cancel\": \"POST\",\n \"/flutterwave/subscription/restore\": \"POST\",\n },\n getActions: ($fetch) => {\n const transaction: FlutterwaveProviderActions[\"transaction\"] = {\n initialize: (data, options) =>\n $fetch(\"/flutterwave/transaction/initialize\", { ...options, method: \"POST\", body: data }),\n verify: (data, options) =>\n $fetch(\"/flutterwave/transaction/verify\", { ...options, method: \"POST\", body: data }),\n list: (data, options) =>\n $fetch(\"/flutterwave/transaction/list\", {\n query: data?.query,\n ...options,\n method: \"GET\",\n }),\n };\n const subscription: FlutterwaveProviderActions[\"subscription\"] = {\n create: (data, options) =>\n $fetch(\"/flutterwave/subscription/create\", { ...options, method: \"POST\", body: data }),\n upgrade: (data, options) =>\n $fetch(\"/flutterwave/subscription/upgrade\", { ...options, method: \"POST\", body: data }),\n cancel: (data, options) =>\n $fetch(\"/flutterwave/subscription/cancel\", { ...options, method: \"POST\", body: data }),\n restore: (data, options) =>\n $fetch(\"/flutterwave/subscription/restore\", { ...options, method: \"POST\", body: data }),\n list: (data, options) =>\n $fetch(\"/flutterwave/subscription/list\", {\n query: data?.query,\n ...options,\n method: \"GET\",\n }),\n };\n const provider: FlutterwaveProviderActions = {\n transaction,\n subscription,\n config: () => $fetch(\"/flutterwave/config\", { method: \"GET\" }),\n listPlans: () => $fetch(\"/flutterwave/plan/list\", { method: \"GET\" }),\n listProducts: () => $fetch(\"/flutterwave/product/list\", { method: \"GET\" }),\n };\n return { flutterwave: provider, subscription };\n },\n});\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterFetch, BetterFetchOption, BetterFetchResponse } from \"@better-fetch/fetch\";\nimport type { BetterAuthClientPlugin } from \"better-auth/client\";\nimport type {\n FlutterwaveInitializeResult,\n FlutterwavePlan,\n FlutterwaveProduct,\n FlutterwaveTransaction,\n FlutterwaveTransactionResponse,\n Subscription,\n} from \"./types.ts\";\nimport type { flutterwave as flutterwaveServer } from \"./index.ts\";\nimport { PACKAGE_VERSION } from \"./version.ts\";\n\nexport { parseFlutterwaveMetadata } from \"./metadata.ts\";\nexport type { FlutterwaveMetadata } from \"./metadata.ts\";\n\nexport type FetchResult<T, O extends BetterFetchOption | undefined> = O extends { throw: true }\n ? T\n : BetterFetchResponse<T>;\n\nexport interface FlutterwaveProviderActions {\n transaction: {\n initialize: <O extends BetterFetchOption | undefined = undefined>(\n data: {\n amount?: number;\n currency?: string;\n redirectUrl: string;\n txRef?: string;\n referenceId?: string;\n plan?: string;\n product?: string;\n quantity?: number;\n paymentOptions?: string;\n subaccounts?: {\n id: string;\n transactionSplitRatio?: number;\n transactionChargeType?: \"flat\" | \"percentage\" | \"flat_subaccount\";\n transactionCharge?: number;\n }[];\n },\n options?: O,\n ) => Promise<FetchResult<FlutterwaveInitializeResult, O>>;\n verify: <O extends BetterFetchOption | undefined = undefined>(\n data: { transactionId?: string | number; txRef?: string; referenceId?: string },\n options?: O,\n ) => Promise<\n FetchResult<{ status: string; txRef: string; data: FlutterwaveTransactionResponse }, O>\n >;\n list: <O extends BetterFetchOption | undefined = undefined>(\n data?: { query?: { referenceId?: string } },\n options?: O,\n ) => Promise<FetchResult<{ transactions: FlutterwaveTransaction[] }, O>>;\n };\n subscription: {\n create: FlutterwaveProviderActions[\"transaction\"][\"initialize\"];\n upgrade: FlutterwaveProviderActions[\"transaction\"][\"initialize\"];\n cancel: <O extends BetterFetchOption | undefined = undefined>(\n data: { subscriptionId: string | number; atPeriodEnd?: boolean },\n options?: O,\n ) => Promise<FetchResult<{ status: string }, O>>;\n restore: <O extends BetterFetchOption | undefined = undefined>(\n data: { subscriptionId: string | number },\n options?: O,\n ) => Promise<FetchResult<{ status: string }, O>>;\n list: <O extends BetterFetchOption | undefined = undefined>(\n data?: { query?: { referenceId?: string } },\n options?: O,\n ) => Promise<FetchResult<{ subscriptions: Subscription[] }, O>>;\n };\n config: () => Promise<\n BetterFetchResponse<{ plans: FlutterwavePlan[]; products: FlutterwaveProduct[] }>\n >;\n listPlans: () => Promise<BetterFetchResponse<{ plans: FlutterwavePlan[] }>>;\n listProducts: () => Promise<BetterFetchResponse<{ products: FlutterwaveProduct[] }>>;\n}\n\nexport interface FlutterwaveClientActions {\n flutterwave: FlutterwaveProviderActions;\n subscription: FlutterwaveProviderActions[\"subscription\"];\n}\n\ndeclare module \"better-auth/client\" {\n interface BetterAuthClient {\n flutterwave: FlutterwaveProviderActions;\n subscription: FlutterwaveProviderActions[\"subscription\"];\n }\n}\n\ntype FlutterwaveClientPluginInstance = Omit<\n BetterAuthClientPlugin,\n \"id\" | \"$InferServerPlugin\" | \"getActions\"\n> & {\n id: \"flutterwave-client\";\n $InferServerPlugin: ReturnType<typeof flutterwaveServer>;\n getActions: ($fetch: BetterFetch) => FlutterwaveClientActions;\n};\n\nexport const flutterwaveClient = (_options?: {\n subscription?: boolean;\n}): FlutterwaveClientPluginInstance => ({\n id: \"flutterwave-client\",\n version: PACKAGE_VERSION,\n $InferServerPlugin: {} as ReturnType<typeof flutterwaveServer>,\n pathMethods: {\n \"/flutterwave/transaction/initialize\": \"POST\",\n \"/flutterwave/transaction/verify\": \"POST\",\n \"/flutterwave/subscription/create\": \"POST\",\n \"/flutterwave/subscription/upgrade\": \"POST\",\n \"/flutterwave/subscription/cancel\": \"POST\",\n \"/flutterwave/subscription/restore\": \"POST\",\n },\n getActions: ($fetch) => {\n const transaction: FlutterwaveProviderActions[\"transaction\"] = {\n initialize: (data, options) =>\n $fetch(\"/flutterwave/transaction/initialize\", { ...options, method: \"POST\", body: data }),\n verify: (data, options) =>\n $fetch(\"/flutterwave/transaction/verify\", { ...options, method: \"POST\", body: data }),\n list: (data, options) =>\n $fetch(\"/flutterwave/transaction/list\", {\n query: data?.query,\n ...options,\n method: \"GET\",\n }),\n };\n const subscription: FlutterwaveProviderActions[\"subscription\"] = {\n create: (data, options) =>\n $fetch(\"/flutterwave/subscription/create\", { ...options, method: \"POST\", body: data }),\n upgrade: (data, options) =>\n $fetch(\"/flutterwave/subscription/upgrade\", { ...options, method: \"POST\", body: data }),\n cancel: (data, options) =>\n $fetch(\"/flutterwave/subscription/cancel\", { ...options, method: \"POST\", body: data }),\n restore: (data, options) =>\n $fetch(\"/flutterwave/subscription/restore\", { ...options, method: \"POST\", body: data }),\n list: (data, options) =>\n $fetch(\"/flutterwave/subscription/list\", {\n query: data?.query,\n ...options,\n method: \"GET\",\n }),\n };\n const provider: FlutterwaveProviderActions = {\n transaction,\n subscription,\n config: () => $fetch(\"/flutterwave/config\", { method: \"GET\" }),\n listPlans: () => $fetch(\"/flutterwave/plan/list\", { method: \"GET\" }),\n listProducts: () => $fetch(\"/flutterwave/product/list\", { method: \"GET\" }),\n };\n return { flutterwave: provider, subscription };\n },\n});\n"],"mappings":";;AAiGA,MAAa,qBAAqB,cAEM;CACtC,IAAI;CACJ,SAAS;CACT,oBAAoB,CAAC;CACrB,aAAa;EACX,uCAAuC;EACvC,mCAAmC;EACnC,oCAAoC;EACpC,qCAAqC;EACrC,oCAAoC;EACpC,qCAAqC;CACvC;CACA,aAAa,WAAW;EACtB,MAAM,cAAyD;GAC7D,aAAa,MAAM,YACjB,OAAO,uCAAuC;IAAE,GAAG;IAAS,QAAQ;IAAQ,MAAM;GAAK,CAAC;GAC1F,SAAS,MAAM,YACb,OAAO,mCAAmC;IAAE,GAAG;IAAS,QAAQ;IAAQ,MAAM;GAAK,CAAC;GACtF,OAAO,MAAM,YACX,OAAO,iCAAiC;IACtC,OAAO,MAAM;IACb,GAAG;IACH,QAAQ;GACV,CAAC;EACL;EACA,MAAM,eAA2D;GAC/D,SAAS,MAAM,YACb,OAAO,oCAAoC;IAAE,GAAG;IAAS,QAAQ;IAAQ,MAAM;GAAK,CAAC;GACvF,UAAU,MAAM,YACd,OAAO,qCAAqC;IAAE,GAAG;IAAS,QAAQ;IAAQ,MAAM;GAAK,CAAC;GACxF,SAAS,MAAM,YACb,OAAO,oCAAoC;IAAE,GAAG;IAAS,QAAQ;IAAQ,MAAM;GAAK,CAAC;GACvF,UAAU,MAAM,YACd,OAAO,qCAAqC;IAAE,GAAG;IAAS,QAAQ;IAAQ,MAAM;GAAK,CAAC;GACxF,OAAO,MAAM,YACX,OAAO,kCAAkC;IACvC,OAAO,MAAM;IACb,GAAG;IACH,QAAQ;GACV,CAAC;EACL;EAQA,OAAO;GAAE,aAAa;IANpB;IACA;IACA,cAAc,OAAO,uBAAuB,EAAE,QAAQ,MAAM,CAAC;IAC7D,iBAAiB,OAAO,0BAA0B,EAAE,QAAQ,MAAM,CAAC;IACnE,oBAAoB,OAAO,6BAA6B,EAAE,QAAQ,MAAM,CAAC;GAE9C;GAAG;EAAa;CAC/C;AACF"}
|
|
@@ -116,8 +116,8 @@ type FlutterwaveRefundData = z.infer<typeof refundSchema>;
|
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/flutterwave-sdk.d.ts
|
|
118
118
|
type SdkResult = Promise<unknown>;
|
|
119
|
-
/** The deliberately small
|
|
120
|
-
interface
|
|
119
|
+
/** The deliberately small provider boundary used by this package. */
|
|
120
|
+
interface FlutterwaveClient {
|
|
121
121
|
Transaction: {
|
|
122
122
|
verify(input: {
|
|
123
123
|
id: number;
|
|
@@ -146,10 +146,12 @@ interface FlutterwaveSdkClient {
|
|
|
146
146
|
charge(input: FlutterwaveTokenChargeInput): SdkResult;
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
+
/** @deprecated Use FlutterwaveClient. */
|
|
150
|
+
type FlutterwaveSdkClient = FlutterwaveClient;
|
|
149
151
|
interface FlutterwaveAdapterOptions {
|
|
150
152
|
publicKey: string;
|
|
151
153
|
secretKey: string;
|
|
152
|
-
flutterwaveClient?:
|
|
154
|
+
flutterwaveClient?: FlutterwaveClient;
|
|
153
155
|
fetch?: typeof globalThis.fetch;
|
|
154
156
|
apiBaseUrl?: string;
|
|
155
157
|
}
|
|
@@ -186,10 +188,9 @@ declare class FlutterwaveAdapterError extends Error {
|
|
|
186
188
|
/**
|
|
187
189
|
* Creates the provider boundary used by the plugin.
|
|
188
190
|
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* required. This adapter intentionally uses only the SDK's Promise API.
|
|
191
|
+
* Uses Flutterwave's v3 HTTP API directly so applications do not need a separate
|
|
192
|
+
* SDK dependency. Inject `flutterwaveClient` for a custom provider boundary or
|
|
193
|
+
* `fetch` for controlled transport and tests.
|
|
193
194
|
*/
|
|
194
195
|
declare function createFlutterwaveAdapter(options: FlutterwaveAdapterOptions): FlutterwaveAdapter;
|
|
195
196
|
//#endregion
|
|
@@ -440,7 +441,7 @@ interface ChargeRecurringSubscriptionResult {
|
|
|
440
441
|
}
|
|
441
442
|
//#endregion
|
|
442
443
|
//#region src/routes.d.ts
|
|
443
|
-
declare const initializeTransaction: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
444
|
+
declare const initializeTransaction: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
444
445
|
method: "POST";
|
|
445
446
|
body: z.ZodObject<{
|
|
446
447
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
@@ -464,7 +465,7 @@ declare const initializeTransaction: <P extends string>(options: AnyFlutterwaveO
|
|
|
464
465
|
transactionCharge: z.ZodOptional<z.ZodNumber>;
|
|
465
466
|
}, z.core.$strip>>>;
|
|
466
467
|
}, z.core.$strip>;
|
|
467
|
-
use: (((inputContext: import("better-
|
|
468
|
+
use: (import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
468
469
|
session: {
|
|
469
470
|
session: Record<string, any> & {
|
|
470
471
|
id: string;
|
|
@@ -486,21 +487,21 @@ declare const initializeTransaction: <P extends string>(options: AnyFlutterwaveO
|
|
|
486
487
|
image?: string | null | undefined;
|
|
487
488
|
};
|
|
488
489
|
};
|
|
489
|
-
}
|
|
490
|
+
}>> | import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>)[];
|
|
490
491
|
}, {
|
|
491
492
|
kind: "checkout";
|
|
492
493
|
url: string;
|
|
493
494
|
txRef: string;
|
|
494
495
|
redirect: true;
|
|
495
496
|
}>;
|
|
496
|
-
declare const verifyTransaction: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
497
|
+
declare const verifyTransaction: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
497
498
|
method: "POST";
|
|
498
499
|
body: z.ZodObject<{
|
|
499
500
|
transactionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
500
501
|
txRef: z.ZodOptional<z.ZodString>;
|
|
501
502
|
referenceId: z.ZodOptional<z.ZodString>;
|
|
502
503
|
}, z.core.$strip>;
|
|
503
|
-
use: (((inputContext: import("better-
|
|
504
|
+
use: (import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
504
505
|
session: {
|
|
505
506
|
session: Record<string, any> & {
|
|
506
507
|
id: string;
|
|
@@ -522,18 +523,18 @@ declare const verifyTransaction: <P extends string>(options: AnyFlutterwaveOptio
|
|
|
522
523
|
image?: string | null | undefined;
|
|
523
524
|
};
|
|
524
525
|
};
|
|
525
|
-
}
|
|
526
|
+
}>> | import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>)[];
|
|
526
527
|
}, {
|
|
527
528
|
status: string;
|
|
528
529
|
txRef: string;
|
|
529
530
|
data: FlutterwaveTransactionResponse;
|
|
530
531
|
}>;
|
|
531
|
-
declare const listTransactions: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
532
|
+
declare const listTransactions: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
532
533
|
method: "GET";
|
|
533
534
|
query: z.ZodObject<{
|
|
534
535
|
referenceId: z.ZodOptional<z.ZodString>;
|
|
535
536
|
}, z.core.$strip>;
|
|
536
|
-
use: ((inputContext: import("better-
|
|
537
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
537
538
|
session: {
|
|
538
539
|
session: Record<string, any> & {
|
|
539
540
|
id: string;
|
|
@@ -555,16 +556,16 @@ declare const listTransactions: <P extends string>(options: AnyFlutterwaveOption
|
|
|
555
556
|
image?: string | null | undefined;
|
|
556
557
|
};
|
|
557
558
|
};
|
|
558
|
-
}
|
|
559
|
+
}>>[];
|
|
559
560
|
}, {
|
|
560
561
|
transactions: FlutterwaveTransaction[];
|
|
561
562
|
}>;
|
|
562
|
-
declare const listSubscriptions: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
563
|
+
declare const listSubscriptions: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
563
564
|
method: "GET";
|
|
564
565
|
query: z.ZodObject<{
|
|
565
566
|
referenceId: z.ZodOptional<z.ZodString>;
|
|
566
567
|
}, z.core.$strip>;
|
|
567
|
-
use: ((inputContext: import("better-
|
|
568
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
568
569
|
session: {
|
|
569
570
|
session: Record<string, any> & {
|
|
570
571
|
id: string;
|
|
@@ -586,17 +587,17 @@ declare const listSubscriptions: <P extends string>(options: AnyFlutterwaveOptio
|
|
|
586
587
|
image?: string | null | undefined;
|
|
587
588
|
};
|
|
588
589
|
};
|
|
589
|
-
}
|
|
590
|
+
}>>[];
|
|
590
591
|
}, {
|
|
591
592
|
subscriptions: Subscription[];
|
|
592
593
|
}>;
|
|
593
|
-
declare const cancelSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
594
|
+
declare const cancelSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
594
595
|
method: "POST";
|
|
595
596
|
body: z.ZodObject<{
|
|
596
|
-
subscriptionId: z.
|
|
597
|
+
subscriptionId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
597
598
|
atPeriodEnd: z.ZodOptional<z.ZodBoolean>;
|
|
598
599
|
}, z.core.$strip>;
|
|
599
|
-
use: (((inputContext: import("better-
|
|
600
|
+
use: (import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
600
601
|
session: {
|
|
601
602
|
session: Record<string, any> & {
|
|
602
603
|
id: string;
|
|
@@ -618,16 +619,16 @@ declare const cancelSubscription: <P extends string>(options: AnyFlutterwaveOpti
|
|
|
618
619
|
image?: string | null | undefined;
|
|
619
620
|
};
|
|
620
621
|
};
|
|
621
|
-
}
|
|
622
|
+
}>> | import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>)[];
|
|
622
623
|
}, {
|
|
623
624
|
status: string;
|
|
624
625
|
}>;
|
|
625
|
-
declare const restoreSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
626
|
+
declare const restoreSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
626
627
|
method: "POST";
|
|
627
628
|
body: z.ZodObject<{
|
|
628
|
-
subscriptionId: z.
|
|
629
|
+
subscriptionId: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
629
630
|
}, z.core.$strip>;
|
|
630
|
-
use: (((inputContext: import("better-
|
|
631
|
+
use: (import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
631
632
|
session: {
|
|
632
633
|
session: Record<string, any> & {
|
|
633
634
|
id: string;
|
|
@@ -649,11 +650,11 @@ declare const restoreSubscription: <P extends string>(options: AnyFlutterwaveOpt
|
|
|
649
650
|
image?: string | null | undefined;
|
|
650
651
|
};
|
|
651
652
|
};
|
|
652
|
-
}
|
|
653
|
+
}>> | import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>)[];
|
|
653
654
|
}, {
|
|
654
655
|
status: string;
|
|
655
656
|
}>;
|
|
656
|
-
declare const createSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
657
|
+
declare const createSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
657
658
|
method: "POST";
|
|
658
659
|
body: z.ZodObject<{
|
|
659
660
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
@@ -677,7 +678,7 @@ declare const createSubscription: <P extends string>(options: AnyFlutterwaveOpti
|
|
|
677
678
|
transactionCharge: z.ZodOptional<z.ZodNumber>;
|
|
678
679
|
}, z.core.$strip>>>;
|
|
679
680
|
}, z.core.$strip>;
|
|
680
|
-
use: (((inputContext: import("better-
|
|
681
|
+
use: (import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
681
682
|
session: {
|
|
682
683
|
session: Record<string, any> & {
|
|
683
684
|
id: string;
|
|
@@ -699,14 +700,14 @@ declare const createSubscription: <P extends string>(options: AnyFlutterwaveOpti
|
|
|
699
700
|
image?: string | null | undefined;
|
|
700
701
|
};
|
|
701
702
|
};
|
|
702
|
-
}
|
|
703
|
+
}>> | import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>)[];
|
|
703
704
|
}, {
|
|
704
705
|
kind: "checkout";
|
|
705
706
|
url: string;
|
|
706
707
|
txRef: string;
|
|
707
708
|
redirect: true;
|
|
708
709
|
}>;
|
|
709
|
-
declare const upgradeSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
710
|
+
declare const upgradeSubscription: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
710
711
|
method: "POST";
|
|
711
712
|
body: z.ZodObject<{
|
|
712
713
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
@@ -730,7 +731,7 @@ declare const upgradeSubscription: <P extends string>(options: AnyFlutterwaveOpt
|
|
|
730
731
|
transactionCharge: z.ZodOptional<z.ZodNumber>;
|
|
731
732
|
}, z.core.$strip>>>;
|
|
732
733
|
}, z.core.$strip>;
|
|
733
|
-
use: (((inputContext: import("better-
|
|
734
|
+
use: (import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
734
735
|
session: {
|
|
735
736
|
session: Record<string, any> & {
|
|
736
737
|
id: string;
|
|
@@ -752,24 +753,24 @@ declare const upgradeSubscription: <P extends string>(options: AnyFlutterwaveOpt
|
|
|
752
753
|
image?: string | null | undefined;
|
|
753
754
|
};
|
|
754
755
|
};
|
|
755
|
-
}
|
|
756
|
+
}>> | import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>)[];
|
|
756
757
|
}, {
|
|
757
758
|
kind: "checkout";
|
|
758
759
|
url: string;
|
|
759
760
|
txRef: string;
|
|
760
761
|
redirect: true;
|
|
761
762
|
}>;
|
|
762
|
-
declare const listProducts: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
763
|
+
declare const listProducts: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
763
764
|
method: "GET";
|
|
764
765
|
}, {
|
|
765
766
|
products: FlutterwaveProduct[];
|
|
766
767
|
}>;
|
|
767
|
-
declare const listPlans: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
768
|
+
declare const listPlans: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
768
769
|
method: "GET";
|
|
769
770
|
}, {
|
|
770
771
|
plans: FlutterwavePlan[];
|
|
771
772
|
}>;
|
|
772
|
-
declare const getConfig: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
773
|
+
declare const getConfig: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
773
774
|
method: "GET";
|
|
774
775
|
}, {
|
|
775
776
|
plans: FlutterwavePlan[];
|
|
@@ -777,7 +778,7 @@ declare const getConfig: <P extends string>(options: AnyFlutterwaveOptions, path
|
|
|
777
778
|
subscriptions: boolean;
|
|
778
779
|
marketplace: boolean;
|
|
779
780
|
}>;
|
|
780
|
-
declare const flutterwaveWebhook: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-
|
|
781
|
+
declare const flutterwaveWebhook: <P extends string>(options: AnyFlutterwaveOptions, path: P) => import("better-auth").StrictEndpoint<P, {
|
|
781
782
|
method: "POST";
|
|
782
783
|
metadata: {
|
|
783
784
|
openapi: {
|
|
@@ -792,7 +793,7 @@ declare const flutterwaveWebhook: <P extends string>(options: AnyFlutterwaveOpti
|
|
|
792
793
|
}>;
|
|
793
794
|
//#endregion
|
|
794
795
|
//#region src/version.d.ts
|
|
795
|
-
declare const PACKAGE_VERSION = "0.
|
|
796
|
+
declare const PACKAGE_VERSION = "0.3.0";
|
|
796
797
|
//#endregion
|
|
797
798
|
//#region src/metadata.d.ts
|
|
798
799
|
type FlutterwaveMetadata = Record<string, unknown>;
|
|
@@ -845,9 +846,25 @@ declare function getOrganizationEntitlements(ctx: GenericEndpointContext, organi
|
|
|
845
846
|
}>;
|
|
846
847
|
declare const checkTeamLimit: (ctx: GenericEndpointContext, organizationId: string, maxTeams: number) => Promise<boolean>;
|
|
847
848
|
//#endregion
|
|
849
|
+
//#region src/billing-store.d.ts
|
|
850
|
+
type BillingStoreAdapter = Pick<GenericEndpointContext["context"]["adapter"], "create" | "findOne" | "findMany" | "update" | "updateMany">;
|
|
851
|
+
//#endregion
|
|
848
852
|
//#region src/operations.d.ts
|
|
849
853
|
declare function syncFlutterwavePlans(ctx: GenericEndpointContext, options: AnyFlutterwaveOptions): Promise<FlutterwaveSyncResult>;
|
|
850
854
|
declare function chargeSubscriptionRenewal(ctx: GenericEndpointContext, options: AnyFlutterwaveOptions, input: ChargeRecurringSubscriptionInput): Promise<ChargeRecurringSubscriptionResult>;
|
|
855
|
+
/** Call from an independently authorized scheduled job; no browser endpoint is exposed. */
|
|
856
|
+
declare function processScheduledFlutterwaveCancellations(ctx: {
|
|
857
|
+
context: {
|
|
858
|
+
adapter: BillingStoreAdapter;
|
|
859
|
+
};
|
|
860
|
+
}, options: AnyFlutterwaveOptions, input?: {
|
|
861
|
+
now?: Date;
|
|
862
|
+
limit?: number;
|
|
863
|
+
}): Promise<{
|
|
864
|
+
canceled: number;
|
|
865
|
+
failed: string[];
|
|
866
|
+
hasMore: boolean;
|
|
867
|
+
}>;
|
|
851
868
|
declare function refundFlutterwaveTransaction(ctx: GenericEndpointContext, options: AnyFlutterwaveOptions, input: {
|
|
852
869
|
transactionId: number;
|
|
853
870
|
amount?: number;
|
|
@@ -923,5 +940,5 @@ type FlutterwavePluginInstance<O extends AnyFlutterwaveOptions> = Omit<BetterAut
|
|
|
923
940
|
};
|
|
924
941
|
declare const flutterwave: <TFlutterwaveClient extends FlutterwaveClientLike = FlutterwaveClientLike, O extends FlutterwaveOptions<TFlutterwaveClient> = FlutterwaveOptions<TFlutterwaveClient>>(options: O) => FlutterwavePluginInstance<O>;
|
|
925
942
|
//#endregion
|
|
926
|
-
export {
|
|
927
|
-
//# sourceMappingURL=index-
|
|
943
|
+
export { FlutterwaveSdkClient as $, FlutterwaveInitializeResult as A, FlutterwaveWebhookEvent as B, AnyFlutterwaveOptions as C, FlutterwaveClientLike as D, FlutterwaveCheckoutChannel as E, FlutterwaveSubaccountSplit as F, Organization as G, FlutterwaveWebhookPayload as H, FlutterwaveSubscription as I, SubscriptionOptions as J, Session as K, FlutterwaveSyncResult as L, FlutterwavePlan as M, FlutterwaveProduct as N, FlutterwaveCurrency as O, FlutterwaveRefund as P, FlutterwaveAdapterOptions as Q, FlutterwaveTransaction as R, stringifyFlutterwaveMetadata as S, ChargeRecurringSubscriptionResult as T, InputFlutterwaveProduct as U, FlutterwaveWebhookEventRecord as V, Member as W, FlutterwaveAdapter as X, User as Y, FlutterwaveAdapterError as Z, getMetadataBoolean as _, processScheduledFlutterwaveCancellations as a, hasFlutterwaveMetadata as b, checkSeatLimit as c, decryptPaymentToken as d, createFlutterwaveAdapter as et, encryptPaymentToken as f, createRenewalMetadata as g, createProrationMetadata as h, chargeSubscriptionRenewal as i, FlutterwaveOptions as j, FlutterwaveCustomer as k, checkTeamLimit as l, createCheckoutMetadata as m, reconcileFlutterwaveRefunds as n, refundFlutterwaveTransaction as o, FlutterwaveMetadata as p, Subscription as q, reconcileFlutterwaveTransaction as r, syncFlutterwavePlans as s, flutterwave as t, FlutterwaveTokenChargeInput as tt, getOrganizationEntitlements as u, getMetadataNumber as v, ChargeRecurringSubscriptionInput as w, parseFlutterwaveMetadata as x, getMetadataString as y, FlutterwaveTransactionResponse as z };
|
|
944
|
+
//# sourceMappingURL=index-zC8Dbzqo.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-zC8Dbzqo.d.mts","names":["_$__types_ts0.FlutterwaveTransaction","_$__types_ts0.Subscription","_$__types_ts0.FlutterwavePlan","_$__types_ts0.FlutterwaveRefund"],"sources":["../src/schema.ts","../src/flutterwave-contracts.ts","../src/flutterwave-sdk.ts","../src/types.d.ts","../src/routes.ts","../src/version.ts","../src/metadata.ts","../src/token-crypto.ts","../src/limits.ts","../src/billing-store.ts","../src/operations.ts","../src/reconciliation.ts","../src/index.ts"],"mappings":";;;;;KAIK,kBAAkB,0BAA0B,4BAA4B,OAC3E;EAEE,QAAQ,OAAO,WAAW;EAC1B;EACA;;KAIC,qBAAqB;KAuBrB,sBAAsB;KA4BtB,iBAAiB;KAcjB,cAAc;KAed,sBAAsB;KAatB,gBAAgB;KAgBT,0BAA0B,qBACpC,sBACA,iBACA,cACA,sBACA;cA0IW,YAAa,SAAS,uBAAqB;;;cCzP3C,6BAA2B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCxB,EAAA,KAAA;cAEH,oBAAkB,EAAA;;GAIf,EAAA,KAAA;cAEH,mBAAiB,EAAA;;;;;;;;;;;;;;;;;;GA2Bd,EAAA,KAAA;cAEH,mBAAiB,EAAA;;;;;;;;;GAcd,EAAA,KAAA;cAEH,oBAAkB,EAAA;;;;;;;;;;;GAgBf,EAAA,KAAA;cAEH,wBAAsB,EAAA;;;;;;;;GAUnB,EAAA,KAAA;cAEH,cAAY,EAAA;;;;;;;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YAAY;;UAEC;EACb;EACA;EACA;EACA;;UAEa;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IACI;IACA,gBAAgB,cAAc,iBAAiB;IAC/C,cAAc,cAAc,iBAAiB;IAC7C,kBAAkB,cAAc,iBAAiB;;EAErD,SAAS;EACT;EACA;EACA,YAAY;EACZ,YAAY;;UAEC;EACb;EACA,MAAM;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;MACI;;;;KAIA,4BAA4B;UACvB;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA,OAAO;;UAEM;EACb;EACA;EACA;EACA;;UAEa;EACb;EACA,OAAO,2BAA2B,QAAQ;EAC1C;EACA;EACA;EACA,yBAAyB;EACzB,sBAAsB;IAClB,MAAM;IACN,SAAS;IACT;IACA;KACD,KAAK,2BAA2B;EACnC,0BAA0B;IACtB,OAAO;IACP,cAAc;IACd,MAAM;KACP,KAAK,2BAA2B;EACnC,yBAAyB;IACrB,OAAO;IACP,cAAc;IACd,MAAM;KACP,KAAK,2BAA2B;EACnC,wBAAwB;IACpB,OAAO;IACP,cAAc;IACd,MAAM;KACP,KAAK,2BAA2B;EACnC,wBAAwB;IACpB,OAAO;IACP,cAAc;KACf,KAAK,2BAA2B;;UAEtB,mBAAmB,2BAA2B,wBAAwB;EACnF;EACA;EACA;EACA,oBAAoB;EACpB,eAAe,WAAW;EAC1B;EACA;EACA;IACI;;EAEJ,eAAe;EACf;IACI;IACA;;EAEJ;IACI,WAAW,8BAA8B,QAAQ;;EAErD;IACI;IACA,eAAe;;EAEnB,WAAW,OAAO,4BAA4B;EAC9C,SAAS,kBAAkB;;UAEd;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,YAAY;EACZ;EACA,WAAW;EACX,aAAa;EACb,UAAU;EACV;EACA,aAAa;EACb,WAAW;EACX;EACA,WAA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EACf;EACA;EACA,SAAS;EACT;;iBAGoB,gCACpB,KAAK,wBACL,SAAS,uBACT,OAAO,uCAAoC;;;;;;;;;;;;;;;;;;iBA6DvB,4BACpB,KAAK,wBACL,SAAS,wBAAqB;;;;;;;YCjCpB,yBAAyB,aAAa;IAC9C;MAAe,gBAAgB;;;;cAI7B;GAAA,kCAAA;;KAYD;EACH,kCAAkC,kBAAkB;EACpD,8BAA8B,kBAAkB;EAChD,6BAA6B,kBAAkB;EAC/C,8BAA8B,kBAAkB;EAChD,+BAA+B,kBAAkB;EACjD,gCAAgC,kBAAkB;EAClD,+BAA+B,kBAAkB;EACjD,gCAAgC,kBAAkB;EAClD,yBAAyB,kBAAkB;EAC3C,sBAAsB,kBAAkB;EACxC,sBAAsB,kBAAkB;EACxC,oBAAoB,kBAAkB;;KAGnC,0BAA0B,UAAU,yBAAyB,KAChE;EAGA;EACA,gBAAgB;EAChB,WAAW;EACX,QAAQ,kBAAkB;EAC1B,SAAS,QAAQ;EACjB,qBAAqB;EACrB,OAAO,KAAK;IAAkB,SAAS;;;cAG5B,cACX,2BAA2B,wBAAwB,uBACnD,UAAU,mBAAmB,sBAAsB,mBAAmB,qBAEtE,SAAS,MACR,0BAA0B"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { type AnyFlutterwaveOptions, type ChargeRecurringSubscriptionInput, type ChargeRecurringSubscriptionResult, type FlutterwaveAdapter, FlutterwaveAdapterError, type FlutterwaveAdapterOptions, type FlutterwaveCheckoutChannel, type FlutterwaveClientLike, type FlutterwaveCurrency, type FlutterwaveCustomer, type FlutterwaveInitializeResult, type FlutterwaveMetadata, type FlutterwaveOptions, type FlutterwavePlan, type FlutterwaveProduct, type FlutterwaveRefund, type FlutterwaveSdkClient, type FlutterwaveSubaccountSplit, type FlutterwaveSubscription, type FlutterwaveSyncResult, type FlutterwaveTransaction, type FlutterwaveTransactionResponse, type FlutterwaveWebhookEvent, type FlutterwaveWebhookEventRecord, type FlutterwaveWebhookPayload, type InputFlutterwaveProduct, type Member, type Organization, type Session, type Subscription, type SubscriptionOptions, type User, chargeSubscriptionRenewal, checkSeatLimit, checkTeamLimit, createCheckoutMetadata, createFlutterwaveAdapter, createProrationMetadata, createRenewalMetadata, decryptPaymentToken, encryptPaymentToken, flutterwave, getMetadataBoolean, getMetadataNumber, getMetadataString, getOrganizationEntitlements, hasFlutterwaveMetadata, parseFlutterwaveMetadata, reconcileFlutterwaveRefunds, reconcileFlutterwaveTransaction, refundFlutterwaveTransaction, stringifyFlutterwaveMetadata, syncFlutterwavePlans };
|
|
1
|
+
import { $ as FlutterwaveSdkClient, A as FlutterwaveInitializeResult, B as FlutterwaveWebhookEvent, C as AnyFlutterwaveOptions, D as FlutterwaveClientLike, E as FlutterwaveCheckoutChannel, F as FlutterwaveSubaccountSplit, G as Organization, H as FlutterwaveWebhookPayload, I as FlutterwaveSubscription, J as SubscriptionOptions, K as Session, L as FlutterwaveSyncResult, M as FlutterwavePlan, N as FlutterwaveProduct, O as FlutterwaveCurrency, P as FlutterwaveRefund, Q as FlutterwaveAdapterOptions, R as FlutterwaveTransaction, S as stringifyFlutterwaveMetadata, T as ChargeRecurringSubscriptionResult, U as InputFlutterwaveProduct, V as FlutterwaveWebhookEventRecord, W as Member, X as FlutterwaveAdapter, Y as User, Z as FlutterwaveAdapterError, _ as getMetadataBoolean, a as processScheduledFlutterwaveCancellations, b as hasFlutterwaveMetadata, c as checkSeatLimit, d as decryptPaymentToken, et as createFlutterwaveAdapter, f as encryptPaymentToken, g as createRenewalMetadata, h as createProrationMetadata, i as chargeSubscriptionRenewal, j as FlutterwaveOptions, k as FlutterwaveCustomer, l as checkTeamLimit, m as createCheckoutMetadata, n as reconcileFlutterwaveRefunds, o as refundFlutterwaveTransaction, p as FlutterwaveMetadata, q as Subscription, r as reconcileFlutterwaveTransaction, s as syncFlutterwavePlans, t as flutterwave, tt as FlutterwaveTokenChargeInput, u as getOrganizationEntitlements, v as getMetadataNumber, w as ChargeRecurringSubscriptionInput, x as parseFlutterwaveMetadata, y as getMetadataString, z as FlutterwaveTransactionResponse } from "./index-zC8Dbzqo.mjs";
|
|
2
|
+
export { type AnyFlutterwaveOptions, type ChargeRecurringSubscriptionInput, type ChargeRecurringSubscriptionResult, type FlutterwaveAdapter, FlutterwaveAdapterError, type FlutterwaveAdapterOptions, type FlutterwaveCheckoutChannel, type FlutterwaveClientLike, type FlutterwaveCurrency, type FlutterwaveCustomer, type FlutterwaveInitializeResult, type FlutterwaveMetadata, type FlutterwaveOptions, type FlutterwavePlan, type FlutterwaveProduct, type FlutterwaveRefund, type FlutterwaveSdkClient, type FlutterwaveSubaccountSplit, type FlutterwaveSubscription, type FlutterwaveSyncResult, type FlutterwaveTokenChargeInput, type FlutterwaveTransaction, type FlutterwaveTransactionResponse, type FlutterwaveWebhookEvent, type FlutterwaveWebhookEventRecord, type FlutterwaveWebhookPayload, type InputFlutterwaveProduct, type Member, type Organization, type Session, type Subscription, type SubscriptionOptions, type User, chargeSubscriptionRenewal, checkSeatLimit, checkTeamLimit, createCheckoutMetadata, createFlutterwaveAdapter, createProrationMetadata, createRenewalMetadata, decryptPaymentToken, encryptPaymentToken, flutterwave, getMetadataBoolean, getMetadataNumber, getMetadataString, getOrganizationEntitlements, hasFlutterwaveMetadata, parseFlutterwaveMetadata, processScheduledFlutterwaveCancellations, reconcileFlutterwaveRefunds, reconcileFlutterwaveTransaction, refundFlutterwaveTransaction, stringifyFlutterwaveMetadata, syncFlutterwavePlans };
|