better-auth-paystack 3.1.2 → 3.2.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 CHANGED
@@ -79,9 +79,9 @@ npm install better-auth-paystack
79
79
  Then update imports from `@alexasomba/better-auth-paystack` to `better-auth-paystack` and from
80
80
  `@alexasomba/better-auth-paystack/client` to `better-auth-paystack/client`.
81
81
 
82
- This is a package-name migration only. The plugin API, configuration, routes, and database schema
83
- are unchanged, so no database migration or configuration changes are required. Do not install both
84
- package names simultaneously: they expose the same Better Auth plugin and schema.
82
+ This is a package-name migration. The v4 release also moves Paystack billing data into
83
+ provider-owned tables. Existing client route names remain compatible, but a database migration
84
+ and the trusted migration operation described below are required.
85
85
 
86
86
  #### Optional: Browser SDK (for Popup Modals)
87
87
 
@@ -327,7 +327,7 @@ Transactions below these thresholds will be rejected with a `BAD_REQUEST` error.
327
327
 
328
328
  Enable `organization.enabled` to bill organizations instead of users.
329
329
 
330
- - **Auto Customer**: Organizations get their own `paystackCustomerCode`.
330
+ - **Auto Customer**: Organizations get their own provider-owned `paystackCustomer` record.
331
331
  - **Authorization**: Organization owners and admins can manage billing by default. Use `organization.billingRoles` to extend the trusted role list, or `subscription.authorizeReference` when you need fully custom authorization.
332
332
 
333
333
  ```ts
@@ -411,6 +411,11 @@ If a subscription payment is later verified with a disallowed channel, the plugi
411
411
 
412
412
  ### Webhook Security
413
413
 
414
+ Webhook deliveries are persisted in the provider-specific `paystackWebhookEvent` table using a
415
+ stable hash of the verified raw payload. Duplicate deliveries that were already processed are
416
+ acknowledged without running billing side effects again. Failed or interrupted deliveries remain
417
+ pending for later reconciliation or replay handling.
418
+
414
419
  The plugin automatically verifies the `x-paystack-signature` header to ensure events are authentic. For an extra layer of security, you can enable **IP Whitelisting** to restrict processing to Paystack's official servers.
415
420
 
416
421
  ```ts
