Developer Integration Guide

Our API is designed to be intuitive and consistent across payment rails. Follow the examples below to get started quickly.

1. Obtain your API key

Once you've registered and your account is verified, log into your dashboard and generate a set of public and secret keys. Use the secret key in the Authorization header of every request.

# Retrieve an access token with your credentials
curl -X POST https://api.monopay.ls/v1/auth/token 
  -u YOUR_PUBLIC_KEY:YOUR_SECRET_KEY 
  -d "grant_type=client_credentials"

2. Make a payment

Initiate a mobile money payment using our REST API. Change the payment_method to eft or card for other rails.

POST /v1/payments HTTP/1.1
Host: api.monopay.ls
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "amount": 100.00,
  "currency": "LSL",
  "payment_method": "mpesa",
  "merchant_id": "MERCHANT-001",
  "customer": {
    "phone": "+26650123456",
    "name": "Lerato Mokoena"
  },
  "reference": "INV-1001",
  "callback_url": "https://yourapp.com/webhooks/monopay"
}

3. Receive payment notifications

MonoPay notifies your app of payment events via HTTPS webhooks. Validate the signature header and update your records accordingly.

// Verify a webhook signature in C# (.NET)
[ApiController]
[Route("api/webhooks/monopay")]
public class MonopayWebhookController : ControllerBase
{
    [HttpPost]
    public async Task Receive([FromBody] JObject payload)
    {
        var signature = Request.Headers["X-Monopay-Signature"];
        bool valid = WebhookVerifier.Verify(payload.ToString(), signature, "YOUR_WEBHOOK_SECRET");
        if (!valid)
        {
            return Unauthorized();
        }
        // TODO: process the event
        return Ok();
    }
}

Need more examples?

Visit our full documentation for SDK guides in C#, JavaScript and Python, or explore our interactive sandbox to test API calls without writing any code.

View Documentation Open Sandbox