Core concepts
Security and limits
A live key spends real money. These controls keep it that way only for you.
IP allowlist
In Developer settings (confirm with your PIN) you can list up to 20 IP addresses allowed to use your keys (the list applies to both your test and live keys). Each entry is a single address (203.0.113.10) or a CIDR range (198.51.100.0/24). Requests from anywhere else are rejected with 403 IP_NOT_WHITELISTED.
An empty list allows every address. Set the list before you use a live key. Pay Sef checks the public address your request arrives from, as recorded by our load balancer: your server's egress address. An X-Forwarded-For header you set yourself is not trusted.
Key handling
- Keep keys in environment variables or a secrets manager, never in source control.
- Call the API only from your backend. Never ship a key in a browser or mobile app.
- Use separate test and live keys, and only give production servers the live key.
- Rotate a key by generating a new one; the old key stops working at once. Revoke a key straight away if you think it has leaked.
Webhook security
Verify the X-Paysef-Signature header on every webhook before acting on it, and treat the webhook as a prompt to check the order rather than as proof of payment if you cannot verify it. See Verify signatures.
Rate limits
| Endpoints | Limit |
|---|---|
| GET /services, GET /services/{id}/products | 120 requests per minute per IP address and path |
| Purchases and bulk purchases | 30 purchases per minute per account, across every purchase route; a bulk batch counts once, and you can send up to 5 batches per minute |
| Cable TV, electricity and JAMB validation | 20 checks per 10 minutes per account, shared between the three |
| GET /transactions | 60 requests per minute per account |
Exceeding a limit returns HTTP 429 RATE_LIMIT_EXCEEDED. When the wait is known, the body carries retry_after_seconds and the response sends the same value in a Retry-After header; wait that long before trying again. Retry a purchase that got a 429 with the same Idempotency-Key. Catalogue data is cached on our side for 5 minutes, so cache it on yours too instead of fetching it before every purchase.
Maintenance
During planned maintenance the API returns HTTP 503 SERVICE_MAINTENANCE with a Retry-After header and retry_after_seconds in the body. In read-only maintenance, GET requests still work, and purchases and validation requests are refused, so nothing is charged.
Duplicate guard
Purchases are protected by a duplicate guard rather than a rate limit: the same purchase repeated within the guard window is refused. See Idempotency and duplicates.