@@ -664,36 +669,63 @@ type cancelSubscription = {
664
669
 
665
670
  The plugin extends your database with the following fields and tables.
666
671
 
667
- ### `user`
668
-
669
- | Field | Type | Required | Description |
670
- | :--------------------- | :------- | :------- | :-------------------------------------------- |
671
- | `paystackCustomerCode` | `string` | No | The unique customer identifier from Paystack. |
672
-
673
- ### `organization`
674
-
675
- | Field | Type | Required | Description |
676
- | :--------------------- | :------- | :------- | :----------------------------------------------------------------------------------------- |
677
- | `paystackCustomerCode` | `string` | No | The unique customer identifier for the organization. |
678
- | `email` | `string` | No | The billing email for the organization. fallsback to organization owner's email if absent. |
679
-
680
- ### `subscription`
681
-
682
- | Field | Type | Required | Description |
683
- | :----------------------------- | :-------- | :------- | :------------------------------------------------------------------- |
684
- | `plan` | `string` | Yes | Lowercased name of the active plan. |
685
- | `referenceId` | `string` | Yes | Associated User ID or Organization ID. |
686
- | `paystackCustomerCode` | `string` | No | The Paystack customer code for this subscription. |
687
- | `paystackSubscriptionCode` | `string` | No | The unique code for the subscription (e.g., `SUB_...` or `LOC_...`). |
688
- | `paystackTransactionReference` | `string` | No | The reference of the transaction that started the subscription. |
689
- | `paystackAuthorizationCode` | `string` | No | Stored card authorization code for recurring charges (local plans). |
690
- | `status` | `string` | Yes | `active`, `trialing`, `canceled`, `incomplete`. |
691
- | `periodStart` | `Date` | No | Start date of the current billing period. |
692
- | `periodEnd` | `Date` | No | End date of the current billing period. |
693
- | `trialStart` | `Date` | No | Start date of the trial period. |
694
- | `trialEnd` | `Date` | No | End date of the trial period. |
695
- | `cancelAtPeriodEnd` | `boolean` | No | Whether to cancel at the end of the current period. |
696
- | `seats` | `number` | No | Purchased seat count for team billing. |
672
+ ### `user` and `organization`
673
+
674
+ Paystack customer codes are no longer added to Better Auth auth tables. Organization `email`
675
+ remains available for billing fallback.
676
+
677
+ | Field | Type | Required | Description |
678
+ | :------ | :------- | :------- | :--------------------------------------------------------------------------------- |
679
+ | `email` | `string` | No | The billing email for the organization. Falls back to the owner's email if absent. |
680
+
681
+ ### `paystackCustomer`
682
+
683
+ | Field | Type | Required | Description |
684
+ | :-------------- | :------- | :------- | :----------------------------------- |
685
+ | `referenceType` | `string` | Yes | `user` or `organization`. |
686
+ | `referenceId` | `string` | Yes | Owning Better Auth identifier. |
687
+ | `referenceKey` | `string` | Yes | Unique provider-owned reference key. |
688
+ | `customerCode` | `string` | Yes | Paystack customer code. |
689
+ | `email` | `string` | No | Billing email. |
690
+
691
+ ### `paystackPaymentCredential`
692
+
693
+ Payment credentials are stored separately as AES-256-GCM ciphertext. Plaintext values are not
694
+ returned by subscription APIs, callbacks, logs, or client actions. Set `credentialEncryptionKey`
695
+ to a dedicated production secret; the plugin falls back to `secretKey` for compatibility.
696
+
697
+ | Field | Type | Required | Description |
698
+ | :--------------------------- | :------- | :------- | :---------------------------------------- |
699
+ | `subscriptionId` | `string` | Yes | Unique Paystack subscription ID. |
700
+ | `authorizationCodeEncrypted` | `string` | No | Encrypted recurring-charge authorization. |
701
+ | `emailTokenEncrypted` | `string` | No | Encrypted subscription-management token. |
702
+
703
+ ### `paystackSubscription`
704
+
705
+ | Field | Type | Required | Description |
706
+ | :--------------------- | :-------- | :------- | :------------------------------------------------------------------- |
707
+ | `plan` | `string` | Yes | Lowercased name of the active plan. |
708
+ | `referenceId` | `string` | Yes | Associated User ID or Organization ID. |
709
+ | `userId` | `string` | Yes | User who initiated the subscription checkout. |
710
+ | `customerCode` | `string` | No | The Paystack customer code for this subscription. |
711
+ | `subscriptionCode` | `string` | No | The unique code for the subscription (e.g., `SUB_...` or `LOC_...`). |
712
+ | `transactionReference` | `string` | No | The reference of the transaction that started the subscription. |
713
+ | `planCode` | `string` | No | The Paystack plan code, when Paystack manages the subscription. |
714
+ | `status` | `string` | Yes | `active`, `trialing`, `canceled`, `incomplete`. |
715
+ | `periodStart` | `Date` | No | Start date of the current billing period. |
716
+ | `periodEnd` | `Date` | No | End date of the current billing period. |
717
+ | `trialStart` | `Date` | No | Start date of the trial period. |
718
+ | `trialEnd` | `Date` | No | End date of the trial period. |
719
+ | `cancelAtPeriodEnd` | `boolean` | No | Whether to cancel at the end of the current period. |
720
+ | `cancelAt` | `Date` | No | Scheduled cancellation timestamp. |
721
+ | `canceledAt` | `Date` | No | Cancellation timestamp. |
722
+ | `endedAt` | `Date` | No | Subscription end timestamp. |
723
+ | `billingInterval` | `string` | No | Billing interval used by the plan. |
724
+ | `groupId` | `string` | No | Optional subscription group. |
725
+ | `pendingPlan` | `string` | No | Plan pending a future lifecycle change. |
726
+ | `seats` | `number` | No | Purchased seat count for team billing. |
727
+ | `createdAt` | `Date` | Yes | Record creation timestamp. |
728
+ | `updatedAt` | `Date` | Yes | Record update timestamp. |
697
729
 
698
730
  ### `paystackTransaction`
699
731
 
@@ -728,6 +760,50 @@ The plugin extends your database with the following fields and tables.
728
760
  | `createdAt` | `Date` | Yes | Product creation timestamp. |
729
761
  | `updatedAt` | `Date` | Yes | Product last update timestamp. |
730
762
 
763
+ ### `paystackWebhookEvent`
764
+
765
+ The plugin records verified webhook deliveries with their event type, raw payload, reference (when
766
+ available), processing status, and processed timestamp. This table is provider-namespaced so the
767
+ Paystack and Flutterwave plugins can be installed together without sharing webhook state.
768
+
769
+ | Field | Type | Required | Description |
770
+ | :------------ | :------- | :------- | :----------------------------------------- |
771
+ | `eventId` | `string` | Yes | Stable hash of the exact verified payload. |
772
+ | `eventType` | `string` | Yes | Paystack event name. |
773
+ | `reference` | `string` | No | Transaction reference when available. |
774
+ | `payload` | `string` | Yes | Exact raw webhook payload. |
775
+ | `status` | `string` | Yes | `pending` or `processed`. |
776
+ | `processedAt` | `Date` | No | Processing completion timestamp. |
777
+
778
+ ### v4 schema migration
779
+
780
+ After upgrading the package, generate/apply the Better Auth schema first, then run the trusted
781
+ server-only operation:
782
+
783
+ ```ts
784
+ import { migratePaystackSubscriptionSchema } from "better-auth-paystack";
785
+
786
+ const report = await migratePaystackSubscriptionSchema(ctx, {
787
+ secretKey: process.env.PAYSTACK_SECRET_KEY!,
788
+ credentialEncryptionKey: process.env.PAYSTACK_CREDENTIAL_ENCRYPTION_KEY,
789
+ });
790
+ ```
791
+
792
+ Run it in this order:
793
+
794
+ 1. Upgrade the package.
795
+ 2. Run Better Auth schema generation/migration.
796
+ 3. Run `migratePaystackSubscriptionSchema()` from a trusted server job.
797
+ 4. Verify migration counts and billing behavior.
798
+ 5. Remove legacy columns/tables manually only after verification.
799
+
800
+ The operation preserves legacy rows, keeps original subscription IDs where possible, skips already
801
+ migrated records, encrypts legacy authorization/email tokens, and reports partial failures so a
802
+ later run can retry them.
803
+
804
+ During the compatibility window, customer resolution can still read legacy auth-table customer
805
+ codes. Remove those legacy columns manually after the migration has been verified.
806
+
731
807
  ---
732
808
 
733
809
  ## Troubleshooting
@@ -749,8 +825,9 @@ columns are nullable; historical rows are populated as future lifecycle events a
749
825
  The following fields are indexed:
750
826
 
751
827
  - **`paystackTransaction`**: `reference` (unique), `userId`, `referenceId`.
752
- - **`subscription`**: `paystackSubscriptionCode` (unique), `referenceId`, `paystackTransactionReference`, `paystackCustomerCode`, `plan`.
753
- - **`user` & `organization`**: `paystackCustomerCode`.
828
+ - **`paystackSubscription`**: `subscriptionCode` (unique), `referenceId`, `transactionReference`, `customerCode`, `plan`.
829
+ - **`paystackCustomer`**: `referenceKey` (unique), `referenceId`, `customerCode` (unique).
830
+ - **`paystackPaymentCredential`**: `subscriptionId` (unique).
754
831
  - **`paystackProduct`**: `slug` (unique), `paystackId` (unique).
755
832
 
756
833
  Proration upgrades and trusted renewal charges also persist `paystackTransaction` rows, so local transaction history stays aligned with successful off-session charges.
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as PaystackPlan, C as parsePaystackMetadata, D as PaystackClientLike, F as Subscription, N as PaystackTransaction, O as PaystackInitializeResult, P as PaystackTransactionResponse, T as AnyPaystackOptions, h as PaystackMetadata, j as PaystackProduct, n as paystack$1 } from "./index-BfHLsAWb.mjs";
1
+ import { A as PaystackClientLike, B as PaystackTransactionResponse, E as parsePaystackMetadata, F as PaystackPlan, H as Subscription, I as PaystackProduct, M as PaystackInitializeResult, O as AnyPaystackOptions, n as paystack$1, v as PaystackMetadata, z as PaystackTransaction } from "./index-CXuHlFoy.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
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { l as parsePaystackMetadata, t as PACKAGE_VERSION } from "./version-Db-470Pe.mjs";
1
+ import { l as parsePaystackMetadata, t as PACKAGE_VERSION } from "./version-BYbIySEf.mjs";
2
2
  //#region src/client.ts
