Appearance
Collect an EcoCash payment
Xash Payments accepts USD EcoCash payments and returns a verified result to your server. Start by creating an application in the dashboard. Copy its API token and signing secret into your server's secret store.
Send a request
Replace CUSTOMER_PHONE with the payer's Econet number. 100 is USD 1.00.
sh
curl https://payments.xash.co.zw/api/v1/payments \
-H "Authorization: Bearer $XASH_PAYMENTS_TOKEN" \
-H "Idempotency-Key: order-1042-collection" \
-H "Content-Type: application/json" \
-d '{"reference":"order-1042","method":"ecocash","amount_minor":100,"currency":"USD","customer":{"phone":"CUSTOMER_PHONE"},"description":"Order 1042"}'The response returns data.id and a status. HTTP 202 means the request is saved. The customer approves the payment using their EcoCash PIN on their phone.
Wait for confirmation
Read GET /api/v1/payments/{id} or receive a signed webhook. Credit the wallet or fulfil the order once the payment is succeeded and includes a receipt.
If the first response is lost, recover the payment with GET /api/v1/payments/by-reference/order-1042. Keep the original reference and idempotency key.
Return a payment
A successful payment can have one full refund. The application must reserve the credited amount before the gateway submits the return to EcoCash.