# Kenya

| | |
|---|---|
| Currency | `KES` |
| Country code | `KE` (the default. You don't need to send `country`) |
| Phone format | `2547XXXXXXXX`, `2541XXXXXXXX`, `07XXXXXXXX` or `01XXXXXXXX` |

## Collect

| Method | Endpoint | Guide |
|---|---|---|
| M-Pesa STK Push | `POST /payment/mpesa-stk-push/` | [Guide](https://developers.intasend.com/guides/collections/mpesa-stk-push/) |
| Checkout (M-Pesa, card, Apple Pay, Google Pay, PesaLink) | `POST /checkout/` | [Guide](https://developers.intasend.com/guides/collections/checkout/) |
| Customer account numbers (bank or paybill) | `POST /payment/create_customer_reference/` | [Guide](https://developers.intasend.com/guides/collections/bank-deposits/) |
| Co-op agent deposit | `POST /payment/coop-agent-deposit/` | [Guide](https://developers.intasend.com/guides/collections/bank-deposits/#co-op-bank-agent-deposits) |

### M-Pesa STK Push

```bash
curl -X POST https://api.intasend.com/api/v1/payment/mpesa-stk-push/ \
  -H "Authorization: Bearer $INTASEND_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 100,
  "phone_number": "254712345678",
  "api_ref": "order-123"
}'
```

## Send money

| `provider` | Pays to | Required fields | Limits |
|---|---|---|---|
| `MPESA-B2C` | M-Pesa phone | `account` | Min KES 10 |
| `MPESA-B2B` | Till / paybill | `account`, `account_type`, `account_reference` (paybill) | Whole shillings |
| `PESALINK` | Bank (instant) | `account`, `bank_code` | KES 100 to 999,999 |
| `RTGS` | Bank (high value) | `account`, `bank_code`, `name` | Min KES 100 |
| `EFT` | Bank | `account`, `bank_code`, `name` | Min KES 100 |
| `AIRTIME` | Airtime | `account` (phone) | Live only |
| `KPLC` | Prepaid electricity token | `account` (meter), `notify_phone` | |
| `INTASEND` | IntaSend account | `account` | |

### M-Pesa (B2C)

```bash
curl -X POST https://api.intasend.com/api/v1/send-money/initiate/ \
  -H "Authorization: Bearer $INTASEND_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "currency": "KES",
  "provider": "MPESA-B2C",
  "requires_approval": "NO",
  "callback_url": "https://example.com/intasend/payouts",
  "transactions": [
    {
      "name": "Jane Doe",
      "account": "254712345678",
      "amount": "150",
      "narrative": "Salary"
    }
  ]
}'
```

### Till and paybill (B2B)

```bash
curl -X POST https://api.intasend.com/api/v1/send-money/initiate/ \
  -H "Authorization: Bearer $INTASEND_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "currency": "KES",
  "provider": "MPESA-B2B",
  "transactions": [
    {
      "account": "888880",
      "account_type": "PayBill",
      "account_reference": "12345678",
      "amount": "500",
      "narrative": "Bill"
    },
    {
      "account": "174379",
      "account_type": "TillNumber",
      "amount": "200",
      "narrative": "Stock"
    }
  ]
}'
```

### Bank (PesaLink)

Get `bank_code` from [`GET /send-money/bank-codes/ke/`](https://developers.intasend.com/guides/send-money/validate-accounts/#bank-codes). Use `RTGS` above KES 999,999.

```bash
curl -X POST https://api.intasend.com/api/v1/send-money/initiate/ \
  -H "Authorization: Bearer $INTASEND_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "currency": "KES",
  "provider": "PESALINK",
  "transactions": [
    {
      "name": "John Doe",
      "account": "0123456789012",
      "bank_code": "68",
      "amount": "1000",
      "narrative": "Invoice 22"
    }
  ]
}'
```

Some bank routes need an [OTP confirmation](https://developers.intasend.com/guides/send-money/approval-and-otp/#otp-confirmation) per transaction.

### KPLC tokens

```bash
curl -X POST https://api.intasend.com/api/v1/send-money/initiate/ \
  -H "Authorization: Bearer $INTASEND_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "currency": "KES",
  "provider": "KPLC",
  "transactions": [
    {
      "account": "37123456789",
      "amount": "500",
      "notify_phone": "254712345678"
    }
  ]
}'
```

### Validate before paying

M-Pesa, till/paybill and PesaLink accounts can be looked up first:

```bash
curl -X POST https://api.intasend.com/api/v1/send-money/validate-accounts/ \
  -H "Authorization: Bearer $INTASEND_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "provider": "MPESA-B2B",
  "account": "888880",
  "account_type": "PayBill"
}'
```