3
3
  /**
4
4
  * Better Auth Paystack Client Plugin
@@ -10,12 +10,15 @@ type PluginSchemaTable<TableName extends string, FieldName extends string> = Rec
10
10
  modelName?: string;
11
11
  }>;
12
12
  type TransactionsSchema = PluginSchemaTable<"paystackTransaction", "reference" | "paystackId" | "referenceId" | "userId" | "amount" | "currency" | "status" | "plan" | "product" | "metadata" | "createdAt" | "updatedAt">;
13
- type SubscriptionsSchema = PluginSchemaTable<"subscription", "plan" | "referenceId" | "paystackCustomerCode" | "paystackSubscriptionCode" | "paystackTransactionReference" | "paystackAuthorizationCode" | "paystackEmailToken" | "status" | "periodStart" | "periodEnd" | "trialStart" | "trialEnd" | "cancelAtPeriodEnd" | "cancelAt" | "canceledAt" | "endedAt" | "billingInterval" | "groupId" | "seats" | "pendingPlan">;
14
- type UserSchema = PluginSchemaTable<"user", "paystackCustomerCode">;
15
- type OrganizationSchema = PluginSchemaTable<"organization", "paystackCustomerCode" | "email">;
13
+ type WebhookEventsSchema = PluginSchemaTable<"paystackWebhookEvent", "eventId" | "eventType" | "reference" | "payload" | "status" | "processedAt" | "createdAt" | "updatedAt">;
14
+ type SubscriptionsSchema = PluginSchemaTable<"paystackSubscription", "plan" | "referenceId" | "userId" | "customerCode" | "subscriptionCode" | "transactionReference" | "planCode" | "status" | "periodStart" | "periodEnd" | "trialStart" | "trialEnd" | "cancelAtPeriodEnd" | "cancelAt" | "canceledAt" | "endedAt" | "billingInterval" | "groupId" | "seats" | "pendingPlan" | "createdAt" | "updatedAt">;
15
+ type CustomerSchema = PluginSchemaTable<"paystackCustomer", "referenceType" | "referenceId" | "referenceKey" | "customerCode" | "email" | "createdAt" | "updatedAt">;
16
+ type PaymentCredentialsSchema = PluginSchemaTable<"paystackPaymentCredential", "subscriptionId" | "authorizationCodeEncrypted" | "emailTokenEncrypted" | "createdAt" | "updatedAt">;
17
+ type UserSchema = PluginSchemaTable<"user", never>;
18
+ type OrganizationSchema = PluginSchemaTable<"organization", "email">;
16
19
  type ProductsSchema = PluginSchemaTable<"paystackProduct", "name" | "description" | "price" | "currency" | "quantity" | "unlimited" | "paystackId" | "slug" | "metadata" | "createdAt" | "updatedAt">;
17
20
  type PlansSchema = PluginSchemaTable<"paystackPlan", "name" | "description" | "amount" | "currency" | "interval" | "group" | "planCode" | "paystackId" | "metadata" | "createdAt" | "updatedAt">;
18
- type PaystackPluginSchema = SubscriptionsSchema & TransactionsSchema & UserSchema & OrganizationSchema & ProductsSchema & PlansSchema;
21
+ type PaystackPluginSchema = SubscriptionsSchema & TransactionsSchema & CustomerSchema & PaymentCredentialsSchema & UserSchema & OrganizationSchema & ProductsSchema & PlansSchema & WebhookEventsSchema;
19
22
  declare const getSchema: (options: PaystackOptions) => BetterAuthPluginDBSchema;
20
23
  //#endregion
21
24
  //#region src/types.d.ts
@@ -39,6 +42,35 @@ interface PaystackTransaction {
39
42
  createdAt: Date;
40
43
  updatedAt: Date;
41
44
  }
45
+ interface PaystackWebhookEventRecord {
46
+ id: string;
47
+ eventId: string;
48
+ eventType: string;
49
+ reference?: string | null;
50
+ payload: string;
51
+ status: string;
52
+ processedAt?: Date | null;
53
+ createdAt: Date;
54
+ updatedAt: Date;
55
+ }
56
+ interface PaystackCustomer {
57
+ id: string;
58
+ referenceType: "user" | "organization";
59
+ referenceId: string;
60
+ /** Internal unique key used to enforce referenceType/referenceId uniqueness. */
61
+ referenceKey: string;
62
+ customerCode: string;
63
+ email?: string | null;
64
+ createdAt: Date;
65
+ updatedAt: Date;
66
+ }
67
+ /** Public credential metadata. Plaintext and encrypted values are intentionally omitted. */
68
+ interface PaystackPaymentCredential {
69
+ id: string;
70
+ subscriptionId: string;
71
+ createdAt: Date;
72
+ updatedAt: Date;
73
+ }
42
74
  interface PaystackProduct {
43
75
  id?: string;
44
76
  name: string;
@@ -177,6 +209,11 @@ interface PaystackOptions<TPaystackClient extends PaystackClientLike = PaystackC
177
209
  * Paystack Secret Key
178
210
  */
179
211
  secretKey: string;
212
+ /**
213
+ * Key used to encrypt Paystack payment credentials with AES-256-GCM.
214
+ * Recommended for production. `secretKey` is used as a compatibility fallback.
215
+ */
216
+ credentialEncryptionKey?: string;
180
217
  /**
181
218
  * @deprecated Paystack signs webhooks with `secretKey`; this option is ignored.
182
219
  */
@@ -256,21 +293,19 @@ interface PaystackOptions<TPaystackClient extends PaystackClientLike = PaystackC
256
293
  */
257
294
  schema?: InferOptionSchema<PaystackPluginSchema>;
258
295
  }
