Packages@g14o/paystack
Overview
Typed Paystack REST SDK with Zod validation, retries, and webhook verification.
Typed Paystack REST SDK with Zod-validated responses, retries, and webhook verification.
Installation
pnpm add @g14o/paystack zodQuick usage
import { Paystack } from "@g14o/paystack";
import { env } from "@/lib/env";
const paystack = new Paystack({
secretKey: env.PAYSTACK_SECRET_KEY,
});// Start hosted checkout
const checkout = await paystack.transactions.initialize({
email: "user@example.com",
amount: 1500,
currency: "GHS",
});
// Create customer
const customer = await paystack.customers.create({
email: "user@example.com",
first_name: "Ada",
last_name: "Lovelace",
});Features
- Typed API client for customers, transactions, plans, and subscriptions
- Zod-validated responses
- Retries with exponential backoff
- Timeout and rate-limit handling
- Structured error types
Better Auth integration
For Better Auth billing (checkout, subscriptions, webhooks, DB sync), see @g14o/paystack-better-auth.
pnpm add @g14o/paystack @g14o/paystack-better-auth better-auth zod