Passer au contenu principal

Endpoint

POST https://pay.sandbox.yabetoopay.com/v1/payment-intents/:id/confirm   # Sandbox
POST https://pay.api.yabetoopay.com/v1/payment-intents/:id/confirm       # Production
:id correspond à l’identifiant de l’intention de paiement.

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/PAYMENT_INTENT_ID/confirm \
  -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": "jean.dupont@example.com",
    "payment_method_data": {
      "type": "momo",
      "momo": {
        "country": "cg",
        "msisdn": "+242123456789",
        "operator_name": "mtn"
      }
    }
  }'

Réponse

200 OK - Paiement réussi

{
  "intentId": "pi_3r8utQTUlCY5hjV2pMtjtaNYsZ30FylO3PZk",
  "financialTransactionId": "7331529368",
  "transactionId": "pi_3r8utQTUlCY5hjV2pMtjtaNYsZ30FylO3PZk",
  "amount": 2228,
  "currency": "xaf",
  "status": "succeeded",
  "captured": true,
  "externalId": "ext_7hp8lsjCFwTemoeL",
  "id": "ch_ADdQhObdEDlz4L0kl7qNRniFjruNcrcY85xq",
  "createdAt": "2026-02-16T06:51:43.103+00:00",
  "updatedAt": "2026-02-16T06:51:43.177+00:00",
  "paymentMethodId": "pm_evILNJIgAyJs7S4KYmy5n5Ect8itay2GeycL"
}

200 OK - Paiement échoué

Lorsque le paiement échoue (ex : délai dépassé, solde insuffisant), la réponse retourne toujours un code 200 mais avec un statut d’échec :
{
  "intentId": "pi_HUHh0kAg9H8QZvHtFf0taIspdWlUVftSOLhB",
  "transactionId": "pi_HUHh0kAg9H8QZvHtFf0taIspdWlUVftSOLhB",
  "amount": 10363,
  "currency": "xaf",
  "status": "expired",
  "captured": false,
  "externalId": "ext_mQliBh5ZbdQ9w15S",
  "failureMessage": "Transaction timed out",
  "failureCode": "Transaction timed out",
  "id": "ch_nZBtA8euTJFnpFMTSO402WJOP1g2WwWSGiC7",
  "createdAt": "2026-02-16T14:07:02.061+00:00",
  "updatedAt": "2026-02-16T14:07:02.190+00:00",
  "paymentMethodId": "pm_tU0HivHLBjozujmhwbVk3LO0B2ttcd0Rk1j3"
}

422 Mauvaise requête

{
  "status": 422,
  "path": "/v1/payment-intents/pi_2GlfKbBC6IMYBPDhOaFIRdn0nrXDDEAjBxyW/confirm",
  "timestamp": "2026-02-16T15:54:49.730+00:00",
  "code": "E_OPERATION_NOT_PERMITTED",
  "message": "Operation not permitted",
  "detail": "You are not permitted to perform this operation."
}

404 Non trouvé

{
  "message": "Row not found"
}

401 Non autorisé

{
  "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.).