Skip to content

Errors

ZevPay uses standard HTTP status codes and consistent error response formats.

Error response format

All error responses follow this structure:

json
{
  "success": false,
  "error": {
    "code": "HTTP_ERROR",
    "message": "A human-readable error description"
  },
  "correlationId": "-"
}
FieldTypeDescription
successbooleanAlways false for errors
error.codestringMachine-readable error code
error.messagestringHuman-readable description of what went wrong
correlationIdstringRequest correlation ID (from x-correlation-id header, or "-")

Error codes

CodeDescription
HTTP_ERRORStandard HTTP error (bad request, not found, unauthorized, etc.)
INTERNAL_ERRORUnexpected server error

HTTP status codes

CodeMeaningDescription
200OKRequest succeeded
400Bad RequestInvalid parameters, expired session, or business logic error
401UnauthorizedMissing or invalid API key
403ForbiddenOrigin not allowed for this API key
404Not FoundResource does not exist
429Too Many RequestsRate limit exceeded
500Internal Server ErrorSomething went wrong on our end

Common errors

Authentication errors

StatusMessageCauseSolution
401Invalid API keyAPI key not found or inactiveCheck your API key is correct and active
403Origin not allowed for this API keyRequest origin doesn't match allowed domainsAdd your domain to the API key's allowed domains in the dashboard

Session errors

StatusMessageCauseSolution
404Session not found.Invalid session IDVerify the session ID is correct
400Session is expired.Session status is expiredCreate a new session
400Session is completed.Payment already receivedNo action needed — payment is done
400Session has expired.Session's expiresAt time has passedCreate a new session
400Session does not belong to this API key.API key not from the same key pairUse a key from the same key pair used to create the session

Payment method errors

StatusMessageCauseSolution
400Unsupported payment method:Invalid payment_method valueUse "bank_transfer" or "payid"

Validation errors

StatusMessageCauseSolution
400amount must not be less than 100Amount below minimumMinimum is 100 kobo (NGN 1.00)
400email must be an emailInvalid email formatProvide a valid email address

Rate limit errors

StatusMessageCauseSolution
429Too Many RequestsExceeded 100 requests/min (or 30/min for session initialization)Wait and retry with exponential backoff — see Rate Limiting

Handling errors

Always check the success field in the response. If false, read error.message for details. Implement exponential backoff for 429 and 5xx errors.

Error handling example

js
const response = await fetch('https://api.zevpaycheckout.com/v1/checkout/session/initialize', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'sk_test_your_secret_key',
  },
  body: JSON.stringify({
    amount: 500000,
    currency: 'NGN',
    email: 'customer@example.com',
  }),
});

const result = await response.json();

if (!response.ok || result.success === false) {
  console.error(`Error: ${result.error?.message || 'Unknown error'}`);
  // Handle error appropriately
  return;
}

// Success
const session = result.data;
python
import requests

response = requests.post(
    "https://api.zevpaycheckout.com/v1/checkout/session/initialize",
    headers={
        "Content-Type": "application/json",
        "x-api-key": "sk_test_your_secret_key",
    },
    json={
        "amount": 500000,
        "currency": "NGN",
        "email": "customer@example.com",
    },
)

result = response.json()

if not response.ok or not result.get("success"):
    error = result.get("error", {})
    print(f"Error: {error.get('message', 'Unknown error')}")
    # Handle error
else:
    session = result["data"]

ZevPay Checkout Developer Documentation