259
- interface Subscription {
296
+ interface PaystackSubscription {
260
297
  id: string;
261
298
  userId: string;
262
299
  organizationId?: string;
263
300
  plan: string;
301
+ referenceId: string;
302
+ customerCode?: string | null;
303
+ subscriptionCode?: string | null;
304
+ transactionReference?: string | null;
305
+ planCode?: string | null;
264
306
  pendingPlan?: string | null;
265
- paystackSubscriptionCode?: string;
266
- paystackCustomerCode?: string;
267
- paystackPlanCode?: string;
268
- paystackAuthorizationCode?: string;
269
- paystackTransactionReference?: string;
270
- paystackEmailToken?: string;
271
307
  status: string;
272
- seats: number;
273
- referenceId: string;
308
+ seats?: number | null;
274
309
  periodStart?: Date | null;
275
310
  periodEnd?: Date | null;
276
311
  cancelAtPeriodEnd: boolean;
@@ -284,6 +319,20 @@ interface Subscription {
284
319
  createdAt: Date;
285
320
  updatedAt: Date;
286
321
  }
322
+ /**
323
+ * @deprecated Use `PaystackSubscription`. These aliases are retained for source
324
+ * compatibility while storage uses provider-local canonical field names.
325
+ */
326
+ type Subscription = PaystackSubscription & {
327
+ /** @deprecated Use `subscriptionCode`. */
328
+ paystackSubscriptionCode?: string | null;
329
+ /** @deprecated Use `customerCode`. */
330
+ paystackCustomerCode?: string | null;
331
+ /** @deprecated Use `planCode`. */
332
+ paystackPlanCode?: string | null;
333
+ /** @deprecated Use `transactionReference`. */
334
+ paystackTransactionReference?: string | null;
335
+ };
287
336
  interface ChargeRecurringSubscriptionInput {
288
337
  subscriptionId: string;
289
338
  amount?: number;
@@ -600,7 +649,7 @@ declare const getConfig: <P extends string = "/get-config">(options: AnyPaystack
600
649
  }>;
601
650
  //#endregion
602
651
  //#region src/version.d.ts
603
- declare const PACKAGE_VERSION = "3.1.2";
652
+ declare const PACKAGE_VERSION = "3.2.0";
604
653
  //#endregion
605
654
  //#region src/metadata.d.ts
606
655
  type PaystackMetadata = Record<string, unknown>;
@@ -714,6 +763,34 @@ interface ReconcilePaystackTransactionFailure extends PaystackReconciliationSumm
714
763
  type ReconcilePaystackTransactionResult = ReconcilePaystackTransactionSuccess | ReconcilePaystackTransactionFailure;
715
764
  declare function reconcilePaystackTransaction(ctx: GenericEndpointContext, options: AnyPaystackOptions, input: ReconcilePaystackTransactionInput): Promise<ReconcilePaystackTransactionResult>;
716
765
  //#endregion
766
+ //#region src/migrations.d.ts
767
+ interface PaystackSchemaMigrationFailure {
768
+ kind: "subscription" | "customer" | "credential";
769
+ id: string;
770
+ message: string;
771
+ }
772
+ interface PaystackSchemaMigrationReport {
773
+ status: "complete" | "partial";
774
+ subscriptions: {
775
+ migrated: number;
776
+ skipped: number;
777
+ failed: number;
778
+ };
779
+ customers: {
780
+ migrated: number;
781
+ skipped: number;
782
+ failed: number;
783
+ };
784
+ credentials: {
785
+ migrated: number;
786
+ skipped: number;
787
+ failed: number;
788
+ };
789
+ skipped: number;
790
+ failures: PaystackSchemaMigrationFailure[];
791
+ }
792
+ declare function migratePaystackSubscriptionSchema(ctx: GenericEndpointContext, options: AnyPaystackOptions): Promise<PaystackSchemaMigrationReport>;
793
+ //#endregion
717
794
  //#region src/index.d.ts
718
795
  declare module "better-auth" {
719
796
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
@@ -777,5 +854,5 @@ declare const createPaystackPlugin: <TPaystackClient extends PaystackClientLike
777
854
  declare const paystack: typeof createPaystackPlugin;
778
855
  type PaystackPlugin<TPaystackClient extends PaystackClientLike = PaystackClientLike, O extends PaystackOptions<TPaystackClient> = PaystackOptions<TPaystackClient>> = ReturnType<typeof paystack<TPaystackClient, O>>;
779
856
  //#endregion
780
- export { PaystackPlan as A, parsePaystackMetadata as C, PaystackClientLike as D, ChargeRecurringSubscriptionResult as E, Subscription as F, SubscriptionOptions as I, PaystackSyncResult as M, PaystackTransaction as N, PaystackInitializeResult as O, PaystackTransactionResponse as P, hasPaystackMetadata as S, AnyPaystackOptions as T, createProrationMetadata as _, PaystackReconciliationSummary as a, getMetadataNumber as b, ReconcilePaystackTransactionResult as c, getOrganizationEntitlements as d, chargeSubscriptionRenewal as f, createCheckoutMetadata as g, PaystackMetadata as h, PaystackReconciliationSource as i, PaystackProduct as j, PaystackOptions as k, ReconcilePaystackTransactionSuccess as l, syncPaystackProducts as m, paystack as n, ReconcilePaystackTransactionFailure as o, syncPaystackPlans as p, PaystackReconciliationError as r, ReconcilePaystackTransactionInput as s, PaystackPlugin as t, reconcilePaystackTransaction as u, createRenewalMetadata as v, stringifyPaystackMetadata as w, getMetadataString as x, getMetadataBoolean as y };
781
- //# sourceMappingURL=index-BfHLsAWb.d.mts.map
857
+ export { PaystackClientLike as A, PaystackTransactionResponse as B, getMetadataNumber as C, stringifyPaystackMetadata as D, parsePaystackMetadata as E, PaystackPlan as F, Subscription as H, PaystackProduct as I, PaystackSubscription as L, PaystackInitializeResult as M, PaystackOptions as N, AnyPaystackOptions as O, PaystackPaymentCredential as P, PaystackSyncResult as R, getMetadataBoolean as S, hasPaystackMetadata as T, SubscriptionOptions as U, PaystackWebhookEventRecord as V, syncPaystackProducts as _, migratePaystackSubscriptionSchema as a, createProrationMetadata as b, PaystackReconciliationSummary as c, ReconcilePaystackTransactionResult as d, ReconcilePaystackTransactionSuccess as f, syncPaystackPlans as g, chargeSubscriptionRenewal as h, PaystackSchemaMigrationReport as i, PaystackCustomer as j, ChargeRecurringSubscriptionResult as k, ReconcilePaystackTransactionFailure as l, getOrganizationEntitlements as m, paystack as n, PaystackReconciliationError as o, reconcilePaystackTransaction as p, PaystackSchemaMigrationFailure as r, PaystackReconciliationSource as s, PaystackPlugin as t, ReconcilePaystackTransactionInput as u, PaystackMetadata as v, getMetadataString as w, createRenewalMetadata as x, createCheckoutMetadata as y, PaystackTransaction as z };
858
+ //# sourceMappingURL=index-CXuHlFoy.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CXuHlFoy.d.mts","names":[],"sources":["../src/schema.ts","../src/types.d.ts","../src/routes.ts","../src/version.ts","../src/metadata.ts","../src/operations.ts","../src/limits.ts","../src/reconciliation.ts","../src/migrations.ts","../src/index.ts"],"mappings":";;;;;;KAIK,kBAAkB,0BAA0B,4BAA4B,OAC3E;EAEE,QAAQ,OAAO,WAAW;EAC1B;EACA;;KAIC,qBAAqB;KAgBrB,sBAAsB;KAYtB,sBAAsB;KA0BtB,iBAAiB;KAWjB,2BAA2B;KAS3B,aAAa;KAEb,qBAAqB;KAErB,iBAAiB;KAejB,cAAc;KAeP,uBAAuB,sBACjC,qBACA,iBACA,2BACA,aACA,qBACA,iBACA,cACA;cAwYW,YAAa,SAAS,oBAAkB;;;KCjgBzC;;;;;UAWK;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,WAAW;;UAEE;EACb;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,WAAW;EACX,WAAW;;UAEE;EACb;EACA;EACA;;EAEA;EACA;EACA;EACA,WAAW;EACX,WAAW;;;UAGE;EACb;EACA;EACA,WAAW;EACX,WAAW;;UAEE;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;E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D,kBAAkB,SAAS,iBAAiB"}
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as PaystackPlan, C as parsePaystackMetadata, D as PaystackClientLike, E as ChargeRecurringSubscriptionResult, F as Subscription, I as SubscriptionOptions, M as PaystackSyncResult, O as PaystackInitializeResult, P as PaystackTransactionResponse, S as hasPaystackMetadata, _ as createProrationMetadata, a as PaystackReconciliationSummary, b as getMetadataNumber, c as ReconcilePaystackTransactionResult, d as getOrganizationEntitlements, f as chargeSubscriptionRenewal, g as createCheckoutMetadata, h as PaystackMetadata, i as PaystackReconciliationSource, j as PaystackProduct, k as PaystackOptions, l as ReconcilePaystackTransactionSuccess, m as syncPaystackProducts, n as paystack, o as ReconcilePaystackTransactionFailure, p as syncPaystackPlans, r as PaystackReconciliationError, s as ReconcilePaystackTransactionInput, t as PaystackPlugin, u as reconcilePaystackTransaction, v as createRenewalMetadata, w as stringifyPaystackMetadata, x as getMetadataString, y as getMetadataBoolean } from "./index-BfHLsAWb.mjs";
2
- export { type ChargeRecurringSubscriptionResult, type PaystackClientLike, type PaystackInitializeResult, type PaystackMetadata, type PaystackOptions, type PaystackPlan, PaystackPlugin, type PaystackProduct, type PaystackReconciliationError, type PaystackReconciliationSource, type PaystackReconciliationSummary, type PaystackSyncResult, type PaystackTransactionResponse, type ReconcilePaystackTransactionFailure, type ReconcilePaystackTransactionInput, type ReconcilePaystackTransactionResult, type ReconcilePaystackTransactionSuccess, type Subscription, type SubscriptionOptions, chargeSubscriptionRenewal, createCheckoutMetadata, createProrationMetadata, createRenewalMetadata, getMetadataBoolean, getMetadataNumber, getMetadataString, getOrganizationEntitlements, hasPaystackMetadata, parsePaystackMetadata, paystack, reconcilePaystackTransaction, stringifyPaystackMetadata, syncPaystackPlans, syncPaystackProducts };
1
+ import { A as PaystackClientLike, B as PaystackTransactionResponse, C as getMetadataNumber, D as stringifyPaystackMetadata, E as parsePaystackMetadata, F as PaystackPlan, H as Subscription, I as PaystackProduct, L as PaystackSubscription, M as PaystackInitializeResult, N as PaystackOptions, P as PaystackPaymentCredential, R as PaystackSyncResult, S as getMetadataBoolean, T as hasPaystackMetadata, U as SubscriptionOptions, V as PaystackWebhookEventRecord, _ as syncPaystackProducts, a as migratePaystackSubscriptionSchema, b as createProrationMetadata, c as PaystackReconciliationSummary, d as ReconcilePaystackTransactionResult, f as ReconcilePaystackTransactionSuccess, g as syncPaystackPlans, h as chargeSubscriptionRenewal, i as PaystackSchemaMigrationReport, j as PaystackCustomer, k as ChargeRecurringSubscriptionResult, l as ReconcilePaystackTransactionFailure, m as getOrganizationEntitlements, n as paystack, o as PaystackReconciliationError, p as reconcilePaystackTransaction, r as PaystackSchemaMigrationFailure, s as PaystackReconciliationSource, t as PaystackPlugin, u as ReconcilePaystackTransactionInput, v as PaystackMetadata, w as getMetadataString, x as createRenewalMetadata, y as createCheckoutMetadata } from "./index-CXuHlFoy.mjs";
2
+ export { type ChargeRecurringSubscriptionResult, type PaystackClientLike, type PaystackCustomer, type PaystackInitializeResult, type PaystackMetadata, type PaystackOptions, type PaystackPaymentCredential, type PaystackPlan, PaystackPlugin, type PaystackProduct, type PaystackReconciliationError, type PaystackReconciliationSource, type PaystackReconciliationSummary, type PaystackSchemaMigrationFailure, type PaystackSchemaMigrationReport, type PaystackSubscription, type PaystackSyncResult, type PaystackTransactionResponse, type PaystackWebhookEventRecord, type ReconcilePaystackTransactionFailure, type ReconcilePaystackTransactionInput, type ReconcilePaystackTransactionResult, type ReconcilePaystackTransactionSuccess, type Subscription, type SubscriptionOptions, chargeSubscriptionRenewal, createCheckoutMetadata, createProrationMetadata, createRenewalMetadata, getMetadataBoolean, getMetadataNumber, getMetadataString, getOrganizationEntitlements, hasPaystackMetadata, migratePaystackSubscriptionSchema, parsePaystackMetadata, paystack, reconcilePaystackTransaction, stringifyPaystackMetadata, syncPaystackPlans, syncPaystackProducts };