Error Codes
Every failure is machine-readable: {"error": {"code": "...", "message": "..."}} with the correct HTTP status. Handle codes, not messages — messages may be refined; codes are the contract.
| HTTP | Code | Meaning |
|---|---|---|
| 401 | AUTH_FAILED | Bad credentials, unknown client_id/secret, revoked credential, or a token from a non-API login |
| 401 | TOKEN_EXPIRED | Bearer token older than 24h — exchange a new one |
| 403 | SCOPE_DENIED | Credential lacks the scope the route requires |
| 403 | IP_NOT_ALLOWED | Calling IP is not on the credential's allowlist |
| 403 | MERCHANT_DEACTIVATED | Merchant account disabled |
| 403 | MERCHANT_NOT_APPROVED | Merchant account not approved for API use |
| 429 | RATE_LIMITED | Rate limit exceeded — back off and retry (token endpoint: 10/min/IP; others 60/min/key) |
| 404 | CUSTOMER_NOT_FOUND | No customer with that payroll number |
| 404 | NOT_FOUND | Transaction serial does not exist or belongs to another merchant |
| 422 | VALIDATION_FAILED | Field-level validation — the Laravel message / errors object describes the fields |
| 422 | BUYER_DEACTIVATED | The civil servant's GP account is disabled |
| 422 | BUYER_NOT_VERIFIED | The civil servant hasn't completed GP verification |
| 422 | NEAR_RETIREMENT | Buyer is at the retirement boundary (age 59 / 34 years in service) |
| 422 | NOT_CANCELLABLE | Only pending transactions can be cancelled via the API |
| 422 | GP_LIMIT_EXCEEDEDSALARY_GATE_BLOCKED | Eligibility declines (GP monthly max / salary-data checks). The message carries the human detail |
| 409 | DUPLICATE_REFERENCE | merchant_reference reused with a different payload |
| 409 | CUSTOMER_TAKEN / EMAIL_TAKEN | Registration conflicts (see the registrations section) |
Unauthenticated requests rejected by the auth layer return Laravel's standard
{"message": "Unauthenticated."} with 401 — same handling as AUTH_FAILED. If you forget the Accept: application/json header you will get HTML instead of any of these — always send it.