Quickstart
Create your first test payment on the Cardencer sandbox in five minutes with curl, Node.js or Python.
This guide takes you from a new account to a successful test payment. You need a terminal and five minutes.
1. Create an account#
Sign up and complete onboarding. Your sandbox is available as soon as your account exists; live keys follow once your business is verified.
2. Get a sandbox key#
- Open the dashboard and go to API keys.
- Create a test key. It starts with
snd_. - Copy the full key now: Cardencer stores it hashed and shows it only once. A value with
********in it is a masked identifier and cannot authenticate.
Export it so the snippets below work as-is:
export CARDENCER_API_KEY="snd_REPLACE_WITH_YOUR_FULL_KEY"3. Create a payment#
Send a payment to the sandbox with a test card. confirm: true with capture_method: "automatic" authorizes and captures in one call.
curl https://sandbox.cardencer.com/payments \
-H "api-key: $CARDENCER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 4900,
"currency": "EUR",
"confirm": true,
"capture_method": "automatic",
"description": "Order 58211",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "12",
"card_exp_year": "2030",
"card_holder_name": "Test Customer",
"card_cvc": "123"
}
}
}'const res = await fetch("https://sandbox.cardencer.com/payments", {
method: "POST",
headers: { "api-key": process.env.CARDENCER_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
amount: 4900,
currency: "EUR",
confirm: true,
capture_method: "automatic",
description: "Order 58211",
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: {
card_number: "4242424242424242",
card_exp_month: "12",
card_exp_year: "2030",
card_holder_name: "Test Customer",
card_cvc: "123",
},
},
}),
});
const payment = await res.json();
console.log(payment.payment_id, payment.status);import os, requests
res = requests.post(
"https://sandbox.cardencer.com/payments",
headers={"api-key": os.environ["CARDENCER_API_KEY"]},
json={
"amount": 4900,
"currency": "EUR",
"confirm": True,
"capture_method": "automatic",
"description": "Order 58211",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "12",
"card_exp_year": "2030",
"card_holder_name": "Test Customer",
"card_cvc": "123",
}
},
},
)
payment = res.json()
print(payment["payment_id"], payment["status"])The response contains the payment. Look for:
{
"payment_id": "pay_mbabizu24mvu3mela5njyhpit4",
"status": "succeeded",
"amount": 4900,
"amount_received": 4900,
"currency": "EUR",
"capture_method": "automatic",
"client_secret": "pay_mbabizu24mvu3mela5njyhpit4_secret_el9ksDkiB8hi6j9N78yo"
}"status": "succeeded" means the payment is authorized and captured. It now appears under Payments in the dashboard.
Sending raw card numbers from your server, as above, is fine in the sandbox. In production, collect cards with the checkout SDK so card data never touches your servers and your PCI DSS scope stays minimal.
4. Retrieve the payment#
curl https://sandbox.cardencer.com/payments/pay_mbabizu24mvu3mela5njyhpit4 \
-H "api-key: $CARDENCER_API_KEY"const res = await fetch(`https://sandbox.cardencer.com/payments/${paymentId}`, {
headers: { "api-key": process.env.CARDENCER_API_KEY },
});
console.log((await res.json()).status);res = requests.get(
f"https://sandbox.cardencer.com/payments/{payment_id}",
headers={"api-key": os.environ["CARDENCER_API_KEY"]},
)
print(res.json()["status"])5. Try a decline#
Run the same request with 4000000000000002. The payment comes back with "status": "failed" and an error_code and error_message explaining why. See Sandbox & test cards for every scenario.
Next steps#
- Embed the checkout on your site.
- Handle 3D Secure.
- Refund a payment.
- Receive webhooks.