# Authentication & security Merchant-facing APIs do not use certificate signing. Each integration is protected by: - **OAuth2 client credentials** and short-lived **JWT bearer tokens** - **IP whitelisting** of your public IP addresses - **Timestamps** and **nonces** to prevent replay attacks - **Idempotency keys** for payment creation - Optional **HMAC-SHA256 signatures**, when enabled for your integration ## Access tokens Request a token with the client credentials grant: ```http POST /oauth/token Content-Type: application/x-www-form-urlencoded grant_type=client_credentials&client_id={clientId}&client_secret={clientSecret} ``` Send it on every payment request as `Authorization: Bearer `. Tokens expire after `expires_in` seconds (normally `3600`). :::danger{title="Keep your client secret on your server"} Never put your client secret in a browser, mobile app or public repository. ::: ## Required headers for payment APIs | Header | Description | | -------------------------- | --------------------------------------------------------------------------- | | `Authorization` | `Bearer ` | | `X-Client-Id` | Client identifier issued during onboarding. | | `X-Request-Id` | Unique request identifier (UUID recommended). | | `X-Idempotency-Key` | Unique idempotency key for the request. See [Idempotency](/idempotency). | | `X-Timestamp` | 10-digit Unix epoch time in **seconds**, e.g. `1782275551`. | | `X-Nonce` | Unique random value for every request. | | `X-Content-SHA256` | SHA-256 of the raw request body, **Base64**-encoded. | | `X-Signature` _(optional)_ | Base64-encoded HMAC-SHA256 signature, only if enabled during onboarding. | The **Balance enquiry** endpoint also expects `Accept: application/json` and `Content-Type: application/json`. The **Name check** endpoint needs `Accept`, `X-Client-Id` and `X-Request-Id`. ### Computing `X-Content-SHA256` ```python title="Python" import base64, hashlib def content_sha256(body: str) -> str: return base64.b64encode(hashlib.sha256(body.encode("utf-8")).digest()).decode() # Empty body (GET requests): content_sha256("") # 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= ``` ```php title="PHP" $contentSha256 = base64_encode(hash('sha256', $body, true)); ``` ```java title="Java" String contentSha256 = Base64.getEncoder().encodeToString( MessageDigest.getInstance("SHA-256").digest(body.getBytes(StandardCharsets.UTF_8))); ``` ## IP whitelisting All API clients are restricted to the public IP addresses approved during onboarding. Requests from other addresses are rejected: ```json { "status": "FAILED", "code": "PGW-1009", "message": "IP address is not whitelisted" } ``` :::note{title="Testing from this site"} The playground sends requests from **your browser**, so your current public IP must be whitelisted in the sandbox for live tests to succeed. ::: ## Keep your clock in sync `X-Timestamp` is validated against server time. Keep your servers synchronized with NTP to avoid timestamp validation failures.