Skip to main content
POST
https://api.sandbox.zafapay.com
/
v1
/
payments
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"
  }'
{
  "success": true,
  "status": "requires_action",
  "transaction_id": "tx_abc123",
  "gateway_transaction_id": "pi_xxxxx",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/tx_abc123?sig=xxxxxxxxxxxxxxxx"
}

Overview

Card payments use hosted checkout. Simply redirect the user to the payment_url from the API response, and card input through 3D Secure authentication is handled automatically.

Payment Flow

1

Create Payment

Create payment via API and obtain payment_url
2

Redirect

Redirect user to payment_url
3

Payment Complete

After payment, user is automatically redirected to configured success_redirect_url or failure_redirect_url

Request

amount
number
required
Payment amount (positive integer)
currency
string
required
3-letter currency code (e.g., usd, sgd, jpy)
capture_method
string
default:"automatic"
Capture method
  • automatic: Immediate payment
  • manual: Authorization only (capture later)
return_url
string
Redirect URL after 3D Secure authentication (only available when using payment_method.token; not required for hosted checkout)
external_id
string
Merchant’s order ID
metadata
object
Additional data to store with the transaction

Response

success
boolean
Success flag
status
string
Status (requires_action)
transaction_id
string
Transaction ID (tx_ prefix)
gateway_transaction_id
string
PSP’s transaction ID
payment_url
string
Hosted checkout page URL (with signature)

Implementation

Simply redirect to payment_url.
// After creating payment
const { payment_url } = await createPayment();

// Redirect user
window.location.href = payment_url;

// After payment completion, user is automatically redirected to
// success_redirect_url or failure_redirect_url
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"
  }'
{
  "success": true,
  "status": "requires_action",
  "transaction_id": "tx_abc123",
  "gateway_transaction_id": "pi_xxxxx",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/tx_abc123?sig=xxxxxxxxxxxxxxxx"
}