The open-source React Native SDK for African mobile money & open banking APIs (MTN MoMo adapter first)
# OpenBank Africa SDK
> The open-source React Native SDK for African mobile money & open banking APIs.
**First adapter:** MTN Mobile Money (MoMo) API — Rwanda, with an architecture ready to add Airtel Money and banks later.
## Status
✅ **Collections** — Request to Pay, transaction status, balance. Validated end-to-end against the real MTN sandbox.
✅ **Disbursements** — Transfer, transfer status, balance, account-holder validation.
See `docs/spec.md` for the full technical spec (architecture, endpoints, types, checklist).
> **Upgrading from 0.2.x?** The config changed shape. Per-product credentials now live under `products.*` because Collections and Disbursements are separate subscriptions in the MoMo portal, each with its own primary key. See Migrating from 0.2.x.
## Requirements
- Node.js 18+ (needs global `fetch`), or a React Native runtime with `fetch`/`AbortController` available (0.71+).
- No runtime dependencies — the SDK ships with none, so it doesn't add anything to your dependency tree.
## Installation
```bash
npm install openbank-africa-sdk
```
## Usage
Collections and Disbursements are **separate product subscriptions** in the MoMo portal, each issuing its own primary key. Configure the ones you use — at least one is required.
```typescript
import { OpenBankClient } from 'openbank-africa-sdk';
const client = new OpenBankClient({
adapter: 'mtn-momo',
environment: 'sandbox',
callbackHost: '
my-app.com',
products: {
collections: { subscriptionKey: process.env.MTN_COLLECTIONS_KEY ?? '' },
disbursements: { subscriptionKey: process.env.MTN_DISBURSEMENTS_KEY ?? '' },
},
});
await client.authenticate(); // authenticates every configured product
```
### Collections — charge a user
```typescript
const payment = await client.collections.requestToPay({
amount: 5000,
currency: 'RWF',
phoneNumber: '250788123456', // the party being charged
externalId: 'order-123',
payerMessage: 'Payment for order #123',
});
const status = await cli …