Skip to main content

What is the Paystack TypeScript SDK?

The Paystack TypeScript SDK (@efobi/paystack) is a modern, type-safe client library for integrating Paystack payment services into your TypeScript and JavaScript applications. Built with developer experience in mind, it provides a clean, intuitive interface for working with the Paystack API across any JavaScript runtime.
This SDK is actively under development. Check the API Coverage section to see which endpoints are currently available.

Key Features

The SDK is designed to provide a superior developer experience while maintaining robust functionality:

Type-Safe

Full TypeScript support with strict typing. Get IntelliSense autocomplete and catch errors at compile time.

Platform-Agnostic

Works seamlessly in Node.js, Bun, Deno, browsers, and edge runtimes like Cloudflare Workers.

Runtime Validation

Built-in input and output validation using Zod schemas ensures data integrity at runtime.

Modern API

Clean, promise-based interface that follows modern JavaScript best practices.

Lightweight

Minimal dependencies keep your bundle size small. Only peer dependency is Zod.

Secure

Built-in API key validation and secure webhook signature verification using Web Crypto API.

Use Cases

The Paystack SDK is perfect for:
  • E-commerce platforms - Accept payments, manage customers, and handle subscriptions
  • SaaS applications - Implement recurring billing and subscription management
  • Payment gateways - Build custom payment flows with full control
  • Fintech applications - Create transfers, verify accounts, and manage virtual accounts
  • Marketplaces - Handle split payments and manage subaccounts
  • Serverless functions - Process webhooks and verify transactions in edge runtimes

API Coverage

The SDK currently supports the following Paystack APIs:

Fully Implemented

  • Transactions - Initialize, verify, list, and charge transactions
  • Transaction Split - Create and manage split payment configurations
  • Dedicated Virtual Accounts - Create and manage virtual bank accounts
  • Transfer Recipients - Create and manage transfer recipients
  • Transfers - Send money to recipients and manage transfers
  • Verification - Verify bank accounts, card BINs, and more
  • Miscellaneous - Access banks, countries, and states
  • Terminal & Virtual Terminal
  • Customers & Customer Management
  • Direct Debit
  • Apple Pay
  • Subaccounts
  • Plans & Subscriptions
  • Products & Payment Pages
  • Payment Requests
  • Settlements
  • Transfers Control
  • Bulk Charges
  • Integration Settings
  • Charge API
  • Disputes & Refunds

How It Works

The SDK follows a simple, consistent pattern across all API modules:
1

Initialize the SDK

Create a new Paystack instance with your secret key:
import { Paystack } from '@efobi/paystack';

const paystack = new Paystack('sk_test_your_secret_key_here');
2

Call API methods

Access API modules through the main instance:
const result = await paystack.transaction.initialize({
  email: 'customer@email.com',
  amount: '50000' // Amount in kobo (₦500.00)
});
3

Handle responses

All methods return an object with data and error properties:
if (result.error) {
  console.error('Validation error:', result.error.flatten());
} else if (result.data) {
  console.log('Success:', result.data);
}

Why Choose This SDK?

Developer Experience

TypeScript-first design means you get autocomplete, type checking, and inline documentation in your IDE.

Runtime Safety

Zod validation catches invalid data before it reaches the API, providing clear error messages.

Universal Compatibility

One codebase works everywhere - from Node.js servers to Cloudflare Workers to React Native apps.

Modern Standards

Uses Web Crypto API for webhook verification, ensuring compatibility with modern runtimes.

Next Steps

Get Help

Need assistance or want to contribute?