@alexasomba/better-auth-paystack 1.2.1 → 2.1.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/package.json CHANGED
@@ -1,13 +1,38 @@
1
1
  {
2
2
  "name": "@alexasomba/better-auth-paystack",
3
- "version": "1.2.1",
3
+ "version": "2.1.0",
4
4
  "description": "Production-ready Paystack billing plugin for Better Auth. Supports subscriptions, one-time payments, organization billing, secure webhooks and more",
5
- "license": "MIT",
6
- "author": "alexasomba",
5
+ "keywords": [
6
+ "africa",
7
+ "auth",
8
+ "better-auth",
9
+ "billing-system",
10
+ "checkout",
11
+ "cote-divoire",
12
+ "egp",
13
+ "egypt",
14
+ "fintech",
15
+ "ghana",
16
+ "ghs",
17
+ "ivory-coast",
18
+ "kenya",
19
+ "kes",
20
+ "ngn",
21
+ "nigeria",
22
+ "paystack",
23
+ "rwanda",
24
+ "saas",
25
+ "south-africa",
26
+ "subscriptions",
27
+ "usd",
28
+ "zar"
29
+ ],
7
30
  "homepage": "https://github.com/alexasomba/better-auth-paystack#readme",
8
31
  "bugs": {
9
32
  "url": "https://github.com/alexasomba/better-auth-paystack/issues"
10
33
  },
34
+ "license": "MIT",
35
+ "author": "alexasomba",
11
36
  "repository": {
12
37
  "type": "git",
13
38
  "url": "git+https://github.com/alexasomba/better-auth-paystack.git"
@@ -18,39 +43,12 @@
18
43
  "url": "https://solscan.io/account/Gepby394bBBn4AEKkSwAPVnjgBULvYTiXBpbZe9CQqSp"
19
44
  }
20
45
  ],
21
- "keywords": [
22
- "paystack",
23
- "auth",
24
- "better-auth",
25
- "billing-system",
26
- "checkout",
27
- "fintech",
28
- "nigeria",
29
- "ghana",
30
- "south-africa",
31
- "kenya",
32
- "ivory-coast",
33
- "cote-divoire",
34
- "egypt",
35
- "rwanda",
36
- "ngn",
37
- "ghs",
38
- "zar",
39
- "kes",
40
- "usd",
41
- "egp",
42
- "subscriptions",
43
- "africa",
44
- "saas"
45
- ],
46
- "engines": {
47
- "node": ">=22.0.0"
48
- },
49
- "type": "module",
50
- "types": "./dist/index.d.mts",
51
46
  "files": [
52
47
  "dist"
53
48
  ],
49
+ "type": "module",
50
+ "sideEffects": false,
51
+ "types": "./dist/index.d.mts",
54
52
  "exports": {
55
53
  ".": {
56
54
  "types": "./dist/index.d.mts",
@@ -63,61 +61,54 @@
63
61
  "default": "./dist/client.mjs"
64
62
  }
65
63
  },
66
- "sideEffects": false,
67
64
  "publishConfig": {
68
65
  "access": "public"
69
66
  },
70
- "peerDependencies": {
71
- "better-auth": ">=1.3.0"
72
- },
73
67
  "dependencies": {
74
- "@alexasomba/paystack-node": "^1.2.1",
75
- "better-call": "^2.0.1",
76
- "defu": "^6.1.4",
68
+ "@alexasomba/paystack-node": "^1.9.2",
69
+ "better-call": "^1.3.5",
70
+ "defu": "^6.1.7",
77
71
  "zod": "^4.3.6"
78
72
  },
