Skip to content

API — Billing


Forfaits

GET /api/v1/forfaits

Liste des forfaits disponibles (public, sans auth).

bash
curl https://api-rgz.duckdns.org/api/v1/forfaits

Réponse 200:

json
{
  "items": [
    {
      "id": "uuid",
      "name": "Forfait Journalier",
      "price_fcfa": 500,
      "duration_hours": 24,
      "data_limit_mb": 500,
      "cir_kbps": 512,
      "mir_kbps": 2048
    }
  ],
  "total": 5, "page": 1, "pages": 1
}

Paiements KKiaPay

POST /api/v1/payments/initiate

Initier un paiement mobile (MTN MoMo, Moov Flooz, Wave Benin, Celtiis Cash).

bash
curl -X POST -H "Authorization: Bearer $JWT" \
  https://api-rgz.duckdns.org/api/v1/payments/initiate \
  -d '{"forfait_id": "uuid", "provider": "MTN_MOMO"}'

Réponse 201:

json
{
  "payment_url": "https://kkiapay.me/pay/...",
  "transaction_id": "uuid"
}

POST /api/v1/payments/webhook

Callback KKiaPay (appelé par KKiaPay, pas par le frontend).

Header requis: x-kkiapay-secret: [KKIAPAY_SECRET]

Réponse 200: {"status": "processed"}

GET /api/v1/payments/{id}/status

bash
curl -H "Authorization: Bearer $JWT" \
  https://api-rgz.duckdns.org/api/v1/payments/{id}/status

Réponse 200:

json
{"status": "completed", "amount_fcfa": 5000, "provider": "MTN_MOMO"}

Vouchers

POST /api/v1/vouchers/generate

Générer des vouchers (admin uniquement).

bash
curl -X POST -H "Authorization: Bearer $ADMIN_JWT" \
  https://api-rgz.duckdns.org/api/v1/vouchers/generate \
  -d '{"n": 50, "forfait_id": "uuid", "reseller_id": "uuid"}'

Réponse 201:

json
{
  "items": [
    {"code": "ABC12345", "forfait_id": "uuid", "status": "active"}
  ],
  "total": 50
}

Billing Summary

GET /api/v1/billing/summary

bash
curl -H "Authorization: Bearer $JWT" \
  "https://api-rgz.duckdns.org/api/v1/billing/summary?reseller_id={id}&month=2026-02"

Réponse 200:

json
{
  "month": "2026-02",
  "total_fcfa": 450000,
  "split": {
    "reseller_fcfa": 218250,
    "rgz_fcfa": 218250,
    "kkiapay_fee_fcfa": 6750
  },
  "sessions_count": 312
}

Dernière mise à jour: 2026-02-21

PROJET MOSAÏQUE — 81 outils, 22 conteneurs, 500+ revendeurs WiFi Zone