g14o
Packages@g14o/paystack-better-auth

API Reference

Paystack Better Auth plugin options.

Options

OptionTypeDescription
checkout?object

One-time checkout lifecycle hooks.

Default: undefined
createCustomerOnSignUp?boolean | undefined

Create a Paystack customer automatically when a user signs up.

Default: undefined (optional)
disablePaymentPersistence?boolean | undefined

Skip persisting one-time payment records to the database (useful for tests).

Default: undefined (optional)
disableWebhookPersistence?boolean | undefined

Skip persisting webhook payloads to the database (useful for tests).

Default: undefined (optional)
getCustomerCreateParams?function

Customize Paystack customer fields before creation.

onCustomerCreate?function

Called after a Paystack customer is created for a user.

onEvent?function

Called for every verified Paystack webhook event.

paystackClientobject

The Paystack client to use for authentication.

schema?object

The schema for the Paystack plugin.

Default: undefined
subscription?{ enabled: false; } | ({ enabled: true; } & PaystackSubscriptionOptions) | undefined

Subscription billing configuration and lifecycle hooks.

Default: undefined

Subscription options

OptionTypeDescription
enabled?boolean | undefined

Enable subscription billing.

Default: false
onSubscriptionCancel?function

Fires when a subscription is cancelled (including at period end).

onSubscriptionComplete?function

Fires after the first successful payment completes a subscription checkout.

onSubscriptionCreated?function

Fires when Paystack sends subscription.create.

onSubscriptionDeleted?function

Fires when a subscription is permanently deleted/disabled.

onSubscriptionUpdate?function

Fires on subscription status changes from webhooks or API sync.

plans?SubscriptionPlan[] | function

Subscription plans exposed for checkout. Pass a static array of SubscriptionPlan definitions, or an async function that returns plans at runtime (for dynamic pricing or entitlements).

Each SubscriptionPlan is either auto-created or pre-created:

  • Auto-created — provide name, amount, currency, and interval. The plugin creates or reuses matching Paystack plans when a customer subscribes. Optionally set annualDiscountedAmount for a discounted annual billing variant.
  • Pre-created — provide name and planCode to reference an existing Paystack plan. Optionally set annualDiscountedPlanCode for annual billing. Do not include billing fields (amount, currency, interval) when using planCode.

Checkout options

OptionTypeDescription
onCheckoutComplete?function

Fires after a successful one-time checkout payment (charge.success without subscription).

On this page