Get Started

Authentication

Your API keys, the headers every request needs, and the idempotency key for each integration type.

Tonder authenticates every API request with an API key, sent in the Authorization header. You get two keys — a public key and a secret key — for different jobs.

Your API keys

  • Public key — processes payments, APMs, and Hosted Checkout sessions. Safe to use anywhere your backend can reach Tonder.
  • Secret key — for card tokenization (Save Cards). Server-side only — never expose it in client code, mobile apps, or version control.

Get your keys

Find them in the dashboard under Developers → API Keys. Sandbox and production have separate keys:

Never use production keys for testing. See Environments for the full split.

Required headers

Authenticate with the Authorization header plus the JSON content type. The idempotency header differs by integration type.

The scheme is Token followed by a space, then your key — not Bearer. A missing space returns 401 Unauthorized.

Hosted Checkout

Authorization: Token YOUR_API_KEY
x-idempotency-key: <free-string>
Content-Type: application/json

x-idempotency-key is a free string you define (for example test-001), with an idempotency window of 5 seconds.

API Direct

Authorization: Token YOUR_API_KEY
X-Request-Id: <uuid-v4>
Content-Type: application/json

X-Request-Id must be a UUID v4 generated per request (not a free string).

IntegrationIdempotency headerFormatWindow
Hosted Checkoutx-idempotency-keyfree string5 seconds
API DirectX-Request-IdUUID v4per request

Card tokenization

To save cards, exchange your secret key for a short-lived access token: GET /api/v1/tokenization/auth/ returns an access_token (a JWT) used to tokenize card data. The SDKs handle this for you — see SDKs and API Direct → Authentication.

Webhooks

Always confirm webhooks server-side before acting on them: re-fetch the transaction or session status (by payment_id / external_id) rather than trusting the received payload alone. See Webhooks.

Security best practices

  • Never expose your secret key in client code, mobile apps, or version control.
  • Store credentials in environment variables — don't hardcode them.
  • Rotate keys immediately if you suspect they're compromised.
  • Use separate keys for sandbox and production.
  • Restrict credential access on a need-to-know basis.

Next steps

Was this page helpful?

On this page