Overview
ZAFA PAY API uses Bearer Token authentication. All API requests must include an access token in theAuthorization header.
Obtaining Access Token
You can obtain an access token from the merchant dashboard.Log in to Dashboard
Log in to the merchant dashboard (https://app.zafapay.com)
API Endpoints
| Environment | Base URL | Purpose |
|---|---|---|
| Sandbox | https://api.sandbox.zafapay.com | Testing & Development |
| Production | https://api.zafapay.com | Production |
Different access tokens are required for Sandbox and Production environments.
Authentication Method
Set theAuthorization header in all API requests.
cURL
Node.js
Authentication Errors
| Error Code | HTTP Status | Cause |
|---|---|---|
unauthorized | 401 | Invalid or expired token |
forbidden | 403 | Account is deactivated |
Error Response Examples
401 Unauthorized
403 Forbidden
Security Best Practices
🔒 Store Tokens SecurelyStore access tokens in environment variables or secret management services. Never hardcode them in your code. 🛡️ Use HTTPS
Always make API requests over HTTPS. 🖥️ Server-Side Calls
Never expose access tokens in client-side (browser) code. 🔄 Regular Rotation
Regularly regenerate access tokens for security.