> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudpay.africa/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudpay

> Collect, pay out and settle across Kenya with one integration.

Cloudpay is payments infrastructure for businesses in Africa. It covers three things:

* **Collect.** Take payments by M-Pesa, Airtel Money, T-Kash and card.
* **Pay out.** Send money to phones, banks, tills and paybills.
* **Settle.** Move your balance to your own account.

Every shilling goes through a double-entry ledger, and the database itself keeps that ledger balanced.

> [card] [Quickstart](https://docs.cloudpay.africa/quickstart.md)
>
> Collect your first payment in five minutes with a test key.

> [card] [Environments](https://docs.cloudpay.africa/environments.md)
>
> Test and live keys, what's real in Development, and how to go live.

> [card] [Test your integration](https://docs.cloudpay.africa/testing.md)
>
> Twelve scenarios to run, and the go-live checklist.

> [card] [Rails and networks](https://docs.cloudpay.africa/guides/rails.md)
>
> M-Pesa, Airtel Money, T-Kash and cards: which provider does what.

> [card] [Collect payments](https://docs.cloudpay.africa/guides/collections.md)
>
> M-Pesa prompts, other networks and card checkout.

> [card] [Pay out](https://docs.cloudpay.africa/guides/payouts.md)
>
> Phones, banks, tills and paybills, one at a time or in bulk.

> [card] [Errors](https://docs.cloudpay.africa/errors/overview.md)
>
> Every error code, what causes it and what to do.

> [card] [API reference](https://docs.cloudpay.africa/api-reference/merchant-rails/collect-from-a-payer-on-the-merchants-collection-rail.md)
>
> Every endpoint, with request and response schemas.

## How an integration fits together

**1. Get keys**

Cloudpay issues your business a test key (`sk_test_…`) and, after verification, a live key (`sk_live_…`). An owner can also create keys in the dashboard under **API keys**.

**2. Create a payment**

`POST` a collection or payout with an `idempotency_key`. The response comes back at once with `status: initiated` or `pending`.

**3. Wait for the rail**

Payments are asynchronous: the customer has to approve the prompt on their phone, or the bank has to confirm. Poll the payment until it reaches a final status. See [Payment lifecycle](https://docs.cloudpay.africa/concepts/lifecycle.md).

**4. Handle errors by code**

Every failure carries a stable `errors.code`. Branch on that code, never on the message. See [Errors](https://docs.cloudpay.africa/errors/overview.md).

## Base URL

```text theme={null}
https://api.cloudpay.africa/cloudpay
```

Every path in these docs goes after this base, for example `https://api.cloudpay.africa/cloudpay/v1/merchants/{id}/collections`. Keep it in one setting (`CLOUDPAY_API`) rather than in each call.

Test and live share this one URL. **The key decides the environment.** Every response carries `X-CloudPay-Environment: test` or `live`, so you can always check which environment answered.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.