Skip to main content

Environments

EnvironmentAdmin DashboardAPI
Sandboxadmin.sandbox.zafapay.comapi.sandbox.zafapay.com
Productionadmin.zafapay.comapi.zafapay.com
Use the Sandbox environment for development and testing. Switching to production only requires changing the API endpoint URL.

1. Get Access Token

Get your access token from the “Merchant Settings” page in the merchant dashboard.
# All API requests require an Authorization header
Authorization: Bearer YOUR_ACCESS_TOKEN
For detailed instructions, see Authentication.

2. Create Payment

curl -X POST https://api.sandbox.zafapay.com/v1/payments \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "usd",
    "external_id": "order_12345"
  }'
Response:
{
  "success": true,
  "status": "pending",
  "transaction_id": "tx_abc123",
  "gateway_transaction_id": "depot_xxxxx",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/tx_abc123?sig=xxxxxxxxxxxxxxxx"
}

3. Redirect Customer

Redirect the customer to the payment_url from the response. After payment completion, the customer will be redirected to success_redirect_url or failure_redirect_url configured in your merchant dashboard.

4. Verify Payment Result

curl https://api.sandbox.zafapay.com/v1/payments/tx_abc123 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "id": "tx_abc123",
  "status": "completed",
  "amount": 1000,
  "currency": "usd"
}

Next Steps