Skip to content
Developers

Search the guides, the API reference and the changelog.

Authentication

Every Briqpay API request uses HTTP Basic authentication with your merchant ID and a secret. Use your API key from the Merchant Portal, or generate a short-lived secret limited to one session or certain operations.

On this page

Every request to the Briqpay API must be authenticated. You use HTTP Basic authentication, with your merchant ID as the username and a secret as the password.

The header

Send the credentials in the Authorization header:

Authorization: Basic <base64(merchantId:secret)>

Base64-encode merchantId:secret as one string. Make these calls from your backend only. The secret must never reach the browser.

Get your credentials

Your merchant ID and API keys are on the keys page in the Merchant Portal. If you don't have an account yet, register there to get credentials for the playground.

Environments

EnvironmentBase URL
Playgroundhttps://playground-api.briqpay.com
Productionhttps://api.briqpay.com

Build and test against the playground first.

Which secret to use

You can use one of two kinds of secret as the password.

The API key

This is the recommended way. Use an API key from the Merchant Portal. It gives full access to the API.

A generated secret

For more control, call Generate a secret with your merchant ID and API key. You get back a secret and an expiresAt time. Use the secret as the password. Generated secrets start with generated_secret_.

In the request you can set:

  • lifetime: a unit (second, minute, hour or day) and a whole-number count. A secret lasts one day if you leave lifetime out, and at most seven days: a longer lifetime is rejected with a 400.
  • scopes.operations: the operations the secret may be used for. If you leave it out, all operations are allowed.
  • scopes.sessionId: limits the secret to one session. The session must be one of yours; otherwise the request answers 404.

The operations you can list are create_session, read_session, update_session, update_session_metadata, validate_session, update_cart, update_references, capture_order, refund_order, cancel_order, release_remaining_order, create_hpp, update_hpp, read_hpp, read_token, patch_token and delete_token.

{
  "lifetime": { "unit": "hour", "count": 48 },
  "scopes": { "operations": ["create_session"] }
}

When authentication fails

Errors come back as { "error": { "code": "...", "message": "..." } }.

StatusCodeCause
401INVALID_CREDENTIALSThe Authorization header is missing or not valid Basic.
403INVALID_CREDENTIALSThe API key is not valid, or the call is outside a generated secret's scopes.
403INVALID_API_KEYThe generated secret doesn't exist, or was removed seven days after its creation.
403AUTH_SECRET_EXPIREDThe generated secret has expired.

If a generated secret expires, generate a new one. A request outside a secret's scopes is refused, so check the scopes you asked for.

Generate a secret itself only accepts your API key, not a generated secret. With a wrong merchant ID or key it answers 400 with the code INVALID_DATA.