@alexasomba/better-auth-paystack 1.0.0-rc.3 → 1.0.4

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 CHANGED
@@ -167,6 +167,21 @@ The plugin natively checks the `teams` limit if using the Better Auth Organizati
167
167
 
168
168
  ---
169
169
 
170
+ ## Currency Support
171
+
172
+ The plugin supports the following currencies with automatic minimum transaction amount validation:
173
+
174
+ | Currency | Name | Minimum Amount |
175
+ | -------- | ---------------------- | -------------- |
176
+ | **NGN** | Nigerian Naira | ₦50.00 |
177
+ | **GHS** | Ghanaian Cedi | ₵0.10 |
178
+ | **ZAR** | South African Rand | R1.00 |
179
+ | **KES** | Kenyan Shilling | KSh 3.00 |
180
+ | **USD** | United States Dollar | $2.00 |
181
+ | **XOF** | West African CFA Franc | CFA 100 |
182
+
183
+ Transactions below these thresholds will be rejected with a `BAD_REQUEST` error.
184
+
170
185
  ## Advanced Usage
171
186
 
172
187
  ### Organization Billing
@@ -338,6 +353,9 @@ type listSubscriptions = {
338
353
 
339
354
  Cancel or restore a subscription.
340
355
 
356
+ - **Cancel**: Sets `cancelAtPeriodEnd: true`. The subscription remains `active` until the end of the current billing period, after which it moves to `canceled`.
357
+ - **Restore**: Reactivates a subscription that is scheduled to cancel.
358
+
341
359
  ```ts
342
360
  type cancelSubscription = {
343
361
  /**
@@ -358,47 +376,48 @@ The plugin extends your database with the following fields and tables.
358
376
 
359
377
  ### `user`
360
378
 
361
- | Field | Type | Description |
362
- | :--------------------- | :------- | :-------------------------------------------- |
363
- | `paystackCustomerCode` | `string` | The unique customer identifier from Paystack. |
379
+ | Field | Type | Required | Description |
380
+ | :--------------------- | :------- | :------- | :-------------------------------------------- |
381
+ | `paystackCustomerCode` | `string` | No | The unique customer identifier from Paystack. |
364
382
 
365
383
  ### `organization`
366
384
 
367
- | Field | Type | Description |
368
- | :--------------------- | :------- | :----------------------------------------------------------------------------------------- |
369
- | `paystackCustomerCode` | `string` | The unique customer identifier for the organization. |
370
- | `email` | `string` | The billing email for the organization. fallsback to organization owner's email if absent. |
385
+ | Field | Type | Required | Description |
386
+ | :--------------------- | :------- | :------- | :----------------------------------------------------------------------------------------- |
387
+ | `paystackCustomerCode` | `string` | No | The unique customer identifier for the organization. |
388
+ | `email` | `string` | No | The billing email for the organization. fallsback to organization owner's email if absent. |
371
389
 
372
390
  ### `subscription`
373
391
 
374
- | Field | Type | Description |
375
- | :----------------------------- | :-------- | :-------------------------------------------------------------- |
376
- | `plan` | `string` | Lowercased name of the active plan. |
377
- | `referenceId` | `string` | Associated User ID or Organization ID. |
378
- | `paystackCustomerCode` | `string` | The Paystack customer code for this subscription. |
379
- | `paystackSubscriptionCode` | `string` | The unique code for the subscription (e.g., `SUB_...`). |
380
- | `paystackTransactionReference` | `string` | The reference of the transaction that started the subscription. |
381
- | `status` | `string` | `active`, `trialing`, `canceled`, `incomplete`. |
382
- | `periodStart` | `Date` | Start date of the current billing period. |
383
- | `periodEnd` | `Date` | End date of the current billing period. |
384
- | `trialStart` | `Date` | Start date of the trial period. |
385
- | `trialEnd` | `Date` | End date of the trial period. |
386
- | `cancelAtPeriodEnd` | `boolean` | Whether to cancel at the end of the current period. |
387
- | `seats` | `number` | Purchased seat count for team billing. |
392
+ | Field | Type | Required | Description |
393
+ | :----------------------------- | :-------- | :------- | :------------------------------------------------------------------- |
394
+ | `plan` | `string` | Yes | Lowercased name of the active plan. |
395
+ | `referenceId` | `string` | Yes | Associated User ID or Organization ID. |
396
+ | `paystackCustomerCode` | `string` | No | The Paystack customer code for this subscription. |
397
+ | `paystackSubscriptionCode` | `string` | No | The unique code for the subscription (e.g., `SUB_...` or `LOC_...`). |
398
+ | `paystackTransactionReference` | `string` | No | The reference of the transaction that started the subscription. |
399
+ | `paystackAuthorizationCode` | `string` | No | Stored card authorization code for recurring charges (local plans). |
400
+ | `status` | `string` | Yes | `active`, `trialing`, `canceled`, `incomplete`. |
401
+ | `periodStart` | `Date` | No | Start date of the current billing period. |
402
+ | `periodEnd` | `Date` | No | End date of the current billing period. |
403
+ | `trialStart` | `Date` | No | Start date of the trial period. |
404
+ | `trialEnd` | `Date` | No | End date of the trial period. |
405
+ | `cancelAtPeriodEnd` | `boolean` | No | Whether to cancel at the end of the current period. |
406
+ | `seats` | `number` | No | Purchased seat count for team billing. |
388
407
 
389
408
  ### `paystackTransaction`
390
409
 
391
- | Field | Type | Description |
392
- | :------------ | :------- | :------------------------------------------------ |
393
- | `reference` | `string` | Unique transaction reference. |
394
- | `referenceId` | `string` | Associated User ID or Organization ID. |
395
- | `userId` | `string` | The ID of the user who initiated the transaction. |
396
- | `amount` | `number` | Transaction amount in smallest currency unit. |
397
- | `currency` | `string` | Currency code (e.g., "NGN"). |
398
- | `status` | `string` | `success`, `pending`, `failed`, `abandoned`. |
399
- | `plan` | `string` | Name of the plan associated with the transaction. |
400
- | `metadata` | `string` | JSON string of extra transaction metadata. |
401
- | `paystackId` | `string` | The internal Paystack ID for the transaction. |
410
+ | Field | Type | Required | Description |
411
+ | :------------ | :------- | :------- | :------------------------------------------------ |
412
+ | `reference` | `string` | Yes | Unique transaction reference. |
413
+ | `referenceId` | `string` | Yes | Associated User ID or Organization ID. |
414
+ | `userId` | `string` | Yes | The ID of the user who initiated the transaction. |
415
+ | `amount` | `number` | Yes | Transaction amount in smallest currency unit. |
416
+ | `currency` | `string` | Yes | Currency code (e.g., "NGN"). |
417
+ | `status` | `string` | Yes | `success`, `pending`, `failed`, `abandoned`. |
418
+ | `plan` | `string` | No | Name of the plan associated with the transaction. |
419
+ | `metadata` | `string` | No | JSON string of extra transaction metadata. |
420
+ | `paystackId` | `string` | No | The internal Paystack ID for the transaction. |
402
421
 
403
422
  ---
404
423
 
@@ -440,14 +459,14 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
440
459
 
441
460
  Future features planned for upcoming versions:
442
461
 
443
- ### v1.1.0 - Manual Recurring Subscriptions
462
+ ### v1.1.0 - Manual Recurring Subscriptions (Available Now)
444
463
 
445
- - [ ] **Stored Authorization Codes**: Securely store Paystack authorization codes from verified transactions
446
- - [ ] **Card Management UI**: Let users view/delete saved payment methods (masked card data only)
447
- - [ ] **Charge Authorization Endpoint**: Server-side endpoint to charge stored cards for renewals
448
- - [ ] **Renewal Scheduler Integration**: Documentation for integrating with Cloudflare Workers Cron, Vercel Cron, etc.
464
+ - [x] **Stored Authorization Codes**: Securely store Paystack authorization codes from verified transactions.
465
+ - [x] **Charge Authorization Endpoint**: Server-side endpoint (`/charge-recurring`) to charge stored cards for renewals.
466
+ - [ ] **Card Management UI**: Let users view/delete saved payment methods (masked card data only) - _Upcoming_
467
+ - [ ] **Renewal Scheduler Integration**: Documentation for integrating with Cloudflare Workers Cron, Vercel Cron, etc. - _Upcoming_
449
468
 
450
- > **Note**: For automatic recurring subscriptions today, use Paystack-managed plans via `planCode`. Manual recurring (storing authorization codes) is planned for a future release.
469
+ > **Note**: For local-managed subscriptions (no `planCode`), the plugin now automatically captures and stores the `authorization_code`. You can trigger renewals using `authClient.paystack.chargeRecurringSubscription({ subscriptionId })`.
451
470
 
452
471
  ### Future Considerations
453
472
 
package/dist/client.d.mts CHANGED
@@ -1,15 +1,14 @@
1
- import { o as PaystackTransaction, s as Subscription } from "./types--kIktPs7.mjs";
1
+ import { o as PaystackTransaction, s as Subscription } from "./types-Dlv_nSLg.mjs";
2
2
  import { paystack } from "./index.mjs";
3
- import * as _better_fetch_fetch0 from "@better-fetch/fetch";
4
- import { BetterFetchResponse } from "@better-fetch/fetch";
3
+ import { BetterFetch, BetterFetchOption, BetterFetchResponse } from "@better-fetch/fetch";
5
4
 
6
5
  //#region src/client.d.ts
7
6
  declare const paystackClient: <O extends {
8
7
  subscription: boolean;
9
- }>(_options?: O | undefined) => {
8
+ }>(_options?: O) => {
10
9
  id: "paystack";
11
- $InferServerPlugin: ReturnType<typeof paystack<any, any>>;
12
- getActions: ($fetch: _better_fetch_fetch0.BetterFetch) => {
10
+ $InferServerPlugin: ReturnType<typeof paystack>;
11
+ getActions: ($fetch: BetterFetch) => {
13
12
  subscription: {
14
13
  /**
15
14
  * Initialize a transaction to upgrade or creating a subscription.
@@ -19,14 +18,14 @@ declare const paystackClient: <O extends {
19
18
  email?: string;
20
19
  amount?: number;
21
20
  reference?: string;
22
- metadata?: Record<string, any>;
21
+ metadata?: Record<string, unknown>;
23
22
  callbackUrl?: string;
24
23
  callbackURL?: string;
25
24
  currency?: string;
26
25
  quantity?: number;
27
26
  referenceId?: string;
28
27
  product?: string;
29
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
28
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
30
29
  url: string;
31
30
  reference: string;
32
31
  accessCode: string;
@@ -40,14 +39,14 @@ declare const paystackClient: <O extends {
40
39
  email?: string;
41
40
  amount?: number;
42
41
  reference?: string;
43
- metadata?: Record<string, any>;
42
+ metadata?: Record<string, unknown>;
44
43
  callbackUrl?: string;
45
44
  callbackURL?: string;
46
45
  currency?: string;
47
46
  quantity?: number;
48
47
  referenceId?: string;
49
48
  product?: string;
50
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
49
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
51
50
  url: string;
52
51
  reference: string;
53
52
  accessCode: string;
@@ -59,7 +58,7 @@ declare const paystackClient: <O extends {
59
58
  cancel: (data: {
60
59
  subscriptionCode: string;
61
60
  emailToken?: string;
62
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
61
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
63
62
  status: string;
64
63
  }>>;
65
64
  /**
@@ -68,13 +67,15 @@ declare const paystackClient: <O extends {
68
67
  restore: (data: {
69
68
  subscriptionCode: string;
70
69
  emailToken?: string;
71
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
70
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
72
71
  status: string;
73
72
  }>>;
74
73
  /**
75
74
  * List subscriptions for the user.
76
75
  */
77
- list: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
76
+ list: (data?: {
77
+ query?: Record<string, unknown>;
78
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
78
79
  subscriptions: Subscription[];
79
80
  }>>;
80
81
  /**
@@ -82,30 +83,32 @@ declare const paystackClient: <O extends {
82
83
  */
83
84
  billingPortal: (data: {
84
85
  subscriptionCode: string;
85
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
86
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
86
87
  link: string;
87
88
  }>>;
88
89
  /**
89
90
  * Aliases for legacy/demo usage.
90
91
  */
91
- listLocal: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
92
+ listLocal: (data?: {
93
+ query?: Record<string, unknown>;
94
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
92
95
  subscriptions: Subscription[];
93
96
  }>>;
94
97
  manageLink: (data: {
95
98
  subscriptionCode: string;
96
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
99
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
97
100
  link: string;
98
101
  }>>;
99
102
  disable: (data: {
100
103
  subscriptionCode: string;
101
104
  emailToken?: string;
102
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
105
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
103
106
  status: string;
104
107
  }>>;
105
108
  enable: (data: {
106
109
  subscriptionCode: string;
107
110
  emailToken?: string;
108
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
111
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
109
112
  status: string;
110
113
  }>>;
111
114
  };
@@ -116,14 +119,14 @@ declare const paystackClient: <O extends {
116
119
  email?: string;
117
120
  amount?: number;
118
121
  reference?: string;
119
- metadata?: Record<string, any>;
122
+ metadata?: Record<string, unknown>;
120
123
  callbackUrl?: string;
121
124
  callbackURL?: string;
122
125
  currency?: string;
123
126
  quantity?: number;
124
127
  referenceId?: string;
125
128
  product?: string;
126
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
129
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
127
130
  url: string;
128
131
  reference: string;
129
132
  accessCode: string;
@@ -131,12 +134,14 @@ declare const paystackClient: <O extends {
131
134
  }>>;
132
135
  verify: (data: {
133
136
  reference: string;
134
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
137
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
135
138
  status: string;
136
139
  reference: string;
137
- data: any;
140
+ data: unknown;
138
141
  }>>;
139
- list: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
142
+ list: (data?: {
143
+ query?: Record<string, unknown>;
144
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
140
145
  transactions: PaystackTransaction[];
141
146
  }>>;
142
147
  };
@@ -146,14 +151,14 @@ declare const paystackClient: <O extends {
146
151
  email?: string;
147
152
  amount?: number;
148
153
  reference?: string;
149
- metadata?: Record<string, any>;
154
+ metadata?: Record<string, unknown>;
150
155
  callbackUrl?: string;
151
156
  callbackURL?: string;
152
157
  currency?: string;
153
158
  quantity?: number;
154
159
  referenceId?: string;
155
160
  product?: string;
156
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
161
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
157
162
  url: string;
158
163
  reference: string;
159
164
  accessCode: string;
@@ -164,14 +169,14 @@ declare const paystackClient: <O extends {
164
169
  email?: string;
165
170
  amount?: number;
166
171
  reference?: string;
167
- metadata?: Record<string, any>;
172
+ metadata?: Record<string, unknown>;
168
173
  callbackUrl?: string;
169
174
  callbackURL?: string;
170
175
  currency?: string;
171
176
  quantity?: number;
172
177
  referenceId?: string;
173
178
  product?: string;
174
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
179
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
175
180
  url: string;
176
181
  reference: string;
177
182
  accessCode: string;
@@ -180,41 +185,45 @@ declare const paystackClient: <O extends {
180
185
  cancel: (data: {
181
186
  subscriptionCode: string;
182
187
  emailToken?: string;
183
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
188
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
184
189
  status: string;
185
190
  }>>;
186
191
  restore: (data: {
187
192
  subscriptionCode: string;
188
193
  emailToken?: string;
189
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
194
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
190
195
  status: string;
191
196
  }>>;
192
- list: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
197
+ list: (data?: {
198
+ query?: Record<string, unknown>;
199
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
193
200
  subscriptions: Subscription[];
194
201
  }>>;
195
202
  billingPortal: (data: {
196
203
  subscriptionCode: string;
197
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
204
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
198
205
  link: string;
199
206
  }>>;
200
- listLocal: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
207
+ listLocal: (data?: {
208
+ query?: Record<string, unknown>;
209
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
201
210
  subscriptions: Subscription[];
202
211
  }>>;
203
212
  manageLink: (data: {
204
213
  subscriptionCode: string;
205
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
214
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
206
215
  link: string;
207
216
  }>>;
208
217
  disable: (data: {
209
218
  subscriptionCode: string;
210
219
  emailToken?: string;
211
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
220
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
212
221
  status: string;
213
222
  }>>;
214
223
  enable: (data: {
215
224
  subscriptionCode: string;
216
225
  emailToken?: string;
217
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
226
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
218
227
  status: string;
219
228
  }>>;
220
229
  };
@@ -223,14 +232,14 @@ declare const paystackClient: <O extends {
223
232
  email?: string;
224
233
  amount?: number;
225
234
  reference?: string;
226
- metadata?: Record<string, any>;
235
+ metadata?: Record<string, unknown>;
227
236
  callbackUrl?: string;
228
237
  callbackURL?: string;
229
238
  currency?: string;
230
239
  quantity?: number;
231
240
  referenceId?: string;
232
241
  product?: string;
233
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
242
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
234
243
  url: string;
235
244
  reference: string;
236
245
  accessCode: string;
@@ -238,23 +247,27 @@ declare const paystackClient: <O extends {
238
247
  }>>;
239
248
  verifyTransaction: (data: {
240
249
  reference: string;
241
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
250
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
242
251
  status: string;
243
252
  reference: string;
244
- data: any;
253
+ data: unknown;
245
254
  }>>;
246
- listTransactions: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
255
+ listTransactions: (data?: {
256
+ query?: Record<string, unknown>;
257
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
247
258
  transactions: PaystackTransaction[];
248
259
  }>>;
249
- listSubscriptions: (data?: any, options?: RequestInit) => Promise<BetterFetchResponse<{
260
+ listSubscriptions: (data?: {
261
+ query?: Record<string, unknown>;
262
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
250
263
  subscriptions: Subscription[];
251
264
  }>>;
252
265
  getSubscriptionManageLink: (data: {
253
266
  subscriptionCode: string;
254
- }, options?: RequestInit) => Promise<BetterFetchResponse<{
267
+ }, options?: BetterFetchOption) => Promise<BetterFetchResponse<{
255
268
  link: string;
256
269
  }>>;
257
- getConfig: () => Promise<BetterFetchResponse<any>>;
270
+ getConfig: () => Promise<BetterFetchResponse<Record<string, unknown>>>;
258
271
  };
259
272
  };
260
273
  };
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;cAOa,cAAA;EAEL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AA,GAAmB,OAAA,GAAY,iBAAA,KAAoB,OAAA,CAAQ,mBAAA;QACnG,MAAA;QACA,SAAA;QACA,IAAA;MAAA;;QAauC,KAAA,GAAQ,MAAA;MAAA,GAAyB,OAAA,GAAiB,iBAAA,KAAoB,OAAA,CAAQ,mBAAA;QACrH,YAAA,EAAc,mBAAA;MAAA;;QAW0B,KAAA,GAAQ,MAAA;MAAA,GAAyB,OAAA,GAAiB,iBAAA,KAAoB,OAAA,CAAQ,mBAAA;QACtH,aAAA,EAAe,YAAA;MAAA;;QAWiC,gBAAA;MAAA,GAA0B,OAAA,GAAY,iBAAA,KAAoB,OAAA,CAAQ,mBAAA;QAClH,IAAA;MAAA;uBAkGsB,OAAA,CAAQ,mBAAA,CAAoB,MAAA;IAAA;EAAA;AAAA"}
package/dist/client.mjs CHANGED
@@ -21,14 +21,14 @@ const paystackClient = (_options) => {
21
21
  const listTransactions = async (data = {}, options) => {
22
22
  return $fetch("paystack/list-transactions", {
23
23
  method: "GET",
24
- query: data?.query,
24
+ query: data.query,
25
25
  ...options
26
26
  });
27
27
  };
28
28
  const listSubscriptions = async (data = {}, options) => {
29
29
  return $fetch("paystack/list-subscriptions", {
30
30
  method: "GET",
31
- query: data?.query,
31
+ query: data.query,
32
32
  ...options
33
33
  });
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"better-auth\";\nimport type { BetterFetchResponse } from \"@better-fetch/fetch\";\n\nimport type { PaystackTransaction, Subscription } from \"./types\";\n\nimport type { paystack } from \"./index\";\n\nexport const paystackClient = <\n O extends {\n subscription: boolean;\n },\n>(\n _options?: O | undefined,\n) => {\n return {\n id: \"paystack\",\n $InferServerPlugin: {} as ReturnType<typeof paystack<any, any>>,\n getActions: ($fetch) => {\n const initializeTransaction = async (data: {\n plan?: string;\n email?: string;\n amount?: number;\n reference?: string;\n metadata?: Record<string, any>;\n callbackUrl?: string;\n callbackURL?: string;\n currency?: string;\n quantity?: number;\n referenceId?: string;\n product?: string;\n }, options?: RequestInit): Promise<BetterFetchResponse<{\n url: string;\n reference: string;\n accessCode: string;\n redirect: boolean;\n }>> => {\n return $fetch<{\n url: string;\n reference: string;\n accessCode: string;\n redirect: boolean;\n }>(\"paystack/initialize-transaction\", {\n method: \"POST\",\n body: data,\n ...options,\n });\n };\n\n const verifyTransaction = async (data: { reference: string }, options?: RequestInit): Promise<BetterFetchResponse<{\n status: string;\n reference: string;\n data: any;\n }>> => {\n return $fetch<{\n status: string;\n reference: string;\n data: any;\n }>(\"paystack/verify-transaction\", {\n method: \"POST\",\n body: data,\n ...options,\n });\n };\n\n const listTransactions = async (data: any = {}, options?: RequestInit): Promise<BetterFetchResponse<{\n transactions: PaystackTransaction[];\n }>> => {\n return $fetch<{\n transactions: PaystackTransaction[];\n }>(\"paystack/list-transactions\", {\n method: \"GET\",\n query: data?.query,\n ...options,\n });\n };\n\n const listSubscriptions = async (data: any = {}, options?: RequestInit): Promise<BetterFetchResponse<{\n subscriptions: Subscription[];\n }>> => {\n return $fetch<{\n subscriptions: Subscription[];\n }>(\"paystack/list-subscriptions\", {\n method: \"GET\",\n query: data?.query,\n ...options,\n });\n };\n\n const getSubscriptionManageLink = async (data: { subscriptionCode: string }, options?: RequestInit): Promise<BetterFetchResponse<{\n link: string;\n }>> => {\n return $fetch<{\n link: string;\n }>(\"paystack/get-subscription-manage-link\", {\n method: \"GET\",\n query: data,\n ...options,\n });\n };\n\n const cancelSubscription = async (data: {\n subscriptionCode: string;\n emailToken?: string;\n }, options?: RequestInit): Promise<BetterFetchResponse<{\n status: string;\n }>> => {\n return $fetch<{\n status: string;\n }>(\"paystack/disable-subscription\", {\n method: \"POST\",\n body: data,\n ...options,\n });\n };\n\n const restoreSubscription = async (data: {\n subscriptionCode: string;\n emailToken?: string;\n }, options?: RequestInit): Promise<BetterFetchResponse<{\n status: string;\n }>> => {\n return $fetch<{\n status: string;\n }>(\"paystack/enable-subscription\", {\n method: \"POST\",\n body: data,\n ...options,\n });\n };\n\n return {\n subscription: {\n /**\n * Initialize a transaction to upgrade or creating a subscription.\n */\n upgrade: initializeTransaction,\n /**\n * Initialize a payment to create a subscription.\n */\n create: initializeTransaction,\n /**\n * Disable a subscription.\n */\n cancel: cancelSubscription,\n /**\n * Enable a subscription.\n */\n restore: restoreSubscription,\n /**\n * List subscriptions for the user.\n */\n list: listSubscriptions,\n /**\n * Get a link to manage the subscription on Paystack.\n */\n billingPortal: getSubscriptionManageLink,\n /**\n * Aliases for legacy/demo usage.\n */\n listLocal: listSubscriptions,\n manageLink: getSubscriptionManageLink,\n disable: cancelSubscription,\n enable: restoreSubscription,\n },\n paystack: {\n transaction: {\n initialize: initializeTransaction,\n verify: verifyTransaction,\n list: listTransactions,\n },\n subscription: {\n create: initializeTransaction,\n upgrade: initializeTransaction,\n cancel: cancelSubscription,\n restore: restoreSubscription,\n list: listSubscriptions,\n billingPortal: getSubscriptionManageLink,\n listLocal: listSubscriptions,\n manageLink: getSubscriptionManageLink,\n disable: cancelSubscription,\n enable: restoreSubscription,\n },\n initializeTransaction,\n verifyTransaction,\n listTransactions,\n listSubscriptions,\n getSubscriptionManageLink,\n getConfig: async (): Promise<BetterFetchResponse<any>> => {\n return $fetch(\"paystack/get-config\", {\n method: \"GET\",\n });\n },\n },\n };\n }\n } satisfies BetterAuthClientPlugin;\n};\n"],"mappings":";AAOA,MAAa,kBAKT,aACC;AACD,QAAO;EACH,IAAI;EACJ,oBAAoB,EAAE;EACtB,aAAa,WAAW;GACpB,MAAM,wBAAwB,OAAO,MAYlC,YAKI;AACH,WAAO,OAKJ,mCAAmC;KAClC,QAAQ;KACR,MAAM;KACN,GAAG;KACN,CAAC;;GAGN,MAAM,oBAAoB,OAAO,MAA6B,YAIvD;AACH,WAAO,OAIJ,+BAA+B;KAC9B,QAAQ;KACR,MAAM;KACN,GAAG;KACN,CAAC;;GAGN,MAAM,mBAAmB,OAAO,OAAY,EAAE,EAAE,YAEzC;AACH,WAAO,OAEJ,8BAA8B;KAC7B,QAAQ;KACR,OAAO,MAAM;KACb,GAAG;KACN,CAAC;;GAGN,MAAM,oBAAoB,OAAO,OAAY,EAAE,EAAE,YAE1C;AACH,WAAO,OAEJ,+BAA+B;KAC9B,QAAQ;KACR,OAAO,MAAM;KACb,GAAG;KACN,CAAC;;GAGN,MAAM,4BAA4B,OAAO,MAAoC,YAEtE;AACH,WAAO,OAEJ,yCAAyC;KACxC,QAAQ;KACR,OAAO;KACP,GAAG;KACN,CAAC;;GAGN,MAAM,qBAAqB,OAAO,MAG/B,YAEI;AACH,WAAO,OAEJ,iCAAiC;KAChC,QAAQ;KACR,MAAM;KACN,GAAG;KACN,CAAC;;GAGN,MAAM,sBAAsB,OAAO,MAGhC,YAEI;AACH,WAAO,OAEJ,gCAAgC;KAC/B,QAAQ;KACR,MAAM;KACN,GAAG;KACN,CAAC;;AAGN,UAAO;IACH,cAAc;KAIV,SAAS;KAIT,QAAQ;KAIR,QAAQ;KAIR,SAAS;KAIT,MAAM;KAIN,eAAe;KAIf,WAAW;KACX,YAAY;KACZ,SAAS;KACT,QAAQ;KACX;IACD,UAAU;KACN,aAAa;MACT,YAAY;MACZ,QAAQ;MACR,MAAM;MACT;KACD,cAAc;MACV,QAAQ;MACR,SAAS;MACT,QAAQ;MACR,SAAS;MACT,MAAM;MACN,eAAe;MACf,WAAW;MACX,YAAY;MACZ,SAAS;MACT,QAAQ;MACX;KACD;KACA;KACA;KACA;KACA;KACA,WAAW,YAA+C;AACtD,aAAO,OAAO,uBAAuB,EACjC,QAAQ,OACX,CAAC;;KAET;IACJ;;EAER"}
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"better-auth\";\nimport type { BetterFetchResponse, BetterFetchOption, BetterFetch } from \"@better-fetch/fetch\";\n\nimport type { PaystackTransaction, Subscription } from \"./types\";\n\nimport type { paystack } from \"./index\";\n\nexport const paystackClient = <\n\tO extends {\n\t\tsubscription: boolean;\n\t},\n>(\n\t\t_options?: O,\n\t) => {\n\treturn {\n\t\tid: \"paystack\",\n\t\t$InferServerPlugin: {} as ReturnType<typeof paystack>,\n\t\tgetActions: ($fetch: BetterFetch) => {\n\t\t\tconst initializeTransaction = async (data: {\n\t\t\t\tplan?: string;\n\t\t\t\temail?: string;\n\t\t\t\tamount?: number;\n\t\t\t\treference?: string;\n\t\t\t\tmetadata?: Record<string, unknown>;\n\t\t\t\tcallbackUrl?: string;\n\t\t\t\tcallbackURL?: string;\n\t\t\t\tcurrency?: string;\n\t\t\t\tquantity?: number;\n\t\t\t\treferenceId?: string;\n\t\t\t\tproduct?: string;\n\t\t\t}, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\turl: string;\n\t\t\t\treference: string;\n\t\t\t\taccessCode: string;\n\t\t\t\tredirect: boolean;\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\turl: string;\n\t\t\t\t\treference: string;\n\t\t\t\t\taccessCode: string;\n\t\t\t\t\tredirect: boolean;\n\t\t\t\t}>(\"paystack/initialize-transaction\", {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tbody: data,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst verifyTransaction = async (data: { reference: string }, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\tstatus: string;\n\t\t\t\treference: string;\n\t\t\t\tdata: unknown;\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\tstatus: string;\n\t\t\t\t\treference: string;\n\t\t\t\t\tdata: unknown;\n\t\t\t\t}>(\"paystack/verify-transaction\", {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tbody: data,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst listTransactions = async (data: { query?: Record<string, unknown> } = {}, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\ttransactions: PaystackTransaction[];\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\ttransactions: PaystackTransaction[];\n\t\t\t\t}>(\"paystack/list-transactions\", {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tquery: data.query,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst listSubscriptions = async (data: { query?: Record<string, unknown> } = {}, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\tsubscriptions: Subscription[];\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\tsubscriptions: Subscription[];\n\t\t\t\t}>(\"paystack/list-subscriptions\", {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tquery: data.query,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst getSubscriptionManageLink = async (data: { subscriptionCode: string }, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\tlink: string;\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\tlink: string;\n\t\t\t\t}>(\"paystack/get-subscription-manage-link\", {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tquery: data,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst cancelSubscription = async (data: {\n\t\t\t\tsubscriptionCode: string;\n\t\t\t\temailToken?: string;\n\t\t\t}, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\tstatus: string;\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\tstatus: string;\n\t\t\t\t}>(\"paystack/disable-subscription\", {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tbody: data,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tconst restoreSubscription = async (data: {\n\t\t\t\tsubscriptionCode: string;\n\t\t\t\temailToken?: string;\n\t\t\t}, options?: BetterFetchOption): Promise<BetterFetchResponse<{\n\t\t\t\tstatus: string;\n\t\t\t}>> => {\n\t\t\t\treturn $fetch<{\n\t\t\t\t\tstatus: string;\n\t\t\t\t}>(\"paystack/enable-subscription\", {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tbody: data,\n\t\t\t\t\t...options,\n\t\t\t\t});\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tsubscription: {\n\t\t\t\t\t/**\n * Initialize a transaction to upgrade or creating a subscription.\n */\n\t\t\t\t\tupgrade: initializeTransaction,\n\t\t\t\t\t/**\n * Initialize a payment to create a subscription.\n */\n\t\t\t\t\tcreate: initializeTransaction,\n\t\t\t\t\t/**\n * Disable a subscription.\n */\n\t\t\t\t\tcancel: cancelSubscription,\n\t\t\t\t\t/**\n * Enable a subscription.\n */\n\t\t\t\t\trestore: restoreSubscription,\n\t\t\t\t\t/**\n * List subscriptions for the user.\n */\n\t\t\t\t\tlist: listSubscriptions,\n\t\t\t\t\t/**\n * Get a link to manage the subscription on Paystack.\n */\n\t\t\t\t\tbillingPortal: getSubscriptionManageLink,\n\t\t\t\t\t/**\n * Aliases for legacy/demo usage.\n */\n\t\t\t\t\tlistLocal: listSubscriptions,\n\t\t\t\t\tmanageLink: getSubscriptionManageLink,\n\t\t\t\t\tdisable: cancelSubscription,\n\t\t\t\t\tenable: restoreSubscription,\n\t\t\t\t},\n\t\t\t\tpaystack: {\n\t\t\t\t\ttransaction: {\n\t\t\t\t\t\tinitialize: initializeTransaction,\n\t\t\t\t\t\tverify: verifyTransaction,\n\t\t\t\t\t\tlist: listTransactions,\n\t\t\t\t\t},\n\t\t\t\t\tsubscription: {\n\t\t\t\t\t\tcreate: initializeTransaction,\n\t\t\t\t\t\tupgrade: initializeTransaction,\n\t\t\t\t\t\tcancel: cancelSubscription,\n\t\t\t\t\t\trestore: restoreSubscription,\n\t\t\t\t\t\tlist: listSubscriptions,\n\t\t\t\t\t\tbillingPortal: getSubscriptionManageLink,\n\t\t\t\t\t\tlistLocal: listSubscriptions,\n\t\t\t\t\t\tmanageLink: getSubscriptionManageLink,\n\t\t\t\t\t\tdisable: cancelSubscription,\n\t\t\t\t\t\tenable: restoreSubscription,\n\t\t\t\t\t},\n\t\t\t\t\tinitializeTransaction,\n\t\t\t\t\tverifyTransaction,\n\t\t\t\t\tlistTransactions,\n\t\t\t\t\tlistSubscriptions,\n\t\t\t\t\tgetSubscriptionManageLink,\n\t\t\t\t\tgetConfig: async (): Promise<BetterFetchResponse<Record<string, unknown>>> => {\n\t\t\t\t\t\treturn $fetch<Record<string, unknown>>(\"paystack/get-config\", {\n\t\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} satisfies BetterAuthClientPlugin;\n};\n"],"mappings":";AAOA,MAAa,kBAKX,aACI;AACL,QAAO;EACN,IAAI;EACJ,oBAAoB,EAAE;EACtB,aAAa,WAAwB;GACpC,MAAM,wBAAwB,OAAO,MAYlC,YAKI;AACN,WAAO,OAKJ,mCAAmC;KACrC,QAAQ;KACR,MAAM;KACN,GAAG;KACH,CAAC;;GAGH,MAAM,oBAAoB,OAAO,MAA6B,YAIvD;AACN,WAAO,OAIJ,+BAA+B;KACjC,QAAQ;KACR,MAAM;KACN,GAAG;KACH,CAAC;;GAGH,MAAM,mBAAmB,OAAO,OAA4C,EAAE,EAAE,YAEzE;AACN,WAAO,OAEJ,8BAA8B;KAChC,QAAQ;KACR,OAAO,KAAK;KACZ,GAAG;KACH,CAAC;;GAGH,MAAM,oBAAoB,OAAO,OAA4C,EAAE,EAAE,YAE1E;AACN,WAAO,OAEJ,+BAA+B;KACjC,QAAQ;KACR,OAAO,KAAK;KACZ,GAAG;KACH,CAAC;;GAGH,MAAM,4BAA4B,OAAO,MAAoC,YAEtE;AACN,WAAO,OAEJ,yCAAyC;KAC3C,QAAQ;KACR,OAAO;KACP,GAAG;KACH,CAAC;;GAGH,MAAM,qBAAqB,OAAO,MAG/B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