Create MTN MoMo charge
Create MTN MoMo charge
Aperçu
Create MTN MoMo charge
Initiates an MTN Mobile Money RequestToPay. With a test API key the transaction completes in the ledger without calling the MTN sandbox.
Quand l’utiliser
Utilisez cet endpoint quand vous devez exécuter POST /charge/mtn (Create MTN MoMo charge).
Authentification
Les routes marchandes nécessitent une clé API dans l’en-tête X-API-KEY (voir Vue d’ensemble). Utilisez une clé test avec https://sandbox.api.lomi.africa et une clé live avec https://api.lomi.africa.
Endpoint
POST /charge/mtn
URLs de base :
https://sandbox.api.lomi.africahttps://api.lomi.africa
Requête
Paramètres d’URL
Pas d’autre paramètre dans l’URL.
Paramètres de requête
Aucun paramètre de requête.
En-têtes
| Nom | Emplacement | Obligatoire | Schéma | Description |
|---|---|---|---|---|
Lomi-Account | header | Non | - | Optional lomi. Network account id (acct_...). When present, the API key acts as the Operator and the request targets the connected Member Account. |
Corps de la requête
Corps JSON.
Schéma: CreateMtnChargeDto
| Champ | Obligatoire | Type | Description |
|---|---|---|---|
amount | Oui | number | - |
currency | Oui | string | - |
organizationId | Non | string | - |
merchantId | Non | string | - |
customer | Oui | CustomerDto | - |
description | Non | string | - |
countryCode | Non | string | - |
productId | Non | string | - |
subscriptionId | Non | string | - |
quantity | Non | number | - |
Exemple de corps :
{
"amount": 1000,
"currency": "XOF",
"customer": {
"name": "...",
"phoneNumber": "..."
}
}Réponses
| Statut | Description |
|---|---|
201 | MTN charge initiated |
Erreurs
Les erreurs suivent un format JSON standard. 401 : clé manquante ou invalide. 404 : ressource introuvable. 429 : trop de requêtes. Pour les créations, envoyez une clé d’idempotence si votre flux le permet.
Exemple
curl -sS -X POST "https://sandbox.api.lomi.africa/charge/mtn" \
-H "X-API-KEY: $LOMI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"amount":1000,"currency":"XOF","customer":{"name":"...","phoneNumber":"..."}}'OpenAPI
- operationId:
ChargesController_createMtnCharge - Operation:
POST /charge/mtn
Schémas complets et Try it : référence API.