HSRCPAY Documentation

Errors and Retries

Error classes, safe retry, and operational recovery.

In payment APIs, "retry on every error" gets expensive fast. First classify the error, then decide what to show the user.

Decline and code list: Testing Declines.

Classes

GroupWhat to do
4xx validationFix payload; no retry
401/403Key or permission
409Idempotency conflict; read result with same key
5xx / timeoutLimited backoff; same idempotency key

Confirm and decline

After a decline, payment usually stays REQUIRES_PAYMENT_METHOD. Before opening a new payment, check payments.get and the charge list. On hard decline, do not loop with the same card.

Backoff

const delays = [250, 750, 1500]; // ms, example

Monitoring

  • Consecutive failed confirm rate
  • Webhook delivery failures
  • Provider-level decline distribution (dashboard)

On this page