79
- "optionalDependencies": {
80
- "@rollup/rollup-linux-x64-gnu": "^4.59.0"
81
- },
82
73
  "devDependencies": {
83
74
  "@arethetypeswrong/cli": "^0.18.2",
84
- "@better-auth/core": "^1.5.3",
75
+ "@better-auth/core": "1.7.0-beta.1",
85
76
  "@better-fetch/fetch": "^1.1.21",
86
- "@eslint/compat": "^2.0.2",
87
- "@eslint/js": "^9.39.3",
88
- "@rollup/rollup-linux-x64-gnu": "^4.59.0",
89
- "@types/node": "^22.19.13",
90
- "@typescript-eslint/eslint-plugin": "^8.56.1",
91
- "@typescript-eslint/parser": "^8.56.1",
92
- "@vitest/coverage-v8": "^3.2.4",
93
- "better-auth": "^1.5.3",
94
- "eslint": "^9.39.3",
95
- "eslint-plugin-import-x": "^4.16.1",
77
+ "@commitlint/cli": "^20.5.0",
78
+ "@commitlint/config-conventional": "^20.5.0",
79
+ "@eslint/compat": "^2.0.5",
80
+ "@eslint/js": "^10.0.1",
81
+ "@types/node": "^24.12.2",
82
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
83
+ "@typescript-eslint/parser": "^8.58.2",
84
+ "@vitest/coverage-v8": "^4.1.4",
85
+ "better-auth": "1.7.0-beta.1",
86
+ "eslint-plugin-import-x": "^4.16.2",
96
87
  "eslint-plugin-promise": "^7.2.1",
97
- "eslint-plugin-react-hooks": "^7.0.1",
98
- "eslint-plugin-unicorn": "^63.0.0",
99
- "husky": "^9.1.7",
100
- "lint-staged": "^16.3.2",
88
+ "eslint-plugin-react-hooks": "^7.1.0",
89
+ "eslint-plugin-unicorn": "^64.0.0",
101
90
  "publint": "^0.3.18",
102
- "tsdown": "^0.21.0",
103
91
  "typescript": "^5.9.3",
104
- "typescript-eslint": "^8.56.1",
105
- "vitest": "^3.2.4"
92
+ "typescript-eslint": "^8.58.2",
93
+ "vite-plus": "^0.1.18",
94
+ "vitest": "npm:@voidzero-dev/vite-plus-test@^0.1.18"
95
+ },
96
+ "peerDependencies": {
97
+ "better-auth": "^1.6.5"
98
+ },
99
+ "optionalDependencies": {
100
+ "@rollup/rollup-linux-x64-gnu": "^4.60.1"
106
101
  },
