Passer au contenu principal

Endpoint

POST https://pay.sandbox.yabetoopay.com/v1/payment-intents   # Sandbox
POST https://pay.api.yabetoopay.com/v1/payment-intents       # Production

Authentification

Utilisez votre clé secrète dans l’en-tête Authorization :
Authorization: Bearer YOUR_SECRET_KEY

Corps de la requête

ParamètreTypeObligatoireDescription
client_secretstringOuiLe secret client de l’intention de paiement
first_namestringNonPrénom du client
last_namestringNonNom du client
receipt_emailstringNonAdresse email du client
payment_method_dataobjectOuiDétails de la méthode de paiement

Structure payment_method_data

{
  "type": "momo",
  "momo": {
    "country": "cg",
    "msisdn": "+242123456789",
    "operator_name": "mtn"
  }
}
ChampDescription
typeType de méthode de paiement (momo pour Mobile Money)
momo.countryCode pays (ex: cg, cm)
momo.msisdnNuméro de téléphone au format international
momo.operator_nameNom de l’opérateur (mtn, airtel)

Exemple de requête

curl -X POST https://pay.sandbox.yabetoopay.com/v1/payment-intents \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -d '{
    "client_secret": "YOUR_CLIENT_SECRET",
    "first_name": "Jean",
    "last_name": "Dupont",
    "receipt_email": "[email protected]",
    "payment_method_data": {
      "type": "momo",
      "momo": {
        "country": "cg",
        "msisdn": "+242123456789",
        "operator_name": "mtn"
      }
    }
  }'

Réponse

200 OK

{
  "intent_id": "pi_9aATHBv8UXuD6H5qrSav",
  "financial_transaction_id": "832546449",
  "transaction_id": "3c043d55-e659-4a86-9fab-b377fea9ee6b",
  "amount": 500,
  "currency": "xaf",
  "status": "succeeded",
  "captured": true,
  "external_id": "ext_3rxAagDtTSlN9XO96R1slJk14WENvxOlJbCu",
  "id": "ch_1jro7CEishIEWadybzlm"
}

422 Bad Request

{
  "error": {
    "message": "E_CONFIRMED_INTENT_EXCEPTION: Intent already confirmed",
    "code": "E_CONFIRMED_INTENT_EXCEPTION"
  }
}

Paiement échoué - Solde insuffisant

{
  "error": {
    "message": "LOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED",
    "code": "LOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED"
  }
}
Cette erreur survient quand :
  • Le client n’a pas assez de fonds sur son compte Mobile Money
  • Le client a atteint sa limite de transaction
  • La transaction n’est pas autorisée par l’opérateur

Paiement échoué - Délai dépassé

{
  "error": {
    "message": "TIMEOUT",
    "code": "TIMEOUT"
  }
}
Cette erreur survient quand le client n’a pas confirmé le paiement à temps (n’a pas entré son code PIN sur l’invite Mobile Money).

401 Unauthorized

{
  "error": {
    "message": "Unauthorized",
    "code": "Unauthorized"
  }
}
La gestion des erreurs est importante, car la confirmation peut échouer pour diverses raisons (fonds insuffisants, informations de paiement incorrectes, etc.).