Skip to content

Developers

Authentication

Keys, access tokens and signing your API requests.

3 answers

How does API authentication work?

You sign your requests with keys only you hold. At a high level it works like this:

  1. Generate an RSA key pair and send us your public key. Keep the private key on your own systems.
  2. We give you your merchant code and API key. You can see them, masked, in the developer portal under Developers → API keys, for the environment you're signed in to.
  3. Your server requests an access token, signing that request with your private key. The response includes an access token, a refresh token and a secret key.
  4. On every API call, send your API key and access token, a timestamp, a nonce (a new random value each time) and a signature made with the secret key.

The exact headers, the string to sign and code samples are in the authentication guide.

Open as a page: How does API authentication work?

Why is my API request rejected with an authentication error?

Usually the access token has expired or the signature doesn't match what we calculate. Check these in order.

  1. If the access token has expired, get a new one from the refresh-token endpoint using your refresh token. If the refresh token has expired too, check the authentication guide, or email support@pexx.com.
  2. Check the timestamp is the current Unix time in seconds, not milliseconds, and that your server clock is correct.
  3. Use a new nonce for every request. A nonce you've already used is rejected.
  4. Hash the request body exactly as the guide describes, and use the same access token in the string you sign as in the authorisation header.
  5. Check you're using keys for the right environment: sandbox keys don't work in production.

If it still fails, email support@pexx.com with your business name, the endpoint and the X-Trace-Id value from the response header. Never send your private key or secret key.

Open as a page: Why is my API request rejected with an authentication error?

How should I keep my API keys secure, and what if a key is lost or exposed?

Keep your keys on your server only. Never put your API key, private key or secret key in a browser, a mobile app or a public code repository.

Your private key never needs to leave your systems. We only need your public key.

If a key or private key is lost, or you think someone else has seen it, email support@pexx.com straight away with your business name and merchant code. We'll help you replace it. Don't include the key itself in your email.

To rotate your keys as a routine step, email support@pexx.com and we'll guide you through it.

Open as a page: How should I keep my API keys secure, and what if a key is lost or exposed?

Contact

Still stuck?

Talk to a person. We'll never ask for your passcode, one-time codes or full card details.

PEXX API

Start with the docs

Guides and the API reference are at docs.pexx.com. For your integration, email us with your business name and the request or payout reference.