@noelzappy/voltax
v0.1.0
Published
Voltax Node.js SDK for unified payment gateway integration
Downloads
354
Readme
@noelzappy/voltax
The Unified Payment SDK for Africa.
Voltax unifies fragmented African payment gateways (Paystack, Hubtel, Flutterwave, etc.) into a single, standardized, and strictly typed API. Build faster, switch providers easily, and maintain less code.
Features
- 🛡 Strictly Typed: Built with TypeScript + Zod for runtime validation.
- 🔗 Standardized API: One interface (
VoltaxProvider) for all gateways. - 🔄 Adapter Pattern: Swap providers without rewriting business logic.
- ⚡ Lightweight: Tree-shakeable, ESM & CJS support.
- 🔒 Secure: No hardcoded keys, enforced checks.
Installation
npm install @noelzappy/voltaxpnpm add @noelzappy/voltaxyarn add @noelzappy/voltaxQuick Start
Single Provider (Recommended)
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: '[email protected]',
currency: Currency.NGN,
reference: `order-${Date.now()}`,
callbackUrl: 'https://yoursite.com/callback',
});
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
import { VoltaxAdapter, Currency } from '@noelzappy/voltax';
// Initialize multiple providers at once
const voltax = new VoltaxAdapter({
paystack: { secretKey: process.env.PAYSTACK_SECRET_KEY! },
hubtel: {
clientId: process.env.HUBTEL_CLIENT_ID!,
clientSecret: process.env.HUBTEL_CLIENT_SECRET!,
merchantAccountNumber: process.env.HUBTEL_MERCHANT_ACCOUNT!,
},
});
// Use any configured provider
await voltax.paystack.initiatePayment({ ... });
await voltax.hubtel.initiatePayment({ ... });Documentation
For full documentation, visit voltax.noelzappy.dev.
License
MIT © noelzappy
