Skip to main content

REST API Overview

The ZenPays REST API provides direct HTTP access to all payment processing functionality. Use this API when you need more control than the SDK provides, or when working in a language without an official SDK.

Base URL

EnvironmentBase URLDescription
Sandboxhttps://api.zenpayz.comTesting and development

API Versioning

All API endpoints are versioned. The current version is v1.

https://api.zenpayz.com/api/v1/{endpoint}

Request Format

All requests must:

  • Use HTTPS
  • Include authentication headers (see Authentication)
  • Send request bodies as JSON with Content-Type: application/json

Response Format

All responses are JSON with the following structure:

Success Response

{
"success": true,
"data": {
// Response data
}
}

Error Response

{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "The amount field is required",
"details": {
"field": "amount",
"reason": "required"
}
}
}

HTTP Methods

MethodUsage
GETRetrieve resources
POSTCreate resources
PUTUpdate resources (full replacement)
PATCHUpdate resources (partial)
DELETEDelete resources

Pagination

List endpoints support pagination with the following query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger20Items per page (max 100)

Paginated responses include metadata:

{
"success": true,
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
}
}

Rate Limits

API requests are rate-limited to prevent abuse:

EnvironmentLimit
Production1,000 requests/minute
Sandbox100 requests/minute

Rate limit headers are included in all responses:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640000000

SDK vs REST API

Use CaseRecommended
Quick integrationSDK
Custom language supportREST API
Webhooks handlingREST API
Server-to-server callsBoth
Browser/client-sideSDK (handles signatures)

Quick Start

# Create a payment intent
curl -X POST https://api.zenpayz.com/api/v1/payment-intents \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-Signature: your_hmac_signature" \
-H "X-Secret-Salt: $SECRET_SALT" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"currency": "USD",
"description": "Order #123"
}'

Next Steps