Payment-africa is a TypeScript/JavaScript library that lets you accept payments through Paystack and Flutterwave, two of the most widely-used payment providers in Africa, using one consistent, well-typed API.
# payment-africa — Developer Documentation
A plain-language guide to everything the library does and how to use it.
---
## Table of Contents
1. What this library is
2. Before you start
3. Installation
4. A note on amounts — read this first
5. Basic setup
6. Collecting a payment (Paystack)
7. Collecting a payment (Flutterwave)
8. Using both providers at once
9. Verifying a payment
10. Checking that the right amount was paid
11. Preventing duplicate fulfilment
12. Issuing refunds
13. Webhooks — getting notified when a payment happens
14. Understanding errors
15. Logging
16. Configuration reference
17. TypeScript types reference
18. Frequently asked questions
---
## 1. What this library is
`payment-africa` is a TypeScript/JavaScript library that lets you accept payments through **Paystack** and **Flutterwave** — two of the most widely-used payment providers in Africa — using one consistent, well-typed API.
Without this library you would need to:
- Read and implement two separate API documentations.
- Handle two different response shapes, status names, error formats, and signature styles.
- Build your own retry logic, idempotency handling, and amount-verification separately for each.
With `payment-africa` you write your code once. The library handles all the differences under the hood.
**What you can do with it:**
| Feature | What it means |
| ----------------------- | -------------------------------------------------------------------------------------------- |
| Initialize a payment | Create a payment session and get a URL to send the customer to |
| Verify a payment | Confirm a payment actually happened — server-side, not just based on the customer's callback |
| Refund a payment | Send money back to the customer |
| Receive webhooks | Get notified …