Appearance
Card
Charges a Visa or Mastercard and adds the amount to your USD wallet. Card deposits are USD only.
You are handling card numbers
This endpoint takes the full card number and security code. Sending it from your server puts your system in scope for PCI DSS. Do not store or log these fields.
POST /api/v1/card/pay
Body
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | USD to add to your wallet. At least 0.1. |
pan | string | Yes | The card number, 12 to 19 digits, no spaces. |
exp_month | string | Yes | Two digits, 01 to 12. |
exp_year | string | Yes | Two to four digits, for example 29 or 2029. |
security_code | string | Yes | The 3 or 4 digit code on the card. |
first_name, last_name | string | No | The cardholder's name. Up to 100 characters each. |
email | string | No | The cardholder's email. |
return_url | string | No | Where the bank sends the cardholder after 3-D Secure. |
callback_url | string | No | Where to send the callback. |
expMonth, expYear, securityCode and returnUrl are accepted as alternative names.
request_id is not supported for cards. Repeating the request starts a second charge attempt.
Example
bash
curl -X POST https://app.xash.co.zw/api/v1/card/pay \
-H "Authorization: Bearer YOUR_SERVER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 10,
"pan": "4000000000000002",
"exp_month": "12",
"exp_year": "29",
"security_code": "000",
"first_name": "Tariro",
"last_name": "Example",
"return_url": "https://shop.example.com/card/return?order=1001"
}'Response 200
json
{
"success": true,
"message": "Payment initiated",
"data": {
"id": 9004,
"amount": "10.00",
"currency": "USD",
"payment_method": "card",
"status": "PENDING",
"archived": false,
"reconciliation_required": false,
"start_unconfirmed": false,
"expires_at": "2026-11-19T08:30:00.000000Z",
"created_at": "2026-11-19T08:15:00.000000Z",
"poll_url": "https://app.xash.co.zw/api/v1/card/poll/9004",
"charge_amount": "10.00",
"charge_currency": "USD",
"exchange_rate": null,
"redirect_html": "<html>...the bank's 3-D Secure page...</html>",
"status_message": "Complete card authentication."
}
}3-D Secure
When the bank requires it, the response includes redirect_html: a complete HTML page. Show it to the cardholder in their browser or a web view. It takes them to their bank to approve the payment, then on to your return_url.
redirect_html is returned once, in this response only. It is not stored and the poll endpoint does not return it. If you lose it, do not start a new deposit straight away: if the cardholder was shown the page, the first one may still be paid. Check the original deposit first, and start another only once you know the first was not paid.
When there is no redirect_html, no extra step is needed.
Then
Poll the deposit until status is SUCCESS, FAILED or EXPIRED. Do not treat the cardholder arriving at your return_url as proof of payment.
Errors
| Status | When |
|---|---|
422 | charge_currency is not USD: Card payments currently support USD charges only. |
422 | A card field is missing or malformed. |
See also When starting a deposit fails.