The official Node.js/TypeScript SDK for Reevit — a unified payment orchestration platform for Africa.
# Reevit TypeScript SDK
The official Node.js/TypeScript SDK for Reevit — a unified payment orchestration platform for Africa.
## Table of Contents
- Installation
- Quick Start
- Configuration
- Payments
- Create Payment Intent
- Get Payment
- List Payments
- Refund Payment
- Connections
- Create Connection
- List Connections
- Test Connection
- Subscriptions
- Create Subscription
- List Subscriptions
- Fraud Protection
- Get Fraud Policy
- Update Fraud Policy
- Error Handling
- TypeScript Types
- Supported Providers
- Examples
---
## Installation
```bash
npm install @reevit/node@0.9.0
```
Or using yarn:
```bash
yarn add @reevit/node
```
Or using pnpm:
```bash
pnpm add @reevit/node
```
---
## Quick Start
```typescript
import { Reevit } from '@reevit/node';
// Initialize the client
const reevit = new Reevit(
'pfk_live_your_api_key', // Your API key
'org_your_org_id' // Your organization ID
);
// Create a payment
const payment = await reevit.payments.createIntent({
amount: 5000, // 50.00 GHS (amount in smallest currency unit)
currency: 'GHS',
method: 'mobile_money',
country: 'GH',
customer_id: 'cust_123',
}, {
idempotencyKey: 'order_12345',
});
console.log('Payment ID:', payment.id);
console.log('Status:', payment.status);
```
### Server-created checkout sessions
Create checkout sessions on your server, then pass only `session.session_secret` to a browser SDK such as `@reevit/react`, `@reevit/vue`, or `@reevit/svelte`.
```typescript
const session = await reevit.checkoutSessions.create({
amount: 5000,
currency: 'GHS',
method: 'mobile_money',
country: 'GH',
customer_id: 'cust_123',
metadata: { order_id: '12345' },
}, {
idempotencyKey: 'order_12345',
});
console.log(session.session_secret);
```
### Error handling
Node throws `ReevitAPIError` for API and network failures. The error exposes `code`, `status`, `details`, `requestId`, and `recoverable`.
```typescript
import { ReevitAPIError } from '@reevit/node';
try {
await reevit.ch …