Skip to Content
Docs

API keys

Create sandbox and live API keys in the Pay.com dashboard and store them securely.

API keys authenticate server-side requests to the Pay.com API. Create sandbox keys for testing and live keys for real payments in the Pay.com dashboard. To send a key with a request, see Authentication.

API keys and environments

Each API key works in only one environment, indicated by its prefix.

KeyPrefixBase URL
Sandbox keysk-pay-com-sandbox-…https://api.sandbox.pay.com/v1
Live keysk-pay-com-live-…https://api.pay.com/v1

Sending a sandbox key to the live URL (or a live key to the sandbox URL) returns 401 Unauthorized. See Environments and Go live.

Get your API keys

Follow these steps to create and store a key.

  1. 1

    Open API keys

    Sign in to the Pay.com dashboard and go to Developers → API keys.

  2. 2

    Create a key

    Select Create an API key, then choose the key's workspaces and permissions. A live key also needs network access, the networks it can be used from. See Manage API keys.

  3. 3

    Copy the secret

    Copy the secret immediately when you create or roll the key, because it's shown only once. Afterward, the dashboard displays only the prefix and last six characters (for example, sk-pay-com-live-…7Qk2Xa).

  4. 4

    Store it securely

    Store the key in a secrets manager or server environment variable and read it at runtime. Never hardcode it.

Keep your keys safe

Treat every API key as a secret.

  • Use keys only on your servers. Never place an API key in browser code, mobile apps, or anything else your customers can download. See Browsers and mobile apps.
  • Keep keys out of source control and logs. Load keys from a secrets manager or environment variables, and exclude authorization headers from logs.
  • Isolate environments. Never use live keys in development or test systems.
  • Grant least privilege. Scope each key to only the workspaces, permissions, and (for live keys) networks it needs.
  • Roll a key that may have leaked. Select Roll key on the key's page, update your servers to the new secret, and end the old key. See Roll a key.

Next steps

With a sandbox key, you can authenticate requests and take a test payment.

Was this page helpful?