Developers API reference Get sandbox access
API reference

Errors

Every failure has an HTTP status, a human-readable error, and an error_code to branch on. Show error to your staff; code against error_code.

Error codes

HTTPerror_codeCause and what to do
400invalid_jsonThe body isn't a JSON object. Check the Content-Type and serialisation.
400invalid_actionThe action is missing or unknown.
401missing_api_keyNo Authorization: Bearer header was sent.
401invalid_api_keyThe key is wrong, revoked, or from the other environment.
403merchant_inactiveYour merchant account isn't active yet. Contact Cashwo support.
404not_foundNo agreement or payment with that id in your account.
405method_not_allowedUse POST.
409idempotency_key_reusedThat Idempotency-Key was already used with a different body. Use a new key.
409idempotency_in_progressThe first request with that key is still running. Retry shortly.
409invalid_status_changeThe agreement's status doesn't allow that change. Fetch it and check.
409status_changedThe agreement changed while you were changing it. Fetch it and try again.
422validation_failederror lists every problem; each message names the field.
422invalid_idempotency_keyKeys are 1–100 characters: letters, digits, - _ : .
500internal_errorA problem at Cashwo. Retry with the same Idempotency-Key.
502bank_rejectedThe payment network refused the change.
504bank_timeoutThe payment network didn't answer. Fetch the agreement before retrying.

Validation messages

Typical messages from create_agreement:

  • Limit payment references to 22 characters. — payment_ref must be 2–21 characters.
  • merchant_reference must be at least 2 characters long. — 2–21 characters.
  • Invalid Name. — letters and spaces only, up to 30 characters.
  • Invalid Phone Number. … — an Australian mobile is required.
  • Invalid Email.
  • Invalid frequency. — one value from the list.
  • amount must be greater than 0.
  • agreement_end_date must be a valid date (YYYY-MM-DD), today or later.
  • One-time agreements are not enabled for this merchant. — ask Cashwo support.

When to retry

  • Retry 5xx responses and network timeouts, with the same Idempotency-Key and a growing delay.
  • Don't retry 4xx responses unchanged; fix the request first. The exception is idempotency_in_progress.
  • After bank_timeout, read the agreement: the change may have gone through.