Introduction
L'API REST de SOCCO PAY permet d'intégrer les paiements Mobile Money (MTN, Orange, Wave, Moov), cartes bancaires (Visa, Mastercard), PayPal et Crypto (USDT, Bitcoin) dans vos applications.
Base URL : https://bosssocco.com/api/v1
Toutes les requêtes doivent être faites en HTTPS. Les données sont échangées au format JSON.
Authentification
Chaque requête doit inclure vos clés API dans les en‑têtes :
X-PUBLIC-KEY: votre_clé_publique
X-PRIVATE-KEY: votre_clé_privée
Les clés sont disponibles dans votre tableau de bord SOCCO PAY → API Keys.
Solde du compte
GET
/balance.php
curl -X GET https://bosssocco.com/api/v1/balance.php \
-H "X-PUBLIC-KEY: votre_clé_publique" \
-H "X-PRIVATE-KEY: votre_clé_privée"
Réponse
{
"success": true,
"balance": 125000.00,
"locked_balance": 5000.00,
"available_balance": 120000.00,
"currency": "XAF"
}
Liste des transactions
GET
/transactions.php?page=1&limit=10&status=success
curl -X GET "https://bosssocco.com/api/v1/transactions.php?page=1&limit=10" \
-H "X-PUBLIC-KEY: ..." \
-H "X-PRIVATE-KEY: ..."
Créer un lien de paiement
POST
/payment-link.php
curl -X POST https://bosssocco.com/api/v1/payment-link.php \
-H "X-PUBLIC-KEY: votre_clé_publique" \
-H "X-PRIVATE-KEY: votre_clé_privée" \
-H "Content-Type: application/json" \
-d '{
"title": "Commande #123",
"amount": 5000,
"success_url": "https://monsite.com/success",
"failed_url": "https://monsite.com/error"
}'
Réponse
{
"success": true,
"mode": "production",
"reference": "a1b2c3d4e5f6...",
"payment_url": "https://bosssocco.com/pay_link.php?id=a1b2c3d4...",
"amount": 5000,
"currency": "XAF",
"created_at": "2026-06-11 12:00:00"
}
Vérifier une transaction
GET
/verify-transaction.php?reference=SP123456
curl -X GET "https://bosssocco.com/api/v1/verify-transaction.php?reference=SP20260611123456" \
-H "X-PUBLIC-KEY: ..." \
-H "X-PRIVATE-KEY: ..."
Compte marchand
GET
/account.php
curl -X GET https://bosssocco.com/api/v1/account.php \
-H "X-PUBLIC-KEY: ..." \
-H "X-PRIVATE-KEY: ..."
Retrait (API)
POST
/withdraw.php
curl -X POST https://bosssocco.com/api/v1/withdraw.php \
-H "X-PUBLIC-KEY: ..." \
-H "X-PRIVATE-KEY: ..." \
-H "Content-Type: application/json" \
-d '{"amount":10000,"phone":"2376XXXXXXXX","network":"mtn_cm","pin":"1234"}'
Webhooks
Configurez une URL de notification dans votre tableau de bord. SOCCO PAY enverra une requête POST avec la signature X-Signature.
// Vérification en PHP
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $payload, 'VOTRE_SECRET_WEBHOOK');
if (!hash_equals($expected, $signature)) {
http_response_code(401);
exit;
}
Mode Sandbox (test)
Numéros de test pour le webhook :
| Numéro | Résultat |
670000001 | success |
670000002 | failed |
670000003 | pending |
670000004 | insufficient_funds |
670000005 | invalid_number |
670000006 | cancelled |
🧪 Webhook de test : POST /api/v1/webhook-test.php
Codes d'erreur
| Code | Signification |
401 | Clés API manquantes ou invalides |
403 | Accès interdit (KYC requis) |
422 | Données invalides |
404 | Ressource non trouvée |
500 | Erreur serveur |
Exemple complet d'intégration (PHP)
<?php
$publicKey = 'votre_clé_publique';
$privateKey = 'votre_clé_privée';
$ch = curl_init('https://bosssocco.com/api/v1/payment-link.php');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'title' => 'Commande #1001',
'amount' => 10000,
'success_url' => 'https://monsite.com/merci',
'failed_url' => 'https://monsite.com/erreur'
]),
CURLOPT_HTTPHEADER => [
'X-PUBLIC-KEY: ' . $publicKey,
'X-PRIVATE-KEY: ' . $privateKey,
'Content-Type: application/json'
]
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
$paymentUrl = $data['payment_url'];
// Rediriger l'utilisateur vers $paymentUrl
header('Location: ' . $paymentUrl);
?>
Une fois le paiement terminé, l'utilisateur sera redirigé vers success_url ou failed_url avec les paramètres reference et status.