Unofficial: A custom Node.js SDK for Reloadly API, supporting Airtime, GiftCards, and Utility Payments with TypeScript type-safety and per-service token management.
npm install reloadly-node!npm version
!npm downloads
!license
!CI
!codecov
!typescript
A Node.js SDK for the Reloadly API, providing type-safe access to Airtime, Gift Cards, and Utility Payments with automatic OAuth token management.
---
- Per-Service Token Management
Each Reloadly service (Airtime, Gift Cards, Utilities) uses its own OAuth audience, preventing token conflicts and INVALID_TOKEN errors.
- Single Entry Point for All Services
Access all Reloadly services from a single client instance.
- Automatic Token Refresh
OAuth tokens are refreshed automatically when expired.
- Environment-Aware Configuration
Seamlessly switch between sandbox and production environments.
- Reusable HTTP Client
All requests automatically include:
- Authorization: Bearer
- Correct Accept headers per service
- JSON content handling
- Full TypeScript Support
Strongly typed request and response models.
- Broad API Coverage
- Airtime: Balance, Top-ups, Operators, FX Rates, Promotions, Transactions, MNP Lookup
- Gift Cards: Balance, Categories, Products, Discounts, Orders, Transactions
- Utility Payments: Billers, Payments, Balance, Transactions
- Extensible Architecture
New services or endpoints can be added without modifying the core client.
---
- Node.js >= 18
---
``bash`
npm install reloadly-node
or
`bash`
pnpm install reloadly-node
---
You need Reloadly API credentials:
- RELOADLY_CLIENT_IDRELOADLY_CLIENT_SECRET
-
These can be obtained from the Reloadly dashboard.
---
`ts
import { Reloadly } from 'reloadly-node';
const reloadly = new Reloadly({
clientId: process.env.RELOADLY_CLIENT_ID!,
clientSecret: process.env.RELOADLY_CLIENT_SECRET!,
environment: 'sandbox', // or 'production'
});
// Airtime
const airtimeBalance = await reloadly.airtime.getBalance();
console.log('Airtime Balance:', airtimeBalance);
// Gift Cards
const products = await reloadly.giftcards.getProducts();
console.log('Gift Card Products:', products);
// Utility Payments
const billers = await reloadly.utilityPayments.getBillers();
console.log('Utility Billers:', billers);
`
---
The SDK exposes typed error classes for consistent error handling.
`ts
import { ReloadlyAPIError, ReloadlyNetworkError } from 'reloadly-node';
try {
await reloadly.airtime.getBalance();
} catch (error) {
if (error instanceof ReloadlyAPIError) {
console.error('API Error:', error.status, error.data);
} else if (error instanceof ReloadlyNetworkError) {
console.error('Network Error:', error.originalError);
} else {
console.error('Unexpected Error:', error);
}
}
``
---
- Reloadly API Reference: https://www.reloadly.com/developers
---
MIT