Skip to main content

Overview

ZAFA PAY API uses Bearer Token authentication. All API requests must include an access token in the Authorization header.

Obtaining Access Token

You can obtain an access token from the merchant dashboard.
1

Log in to Dashboard

Log in to the merchant dashboard (https://app.zafapay.com)
2

Open Merchant Settings

Select “Merchant Settings” from the side menu
3

Get Access Token

Use the access token displayed in the “API Settings” section

API Endpoints

Different access tokens are required for Sandbox and Production environments.

Authentication Method

Set the Authorization header in all API requests.
cURL
Node.js

Authentication Errors

Error Response Examples

401 Unauthorized
403 Forbidden

Publishable Key (for S2S Payments)

For server-to-server payments, a separate publishable key is used to tokenize card details from the browser. You can obtain your publishable key from the merchant dashboard under Merchant Settings > API Settings.
Browser
Publishable keys can only create tokens. They cannot access payments, customers, or any other API resources.

Security Best Practices

🔒 Store Tokens Securely
Store 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.