Skip to content
Sandbox open: magic test cards, hosted checkout and signed webhooks · 55 payment methods in the catalogue, cards to crypto · Built and hosted in the EEA · Read the API reference at /developers

Sandbox open: magic test cards, hosted checkout and signed webhooks

Documentation

API reference

Authentication and keys

Bearer keys, the two key shapes, how the environment is decided, what a key never returns twice, and how to roll one without a failed request.

Updated

Every request carries a key in an Authorization header. There is no session, no OAuth and no signature on the request side — the key is the credential.

curl https://cleared-pay.com/api/v1/payments \
  -H "Authorization: Bearer cp_sk_test_…"

The two key shapes

PrefixLengthWhere it belongs
cp_pk_test_… / cp_pk_live_…26 charsThe browser. Tokenisation only — every other endpoint answers 403 authorization_error with code publishable_key_not_allowed.
cp_sk_test_… / cp_sk_live_…32 charsYour server. Never in client code, a mobile binary, a repository or a log line.

A publishable key is not a secret and is expected to be visible in page source. A secret key is a bearer credential: anyone holding it can move money on your account.

The environment is the key

_test_ routes to the sandbox simulator; _live_ routes to a live connector. There is no mode parameter and no header that switches environment, so a test call can never accidentally become a live one. Objects are scoped to their environment too: a payment created with a test key is invisible to a live key and vice versa, and livemode on every object says which it is.

Sandbox-only endpoints (/v1/sandbox/*) answer 403 authorization_error with code test_mode_required when called with a live key.

Keys are shown once

A secret key is stored as HMAC-SHA256(pepper, key) alongside an indexed prefix and its last four characters. The full value exists only in the response that created it. There is no endpoint that returns it again and no support process that can recover it — if it is lost, roll it.

Cleared-pay never asks for your secret key, and it never appears in an API response, an error message, an email or a log line.

Rolling a key

Key management is portal-authenticated and needs step-up TOTP — it is not part of the public API, because a key that can mint keys is a key that cannot be contained. TODO(portal): the screen ships with the merchant portal at /portal/developers/api-keys.

The roll is designed so nothing fails while you deploy:

  1. Roll with a grace period between 0 and 168 hours. The new key is shown once.
  2. Both keys authenticate until the old one's expires_at.
  3. Deploy the new key.
  4. The old key expires on schedule. If it saw traffic in its final hour, the account address gets an email naming the prefix, so a forgotten service is visible before it breaks.

A revoke is immediate and has no grace period. Use it when a key may have leaked.

Failure modes

StatuscodeCause
401api_key_missingNo Authorization header, or an empty bearer token.
401api_key_malformedNot a cp_pk_/cp_sk_ key of the right length.
401api_key_invalidWell-formed but unknown, or the wrong environment for its hash.
401api_key_revokedThe key was revoked.
401api_key_expiredA rolled key past its grace window.
403publishable_key_not_allowedA cp_pk_… key on an endpoint that needs a secret key.
403test_mode_requiredA live key on a /v1/sandbox/* endpoint.
403live_mode_disabledA live key before the account is approved for live payments.
403merchant_suspendedThe account is suspended.

None of these say whether a key exists for another merchant, or which merchant a key belongs to.

Rate limits

Limits apply per key and, more loosely, per IP address. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; a 429 also carries Retry-After in seconds.

Endpoint classDefault limit
POST /v1/payments100 per minute
Other /v1 writes300 per minute
/v1 reads1000 per minute
Key creation10 per hour

Payment creation is deliberately the tightest limit: it is the endpoint card-testing bots target. Limits are overridable per merchant — ask, with the numbers you need and why.