Initier un paiement
curl --request POST \
--url https://sandbox-api.caurisflux.com/api/v1/payments/initiate \
--header 'X-API-Key: <api-key>'import requests
url = "https://sandbox-api.caurisflux.com/api/v1/payments/initiate"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://sandbox-api.caurisflux.com/api/v1/payments/initiate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.caurisflux.com/api/v1/payments/initiate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.caurisflux.com/api/v1/payments/initiate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.caurisflux.com/api/v1/payments/initiate")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.caurisflux.com/api/v1/payments/initiate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyPaiements
Initier un paiement
Créer un nouveau paiement (collect)
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>'import requests
url = "https://sandbox-api.caurisflux.com/api/v1/payments/initiate"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://sandbox-api.caurisflux.com/api/v1/payments/initiate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.caurisflux.com/api/v1/payments/initiate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.caurisflux.com/api/v1/payments/initiate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.caurisflux.com/api/v1/payments/initiate")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.caurisflux.com/api/v1/payments/initiate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyInitie un paiement (collect) pour recevoir de l’argent d’un client.
Authentification
X-API-Key: pk_test_xxx:sk_test_xxx
Headers optionnels
| Header | Description |
|---|---|
X-Idempotency-Key | Clé 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
| Champ | Type | Description |
|---|---|---|
type | string | direct ou checkout |
amount | number | Montant du paiement |
externalReference | string | Votre référence unique (ID commande) |
Champs requis pour type “direct”
| Champ | Type | Description |
|---|---|---|
provider | string | Code du provider (wave, orange_money, etc.) |
country | string | Code ISO du pays (SN, CI, ML, etc.) |
customerPhone | string | Numéro du client (format E.164) |
Champs optionnels
| Champ | Type | Description |
|---|---|---|
currency | string | Devise (défaut: XOF) |
customerName | string | Nom du client |
customerEmail | string | Email du client |
description | string | Description du paiement |
callbackUrl | string | URL webhook pour notifications |
returnUrl | string | Redirection après succès |
cancelUrl | string | Redirection après annulation |
metadata | object | Donné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
| Champ | Type | Description |
|---|---|---|
transactionId | string | ID unique de la transaction |
status | string | Statut initial (pending) |
redirectUrl | string | URL de paiement (rediriger le client) |
expiresAt | string | Date d’expiration |
deepLinks | object | Liens deep pour apps mobiles |
Erreurs
{
"statusCode": 400,
"message": "Le montant doit être supérieur à 100 XOF",
"error": "Bad Request"
}
| Code | Message | Solution |
|---|---|---|
400 | Montant invalide | Vérifiez les limites du provider |
400 | Provider non disponible | Utilisez /payments/providers |
401 | Non authentifié | Vérifiez vos clés API |
⌘I