Authentication (API keys)
Authenticate Cardencer API requests with your secret key in the api-key header, and use publishable keys in the browser.
Cardencer uses API keys. Every key belongs to one merchant account and one environment.
| Key | Prefix | Used for | Where it lives |
|---|---|---|---|
| Secret API key | snd_ (sandbox), prd_ (live) |
Every server-side API call: payments, refunds, customers, lists. | Your server only. |
| Publishable key | pk_snd_, pk_prd_ |
Initialising the checkout SDK. It pairs with a payment's client_secret and cannot create payments, refunds or lists on its own. |
Safe in your website or app. |
| Profile ID | pro_ |
Identifies your business profile to the SDK. Not a credential. | Safe in your website or app. |
Get your keys#
- Open the dashboard and go to API keys.
- Create a test key for the sandbox. Live keys become available once your account is verified.
- Copy the full secret immediately. Cardencer stores keys hashed and shows the full value exactly once. A value such as
prd_9xSUi5pW**********is only a masked identifier and cannot authenticate.
The publishable key, profile ID and webhook signing key are shown on the same page.
Authenticate a request#
Send the secret key in the api-key header. Use HTTPS; plain HTTP is refused.
curl https://sandbox.cardencer.com/payments/pay_mbabizu24mvu3mela5njyhpit4 \
-H "api-key: snd_REPLACE_WITH_YOUR_FULL_KEY"const res = await fetch("https://sandbox.cardencer.com/payments/pay_mbabizu24mvu3mela5njyhpit4", {
headers: { "api-key": process.env.CARDENCER_API_KEY },
});import os, requests
res = requests.get(
"https://sandbox.cardencer.com/payments/pay_mbabizu24mvu3mela5njyhpit4",
headers={"api-key": os.environ["CARDENCER_API_KEY"]},
)A missing, revoked or wrong-environment key returns:
{
"error": {
"type": "invalid_request",
"message": "API key not provided or invalid API key used",
"code": "IR_01"
}
}Fix it by checking the key prefix matches the host (snd_ → sandbox.cardencer.com, prd_ → api.cardencer.com) and that you copied the full value, not the masked one.
Keep your secret key secret#
- Never put a
snd_orprd_key in browser JavaScript, mobile apps or public repositories. Use the publishable key there. - Load the key from an environment variable or a secrets manager, not from source code.
- Keep one copy per environment and avoid duplicating it across systems.
- If a key leaks, create a new one in API keys, deploy it, then delete the old one.
Rate limits and locking#
If you send too many requests in a short time, Cardencer responds with HTTP 429. Retry with exponential backoff (for example 1 s, 2 s, 4 s) and spread bulk jobs over time. Contact support if you need a higher limit.
A 429 can also mean an object is locked because another request is updating it (for example two captures on the same payment at once). The message reads "access to this object is restricted due to ongoing utilization by another API request". Wait a moment and retry; do not send concurrent writes for the same payment.