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
| Environment | Base URL |
|---|---|
| Playground | https://playground-api.briqpay.com |
| Production | https://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: aunit(second,minute,hourorday) and a whole-numbercount. A secret lasts one day if you leavelifetimeout, and at most seven days: a longer lifetime is rejected with a400.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 answers404.
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"] }
}{
"lifetime": { "unit": "hour", "count": 24 },
"scopes": { "sessionId": "dcea4c10-d67e-4ce3-8826-a16c7bbc4771" }
}{
"lifetime": { "unit": "minute", "count": 1 },
"scopes": {
"operations": ["read_session"],
"sessionId": "dcea4c10-d67e-4ce3-8826-a16c7bbc4771"
}
}When authentication fails
Errors come back as { "error": { "code": "...", "message": "..." } }.
| Status | Code | Cause |
|---|---|---|
401 | INVALID_CREDENTIALS | The Authorization header is missing or not valid Basic. |
403 | INVALID_CREDENTIALS | The API key is not valid, or the call is outside a generated secret's scopes. |
403 | INVALID_API_KEY | The generated secret doesn't exist, or was removed seven days after its creation. |
403 | AUTH_SECRET_EXPIRED | The 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.