better-auth-paystack 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.es-ES.md CHANGED
@@ -98,6 +98,8 @@ Paystack también incluye archivos para Next.js y Hono. Usa `nextjs` o `hono` co
98
98
 
99
99
  ## Demo y habilidades para agentes
100
100
 
101
+ Consulta las guías de integración para agentes en inglés de [Next.js App Router](skills/paystack-nextjs/SKILL.md) y [Hono en Cloudflare Workers](skills/paystack-hono/SKILL.md).
102
+
101
103
  La [demo de TanStack Start](examples/tanstack/README.md) incluye configuración, pantallas de facturación y comandos de prueba.
102
104
 
103
105
  El paquete npm incluye [habilidades para agentes](skills). Con pnpm 12.11 o posterior, ejecuta `pnpm approve` después de instalarlo y aprueba sus habilidades cuando se te solicite. TanStack Intent puede localizar y cargar los mismos archivos.
package/README.fr-FR.md CHANGED
@@ -98,6 +98,8 @@ Paystack fournit également des archives Next.js et Hono. Utilisez `nextjs` ou `
98
98
 
99
99
  ## Démo et compétences pour agents
100
100
 
101
+ Consultez les guides d’intégration pour les agents en anglais de [Next.js App Router](skills/paystack-nextjs/SKILL.md) et de [Hono sur Cloudflare Workers](skills/paystack-hono/SKILL.md).
102
+
101
103
  La [démo TanStack Start](examples/tanstack/README.md) présente la configuration, les écrans de facturation et les commandes de test.
102
104
 
103
105
  Le paquet npm inclut des [compétences pour agents](skills). Avec pnpm 12.11 ou une version ultérieure, exécutez `pnpm approve` après l’installation et approuvez les compétences proposées. TanStack Intent peut répertorier et charger les mêmes fichiers.
package/README.md CHANGED
@@ -75,6 +75,14 @@ Register `https://your-domain.example/api/auth/paystack/webhook` in Paystack for
75
75
  - Enable the Better Auth organization plugin and Paystack's `organization.enabled` to bill an organization. Billing actions default to owner and admin roles. [Organization billing](skills/paystack-organization-billing/SKILL.md)
76
76
  - Configure catalog items, trials, and limits on the server. [Catalog and limits](skills/paystack-catalog-limits/SKILL.md) · [Client API](skills/paystack-client-api/SKILL.md) · [Webhooks](skills/paystack-webhooks-events/SKILL.md)
77
77
 
