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 integer)
3-letter currency code (e.g., usd, sgd, jpy)
capture_method
string
default:"automatic"
Capture method
automatic: Immediate payment
manual: Authorization only (capture later)
Redirect URL after 3D Secure authentication (only available when using payment_method.token; not required for hosted checkout)
Additional data to store with the transaction
Response
Transaction ID (tx_ prefix)
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"
}