better-auth-paystack 4.0.0 → 4.0.1
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 +23 -2
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{index-DE-0F3y6.d.mts → index-Z1gDat7u.d.mts} +2 -2
- package/dist/{index-DE-0F3y6.d.mts.map → index-Z1gDat7u.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{version-BW3EZXTR.mjs → version-C8_utAlN.mjs} +2 -2
- package/dist/{version-BW3EZXTR.mjs.map → version-C8_utAlN.mjs.map} +1 -1
- package/package.json +1 -1
- package/skills/better-auth-paystack-setup/SKILL.md +5 -3
- package/skills/paystack-billing-flows/SKILL.md +5 -3
- package/skills/paystack-catalog-limits/SKILL.md +5 -3
- package/skills/paystack-client-api/SKILL.md +6 -4
- package/skills/paystack-local-subscriptions/SKILL.md +3 -3
- package/skills/paystack-organization-billing/SKILL.md +5 -3
- package/skills/paystack-schema-migrations/SKILL.md +3 -3
- package/skills/paystack-tanstack-start/SKILL.md +5 -3
- package/skills/paystack-testing-fixtures/SKILL.md +6 -4
- package/skills/paystack-webhooks-events/SKILL.md +6 -4
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,24 @@ 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
|
-
##
|
|
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
|
-
|
|
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
|
+
- [Test Paystack payments and webhooks](skills/paystack-testing-fixtures/SKILL.md)
|
|
124
|
+
- [Verify webhook signatures and reconcile payments](skills/paystack-webhooks-events/SKILL.md)
|
|
125
|
+
|
|
126
|
+
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
127
|
|
|
107
128
|
```sh
|
|
108
129
|
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-
|
|
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-Z1gDat7u.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
|
@@ -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.
|
|
691
|
+
declare const PACKAGE_VERSION = "4.0.1";
|
|
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-
|
|
887
|
+
//# sourceMappingURL=index-Z1gDat7u.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Z1gDat7u.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;EACA;EACA;;;UAIW;EACf;IAAS;;EACT;EACA;EACA,cAAc;EACd;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA,aAAa;IACb,WAAW;IACX;IACA;;;KAIQ;EACN;EAAiB;EAA2B;;EAC5C;EAAg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AAuB,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-
|
|
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-Z1gDat7u.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-
|
|
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-C8_utAlN.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.
|
|
68
|
+
const PACKAGE_VERSION = "4.0.1";
|
|
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-
|
|
71
|
+
//# sourceMappingURL=version-C8_utAlN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-
|
|
1
|
+
{"version":3,"file":"version-C8_utAlN.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.1\"; // 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.
|
|
3
|
+
"version": "4.0.1",
|
|
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
|
-
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
-
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
-
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
13
|
+
# Paystack browser client API for Better Auth
|
|
14
14
|
|
|
15
|
-
|
|
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
|
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: paystack-local-subscriptions
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: paystack-organization-billing
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
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
|
-
-
|
|
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
|
|
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.
|
|
8
|
+
library_version: "4.0.1" # 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
|
|
13
|
+
# Verify Paystack webhook signatures and reconcile payments
|
|
14
14
|
|
|
15
|
-
|
|
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.
|