Authentification API

Spécifications d'authentification par en-têtes HTTP X-Auth-ApiKey et X-Auth-ApiSecret pour l'accès aux services API B-MO.

Authentification

Pour authentifier vos requêtes vers l'API B-MO, vous devez obligatoirement inclure les en-têtes HTTP suivants dans chaque appel :

  • X-Auth-ApiKey : Votre clé API partenaire fournie par B-MO (ex: +2290196666262).
  • X-Auth-ApiSecret : Votre secret d'API partenaire fourni par B-MO (ex: y7MwWuWeQORtpA==).
  • Content-Type : application/json

URL de Base selon l'environnement :

  • PAP (Pré-production / Défaut) : https://svc.pap.bestcash.me/external
  • TEST (Sandbox) : https://svc.test.bestcash.me/external
  • LIVE (Production) : https://svc.bmo.bestcash.me/external

Si ces en-têtes sont manquants ou invalides, l'API renvoie un code d'erreur HTTP 401 Unauthorized.

Exemple de requête authentifiée (Node.js)

import axios from 'axios';

const apiKey = '+2290196666262';
const apiSecret = 'y7MwWuWeQORtpA==';

axios.get('https://svc.pap.bestcash.me/external/merchant/organization', {
  headers: {
    'X-Auth-ApiKey': apiKey,
    'X-Auth-ApiSecret': apiSecret,
    'Content-Type': 'application/json'
  }
})
.then(response => {
  console.log('Succès de l\'authentification :', response.data);
})
.catch(error => {
  if (error.response?.status === 401) {
    console.error('Échec d\'authentification : Clé API ou secret invalide.');
  } else {
    console.error('Erreur :', error.message);
  }
});

Format d'erreur HTTP 401

{
  "status": 401,
  "error": "Unauthorized",
  "message": "Invalid API key or secret."
}