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": 100,
    "currency": "usd"
  }'
{
  "id": "req_abc123",
  "status": "pending",
  "amount": 100,
  "currency": "usd",
  "external_id": "order_12345",
  "metadata": { "customer_name": "John Doe" },
  "flow_id": "flow_default",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/req_abc123?token=xxxxxxxx",
  "created_at": "2025-01-01T00:00:00.000Z"
}

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 number, supports up to 2 decimal places. e.g., 17.62)
currency
string
required
3-letter currency code (e.g., usd, sgd, jpy)
capture_method
string
Capture method (optional)
  • automatic: Immediate payment
  • manual: Authorization only (capture later)
  • If omitted: Uses flow configuration
flow_id
string
Payment flow ID. If omitted, uses the default flow configured for the merchant
external_id
string
Merchant’s order ID
metadata
object
Additional data to store with the transaction
customer_id
string
Customer ID. Required when saving or reusing cards for recurring payments
save_card
boolean
Set to true to save the card for future recurring payments. Use with customer_id
payment_method_id
string
Saved payment method ID (pmi_xxx format). Used for recurring payments. See Recurring Payments Guide
email
string
Customer’s email address
tel
string
Customer’s phone number
name
string
Cardholder name. Required for some payment methods

Response

id
string
Payment request ID (req_ prefix)
status
string
Status (pending)
amount
number
Payment amount
currency
string
Currency code
external_id
string
Merchant’s order ID (if specified)
metadata
object
Additional data (empty object if not specified)
flow_id
string
Payment flow ID used
payment_url
string
Hosted checkout page URL (with signature)
created_at
string
Creation timestamp (ISO 8601 format)

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": 100,
    "currency": "usd"
  }'
{
  "id": "req_abc123",
  "status": "pending",
  "amount": 100,
  "currency": "usd",
  "external_id": "order_12345",
  "metadata": { "customer_name": "John Doe" },
  "flow_id": "flow_default",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/req_abc123?token=xxxxxxxx",
  "created_at": "2025-01-01T00:00:00.000Z"
}