Aperçu
L'intégration FidePay tient en trois appels : vous obtenez un jeton avec votre public_key, vous initiez un paiement, puis vous écoutez le webhook signé pour confirmer la transaction.
https://admin.fide-pay.com/api — en sandbox, préfixez chaque route par /sandbox (ex. /api/sandbox/access-token).Le flux en bref
| Étape | Appel | Résultat |
|---|---|---|
| 1. Authentifier | POST /api/access-token | un jeton Bearer |
| 2. Encaisser | POST /api/make-payment | une payment_url à ouvrir |
| 3. Confirmer | FidePay → votre ipn_url | webhook signé HMAC |
Authentification
Échangez votre clé publique contre un jeton d'accès. La clé se récupère dans merchant.fide-pay.com → Paramètres → API.
curl -X POST https://admin.fide-pay.com/api/access-token \
-H "Content-Type: application/json" \
-d '{"public_key":"pk_live_xxx"}'
# → { "status":"success", "token":"eyJ0eXAi..." }
const res = await fetch("https://admin.fide-pay.com/api/access-token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ public_key: process.env.FIDEPAY_PUBLIC_KEY })
});
const { token } = await res.json();
$ch = curl_init("https://admin.fide-pay.com/api/access-token");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode(["public_key" => getenv("FIDEPAY_PUBLIC_KEY")]),
]);
$token = json_decode(curl_exec($ch))->token;
import requests
r = requests.post("https://admin.fide-pay.com/api/access-token",
json={"public_key": FIDEPAY_PUBLIC_KEY})
token = r.json()["token"]
Initier un paiement
Avec le jeton, créez le paiement. FidePay renvoie une payment_url : redirigez-y votre client pour qu'il règle par mobile money ou carte.
| Champ | Type | Détail |
|---|---|---|
amount | nombre | requis, min 1 |
currency | texte | requis, ex. EUR, USD, CDF |
transaction_id | texte | votre référence, max 12 |
description | texte | max 20 |
ipn_url | url | optionnel, webhook de confirmation |
callback_url | url | optionnel, retour client après paiement |
curl -X POST https://admin.fide-pay.com/api/make-payment \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 25,
"currency": "EUR",
"transaction_id": "ORD-001",
"description": "Commande #1234",
"ipn_url": "https://shop.tld/webhook",
"callback_url": "https://shop.tld/merci"
}'
# → { "status":"success", "payment_url":"https://admin.fide-pay.com/pay/TNXxxx" }
const pay = await fetch("https://admin.fide-pay.com/api/make-payment", {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
amount: 25,
currency: "EUR",
transaction_id: "ORD-001",
description: "Commande #1234",
ipn_url: "https://shop.tld/webhook",
callback_url: "https://shop.tld/merci"
})
});
const { payment_url } = await pay.json();
// redirigez le client vers payment_url
$ch = curl_init("https://admin.fide-pay.com/api/make-payment");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer {$token}",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"amount" => 25,
"currency" => "EUR",
"transaction_id" => "ORD-001",
"description" => "Commande #1234",
"ipn_url" => "https://shop.tld/webhook",
"callback_url" => "https://shop.tld/merci",
]),
]);
$payment_url = json_decode(curl_exec($ch))->payment_url;
pay = requests.post(
"https://admin.fide-pay.com/api/make-payment",
headers={"Authorization": f"Bearer {token}"},
json={
"amount": 25,
"currency": "EUR",
"transaction_id": "ORD-001",
"description": "Commande #1234",
"ipn_url": "https://shop.tld/webhook",
"callback_url": "https://shop.tld/merci",
},
)
payment_url = pay.json()["payment_url"]
Webhook IPN
Après le paiement, FidePay envoie un POST form-encodé à votre ipn_url. Vérifiez toujours la signature avant de valider la commande.
Charge utile reçue
status=success
signature=<hex hmac-sha256>
data[amount]=25
data[charge]=0.5
data[total_amount]=25.50
data[transaction_id]=ORD-001
data[currency]=EUR
data[customer_name]=Alice
data[customer_email]=alice@exemple.com
Vérifier la signature
La signature est un HMAC-SHA256 de transaction_id + total_amount, calculé avec votre secret_key.
import crypto from "crypto";
const base = data.transaction_id + data.total_amount;
const expected = crypto.createHmac("sha256", SECRET_KEY)
.update(base).digest("hex");
const ok = crypto.timingSafeEqual(
Buffer.from(expected), Buffer.from(signature)
);
if (ok) { /* créditez la commande, répondez 200 */ }
$base = $data['transaction_id'] . $data['total_amount'];
$expected = hash_hmac('sha256', $base, $secret_key);
if (hash_equals($expected, $signature)) {
// créditez la commande, répondez 200
}
import hmac, hashlib
base = data["transaction_id"] + data["total_amount"]
expected = hmac.new(secret_key.encode(), base.encode(),
hashlib.sha256).hexdigest()
if hmac.compare_digest(expected, signature):
pass # créditez la commande, répondez 200
total_amount brute reçue dans le body (jamais reformatée), sinon le HMAC ne correspondra pas. Répondez 200 OK rapidement, sinon l'IPN est considéré en échec.Sandbox & production
Testez l'intégration de bout en bout sans mouvement d'argent réel : préfixez chaque route par /sandbox et utilisez vos clés sandbox. Une fois validé, retirez le préfixe et basculez sur vos clés de production.
Sandbox POST https://admin.fide-pay.com/api/sandbox/access-token
POST https://admin.fide-pay.com/api/sandbox/make-payment
Production POST https://admin.fide-pay.com/api/access-token
POST https://admin.fide-pay.com/api/make-payment
SDK & plugins
Des bibliothèques officielles qui gèrent jeton, paiement et vérification de signature pour vous. Et des modules e-commerce prêts à installer.
SDK
Plugins e-commerce
Questions fréquentes
Comment obtenir une clé API ?
Depuis votre espace marchand : merchant.fide-pay.com → Paramètres → API. Vous y trouverez vos clés publique et secrète, régénérables à tout moment.
Quels moyens de paiement sont pris en charge ?
Mobile money (Orange, MTN, Airtel, Vodacom…) et carte bancaire, selon le pays de votre client et les partenaires actifs.
Puis-je tester avant la production ?
Oui, le mode sandbox reproduit le flux complet — paiement et webhook — sans mouvement d'argent réel.
FidePay envoie-t-il des webhooks ?
Oui, chaque paiement déclenche un POST signé HMAC-SHA256 vers votre ipn_url, à vérifier avant de valider la commande.
