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
Create Payment
Create payment via API and obtain payment_url
Redirect
Redirect user to payment_url
Payment Complete
After payment, user is automatically redirected to configured success_redirect_url or failure_redirect_url
Request
Payment amount (positive number, supports up to 2 decimal places. e.g., 17.62)
3-letter currency code (e.g., usd, sgd, jpy)
Capture method (optional)
automatic: Immediate payment
manual: Authorization only (capture later)
- If omitted: Uses flow configuration
Payment flow ID. If omitted, uses the default flow configured for the merchant
Additional data to store with the transaction
Customer ID. Required when saving or reusing cards for recurring payments
Set to true to save the card for future recurring payments. Use with customer_id
Cardholder name. Required for some payment methods
Response
Payment request ID (req_ prefix)
Merchant’s order ID (if specified)
Additional data (empty object if not specified)
Hosted checkout page URL (with signature)
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"
}