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: 1234567...).
  • X-Auth-ApiSecret : Votre secret d'API partenaire fourni par B-MO (ex: gstt=!iwfnn...).
  • Content-Type : application/json

URL de Base (selon l'environnement sélectionné) :

  • TEST (Défaut) : https://svc.test.bestcash.me/external
  • PAP : https://svc.pap.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 = '1234567...';
const apiSecret = 'gstt=!iwfnn...';

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."
}