78
+ ## Run the TanStack demo with Docker
79
+
80
+ With Docker Compose 2.24 or later, run `docker compose up --build` from the repository root and open [http://localhost:3000](http://localhost:3000). Set `DEMO_PORT` in your shell to use another host port.
81
+
82
+ The demo uses in-memory data. Restarting the container clears local accounts and demo billing records. To configure sandbox checkout, add the required values to the ignored root `.env.docker` file. Use `PAYSTACK_SECRET_KEY` with a Paystack test key for checkout. The container generates a local auth secret at startup when `BETTER_AUTH_SECRET` is unset.
83
+
84
+ Run `docker compose down` to stop the demo. See [Contributing](CONTRIBUTING.md) for issue reports, local checks, and release notes.
85
+
78
86
  ## Standalone starters
79
87
 
80
88
  Scaffold a project with npm. TanStack Start is the default.
@@ -98,11 +106,26 @@ pnpm starter:export tanstack /tmp/paystack-local --tarball /path/to/better-auth-
98
106
 
99
107
  Paystack also publishes Next.js and Hono starter archives. Use `nextjs` or `hono` as the demo name to export either one.
100
108
 
101
- ## Demo and agent skills
109
+ ## Demos and agent guides
102
110
 
103
111
  The [TanStack Start demo](examples/tanstack/README.md) includes setup instructions, billing screens, and test commands.
104
112
 
105
- The npm package includes [agent skills](skills). With pnpm 12.11 or later, run `pnpm approve` after installing the package and approve its skills when prompted. TanStack Intent can list and load the same files from your project.
113
+ ### Paystack integration skills
114
+
115
+ - [Install and configure Paystack payments](skills/better-auth-paystack-setup/SKILL.md)
116
+ - [Implement checkout and subscription billing](skills/paystack-billing-flows/SKILL.md)
117
+ - [Configure products, plans, trials, and seat limits](skills/paystack-catalog-limits/SKILL.md)
118
+ - [Call the Paystack browser client API](skills/paystack-client-api/SKILL.md)
119
+ - [Run recurring payment and renewal jobs](skills/paystack-local-subscriptions/SKILL.md)
120
+ - [Set up organization billing and team subscriptions](skills/paystack-organization-billing/SKILL.md)
121
+ - [Generate or migrate the Paystack database schema](skills/paystack-schema-migrations/SKILL.md)
122
+ - [Integrate Paystack in TanStack Start](skills/paystack-tanstack-start/SKILL.md)
123
+ - [Integrate Paystack in Next.js App Router](skills/paystack-nextjs/SKILL.md)
124
+ - [Integrate Paystack in Hono and Cloudflare Workers](skills/paystack-hono/SKILL.md)
125
+ - [Test Paystack payments and webhooks](skills/paystack-testing-fixtures/SKILL.md)
126
+ - [Verify webhook signatures and reconcile payments](skills/paystack-webhooks-events/SKILL.md)
127
+
128
+ The npm package includes these skills. With pnpm 12.11 or later, run `pnpm approve` after installing the package to review and approve its skills. Use TanStack Intent to list and load them from your project.
106
129
 
107
130
  ```sh
108
131
  pnpm dlx @tanstack/intent list
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as parsePaystackMetadata, G as PaystackTransactionResponse, I as PaystackPlan, L as PaystackProduct, N as PaystackInitializeResult, O as PACKAGE_VERSION, W as PaystackTransaction, j as PaystackClientLike, k as AnyPaystackOptions, n as paystack$1, q as Subscription, v as PaystackMetadata } from "./index-DE-0F3y6.mjs";
1
+ import { E as parsePaystackMetadata, G as PaystackTransactionResponse, I as PaystackPlan, L as PaystackProduct, N as PaystackInitializeResult, O as PACKAGE_VERSION, W as PaystackTransaction, j as PaystackClientLike, k as AnyPaystackOptions, n as paystack$1, q as Subscription, v as PaystackMetadata } from "./index-DWf1Oc9n.mjs";
2
2
  import { BetterFetchResponse } from "@better-fetch/fetch";
3
3
  import { BetterAuthClientPlugin } from "better-auth/client";
4
4
  type AuthFetch = Parameters<NonNullable<BetterAuthClientPlugin["getActions"]>>[0];
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { l as parsePaystackMetadata, t as PACKAGE_VERSION } from "./version-BW3EZXTR.mjs";
1
+ import { l as parsePaystackMetadata, t as PACKAGE_VERSION } from "./version-DDzS78qH.mjs";
2
2
  // src/client.ts
3
3
  /**
4
4
  * Better Auth Paystack Client Plugin
@@ -688,7 +688,7 @@ declare const getConfig: <P extends string = "/get-config">(options: AnyPaystack
688
688
  plans: PaystackPlan[];
689
689
  products: PaystackProduct[];
690
690
  }>;
691
- declare const PACKAGE_VERSION = "4.0.0";
691
+ declare const PACKAGE_VERSION = "4.0.2";
692
692
  type PaystackMetadata = Record<string, unknown>;
693
693
  interface CheckoutMetadataInput {
694
694
  referenceId: string;
@@ -884,4 +884,4 @@ declare const createPaystackPlugin: <TPaystackClient extends PaystackClientLike
884
884
  declare const paystack: typeof createPaystackPlugin;
885
885
  type PaystackPlugin<TPaystackClient extends PaystackClientLike = PaystackClientLike, O extends PaystackOptions<TPaystackClient> = PaystackOptions<TPaystackClient>> = ReturnType<typeof paystack<TPaystackClient, O>>;
886
886
  export { ChargeRecurringSubscriptionResult as A, PaystackSubscriptionOperationDecision as B, getMetadataNumber as C, stringifyPaystackMetadata as D, parsePaystackMetadata as E, PaystackPaymentCredential as F, PaystackTransactionResponse as G, PaystackSubscriptionOperationPhase as H, PaystackPlan as I, SubscriptionOptions as J, PaystackWebhookEventRecord as K, PaystackProduct as L, PaystackCustomer as M, PaystackInitializeResult as N, PACKAGE_VERSION as O, PaystackOptions as P, PaystackSubscription as R, getMetadataBoolean as S, hasPaystackMetadata as T, PaystackSyncResult as U, PaystackSubscriptionOperationHooks as V, PaystackTransaction as W, 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, PaystackClientLike as j, AnyPaystackOptions as k, ReconcilePaystackTransactionFailure as l, getOrganizationEntitlements as m, paystack as n, PaystackReconciliationError as o, reconcilePaystackTransaction as p, Subscription as q, PaystackSchemaMigrationFailure as r, PaystackReconciliationSource as s, PaystackPlugin as t, ReconcilePaystackTransactionInput as u, PaystackMetadata as v, getMetadataString as w, createRenewalMetadata as x, createCheckoutMetadata as y, PaystackSubscriptionOperation as z };
887
- //# sourceMappingURL=index-DE-0F3y6.d.mts.map
887
+ //# sourceMappingURL=index-DWf1Oc9n.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DE-0F3y6.d.mts","names":[],"sources":["../src/schema.ts","../src/types.ts","../src/billing-store.ts","../src/route-modules/shared.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,YAAS,SAAa,oBAAkB;KC9ezC;;;;;UA4BK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,WAAW;EACX,WAAW;;UAGI;EACf;EACA;EACA;;EAEA;EACA;EACA;EACA,WAAW;EACX,WAAW;;;UAII;EACf;EACA;EACA,WAAW;EACX,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,YAAY;;UAgBG;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;EAKA;EACA;EACA;;;;;EAKA;EACA;IACE;;IAEA;IACA,gBAAgB,cAAc,iBAAiB;IAC/C,cAAc,cAAc,iBAAiB;IAC7C,kBAAkB,cAAc,iBAAiB;;EAEnD,SAAS;EACT;EACA;EACA,YAAY;EACZ,YAAY;;;;;KAMF,yBAAyB;;;;KAKzB,8BAA8B;KAC9B,sCAAsC;KAMtC;EAEN;EACA;EACA;EACA;EACA;EACA;IACE;IACA;MAAsB;MAAgB;;;;EAIxC;EACA;EACA;EACA;;EAGA;EACA;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1B,0BAA0B;UAErB;EACR;IACE,eAAe;MACb;QACE;UACE,OAAO;;;;;;KAOZ,4BAA4B,KAAK;EACpC,SAAS,KAAK;EACd,SAAS;;KAGN,uBAAuB,KAAK,8BAA8B,4BAC7D,YAAY;KAET,uBAAuB,UAAU,sBAAsB,KAC1D;EAGA;EACA,gBAAgB;EAChB,WAAW;EACX,QAAQ,kBAAkB;EAC1B,MAAM;EACN,qBAAqB;EACrB,SAAS,QAAQ;;cAGb,uBACJ,wBAAwB,qBAAqB,oBAC7C,UAAU,gBAAgB,mBAAmB,gBAAgB,kBAAgB,SAEpE,MACR,uBAAuB;cAybb,iBAAiB;KAElB,eACV,wBAAwB,qBAAqB,oBAC7C,UAAU,gBAAgB,mBAAmB,gBAAgB,oBAC3D,kBAAkB,SAAS,iBAAiB"}
1
+ {"version":3,"file":"index-DWf1Oc9n.d.mts","names":[],"sources":["../src/schema.ts","../src/types.ts","../src/billing-store.ts","../src/route-modules/shared.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,YAAS,SAAa,oBAAkB;KC9ezC;;;;;UA4BK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,WAAW;EACX,WAAW;;UAGI;EACf;EACA;EACA;;EAEA;EACA;EACA;EACA,WAAW;EACX,WAAW;;;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;EAClD;EACA,UAAU;;iBA0HU,kCACpB,KAAK,wBACL,SAAS,qBACR,QAAQ;;YCrGC,yBAAyB,aAAa;IAC9C;MACE,gBAAgB;;;;;;;;;;;;;;KAgBjB;EACH,uBAAuB,kBAAkB;EACzC,mBAAmB,kBAAkB;EACrC,mBAAmB,kBAAkB;EACrC,iBAAiB,kBAAkB;EACnC,kBAAkB,kBAAkB;EACpC,WAAW,kBAAkB;EAC7B,qBAAqB,kBAAkB;EACvC,oBAAoB,kBAAkB;EACtC,2BAA2B,kBAAkB;EAC7C,wBAAwB,kBAAkB;EAC1C,oBAAoB,kBAAkB;EACtC,qBAAqB,kBAAkB;EACvC,oBAAoB,kBAAkB;EACtC,qBAAqB,kBAAkB;EACvC,cAAc,kBAAkB;EAChC,WAAW,kBAAkB;;KAG1B,0BAA0B;UAErB;EACR;IACE,eAAe;MACb;QACE;UACE,OAAO;;;;;;KAOZ,4BAA4B,KAAK;EACpC,SAAS,KAAK;EACd,SAAS;;KAGN,uBAAuB,KAAK,8BAA8B,4BAC7D,YAAY;KAET,uBAAuB,UAAU,sBAAsB,KAC1D;EAGA;EACA,gBAAgB;EAChB,WAAW;EACX,QAAQ,kBAAkB;EAC1B,MAAM;EACN,qBAAqB;EACrB,SAAS,QAAQ;;cAGb,uBACJ,wBAAwB,qBAAqB,oBAC7C,UAAU,gBAAgB,mBAAmB,gBAAgB,kBAAgB,SAEpE,MACR,uBAAuB;cAybb,iBAAiB;KAElB,eACV,wBAAwB,qBAAqB,oBAC7C,UAAU,gBAAgB,mBAAmB,gBAAgB,oBAC3D,kBAAkB,SAAS,iBAAiB"}
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as ChargeRecurringSubscriptionResult, B as PaystackSubscriptionOperationDecision, C as getMetadataNumber, D as stringifyPaystackMetadata, E as parsePaystackMetadata, F as PaystackPaymentCredential, G as PaystackTransactionResponse, H as PaystackSubscriptionOperationPhase, I as PaystackPlan, J as SubscriptionOptions, K as PaystackWebhookEventRecord, L as PaystackProduct, M as PaystackCustomer, N as PaystackInitializeResult, P as PaystackOptions, R as PaystackSubscription, S as getMetadataBoolean, T as hasPaystackMetadata, U as PaystackSyncResult, V as PaystackSubscriptionOperationHooks, W as PaystackTransaction, _ 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 PaystackClientLike, l as ReconcilePaystackTransactionFailure, m as getOrganizationEntitlements, n as paystack, o as PaystackReconciliationError, p as reconcilePaystackTransaction, q as Subscription, r as PaystackSchemaMigrationFailure, s as PaystackReconciliationSource, t as PaystackPlugin, u as ReconcilePaystackTransactionInput, v as PaystackMetadata, w as getMetadataString, x as createRenewalMetadata, y as createCheckoutMetadata, z as PaystackSubscriptionOperation } from "./index-DE-0F3y6.mjs";
1
+ import { A as ChargeRecurringSubscriptionResult, B as PaystackSubscriptionOperationDecision, C as getMetadataNumber, D as stringifyPaystackMetadata, E as parsePaystackMetadata, F as PaystackPaymentCredential, G as PaystackTransactionResponse, H as PaystackSubscriptionOperationPhase, I as PaystackPlan, J as SubscriptionOptions, K as PaystackWebhookEventRecord, L as PaystackProduct, M as PaystackCustomer, N as PaystackInitializeResult, P as PaystackOptions, R as PaystackSubscription, S as getMetadataBoolean, T as hasPaystackMetadata, U as PaystackSyncResult, V as PaystackSubscriptionOperationHooks, W as PaystackTransaction, _ 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 PaystackClientLike, l as ReconcilePaystackTransactionFailure, m as getOrganizationEntitlements, n as paystack, o as PaystackReconciliationError, p as reconcilePaystackTransaction, q as Subscription, r as PaystackSchemaMigrationFailure, s as PaystackReconciliationSource, t as PaystackPlugin, u as ReconcilePaystackTransactionInput, v as PaystackMetadata, w as getMetadataString, x as createRenewalMetadata, y as createCheckoutMetadata, z as PaystackSubscriptionOperation } from "./index-DWf1Oc9n.mjs";
2
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 PaystackSubscriptionOperation, type PaystackSubscriptionOperationDecision, type PaystackSubscriptionOperationHooks, type PaystackSubscriptionOperationPhase, type PaystackSyncResult, type PaystackTransaction, 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 };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as getMetadataBoolean, c as hasPaystackMetadata, i as createRenewalMetadata, l as parsePaystackMetadata, n as createCheckoutMetadata, o as getMetadataNumber, r as createProrationMetadata, s as getMetadataString, t as PACKAGE_VERSION, u as stringifyPaystackMetadata } from "./version-BW3EZXTR.mjs";
1
+ import { a as getMetadataBoolean, c as hasPaystackMetadata, i as createRenewalMetadata, l as parsePaystackMetadata, n as createCheckoutMetadata, o as getMetadataNumber, r as createProrationMetadata, s as getMetadataString, t as PACKAGE_VERSION, u as stringifyPaystackMetadata } from "./version-DDzS78qH.mjs";
2
2
  import { HIDE_METADATA, defineErrorCodes } from "better-auth";
3
3
  import { APIError, createAuthEndpoint, createAuthMiddleware, getSessionFromCtx, originCheckMiddleware, sessionMiddleware } from "better-auth/api";
4
4
  import { defu } from "defu";
@@ -65,7 +65,7 @@ function createRenewalMetadata(input) {
65
65
  };
66
66
  }
67
67
  // src/version.ts
68
- const PACKAGE_VERSION = "4.0.0";
68
+ const PACKAGE_VERSION = "4.0.2";
69
69
  export { getMetadataBoolean as a, hasPaystackMetadata as c, createRenewalMetadata as i, parsePaystackMetadata as l, createCheckoutMetadata as n, getMetadataNumber as o, createProrationMetadata as r, getMetadataString as s, PACKAGE_VERSION as t, stringifyPaystackMetadata as u };
70
70
 
71
- //# sourceMappingURL=version-BW3EZXTR.mjs.map
71
+ //# sourceMappingURL=version-DDzS78qH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-BW3EZXTR.mjs","names":[],"sources":["../src/metadata.ts","../src/version.ts"],"sourcesContent":["export type PaystackMetadata = Record<string, unknown>;\n\nexport interface CheckoutMetadataInput {\n referenceId: string;\n userId: string;\n plan?: string;\n groupId?: string | null;\n product?: string;\n extra?: PaystackMetadata;\n trial: {\n isTrial: boolean;\n requested: boolean;\n granted: boolean;\n deniedReason?: \"already_used\";\n endsAt?: Date;\n };\n}\n\nexport interface ProrationMetadataInput {\n subscriptionId: string;\n referenceId: string;\n newPlan: string;\n oldPlan: string;\n newSeatCount: number;\n remainingDays: number;\n}\n\nexport interface RenewalMetadataInput {\n subscriptionId: string;\n referenceId: string;\n}\n\nfunction isMetadataRecord(value: unknown): value is PaystackMetadata {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function parsePaystackMetadata(value: unknown): PaystackMetadata {\n if (value === undefined || value === null || value === \"\") return {};\n\n if (typeof value === \"string\") {\n try {\n const parsed: unknown = JSON.parse(value);\n return isMetadataRecord(parsed) ? parsed : {};\n } catch {\n return {};\n }\n }\n\n return isMetadataRecord(value) ? value : {};\n}\n\nexport function stringifyPaystackMetadata(value: unknown): string | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n return JSON.stringify(parsePaystackMetadata(value));\n}\n\nexport function hasPaystackMetadata(value: unknown): boolean {\n return Object.keys(parsePaystackMetadata(value)).length > 0;\n}\n\nexport function getMetadataString(metadata: PaystackMetadata, key: string): string | undefined {\n const value = metadata[key];\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\n\nexport function getMetadataNumber(metadata: PaystackMetadata, key: string): number | undefined {\n const value = metadata[key];\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nexport function getMetadataBoolean(metadata: PaystackMetadata, key: string): boolean {\n const value = metadata[key];\n return value === true || value === \"true\";\n}\n\nexport function createCheckoutMetadata(input: CheckoutMetadataInput): PaystackMetadata {\n return {\n referenceId: input.referenceId,\n userId: input.userId,\n plan: input.plan,\n groupId: input.groupId,\n product: input.product,\n ...input.extra,\n isTrial: input.trial.isTrial,\n trialRequested: input.trial.requested,\n trialGranted: input.trial.granted,\n trialDeniedReason: input.trial.deniedReason,\n trialEnd: input.trial.endsAt?.toISOString(),\n };\n}\n\nexport function createProrationMetadata(input: ProrationMetadataInput): PaystackMetadata {\n return {\n type: \"proration\",\n subscriptionId: input.subscriptionId,\n referenceId: input.referenceId,\n newPlan: input.newPlan,\n oldPlan: input.oldPlan,\n newSeatCount: input.newSeatCount,\n remainingDays: input.remainingDays,\n };\n}\n\nexport function createRenewalMetadata(input: RenewalMetadataInput): PaystackMetadata {\n return {\n type: \"renewal\",\n subscriptionId: input.subscriptionId,\n referenceId: input.referenceId,\n };\n}\n","export const PACKAGE_VERSION = \"4.0.0\"; // x-release-please-version\n"],"mappings":";AAgCA,SAAS,iBAAiB,OAA2C;CACnE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,sBAAsB,OAAkC;CACtE,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ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B,SAAS,MAAM;EACf,SAAS,MAAM;EACf,cAAc,MAAM;EACpB,eAAe,MAAM;CACvB;AACF;AAEA,SAAgB,sBAAsB,OAA+C;CACnF,OAAO;EACL,MAAM;EACN,gBAAgB,MAAM;EACtB,aAAa,MAAM;CACrB;AACF;;AC7GA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"version-DDzS78qH.mjs","names":[],"sources":["../src/metadata.ts","../src/version.ts"],"sourcesContent":["export type PaystackMetadata = Record<string, unknown>;\n\nexport interface CheckoutMetadataInput {\n referenceId: string;\n userId: string;\n plan?: string;\n groupId?: string | null;\n product?: string;\n extra?: PaystackMetadata;\n trial: {\n isTrial: boolean;\n requested: boolean;\n granted: boolean;\n deniedReason?: \"already_used\";\n endsAt?: Date;\n };\n}\n\nexport interface ProrationMetadataInput {\n subscriptionId: string;\n referenceId: string;\n newPlan: string;\n oldPlan: string;\n newSeatCount: number;\n remainingDays: number;\n}\n\nexport interface RenewalMetadataInput {\n subscriptionId: string;\n referenceId: string;\n}\n\nfunction isMetadataRecord(value: unknown): value is PaystackMetadata {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function parsePaystackMetadata(value: unknown): PaystackMetadata {\n if (value === undefined || value === null || value === \"\") return {};\n\n if (typeof value === \"string\") {\n try {\n const parsed: unknown = JSON.parse(value);\n return isMetadataRecord(parsed) ? parsed : {};\n } catch {\n return {};\n }\n }\n\n return isMetadataRecord(value) ? value : {};\n}\n\nexport function stringifyPaystackMetadata(value: unknown): string | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n return JSON.stringify(parsePaystackMetadata(value));\n}\n\nexport function hasPaystackMetadata(value: unknown): boolean {\n return Object.keys(parsePaystackMetadata(value)).length > 0;\n}\n\nexport function getMetadataString(metadata: PaystackMetadata, key: string): string | undefined {\n const value = metadata[key];\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\n\nexport function getMetadataNumber(metadata: PaystackMetadata, key: string): number | undefined {\n const value = metadata[key];\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nexport function getMetadataBoolean(metadata: PaystackMetadata, key: string): boolean {\n const value = metadata[key];\n return value === true || value === \"true\";\n}\n\nexport function createCheckoutMetadata(input: CheckoutMetadataInput): PaystackMetadata {\n return {\n referenceId: input.referenceId,\n userId: input.userId,\n plan: input.plan,\n groupId: input.groupId,\n product: input.product,\n ...input.extra,\n isTrial: input.trial.isTrial,\n trialRequested: input.trial.requested,\n trialGranted: input.trial.granted,\n trialDeniedReason: input.trial.deniedReason,\n trialEnd: input.trial.endsAt?.toISOString(),\n };\n}\n\nexport function createProrationMetadata(input: ProrationMetadataInput): PaystackMetadata {\n return {\n type: \"proration\",\n subscriptionId: input.subscriptionId,\n referenceId: input.referenceId,\n newPlan: input.newPlan,\n oldPlan: input.oldPlan,\n newSeatCount: input.newSeatCount,\n remainingDays: input.remainingDays,\n };\n}\n\nexport function createRenewalMetadata(input: RenewalMetadataInput): PaystackMetadata {\n return {\n type: \"renewal\",\n subscriptionId: input.subscriptionId,\n referenceId: input.referenceId,\n };\n}\n","export const PACKAGE_VERSION = \"4.0.2\"; // x-release-please-version\n"],"mappings":";AAgCA,SAAS,iBAAiB,OAA2C;CACnE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,sBAAsB,OAAkC;CACtE,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI,OAAO,CAAC;CAEnE,IAAI,OAAO,UAAU,UACnB,IAAI;EACF,MAAM,SAAkB,KAAK,MAAM,KAAK;EACxC,OAAO,iBAAiB,MAAM,IAAI,SAAS,CAAC;CAC9C,QAAQ;EACN,OAAO,CAAC;CACV;CAGF,OAAO,iBAAiB,KAAK,IAAI,QAAQ,CAAC;AAC5C;AAEA,SAAgB,0BAA0B,OAAoC;CAC5E,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI,OAAO,KAAA;CAClE,OAAO,KAAK,UAAU,sBAAsB,KAAK,CAAC;AACpD;AAEA,SAAgB,oBAAoB,OAAyB;CAC3D,OAAO,OAAO,KAAK,sBAAsB,KAAK,CAAC,CAAC,CAAC,SAAS;AAC5D;AAEA,SAAgB,kBAAkB,UAA4B,KAAiC;CAC7F,MAAM,QAAQ,SAAS;CACvB,OAAO,OAAO,UAAU,YAAY,UAAU,KAAK,QAAQ,KAAA;AAC7D;AAEA,SAAgB,kBAAkB,UAA4B,KAAiC;CAC7F,MAAM,QAAQ,SAAS;CACvB,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;AAEA,SAAgB,mBAAmB,UAA4B,KAAsB;CACnF,MAAM,QAAQ,SAAS;CACvB,OAAO,UAAU,QAAQ,UAAU;AACrC;AAEA,SAAgB,uBAAuB,OAAgD;CACrF,OAAO;EACL,aAAa,MAAM;EACnB,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,SAAS,MAAM;EACf,GAAG,MAAM;EACT,SAAS,MAAM,MAAM;EACrB,gBAAgB,MAAM,MAAM;EAC5B,cAAc,MAAM,MAAM;EAC1B,mBAAmB,MAAM,MAAM;EAC/B,UAAU,MAAM,MAAM,QAAQ,YAAY;CAC5C;AACF;AAEA,SAAgB,wBAAwB,OAAiD;CACvF,OAAO;EACL,MAAM;EACN,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,SAAS,MAAM;EACf,SAAS,MAAM;EACf,cAAc,MAAM;EACpB,eAAe,MAAM;CACvB;AACF;AAEA,SAAgB,sBAAsB,OAA+C;CACnF,OAAO;EACL,MAAM;EACN,gBAAgB,MAAM;EACtB,aAAa,MAAM;CACrB;AACF;;AC7GA,MAAa,kBAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth-paystack",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Production-ready Paystack billing plugin for Better Auth. Supports subscriptions, one-time payments, organization billing, secure webhooks and more",
5
5
  "keywords": [
6
6
  "africa",
@@ -1,16 +1,18 @@
1
1
  ---
2
2
  name: better-auth-paystack-setup
3
3
  description: >-
4
- Set up better-auth-paystack. Use when installing the Paystack SDK, adding the Better Auth server or client plugin, configuring secrets, or making the first payment in a new app.
4
+ Install and configure Paystack payments in Better Auth. Use for server and browser plugin setup, secret keys, schema setup, and a first test-mode checkout.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Configure better-auth-paystack with Better Auth. Use when adding the paystack() server plugin, paystackClient() client plugin, schema overrides, products/plans, webhook verification, or canonical authClient.paystack/subscription/transaction actions.
11
11
  ---
12
12
 
13
- # Set up Better Auth Paystack
13
+ # Set up Paystack payments with Better Auth
14
+
15
+ Set up `better-auth-paystack` to accept one-time payments or subscriptions in a Node.js app. Wire up the server plugin, browser client, database schema, and Paystack webhook before testing checkout.
14
16
 
15
17
  1. Install `better-auth-paystack`, `better-auth` and `@alexasomba/paystack-node`. Use Node.js 22+, Better Auth `>=1.4.22 <2`, and the Paystack SDK `^1.12.1`.
16
18
  2. On the server, create the SDK with `createPaystack({ secretKey })` and pass it as `paystackClient` to `paystack({ secretKey, paystackClient, ... })`. Load the key from `PAYSTACK_SECRET_KEY`. Use a persistent Better Auth adapter and mount the normal auth handler.
@@ -1,16 +1,18 @@
1
1
  ---
2
2
  name: paystack-billing-flows
3
3
  description: >-
4
- Implement one-time payments, subscription checkout, plan changes, cancellation, and customer billing portals with better-auth-paystack. Use when choosing a billing flow or handling a checkout, scheduled change, or prorated response.
4
+ Build Paystack one-time payments and subscription checkout in Better Auth. Use for plan upgrades, cancellation, billing portals, and scheduled or prorated changes.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Build Paystack transaction and subscription flows with better-auth-paystack. Use for initialize/verify transaction, create/upgrade/cancel/restore/list subscriptions, products/plans, billing portal links, webhooks, reconcilePaystackTransaction, chargeSubscriptionRenewal, syncPaystackProducts, and syncPaystackPlans.
11
11
  ---
12
12
 
13
- # Paystack billing flows
13
+ # Paystack checkout and subscription billing with Better Auth
14
+
15
+ Use one-time checkout for a server-priced product and subscription checkout for recurring plans. Verify the Paystack transaction and match it to the stored order before granting access.
14
16
 
15
17
  - Use `transaction.initialize({ product, callbackURL })` for a fixed one-time purchase. Keep the price on the server. For variable prices, validate the server-side order and reconcile the paid amount and currency before fulfillment.
16
18
  - Use `subscription.create` or `subscription.upgrade` with the configured `plan` name and, for organization billing, `referenceId`. A plan with a Paystack `planCode` uses provider-managed billing. Plans without it use local renewals, and `billingPattern: "local"` can force local billing.
@@ -1,16 +1,18 @@
1
1
  ---
2
2
  name: paystack-catalog-limits
3
3
  description: >-
4
- Configure products, plans, free trials, seat pricing, subscription groups, and resource limits in better-auth-paystack. Use for catalog sync, planCode, freeTrial, seatAmount, limits, or getOrganizationEntitlements.
4
+ Configure the Paystack billing catalog in Better Auth. Use for products, plan codes, free trials, seat pricing, catalog sync, and resource entitlements.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Configure products, Paystack-native plans, local-managed plans, free trials, seat billing, resource limits, and catalog sync in better-auth-paystack. Use when tasks mention planCode, freeTrial, trial eligibility, seatAmount, seatPlanCode, limits, products, syncPaystackProducts, or syncPaystackPlans.
11
11
  ---
12
12
 
13
- # Paystack catalog and limits
13
+ # Paystack products, plans, trials, and seat limits in Better Auth
14
+
15
+ Define what customers can buy, how recurring plans are priced, and which features or limits a subscription grants.
14
16
 
15
17
  - Define one-time items under `products.products` and recurring plans under `subscription.plans`. Use unique names and integer amounts in the currency's minor units. Set `price` for products and `amount` for local plans. Set a Paystack `planCode` for provider-managed plans. Set amount, currency, and interval for local plans.
16
18
  - Use `seatAmount` for local per-seat pricing. Set explicit `limits` and `features` on plans. A reference can have one active or trialing subscription per normalized group. Plans without a group share the default group.
@@ -1,18 +1,20 @@
1
1
  ---
2
2
  name: paystack-client-api
3
3
  description: >-
4
- Call or type the better-auth-paystack browser client. Use for transaction.initialize, verify and list, subscription actions, catalog methods, fetch errors, and the PaystackInitializeResult union.
4
+ Use the Better Auth Paystack browser client for transaction and subscription methods, catalog queries, typed responses, and fetch errors.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Modify or use the better-auth-paystack browser client API. Use for paystackClient(), authClient.paystack, authClient.transaction, authClient.subscription, initializeTransaction, verifyTransaction, listTransactions, listSubscriptions, listProducts, listPlans, subscription billingPortal/manageLink, cancel/restore methods, BetterFetch throw option return types, and legacy disable/enable aliases.
11
11
  ---
12
12
 
13
- # Paystack client calls
13
+ # Paystack browser client API for Better Auth
14
14
 
15
- Register `paystackClient()` from `better-auth-paystack/client`. Call these methods on the Better Auth client:
15
+ The `paystackClient()` plugin exposes typed checkout, verification, subscriptions, and catalog methods on the Better Auth client.
16
+
17
+ Register `paystackClient()` from `better-auth-paystack/client`.
16
18
 
17
19
  | Method | Input or purpose |
18
20
  | -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: paystack-hono
3
+ description: >-
4
+ Integrate Paystack payments with Better Auth in Hono. Use for the Cloudflare Workers API starter, auth routing, checkout verification, and signed webhook delivery.
5
+ license: MIT
6
+ metadata:
7
+ library: better-auth-paystack
8
+ library_version: "4.0.2" # x-release-please-version
9
+ purpose: Mount Better Auth and Paystack in a Hono Worker and check payment routes.
10
+ ---
11
+
12
+ # Paystack payments in Hono with Better Auth
13
+
14
+ 1. For a new Worker, run `npm create better-auth-paystack@latest my-worker -- --template hono`. Follow the generated README. In an existing app, use the [plugin setup](../better-auth-paystack-setup/SKILL.md) with a database adapter supported by the Worker runtime.
15
+ 2. Copy `.dev.vars.example` to `.dev.vars` for local Wrangler development. Use `c.env` for `BETTER_AUTH_SECRET`, `PAYSTACK_SECRET_KEY`, and the configured public `BETTER_AUTH_URL`. Store payment data in a persistent adapter and apply the plugin schema before production use.
16
+ 3. Mount `app.all("/api/auth/*", ...)` and return `auth.handler(c.req.raw)` from the matching route. Keep the request body unread as it passes to Better Auth, including for `POST /api/auth/paystack/webhook`. Apply any JSON parsing to the app's own routes and configure webhook signatures through the [webhooks skill](../paystack-webhooks-events/SKILL.md).
17
+ 4. Use a signed-in client for checkout and verification. When an app route calls `auth.api.verifyTransaction`, forward the incoming request headers to carry the session. Keep catalog sync and renewal jobs in trusted server code. Match the verified reference, amount, currency, and owner to the stored order before fulfillment.
18
+ 5. Run `pnpm typecheck`, `pnpm test`, and `pnpm build` for types, route tests, and a Wrangler dry run. In `pnpm dev`, check `GET /health`, Better Auth sign-in, and a test-mode checkout.
19
+
20
+ [Hono starter](https://github.com/alexasomba/better-auth-paystack/tree/main/examples/hono) · [Better Auth Hono integration](https://better-auth.com/docs/integrations/hono)
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Paystack with Better Auth in Hono"
3
+ short_description: "Paystack payment routes and webhooks in Hono"
4
+ default_prompt: "Use $paystack-hono to add Better Auth and Paystack payment routes to my Hono Worker."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -1,16 +1,16 @@
1
1
  ---
2
2
  name: paystack-local-subscriptions
3
3
  description: >-
4
- Manage local subscriptions in better-auth-paystack. Use for saved payment authorizations, server renewal jobs, seat changes, mid-cycle proration, pending plans, and local-versus-Paystack-managed billing.
4
+ Run app-managed Paystack recurring payments in Better Auth. Use for saved authorizations, renewal jobs, seat changes, mid-cycle proration, and scheduled plan changes.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Implement, debug, or test local-managed subscription behavior in better-auth-paystack. Use for local plans without planCode, saved authorization renewal, chargeSubscriptionRenewal, seat billing, prorateAndCharge, pendingPlan, LOC_ subscription codes, trial transitions, schedule-at-period-end upgrades, and Paystack-managed vs local-managed behavior.
11
11
  ---
12
12
 
13
- # Paystack local subscriptions
13
+ # Paystack recurring payments and local subscription renewals
14
14
 
15
15
  Use a plan without `planCode` for recurring billing controlled by your app. Configure amount, currency, and interval server-side. Verification or webhook reconciliation stores any reusable authorization in the encrypted payment-credential record.
16
16
 
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: paystack-nextjs
3
+ description: >-
4
+ Integrate Paystack checkout and subscriptions with Better Auth in Next.js App Router. Use for auth route handlers, payment callbacks, webhooks, and the OpenNext starter.
5
+ license: MIT
6
+ metadata:
7
+ library: better-auth-paystack
8
+ library_version: "4.0.2" # x-release-please-version
9
+ purpose: Mount Better Auth and Paystack in Next.js and verify checkout from the App Router.
10
+ ---
11
+
12
+ # Paystack payments in Next.js with Better Auth
13
+
14
+ 1. For a new app, run `npm create better-auth-paystack@latest my-app -- --template nextjs`. Follow the generated README. In an existing app, follow [plugin setup](../better-auth-paystack-setup/SKILL.md) and add Paystack to the server auth configuration.
15
+ 2. Keep `BETTER_AUTH_SECRET` and `PAYSTACK_SECRET_KEY` in server environment variables. The starter reads `.env.local` for local Next.js development. Match `BETTER_AUTH_URL` to the app origin. Replace the demo's in-memory adapter with a persistent database and apply the plugin schema before accepting payments.
16
+ 3. Export `GET` and `POST` from `app/api/auth/[...all]/route.ts` with `toNextJsHandler(auth)` from `better-auth/next-js`. The catch-all also receives `POST /api/auth/paystack/webhook`. Preserve the original request body for signature verification. Configure timestamped signing keys using the [webhooks skill](../paystack-webhooks-events/SKILL.md).
17
+ 4. In client components, register `paystackClient()` from `better-auth-paystack/client`. Open `data.url` for a `checkout` result. Use a callback URL on the Better Auth origin and verify the returned reference server-side against the stored order before fulfilling it. See [one-time and subscription checkout](../paystack-billing-flows/SKILL.md).
18
+ 5. Run `pnpm typecheck` and `pnpm build`. With a Paystack test key, check sign-in, checkout initialization, callback verification, and the signature-checked webhook. Use `pnpm preview` to check the Cloudflare runtime when targeting the starter's OpenNext deployment.
19
+
20
+ [Next.js starter](https://github.com/alexasomba/better-auth-paystack/tree/main/examples/nextjs) · [Better Auth Next.js integration](https://better-auth.com/docs/integrations/next)
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Paystack with Better Auth in Next.js"
3
+ short_description: "Paystack checkout and webhooks in Next.js App Router"
4
+ default_prompt: "Use $paystack-nextjs to add Better Auth and Paystack checkout to my Next.js App Router app."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -1,16 +1,18 @@
1
1
  ---
2
2
  name: paystack-organization-billing
3
3
  description: >-
4
- Set up or review organization-scoped Paystack billing in Better Auth. Use for organization.enabled, referenceId, billingRoles, authorizeReference, seat enforcement, team limits, or custom organization entitlements.
4
+ Configure Paystack organization billing in Better Auth. Use for team subscriptions, billing roles, reference authorization, seat limits, and organization entitlements.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Configure organization billing in better-auth-paystack. Use for organization.enabled, Better Auth organization plugin setup, owner/admin default billing authorization, organization.billingRoles, subscription.authorizeReference, organization Paystack customers, seats, invitations, members, and team limits.
11
11
  ---
12
12
 
13
- # Paystack organization billing
13
+ # Paystack organization billing and team subscriptions in Better Auth
14
+
15
+ Bill a team through its Better Auth organization ID and enforce billing permissions and subscription limits on the server.
14
16
 
15
17
  1. Install the Better Auth organization plugin alongside `paystack({ organization: { enabled: true }, ... })`.
16
18
  2. Pass the selected organization ID as `referenceId` on checkout and use the same scope on list requests. The default billing roles are `owner` and `admin`. Configure `organization.billingRoles` for an additional role.
@@ -1,16 +1,16 @@
1
1
  ---
2
2
  name: paystack-schema-migrations
3
3
  description: >-
4
- Generate or migrate the Better Auth schema for better-auth-paystack. Use for the old scoped package, legacy subscription or customer records, encrypted credentials, provider-owned tables, and migratePaystackSubscriptionSchema.
4
+ Generate the Better Auth schema for Paystack or migrate existing billing records. Use for the old scoped package, legacy customer and subscription data, and encrypted credentials.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Modify or review better-auth-paystack database schema behavior. Use for paystackProduct, paystackPlan, paystackTransaction, subscription, user.paystackCustomerCode, organization.paystackCustomerCode/email, Better Auth schema overrides, mergeSchema behavior, migrations, indexes, unique fields, and backward-compatible table or field changes.
11
11
  ---
12
12
 
13
- # Paystack schema and migration
13
+ # Paystack database schema and migrations for Better Auth
14
14
 
15
15
  Generate and apply the Better Auth schema using the app's configured database adapter and plugin options. See the [Better Auth CLI guide](https://www.better-auth.com/docs/concepts/cli).
16
16
 
@@ -1,16 +1,18 @@
1
1
  ---
2
2
  name: paystack-tanstack-start
3
3
  description: >-
4
- Integrate or verify better-auth-paystack in TanStack Start. Use for the auth catch-all route, the cookie plugin, server-only Paystack configuration, demo setup, or the Cloudflare Worker build.
4
+ Integrate Paystack payments with Better Auth in TanStack Start. Use for the auth catch-all route, server-function cookies, the standalone starter, and Cloudflare Workers builds.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Integrate better-auth-paystack in TanStack Start. Use for Better Auth API routes, tanstackStartCookies(), server functions, getRequestHeaders(), authClient Paystack actions, admin billing server functions, and Cloudflare Workers deployment.
11
11
  ---
12
12
 
13
- # Paystack on TanStack Start
13
+ # Paystack payments with Better Auth in TanStack Start
14
+
15
+ Set up checkout and payment verification in a TanStack Start app with server-side Paystack credentials and a mounted Better Auth handler.
14
16
 
15
17
  - Keep the Paystack SDK and secrets in server auth modules. Mount `auth.handler(request)` on both GET and POST in the `/api/auth/$` file route. Add `tanstackStartCookies()` from `better-auth/tanstack-start` last when using Better Auth APIs from Start server functions.
16
18
  - Configure the browser with `better-auth/react` and `paystackClient()`. Use the mounted auth path for checkout and verification. Protect any server functions that grant access or manage billing with a session and an ownership check.
@@ -1,19 +1,21 @@
1
1
  ---
2
2
  name: paystack-testing-fixtures
3
3
  description: >-
4
- Test or troubleshoot better-auth-paystack and its TanStack demo. Use for mock SDK results, Better Auth memory fixtures, webhook signatures, type checks, and focused test commands.
4
+ Test Paystack checkout, webhooks, and billing with Better Auth. Use for SDK mocks, memory-adapter fixtures, signature tests, and TanStack Start checks.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Test better-auth-paystack changes. Use for choosing focused vp test commands, Better Auth test clients, in-memory adapters, mocked Paystack SDK responses, webhook signatures, TanStack example tests, integration tests, type-safety tests, and verification before landing changes.
11
11
  ---
12
12
 
13
- # Paystack testing fixtures
13
+ # Test Paystack payments and webhooks with Better Auth
14
+
15
+ Exercise the same checkout, webhook, and billing paths that the app uses with mocked Paystack responses and a signed-in Better Auth session.
14
16
 
15
17
  - Reuse [the Better Auth memory adapter helper](https://github.com/alexasomba/better-auth-paystack/blob/main/test/helpers/memory-auth.ts) and [Paystack mock result builders](https://github.com/alexasomba/better-auth-paystack/blob/main/test/helpers/paystack-results.ts). Exercise client methods with a signed-in session and realistic SDK inputs and responses.
16
- - Sign the exact webhook request body with HMAC SHA-512 and use the hex digest as `x-paystack-signature`. Cover duplicate events, retryable failures, and mismatched payment amounts or ownership in reconciliation tests.
18
+ - Use the legacy raw-body HMAC fixture for `x-paystack-signature` tests and the timestamped signing-key fixture in `test/payment-integrity.test.ts` for `paystack-signature` tests. Cover duplicate events, retryable failures, and mismatched payment amounts or ownership in reconciliation tests.
17
19
  - Run `vp test run test/paystack.test.ts` for route and plugin behavior, `vp test run test/payment-integrity.test.ts` for reconciliation and webhook races, and `vp test run test/typesafety.test.ts` for the client contract. Include the local subscription, seat billing, or schema migration suites when changing those paths.
18
20
  - For the package, run `vp check`, `vp test run`, `vp pack`, `vp run lint:package`, and `vp run lint:types`. Use the [TanStack Start checks](../paystack-tanstack-start/SKILL.md) when changing demo behavior.
19
21
 
@@ -1,18 +1,20 @@
1
1
  ---
2
2
  name: paystack-webhooks-events
3
3
  description: >-
4
- Configure Paystack webhooks or troubleshoot event processing in better-auth-paystack. Use for x-paystack-signature, charge.success, subscription callbacks, webhook retries, and trusted transaction reconciliation.
4
+ Configure or troubleshoot Paystack webhooks in Better Auth. Use for timestamped and legacy signatures, event retries, and transaction or subscription reconciliation.
5
5
  license: MIT
6
6
  metadata:
7
7
  library: better-auth-paystack
8
- library_version: "4.0.0" # x-release-please-version
8
+ library_version: "4.0.2" # x-release-please-version
9
9
  purpose: >-
10
10
  Implement, debug, or test better-auth-paystack webhook handling. Use for Paystack webhook signatures, secretKey verification, trusted IP checks, charge.success, reconcilePaystackTransaction, subscription.create, subscription.disable, subscription.enable, product quantity updates, subscription status changes, metadata parsing, and event hooks.
11
11
  ---
12
12
 
13
- # Paystack webhooks and reconciliation
13
+ # Verify Paystack webhook signatures and reconcile payments
14
14
 
15
- - Register `/api/auth/paystack/webhook` under the mounted auth base path in the Paystack dashboard. The plugin checks the HMAC SHA-512 of the raw body using `secretKey`, the same Paystack API secret. Preserve the request body through any proxy.
15
+ Register the Better Auth Paystack webhook, verify the signed request body, and reconcile successful charges against the stored order.
16
+
17
+ - Register `/api/auth/paystack/webhook` under the mounted auth base path in the Paystack dashboard. Preserve the exact request body through any proxy. Set `webhook.signingKeys` to map key IDs to signing secrets for timestamped `paystack-signature` deliveries. Deliveries with only the legacy `x-paystack-signature` use the Paystack API secret.
16
18
  - Let the plugin reconcile transaction and subscription state. Use `onEvent` or subscription lifecycle callbacks for app-specific side effects. Make them idempotent using a transaction reference or durable event/business key. Test duplicate, concurrent, and retried deliveries.
17
19
  - Complete a paid order only after verifying its reference, amount, currency, and owner. Keep the product/order binding in server-owned data. A browser return URL or provider event notification alone is insufficient.
18
20
  - Use `reconcilePaystackTransaction(ctx, options, { reference })` from trusted server code for recovery. It verifies the reference with the provider and reports reconciliation status. Authorize any application endpoint that invokes the helper.