POST Obtenir un jeton d'accès

https://auth.market-dialo.com/auth/realms/m360/protocol/openid-connect/token

Gé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ètreTypeObligatoireDescription
client_idstringOuiID client de votre application
client_secretstringOuiSecret client de votre application
grant_typestringOuiValeur 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-payment

Crée une transaction et retourne une URL de paiement hébergée où le client peut finaliser le règlement.

Paramètres

ParamètreTypeObligatoireDescription
amountintegerOuiMontant en unité la plus petite (ex: centimes)
currencystringOuiCode monnaie (XOF, USD…)
callbackUrlstringOuiURL de notification de paiement
referencestringNonRé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

CodeDescription
200 OKRequête traitée avec succès
201 CreatedRessource créée avec succès
400 Bad RequestRequête mal formée ou paramètres invalides
401 UnauthorizedJeton d'authentification manquant ou invalide
403 ForbiddenAccès refusé
404 Not FoundRessource non trouvée
429 Too Many RequestsLimite de requêtes dépassée
500 Internal Server ErrorErreur interne du serveur