POST Obtenir un jeton d'accès
https://auth.market-dialo.com/auth/realms/m360/protocol/openid-connect/tokenGénérez un jeton Bearer pour autoriser les requêtes API. Ce jeton est valable 1 heure et doit être inclus dans l'en-tête Authorization
de chaque requête.
Note : Créez vos identifiants (client_id et client_secret) dans le portail développeur.
Paramètres
Paramètre | Type | Obligatoire | Description |
---|---|---|---|
client_id | string | Oui | ID client de votre application |
client_secret | string | Oui | Secret client de votre application |
grant_type | string | Oui | Valeur fixe client_credentials |
Exemple de requête
user@market-dialo:~
curl -X POST "https://auth.market-dialo.com/auth/realms/m360/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=VOTRE_CLIENT_ID" \
-d "client_secret=VOTRE_CLIENT_SECRET" \
-d "grant_type=client_credentials"
Exemple de réponse
Réponse API
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhZ...",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "profile email"
}
POST Initier un paiement
https://api.market-dialo.com/pay/v1/init-paymentCrée une transaction et retourne une URL de paiement hébergée où le client peut finaliser le règlement.
Paramètres
Paramètre | Type | Obligatoire | Description |
---|---|---|---|
amount | integer | Oui | Montant en unité la plus petite (ex: centimes) |
currency | string | Oui | Code monnaie (XOF, USD…) |
callbackUrl | string | Oui | URL de notification de paiement |
reference | string | Non | Référence unique de votre transaction |
Exemple de requête
user@market-dialo:~
curl -X POST "https://api.market-dialo.com/pay/v1/init-payment" \
-H "Authorization: Bearer VOTRE_JETON" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"currency": "XOF",
"callbackUrl": "https://votre-site.com/webhook",
"reference": "ORDER-12345"
}'
Exemple de réponse
Réponse API
{
"transactionId": "txn_5f7e8d9a0b1c2d3e",
"paymentUrl": "https://pay.market-dialo.com/checkout/txn_5f7e8d9a0b1c2d3e",
"reference": "ORDER-12345",
"amount": 1000,
"currency": "XOF",
"status": "PENDING"
}
GET Statut du paiement
https://api.market-dialo.com/pay/v1/status/{transactionId}Récupère le statut actuel d'une transaction à l'aide de son ID ou de votre référence.
Exemple de requête
user@market-dialo:~
curl -X GET "https://api.market-dialo.com/pay/v1/status/txn_5f7e8d9a0b1c2d3e" \
-H "Authorization: Bearer VOTRE_JETON"
Exemple de réponse
Réponse API
{
"transactionId": "txn_5f7e8d9a0b1c2d3e",
"reference": "ORDER-12345",
"amount": 1000,
"currency": "XOF",
"status": "SUCCESS",
"paidAt": "2023-06-15T14:22:35Z",
"paymentMethod": "ORANGE_MONEY"
}
Codes de réponse HTTP
Code | Description |
---|---|
200 OK | Requête traitée avec succès |
201 Created | Ressource créée avec succès |
400 Bad Request | Requête mal formée ou paramètres invalides |
401 Unauthorized | Jeton d'authentification manquant ou invalide |
403 Forbidden | Accès refusé |
404 Not Found | Ressource non trouvée |
429 Too Many Requests | Limite de requêtes dépassée |
500 Internal Server Error | Erreur interne du serveur |