107
- "lint-staged": {
108
- "*.{ts,tsx}": [
109
- "bash -c 'pnpm tsc --noEmit'",
110
- "eslint --fix",
111
- "vitest related --run"
112
- ]
102
+ "engines": {
103
+ "node": ">=24.0.0"
113
104
  },
114
105
  "scripts": {
115
- "build": "tsdown",
116
- "dev": "tsdown --watch",
117
- "test": "vitest run",
118
- "test:integration": "RUN_INTEGRATION_TESTS=1 vitest run",
119
- "coverage": "vitest run --coverage",
120
- "lint": "eslint src",
106
+ "build": "vp pack",
107
+ "dev": "vp pack --watch",
108
+ "test": "vp test run",
109
+ "test:integration": "RUN_INTEGRATION_TESTS=1 vp test run",
110
+ "coverage": "vp test run --coverage",
111
+ "lint": "vp lint src",
121
112
  "lint:package": "publint run --strict",
122
113
  "lint:types": "attw --profile esm-only --pack .",
123
114
  "typecheck": "tsc -p tsconfig.json --noEmit"
@@ -1,488 +0,0 @@
1
- import * as _better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
2
- import { AuthContext, GenericEndpointContext, InferOptionSchema, Session, User } from "better-auth";
3
- import { createPaystack } from "@alexasomba/paystack-node";
4
- import { GenericEndpointContext as GenericEndpointContext$1 } from "@better-auth/core";
5
- import * as _better_auth_core_db0 from "@better-auth/core/db";
6
-
7
- //#region src/schema.d.ts
8
- declare const subscriptions: {
9
- subscription: {
10
- fields: {
11
- plan: {
12
- type: "string";
13
- required: true;
14
- index: true;
15
- };
16
- referenceId: {
17
- type: "string";
18
- required: true;
19
- index: true;
20
- };
21
- paystackCustomerCode: {
22
- type: "string";
23
- required: false;
24
- index: true;
25
- };
26
- paystackSubscriptionCode: {
27
- type: "string";
28
- required: false;
29
- unique: true;
30
- };
31
- paystackTransactionReference: {
32
- type: "string";
33
- required: false;
34
- index: true;
35
- };
36
- paystackAuthorizationCode: {
37
- type: "string";
38
- required: false;
39
- };
40
- paystackEmailToken: {
41
- type: "string";
42
- required: false;
43
- };
44
- status: {
45
- type: "string";
46
- defaultValue: string;
47
- };
48
- periodStart: {
49
- type: "date";
50
- required: false;
51
- };
52
- periodEnd: {
53
- type: "date";
54
- required: false;
55
- };
56
- trialStart: {
57
- type: "date";
58
- required: false;
59
- };
60
- trialEnd: {
61
- type: "date";
62
- required: false;
63
- };
64
- cancelAtPeriodEnd: {
65
- type: "boolean";
66
- required: false;
67
- defaultValue: false;
68
- };
69
- groupId: {
70
- type: "string";
71
- required: false;
72
- };
73
- seats: {
74
- type: "number";
75
- required: false;
76
- };
77
- pendingPlan: {
78
- type: "string";
79
- required: false;
80
- };
81
- };
82
- };
83
- };
84
- declare const user: {
85
- user: {
86
- fields: {
87
- paystackCustomerCode: {
88
- type: "string";
89
- required: false;
90
- index: true;
91
- };
92
- };
93
- };
94
- };
95
- declare const organization: {
96
- organization: {
97
- fields: {
98
- paystackCustomerCode: {
99
- type: "string";
100
- required: false;
101
- index: true;
102
- };
103
- email: {
104
- type: "string";
105
- required: false;
106
- };
107
- };
108
- };
109
- };
110
- //#endregion
111
- //#region src/types.d.ts
112
- type PaystackNodeClient = ReturnType<typeof createPaystack>;
113
- type PaystackCurrency = "NGN" | "GHS" | "KES" | "ZAR" | "USD" | "XOF";
114
- type PaystackEvent = "charge.success" | "charge.failure" | "subscription.create" | "subscription.disable" | "subscription.not_renew" | "subscription.expiring_cards" | "invoice.create" | "invoice.payment_failed" | "invoice.update" | "transfer.success" | "transfer.failed" | "transfer.reversed" | "customeridentification.success" | "customeridentification.failed" | (string & {});
115
- interface PaystackWebhookPayload<TData = Record<string, unknown>, TMetadata = PaystackMetadata> {
116
- event: PaystackEvent;
117
- data: TData;
118
- metadata?: TMetadata;
119
- [key: string]: unknown;
120
- }
121
- interface PaystackCustomerResponse {
122
- customer_code: string;
123
- email: string;
124
- first_name?: string;
125
- last_name?: string;
126
- metadata?: PaystackMetadata | string | null;
127
- id: number;
128
- [key: string]: unknown;
129
- }
130
- type NonNullableInit<T> = Exclude<T, undefined>;
131
- type ExtractBody<T> = T extends {
132
- body?: infer B;
133
- } ? B : never;
134
- type WithMetadataStringOrObject<T> = T extends object ? Omit<T, "metadata"> & {
135
- metadata?: string | Record<string, unknown>;
136
- } : T;
137
- type WithMetadataObject<T> = T extends object ? Omit<T, "metadata"> & {
138
- metadata?: Record<string, unknown>;
139
- } : T;
140
- type WithEmail<T> = T extends object ? Omit<T, "email"> & {
141
- email?: string;
142
- } : T;
143
- type CustomerCreateInit = NonNullableInit<Parameters<PaystackNodeClient["customer_create"]>[0]>;
144
- type CustomerUpdateInit = NonNullableInit<Parameters<PaystackNodeClient["customer_update"]>[0]>;
145
- type TransactionInitializeInit = NonNullableInit<Parameters<PaystackNodeClient["transaction_initialize"]>[0]>;
146
- type SubscriptionCreateInit = NonNullableInit<Parameters<PaystackNodeClient["subscription_create"]>[0]>;
147
- type SubscriptionToggleInit = NonNullableInit<Parameters<PaystackNodeClient["subscription_disable"]>[0]>;
148
- type TransactionChargeAuthorizationInit = NonNullableInit<Parameters<PaystackNodeClient["transaction_chargeAuthorization"]>[0]>;
149
- type PaystackCustomerCreateInput = WithMetadataStringOrObject<ExtractBody<CustomerCreateInit>>;
150
- type PaystackCustomerUpdateInput = WithMetadataStringOrObject<WithEmail<ExtractBody<CustomerUpdateInit>>>;
151
- type PaystackTransactionInitializeInput = WithMetadataObject<ExtractBody<TransactionInitializeInit>> & {
152
- scheduleAtPeriodEnd?: boolean;
153
- cancelAtPeriodEnd?: boolean;
154
- prorateAndCharge?: boolean;
155
- };
156
- type PaystackTransactionChargeAuthorizationInput = WithMetadataObject<ExtractBody<TransactionChargeAuthorizationInit>>;
157
- type PaystackSubscriptionCreateInput = ExtractBody<SubscriptionCreateInit>;
158
- type PaystackSubscriptionToggleInput = ExtractBody<SubscriptionToggleInit>;
159
- type PaystackClientLike = Partial<PaystackNodeClient> & {
160
- subscription_manage_link?: PaystackNodeClient["subscription_manageLink"];
161
- subscription_update?: (params: {
162
- params: {
163
- path: {
164
- code: string;
165
- };
166
- };
167
- body: {
168
- plan?: string;
169
- authorization?: string;
170
- amount?: number;
171
- };
172
- }) => Promise<unknown>;
173
- customer?: {
174
- create?: (params: PaystackCustomerCreateInput) => Promise<unknown>;
175
- update?: (code: string, params: PaystackCustomerUpdateInput) => Promise<unknown>;
176
- };
177
- transaction?: {
178
- initialize?: (params: PaystackTransactionInitializeInput) => Promise<unknown>;
179
- verify?: (reference: string) => Promise<unknown>;
180
- chargeAuthorization?: (params: PaystackTransactionChargeAuthorizationInput) => Promise<unknown>;
181
- };
182
- subscription?: {
183
- fetch?: (idOrCode: string) => Promise<unknown>;
184
- create?: (params: PaystackSubscriptionCreateInput) => Promise<unknown>;
185
- disable?: (params: PaystackSubscriptionToggleInput) => Promise<unknown>;
186
- enable?: (params: PaystackSubscriptionToggleInput) => Promise<unknown>;
187
- manage?: {
188
- link?: (code: string) => Promise<unknown>;
189
- email?: (code: string, email: string) => Promise<unknown>;
190
- };
191
- };
192
- plan?: {
193
- list?: (init?: any) => Promise<unknown>;
194
- fetch?: (idOrCode: string) => Promise<unknown>;
195
- create?: (params: Record<string, unknown>) => Promise<unknown>;
196
- update?: (idOrCode: string, params: Record<string, unknown>) => Promise<unknown>;
197
- };
198
- product?: {
199
- list?: () => Promise<unknown>;
200
- fetch?: (idOrCode: string) => Promise<unknown>;
201
- create?: (params: Record<string, unknown>) => Promise<unknown>;
202
- update?: (idOrCode: string, params: Record<string, unknown>) => Promise<unknown>;
203
- delete?: (idOrCode: string) => Promise<unknown>;
204
- };
205
- product_list?: (init?: any) => Promise<unknown>;
206
- product_fetch?: (init: any) => Promise<unknown>;
207
- product_create?: (init: any) => Promise<unknown>;
208
- product_update?: (init: any) => Promise<unknown>;
209
- product_delete?: (init: any) => Promise<unknown>;
210
- plan_list?: (init?: any) => Promise<unknown>;
211
- plan_fetch?: (init: any) => Promise<unknown>;
212
- plan_create?: (init: any) => Promise<unknown>;
213
- plan_update?: (init: any) => Promise<unknown>;
214
- };
215
- interface PaystackMetadata {
216
- userId?: string;
217
- organizationId?: string;
218
- [key: string]: unknown;
219
- }
220
- type NoInfer<T> = [T][T extends unknown ? 0 : never];
221
- interface PaystackPlan<TLimits = Record<string, unknown>> {
222
- /** Human name stored in DB (lowercased). */
223
- name: string;
224
- /** Paystack plan code (if you use Paystack plans). */
225
- planCode?: string | undefined;
226
- /** Amount in the smallest currency unit (e.g. kobo). */
227
- amount?: number | undefined;
228
- /** Currency ISO code (e.g. NGN). */
229
- currency?: PaystackCurrency | (string & {}) | undefined;
230
- /** Paystack interval keyword (when using Paystack plans). */
231
- interval?: "daily" | "weekly" | "monthly" | "quarterly" | "biannually" | "annually" | undefined;
232
- /** Optional description of the plan. */
233
- description?: string | undefined;
234
- /** Optional list of features for the plan. */
235
- features?: string[] | undefined;
236
- /** Optional invoice limit; Paystack uses `invoice_limit` during init. */
237
- invoiceLimit?: number | undefined;
238
- /** Arbitrary limits (stored/consumed by your app). */
239
- limits?: TLimits | undefined;
240
- /** Amount per seat (optional). */
241
- seatAmount?: number | undefined;
242
- /** Paystack plan code for seat (optional). */
243
- seatPlanCode?: string | undefined;
244
- /** Optional free trial config, if your app supports it. */
245
- freeTrial?: {
246
- days: number;
247
- onTrialStart?: (subscription: Subscription) => Promise<void>;
248
- onTrialEnd?: (data: {
249
- subscription: Subscription;
250
- }, ctx: GenericEndpointContext$1) => Promise<void>;
251
- onTrialExpired?: (subscription: Subscription, ctx: GenericEndpointContext$1) => Promise<void>;
252
- } | undefined;
253
- }
254
- interface PaystackProduct {
255
- id: string;
256
- /** Human-readable name of the product. */
257
- name: string;
258
- /** Price in the smallest currency unit (e.g., kobo). */
259
- price: number;
260
- /** Currency ISO code (e.g., NGN). */
261
- currency: PaystackCurrency | (string & {});
262
- /** Optional metadata to include with the product. */
263
- metadata?: string | undefined;
264
- /** Optional description of the product. */
265
- description?: string | undefined;
266
- /** Optional list of features for the product. */
267
- features?: string[] | undefined;
268
- /** Optional stock quantity for the product. */
269
- quantity?: number | undefined;
270
- /** Whether the product has unlimited stock. */
271
- unlimited?: boolean | undefined;
272
- /** The internal Paystack ID for the product. */
273
- paystackId?: string | undefined;
274
- /** Unique slug for the product. */
275
- slug: string;
276
- createdAt: Date;
277
- updatedAt: Date;
278
- }
279
- interface InputPaystackProduct extends Omit<PaystackProduct, "id" | "createdAt" | "updatedAt" | "slug"> {
280
- slug?: string;
281
- createdAt?: Date;
282
- updatedAt?: Date;
283
- }
284
- interface PaystackTransaction {
285
- id: string;
286
- reference: string;
287
- paystackId?: string | undefined;
288
- referenceId: string;
289
- userId: string;
290
- amount: number;
291
- currency: PaystackCurrency | (string & {});
292
- status: string;
293
- plan?: string | undefined;
294
- product?: string | undefined;
295
- metadata?: string | undefined;
296
- createdAt: Date;
297
- updatedAt: Date;
298
- }
299
- interface Subscription {
300
- id: string;
301
- plan: string;
302
- referenceId: string;
303
- paystackCustomerCode?: string | undefined;
304
- paystackSubscriptionCode?: string | undefined;
305
- paystackTransactionReference?: string | undefined;
306
- paystackAuthorizationCode?: string | undefined;
307
- paystackEmailToken?: string | undefined;
308
- status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "paused" | "trialing" | "unpaid";
309
- periodStart?: Date | undefined;
310
- periodEnd?: Date | undefined;
311
- trialStart?: Date | undefined;
312
- trialEnd?: Date | undefined;
313
- cancelAtPeriodEnd?: boolean | undefined;
314
- groupId?: string | undefined;
315
- seats?: number | undefined;
316
- /** The plan that will be applied at the next billing cycle. */
317
- pendingPlan?: string | undefined;
318
- }
319
- interface SubscriptionOptions<TMetadata = Record<string, unknown>, TLimits = Record<string, unknown>> {
320
- plans: PaystackPlan<TLimits>[] | (() => PaystackPlan<TLimits>[] | Promise<PaystackPlan<TLimits>[]>);
321
- requireEmailVerification?: boolean | undefined;
322
- authorizeReference?: ((data: {
323
- user: User;
324
- session: Session;
325
- referenceId: string;
326
- action: "initialize-transaction" | "verify-transaction" | "list-subscriptions" | "list-transactions" | "disable-subscription" | "enable-subscription" | "get-subscription-manage-link";
327
- }, ctx: GenericEndpointContext$1) => Promise<boolean>) | undefined;
328
- onSubscriptionComplete?: ((data: {
329
- event: PaystackWebhookPayload<Record<string, unknown>, TMetadata>;
330
- subscription: Subscription;
331
- plan: PaystackPlan<TLimits>;
332
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
333
- onSubscriptionUpdate?: ((data: {
334
- event: PaystackWebhookPayload<Record<string, unknown>, TMetadata>;
335
- subscription: Subscription;
336
- plan?: PaystackPlan<TLimits>;
337
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
338
- onSubscriptionCreated?: ((data: {
339
- event: PaystackWebhookPayload<Record<string, unknown>, TMetadata>;
340
- subscription: Subscription;
341
- plan: PaystackPlan<TLimits>;
342
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
343
- onSubscriptionCancel?: ((data: {
344
- event: PaystackWebhookPayload<Record<string, unknown>, TMetadata>;
345
- subscription: Subscription;
346
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
347
- onSubscriptionDelete?: ((data: {
348
- event: PaystackWebhookPayload<Record<string, unknown>, TMetadata>;
349
- subscription: Subscription;
350
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
351
- }
352
- interface ProductOptions {
353
- products: InputPaystackProduct[] | (() => InputPaystackProduct[] | Promise<InputPaystackProduct[]>);
354
- }
355
- interface OrganizationOptions<TMetadata = Record<string, unknown>> {
356
- enabled: boolean;
357
- createCustomerOnOrganizationCreate?: boolean | undefined;
358
- onCustomerCreate?: ((data: {
359
- paystackCustomer: PaystackCustomerResponse;
360
- organization: Record<string, unknown> & {
361
- paystackCustomerCode: string;
362
- };
363
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
364
- getCustomerCreateParams?: ((organization: unknown, ctx: GenericEndpointContext$1) => Promise<Record<string, unknown> & {
365
- metadata?: TMetadata;
366
- }>) | undefined;
367
- }
368
- interface PaystackOptions<TPaystackClient extends PaystackClientLike = PaystackNodeClient, TMetadata extends Record<string, unknown> = Record<string, unknown>, TLimits extends Record<string, unknown> = Record<string, unknown>> {
369
- /** Paystack SDK instance (recommended: `@alexasomba/paystack-node` via `createPaystack({ secretKey })`). */
370
- paystackClient: NoInfer<TPaystackClient>;
371
- /** Paystack webhook secret used to verify `x-paystack-signature`. */
372
- paystackWebhookSecret: string;
373
- /** Enable customer creation on Better Auth sign up. */
374
- createCustomerOnSignUp?: boolean | undefined;
375
- onCustomerCreate?: ((data: {
376
- paystackCustomer: PaystackCustomerResponse;
377
- user: User & {
378
- paystackCustomerCode: string;
379
- };
380
- }, ctx: GenericEndpointContext$1) => Promise<void>) | undefined;
381
- getCustomerCreateParams?: ((user: User, ctx: GenericEndpointContext$1) => Promise<Record<string, unknown> & {
382
- metadata?: TMetadata;
383
- }>) | undefined;
384
- subscription?: ({
385
- enabled: false;
386
- } | ({
387
- enabled: true;
388
- } & SubscriptionOptions<TMetadata, TLimits>)) | undefined;
389
- products?: ProductOptions | undefined;
390
- organization?: OrganizationOptions<TMetadata> | undefined;
391
- onEvent?: ((event: PaystackWebhookPayload<Record<string, unknown>, TMetadata>) => Promise<void>) | undefined;
392
- schema?: InferOptionSchema<typeof subscriptions & typeof user & typeof organization> | undefined;
393
- }
394
- //#endregion
395
- //#region src/index.d.ts
396
- declare const paystack: <TPaystackClient extends PaystackClientLike = PaystackNodeClient, TMetadata extends Record<string, unknown> = Record<string, unknown>, TLimits extends Record<string, unknown> = Record<string, unknown>, O extends PaystackOptions<TPaystackClient, TMetadata, TLimits> = PaystackOptions<TPaystackClient, TMetadata, TLimits>>(options: O) => {
397
- id: string;
398
- endpoints: {
399
- initializeTransaction: StrictEndpoint<Path, Options, R>;
400
- verifyTransaction: StrictEndpoint<Path, Options, R>;
401
- listSubscriptions: StrictEndpoint<Path, Options, R>;
402
- paystackWebhook: StrictEndpoint<Path, Options, R>;
403
- listTransactions: StrictEndpoint<Path, Options, R>;
404
- getConfig: StrictEndpoint<Path, Options, R>;
405
- disableSubscription: StrictEndpoint<Path, Options, R>;
406
- enableSubscription: StrictEndpoint<Path, Options, R>;
407
- getSubscriptionManageLink: StrictEndpoint<Path, Options, R>;
408
- subscriptionManageLink: StrictEndpoint<Path, Options, R>;
409
- createSubscription: StrictEndpoint<Path, Options, R>;
410
- upgradeSubscription: StrictEndpoint<Path, Options, R>;
411
- cancelSubscription: StrictEndpoint<Path, Options, R>;
412
- restoreSubscription: StrictEndpoint<Path, Options, R>;
413
- chargeRecurringSubscription: StrictEndpoint<Path, Options, R>;
414
- syncProducts: StrictEndpoint<Path, Options, R>;
415
- listProducts: StrictEndpoint<Path, Options, R>;
416
- syncPlans: StrictEndpoint<Path, Options, R>;
417
- listPlans: StrictEndpoint<Path, Options, R>;
418
- };
419
- schema: _better_auth_core_db0.BetterAuthPluginDBSchema;
420
- init: (ctx: AuthContext) => {
421
- options: {
422
- databaseHooks: {
423
- user: {
424
- create: {
425
- after(user: {
426
- id: string;
427
- email?: string | null;
428
- name?: string | null;
429
- }, hookCtx?: GenericEndpointContext | null): Promise<void>;
430
- };
431
- };
432
- organization: {
433
- create: {
434
- after(org: {
435
- id: string;
436
- name: string;
437
- email?: string | null;
438
- }, hookCtx: GenericEndpointContext | null): Promise<void>;
439
- };
440
- } | undefined;
441
- };
442
- member: {
443
- create: {
444
- before: (member: {
445
- organizationId: string;
446
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
447
- after: (member: {
448
- organizationId: string | undefined;
449
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
450
- };
451
- delete: {
452
- after: (member: {
453
- organizationId: string | undefined;
454
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
455
- };
456
- };
457
- invitation: {
458
- create: {
459
- before: (invitation: {
460
- organizationId: string;
461
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
462
- after: (invitation: {
463
- organizationId: string | undefined;
464
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
465
- };
466
- delete: {
467
- after: (invitation: {
468
- organizationId: string | undefined;
469
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
470
- };
471
- };
472
- team: {
473
- create: {
474
- before: (team: {
475
- organizationId: string;
476
- }, ctx: GenericEndpointContext | null | undefined) => Promise<void>;
477
- };
478
- };
479
- };
480
- };
481
- $ERROR_CODES: {
482
- [x: string]: _better_auth_core_utils_error_codes0.RawError<string>;
483
- };
484
- };
485
- type PaystackPlugin<TPaystackClient extends PaystackClientLike = PaystackNodeClient, TMetadata extends Record<string, unknown> = Record<string, unknown>, TLimits extends Record<string, unknown> = Record<string, unknown>, O extends PaystackOptions<TPaystackClient, TMetadata, TLimits> = PaystackOptions<TPaystackClient, TMetadata, TLimits>> = ReturnType<typeof paystack<TPaystackClient, TMetadata, TLimits, O>>;
486
- //#endregion
487
- export { PaystackProduct as a, SubscriptionOptions as c, PaystackPlan as i, paystack as n, PaystackTransaction as o, PaystackOptions as r, Subscription as s, PaystackPlugin as t };
488
- //# sourceMappingURL=index-DoMJ9OLF.d.mts.map