A polyglot open-source payment SDK designed to unify African payment infrastructure.
# ⚡ Voltax
**The Unified Payment SDK for Africa**
Documentation · Report Bug · Request Feature
---
## Why Voltax?
Building payment systems in Africa means dealing with multiple payment gateways, each with its own API, documentation, and quirks. **Voltax** solves this by providing:
- 🔌 **One Interface, Multiple Gateways** - Write once, accept payments from Paystack, Flutterwave, Hubtel, and more
- 🛡️ **Type-Safe** - Built with TypeScript and Zod for runtime validation
- 🔄 **Easy Provider Switching** - Change payment providers without rewriting your code
- ⚡ **Lightweight** - Tree-shakeable, ESM & CJS support
- 🧪 **Well Tested** - Comprehensive test coverage
## Supported Payment Gateways
| Gateway | Countries | Status |
|---------|-----------|--------|
| Paystack | Nigeria, Ghana, South Africa, Kenya | ✅ Ready |
| Flutterwave | Nigeria, Ghana, Kenya, South Africa + | ✅ Ready |
| Hubtel | Ghana | ✅ Ready |
| More coming... | — | Contribute! |
## Installation
```bash
npm install @noelzappy/voltax
```
```bash
pnpm add @noelzappy/voltax
```
```bash
yarn add @noelzappy/voltax
```
## Quick Start
### Single Provider (Recommended)
```typescript
import { Voltax, Currency, PaymentStatus } from '@noelzappy/voltax';
// Initialize a single provider
const paystack = Voltax('paystack', {
secretKey: process.env.PAYSTACK_SECRET_KEY!,
});
// Initiate a payment
const payment = await paystack.initiatePayment({
amount: 5000,
email: 'customer@example.com',
currency: Currency.NGN,
reference: `order-${Date.now()}`,
callbackUrl: '
yoursite.com',
});
console.log(payment.authorizationUrl);
// Redirect customer to complete payment
// Verify the payment
const result = await paystack.verifyTransaction(payment.reference);
if (result.status === PaymentStatus.SUCCESS) {
console.log('Payment successful!');
}
```
### Multiple Providers
```typescript
import { VoltaxAdapter, Currency } from '@noelzappy/voltax';
// Initialize multiple providers at once
const v …