Créer un checkout de test
POST
/checkout/create.phpcurl "https://circus-pay.com/api/checkout/create.php" \
-H "Authorization: Bearer $CIRCUSPAY_SECRET_KEY" \
-H "Content-Type: application/json" \
--data '{
"amount": 1000,
"currency": "EUR",
"orderId": "TEST-DEMO-001",
"testMode": true
}'const response = await fetch("https://circus-pay.com/api/checkout/create.php", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CIRCUSPAY_SECRET_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"amount": 1000,
"currency": "EUR",
"orderId": "TEST-DEMO-001",
"testMode": true
})
});
const result = await response.json();
if (!response.ok || !result.success) {
throw new Error(result.error || "API request failed");
}
console.log(result);<?php
$ch = curl_init("https://circus-pay.com/api/checkout/create.php");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("CIRCUSPAY_SECRET_KEY"),
"Content-Type: application/json",
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '{
"amount": 1000,
"currency": "EUR",
"orderId": "TEST-DEMO-001",
"testMode": true
}',
]);
$raw = curl_exec($ch);
if ($raw === false) { throw new RuntimeException(curl_error($ch)); }
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);
if ($status >= 400 || empty($result["success"])) {
throw new RuntimeException($result["error"] ?? "API request failed");
}import os, requests
response = requests.post(
"https://circus-pay.com/api/checkout/create.php",
headers={"Authorization": "Bearer " + os.environ["CIRCUSPAY_SECRET_KEY"]},
json={'amount': 1000, 'currency': 'EUR', 'orderId': 'TEST-DEMO-001', 'testMode': True},
timeout=20,
)
response.raise_for_status()
result = response.json()
if not result.get("success"):
raise RuntimeError(result.get("error", "API request failed"))
print(result)Une clé de test impose ce mode. La réponse indique test: true, mode: "test" et une URL de sandbox. Vérifiez ces valeurs avant de poursuivre.
Vérifier votre intégration
- Créer une nouvelle commande avec une référence unique.
- Ouvrir l’URL de sandbox renvoyée et suivre son parcours de simulation.
- Vérifier la réception de la notification sur votre environnement de test.
- Vérifier que plusieurs notifications ne produisent pas plusieurs livraisons.
- Tester l’échec et le retour à la boutique.