Authentication

The WHITELABEL API uses the ApiKey security schema to authenticate HTTP requests. API keys are alphanumeric credentials that grant access to specific API features.

All requests require public-api-key and private-secret-key headers. Find them in your WHITELABEL Dashboard.

Do not share your secret API keys in public places like GitHub or Bitbucket to avoid malicious API calls.

Occasionally, an X-Idempotency-Key may be required. This UUID must be unique for each request. See Idempotency for details.

Example request:

curl --request <Method> \
     --url <URL> \
     --header 'X-Idempotency-Key: 7bf41af5-70ae-4e79-9b28-a8fa75c3ac53' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'private-secret-key: <Your private-secret-key>' \
     --header 'public-api-key: <Your public-api-key>'

Idempotency

Idempotency lets you safely retry a request when its outcome is unclear, such as a timeout, a connection error, or a 500 response. It removes the risk of performing the operation twice.

Some requests include a unique identifier sent as the X-Idempotency-Key header (for example, 7bf41af5-70ae-4e79-9b28-a8fa75c3ac53). This key also serves to identify a specific transaction.

Set the X-Idempotency-Key value to {$randomUUID} to generate keys automatically.

Reusing an X-Idempotency-Key produces one of the following results:

  • The original response. If the first request with this key created a payment (whatever its status: approved, authorized, or declined), any later request with the same key returns that original payment instead of creating a new one. The body of the retry is ignored.
  • 400 REQUEST_IN_PROCESS. The first request with this key is still being processed. Retry with the same key after a few seconds.
  • 400 IDEMPOTENCY_DUPLICATED. The first request with this key failed before a payment was created. No payment exists for this key, and the key cannot be reused: correct the request and send it with a new key.
  • Normal processing. If the first request was rejected before processing started (for example, a malformed body), the key was not consumed and the retry is processed as a new request.
  1. If a request fails with an unclear outcome (a timeout, a connection error, a 500, or a response you cannot parse), retry it with the same key. The retry either returns the original result, processes normally, or returns IDEMPOTENCY_DUPLICATED, which means no payment was created.
  2. Use a new key only to start a genuinely new attempt: a new order, or a new attempt after a decline or after IDEMPOTENCY_DUPLICATED.
  3. Never retry an unclear failure with a new key. If the original request actually succeeded, retrying it with a new key creates a duplicate operation.