Documentation Index
Fetch the complete documentation index at: https://docs.zafapay.com/llms.txt
Use this file to discover all available pages before exploring further.
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
Call POST /v1/payments to create a payment and obtain payment_url
Redirect
Redirect user to payment_url
Payment Complete
After payment, user is automatically redirected to your configured success_redirect_url or failure_redirect_url
Implementation Example
// 1. Create payment via API
const response = await fetch('https://api.sandbox.zafapay.com/v1/payments', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 100,
currency: 'usd'
})
});
const payment = await response.json();
// 2. Redirect user to hosted checkout
window.location.href = payment.payment_url;
// 3. User completes payment on hosted page
// 4. User is redirected to success_redirect_url or failure_redirect_url
Authorization & Capture
For two-step payments (authorize first, capture later):
// Step 1: Authorize
const payment = await createPayment({
amount: 100,
currency: 'usd',
capture_method: 'manual' // Authorization only
});
// Step 2: Capture (when ready to charge)
await fetch(`https://api.sandbox.zafapay.com/v1/payments/${payment.transaction_id}/capture`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
});
Test Cards
| Card Number | Description |
|---|
| 4242424242424242 | Successful payment |
| 4000002500003155 | Requires 3D Secure |
| 4000000000000002 | Declined |
| 4000000000000259 | Chargeback |
| 4000000000009995 | Insufficient funds |
| 4000000000009987 | Lost card |
| 4000000000009979 | Stolen card |
| 4000000000000069 | Expired card |
| 4000000000000127 | Incorrect CVC |
| 4000000000000119 | Processing error |
For complete API parameters and response details, see the Create Payment API reference.