Prérequis
Avant de commencer, assurez-vous d’avoir :
Vos credentials Remita : username, password, apiKey, apiId
Un serveur HTTPS capable de recevoir les callbacks webhook
Un UUID v4 généré côté serveur pour chaque transaction (externalId)
Étape 1 — Obtenir un token d’accès
Appelez POST /public/access_token avec vos identifiants. Stockez le access_token et le refresh_token retournés.
cURL
JavaScript
Python
PHP
Java
curl -X POST https://api.remita.cm/public/access_token \
-H "Content-Type: application/json" \
-d '{
"username": "votre@email.com",
"password": "votre_mot_de_passe"
}'
{
"access_token" : "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." ,
"refresh_token" : "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." ,
"token_type" : "Bearer" ,
"expires_in" : 3600
}
Le token expire après expires_in secondes. Appelez POST /public/refresh_token avec le refreshToken pour le renouveler sans redemander les identifiants.
Étape 2 — Initier une collecte
Une collecte débite le compte mobile money d’un client et crédite votre compte Remita.
Client transferMethodOrange Money CM OMCMMTN Mobile Money MOMOCM
curl -X POST https://api.remita.cm/api/v1/transaction/collect \
-H "Content-Type: application/json" \
-H "apiKey: YOUR_API_KEY" \
-H "apiId: YOUR_API_ID" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"transferMethod": "OMCM",
"customerName": "Jean Dupont",
"externalId": "550e8400-e29b-41d4-a716-446655440000",
"phoneNumber": "237690000000",
"amount": 5000,
"webhookUrl": "https://votre-serveur.com/remita/callback",
"countryName": "CAMEROON"
}'
{
"transactionId" : "3fa85f64-5717-4562-b3fc-2c963f66afa6" ,
"externalId" : "550e8400-e29b-41d4-a716-446655440000" ,
"transferMethod" : "OMCM" ,
"customerName" : "Jean Dupont" ,
"customerPhone" : "237690000000" ,
"payToken" : "abc123xyz" ,
"amount" : 5000 ,
"feesSystem" : 50 ,
"feesApp" : 25 ,
"transactionStatus" : "PENDING"
}
Conservez le transactionId — il est nécessaire pour vérifier le statut et traiter le webhook.
Étape 3 — Recevoir le résultat via webhook
Dès que la transaction atteint un état final (SUCCESS ou FAILED), Remita envoie un POST vers votre webhookUrl.
Java (Spring Boot)
Python (FastAPI)
PHP
Node.js (Express)
@ RestController
@ RequestMapping ( "/remita" )
public class RemitaWebhookController {
@ PostMapping ( "/callback" )
public ResponseEntity < String > handleCallback (@ RequestBody Map < String , Object > payload ) {
String transactionId = String . valueOf ( payload . get ( "transactionId" ));
String externalId = String . valueOf ( payload . get ( "externalId" ));
String status = String . valueOf ( payload . get ( "status" ));
if ( "SUCCESS" . equals (status)) {
System . out . println ( "Paiement reçu pour " + externalId);
// Créditer le compte client, envoyer confirmation...
} else if ( "FAILED" . equals (status)) {
System . err . println ( "Paiement échoué pour " + externalId);
}
return ResponseEntity . ok ( "OK" );
}
}
Votre endpoint webhook doit retourner HTTP 200 dans les 5 secondes . Déléguez tout traitement lourd à une file de tâches et répondez immédiatement.
Étape 4 — Vérifier le statut manuellement (polling)
Si vous n’avez pas reçu le webhook, vérifiez le statut avec le transactionId :
import requests, time
def poll_transaction_status (
transaction_id : str , access_token : str , api_key : str , api_id : str ,
max_attempts : int = 10 , interval_seconds : int = 5
) -> str :
headers = {
"apiKey" : api_key, "apiId" : api_id,
"Authorization" : f "Bearer { access_token } " ,
}
for attempt in range (max_attempts):
data = requests.post(
"https://api.remita.cm/api/v1/transaction/transaction-status" ,
headers = headers, params = { "id" : transaction_id}
).json()
status = data.get( "status" )
print ( f "Tentative { attempt + 1 } — Statut: { status } " )
if status in ( "SUCCESS" , "FAILED" ):
return status
time.sleep(interval_seconds)
return "TIMEOUT"
Étape 5 — Initier un dépôt (optionnel)
Un dépôt envoie de l’argent depuis votre compte Remita vers le compte mobile money d’un bénéficiaire. La structure est identique à la collecte :
POST /api/v1/transaction/deposit
# Même corps que /collect — seul le sens du flux change
Référence rapide
Action Méthode Endpoint Obtenir un token POST /public/access_tokenRenouveler le token POST /public/refresh_tokenInitier une collecte POST /api/v1/transaction/collectInitier un dépôt POST /api/v1/transaction/depositVérifier le statut POST /api/v1/transaction/transaction-status?id=<id>Valider une transaction POST /api/v1/transaction/validateTransactionRejeter une transaction POST /api/v1/transaction/rejectTransactionLister les transactions GET /api/v1/transaction/getByApplicationProductConsulter les soldes GET /api/v1/transaction/getByApplicationProductBalances
Checklist avant mise en production
Tokens stockés de manière sécurisée (jamais en clair dans le code ou les logs)
apiKey jamais exposée côté client (frontend / mobile)
externalId unique UUID v4 par transaction
transferMethod cohérent avec countryName
Endpoint webhook retournant HTTP 200 en moins de 5 secondes
Gestion du renouvellement automatique du token (refresh)
Mécanisme de polling en fallback si webhook non reçu
Logs de toutes les transactions (externalId, transactionId, statut)