Getting started
Authentication
Authenticate every request with an API key sent as a Bearer token. Each account has one test key and one live key.
Test and live keys
| Key | Prefix | Base URL | Spends from | Reaches providers |
|---|---|---|---|---|
| Test | pays_test_ | https://sandbox.paysef.com/api/v1 | Your test wallet | No. Outcomes are simulated. |
| Live | pays_live_ | https://api.paysef.com/api/v1 | Your real Pay Sef wallet | Yes |
It is one API on two addresses. The sandbox address takes test keys only, so a live key sent there is refused with 403 SANDBOX_TEST_KEY_REQUIRED and can never move real money. The key, not the address, decides whether an order is a test: test keys also work on api.paysef.com, so an integration that already uses it keeps working. When you go live, change both the base URL and the key.
A key is the prefix followed by 48 hexadecimal characters. Pay Sef stores only a hash of it, so the full key is shown once, when you generate it. If you lose it, generate a new one.
Generate a key
- Open Profile → Developer in the web app (sign in if asked) or the same screen in the Android app.
- Choose test or live and confirm with your transaction PIN.
- Copy the key into your secret store or environment variables straight away.
Generating a key replaces the previous key for that environment immediately, so the old key stops working. You can also revoke a key at any time without generating a new one.
The Developer screen has a Test / Live mode switch. It changes what the screen shows (that mode's key, webhook URL and deliveries), not what works: both keys keep working whatever mode is selected.
Send the key
Put the key in the Authorization header of every request. There is no separate API-key header and no request signing.
curl "https://sandbox.paysef.com/api/v1/wallets/me" \
-H "Authorization: Bearer $PAYSEF_API_KEY"Keep keys on your server
Never put an API key in a mobile app, browser JavaScript or a public repository. Anyone with your live key can spend your wallet balance. Call the API from your backend and use the IP allowlist.
What a key can call
API keys can call the catalogue, wallet balance, transaction history, purchase, validation and order endpoints listed in the API reference. Requests made with a key do not need your transaction PIN.
Account settings (generating keys, webhook URLs, IP allowlist, test wallet reset) can only be changed while signed in to the Pay Sef app. Calling those endpoints with an API key returns 403 FORBIDDEN.
Account types and prices
Any active account can generate a test key and build an integration. A live key needs an API Partner account: on any other account, generating one, or calling with one, answers 403 API_ACCOUNT_REQUIRED. Prices follow your account type: Customer accounts pay standard prices and are held to the daily spend limit for their verification level. When Pay Sef upgrades your account to an API Partner account, List products and every purchase use wholesale API prices, and the daily limit no longer applies. An API Partner account needs KYC tier 2 (documents verified): complete verification in the app, then ask for an upgrade at support@paysef.com.
Authentication errors
| HTTP | error_code | What it means |
|---|---|---|
| 401 | UNAUTHORIZED | The key is missing, malformed, revoked or replaced. The header must start with Bearer followed by a space. |
| 403 | FORBIDDEN | The key is valid but this endpoint does not accept API keys. |
| 403 | IP_NOT_WHITELISTED | The request came from an IP address outside your allowlist. The message includes the address Pay Sef saw. |
| 403 | SANDBOX_TEST_KEY_REQUIRED | A live key, or no key, was sent to sandbox.paysef.com. Use a test key there, or api.paysef.com with your live key. |
| 403 | API_ACCOUNT_REQUIRED | A live key on an account that is not an API Partner account. Ask for an upgrade, or use your test key. |
| 403 | ACCOUNT_SUSPENDED, ACCOUNT_FROZEN, ACCOUNT_CLOSED | Your Pay Sef account is not active. Contact support. On the two catalogue endpoints this is 403 FORBIDDEN instead. |