Skip to main content
POST
/
payments
/
initiate
Initier un paiement
curl --request POST \
  --url https://sandbox-api.caurisflux.com/api/v1/payments/initiate \
  --header 'X-API-Key: <api-key>'
Initie un paiement (collect) pour recevoir de l’argent d’un client.

Authentification

X-API-Key: pk_test_xxx:sk_test_xxx

Headers optionnels

HeaderDescription
X-Idempotency-KeyClé unique pour éviter les doublons (ex: ID de commande)

Types de paiement

Paiement Direct

Le client paie avec un provider spécifique (Wave, Orange Money, etc.).
curl -X POST https://sandbox-api.caurisflux.com/api/v1/payments/initiate \
  -H "X-API-Key: pk_test_xxx:sk_test_xxx" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: COMMANDE-12345" \
  -d '{
    "type": "direct",
    "provider": "wave",
    "country": "SN",
    "amount": 10000,
    "currency": "XOF",
    "externalReference": "COMMANDE-12345",
    "customerPhone": "+221771234567",
    "customerName": "Amadou Diallo",
    "customerEmail": "amadou@example.com",
    "description": "Achat sur MaBoutique.sn",
    "callbackUrl": "https://votresite.com/webhooks/cauris",
    "returnUrl": "https://votresite.com/paiement/succes",
    "cancelUrl": "https://votresite.com/paiement/annule",
    "metadata": {
      "orderId": "12345",
      "customerType": "premium"
    }
  }'

Paiement Checkout

Le client est redirigé vers la page CaurisFlux pour choisir sa méthode.
curl -X POST https://sandbox-api.caurisflux.com/api/v1/payments/initiate \
  -H "X-API-Key: pk_test_xxx:sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "checkout",
    "amount": 25000,
    "currency": "XOF",
    "externalReference": "PANIER-67890",
    "customerName": "Fatou Sow",
    "customerEmail": "fatou@example.com",
    "description": "Panier #67890 - 3 articles",
    "callbackUrl": "https://votresite.com/webhooks/cauris",
    "returnUrl": "https://votresite.com/commande/67890/merci",
    "cancelUrl": "https://votresite.com/panier"
  }'

Paramètres

Champs requis

ChampTypeDescription
typestringdirect ou checkout
amountnumberMontant du paiement
externalReferencestringVotre référence unique (ID commande)

Champs requis pour type “direct”

ChampTypeDescription
providerstringCode du provider (wave, orange_money, etc.)
countrystringCode ISO du pays (SN, CI, ML, etc.)
customerPhonestringNuméro du client (format E.164)

Champs optionnels

ChampTypeDescription
currencystringDevise (défaut: XOF)
customerNamestringNom du client
customerEmailstringEmail du client
descriptionstringDescription du paiement
callbackUrlstringURL webhook pour notifications
returnUrlstringRedirection après succès
cancelUrlstringRedirection après annulation
metadataobjectDonnées personnalisées (JSON)

Réponse

{
  "success": true,
  "data": {
    "transactionId": "TX000007272",
    "status": "pending",
    "type": "collect",
    "amount": 10000,
    "currency": "XOF",
    "paymentMethod": {
      "code": "wave",
      "name": "Wave",
      "logoUrl": "https://s3.denkmako.com/cauris/logos/wave.png"
    },
    "country": "SN",
    "redirectUrl": "https://pay.wave.com/c/sn/~abc123",
    "externalReference": "COMMANDE-12345",
    "expiresAt": "2024-01-15T12:30:00.000Z",
    "createdAt": "2024-01-15T12:00:00.000Z",
    "metadata": {
      "orderId": "12345",
      "customerType": "premium"
    },
    "qrCode": null,
    "deepLinks": {
      "wave": "wave://pay?token=abc123"
    }
  }
}

Champs de réponse

ChampTypeDescription
transactionIdstringID unique de la transaction
statusstringStatut initial (pending)
redirectUrlstringURL de paiement (rediriger le client)
expiresAtstringDate d’expiration
deepLinksobjectLiens deep pour apps mobiles

Erreurs

{
  "statusCode": 400,
  "message": "Le montant doit être supérieur à 100 XOF",
  "error": "Bad Request"
}
CodeMessageSolution
400Montant invalideVérifiez les limites du provider
400Provider non disponibleUtilisez /payments/providers
401Non authentifiéVérifiez vos clés API