API Documentation

Wenacy inakupa API mbili tu muhimu: kuanzisha malipo na kuangalia hali. Tuma API key yako kwenye header ya x-api-key.

1. Anzisha malipo

POST /api/public/v1/charge

curl -X POST https://your-domain/api/public/v1/charge \
  -H "Content-Type: application/json" \
  -H "x-api-key: wen_live_xxx" \
  -d '{
    "amount": 5000,
    "phone": "255712345678",
    "reference": "ORDER-1001",
    "description": "Malipo ya oda",
    "callback_url": "https://yourapp.com/webhook"
  }'
{
  "success": true,
  "reference": "ORDER-1001",
  "transaction_id": "…",
  "status": "pending",
  "amount": 5000
}

2. Angalia hali ya muamala

GET /api/public/v1/status?reference=ORDER-1001

curl "https://your-domain/api/public/v1/status?reference=ORDER-1001" \
  -H "x-api-key: wen_live_xxx"
{
  "success": true,
  "reference": "ORDER-1001",
  "status": "success",
  "amount": 5000,
  "paid_at": "2026-01-04T10:22:00Z"
}

3. Webhook

Mzalendo Pay hutuma taarifa kwenye /api/public/v1/webhook. Baada ya muamala kufanikiwa, salio lako huongezeka moja kwa moja na tunapiga callback_url yako.

{
  "reference": "ORDER-1001",
  "status": "success",
  "amount": 5000,
  "provider_reference": "MZP123456"
}

Hali za muamala

  • pending — inasubiri mteja kulipa
  • success — malipo yamekamilika
  • failed — malipo yameshindikana