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": 2499,
"currency": "EUR",
"productName": "Ma commande",
"orderId": "ORDER-DEMO-001",
"successUrl": "https://example.com/payment/return",
"cancelUrl": "https://example.com/payment/cancel"
}'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": 2499,
"currency": "EUR",
"productName": "Ma commande",
"orderId": "ORDER-DEMO-001",
"successUrl": "https://example.com/payment/return",
"cancelUrl": "https://example.com/payment/cancel"
})
});
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": 2499,
"currency": "EUR",
"productName": "Ma commande",
"orderId": "ORDER-DEMO-001",
"successUrl": "https://example.com/payment/return",
"cancelUrl": "https://example.com/payment/cancel"
}',
]);
$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': 2499, 'currency': 'EUR', 'productName': 'Ma commande', 'orderId': 'ORDER-DEMO-001', 'successUrl': 'https://example.com/payment/return', 'cancelUrl': 'https://example.com/payment/cancel'},
timeout=20,
)
response.raise_for_status()
result = response.json()
if not result.get("success"):
raise RuntimeError(result.get("error", "API request failed"))
print(result)Parameter
| Parameter | Beschreibung |
|---|---|
amount · integer · erforderlich | Positiver Betrag in kleinsten Währungseinheiten. Beispiel: 15000 für 150 PLN. |
currency · string | Währung, standardmäßig EUR. Verfügbarkeit abhängig von Konto und konfigurierter Verarbeitung. |
orderId · string | Ihre Bestellreferenz. Erneute Verwendung kann den bestehenden Link liefern; nicht für eine neue Bestellung verwenden. |
productName · string | Dem Kunden angezeigte Bezeichnung. |
customerEmail / customerName | Optionale Angaben zum Vorausfüllen des Checkouts. |
paymentMethods · string[] | Schränkt angebotene Methoden ein. Aktiviert keine für Ihr Konto nicht verfügbare Methode. |
theme_id · string | Kennung eines aktiven Designs Ihres Kontos. Siehe Checkout Studio. |
successUrl / cancelUrl | Rückkehradressen Ihres Shops. Zahlungen werden serverseitig bestätigt. |
testMode · boolean | Aktiviert den Testablauf. Ein Testschlüssel erzwingt diesen Modus ebenfalls. |
Antwort
{
"success": true,
"token": "pay_EXAMPLE",
"url": "https://checkout.example.com/checkout/pay_EXAMPLE",
"orderId": "ORDER-DEMO-001",
"test": false,
"mode": "live"
}Die Antwort kann zusätzlich fallbackUrl, routing, ghostSite und theme_id enthalten. Verwenden Sie url als Ziel und speichern Sie Ihre Bestellreferenz.
Wiederholen ohne Duplikate
Bei einem nicht wiederverwendbaren Link und vorhandener Referenz kann die API reused: true und alreadyPaid liefern. Prüfen Sie diese Felder und den Status vor einem erneuten Zahlungsversuch. Dies ist keine allgemeine Idempotenzgarantie für alle Endpunkte.