Skip to main content
Use details.code to handle payment errors. It is the stable, machine-readable identifier for each error. Authentication failures can omit details and include only a message.

Error envelope

Some codes add fields to details. For example, VOID_FAILED and PARTIAL_REFUND_PENDING include retryable and a suggestedAction. PAYMENT_DECLINED, PAYMENT_TIMEOUT and PAYMENT_GATEWAY_ERROR include id, the failed payment’s ID, when the payment engine returns one for the attempt (some timeouts do not). GET /payments/{id} returns that payment: failed after a decline or gateway error, and voided or unknown after a timeout, whose outcome may not be settled. Authentication failures with HTTP status 401 or 403 carry only message.

Error codes

Handling patterns

Case-specific restrictions use the payment-level referenceId. This is separate from each line item’s referenceId. The applicable restrictions depend on the agency’s payment configuration.

402 PAYMENT_DECLINED

Show message to the cardholder. If details.id is present, the declined attempt is recorded as a failed payment. Do not retry the same card without cardholder action (a new card, a different payment method).

403 PAYMENT_BLOCKED

The agency has blocked payments for the case identified by the payment-level referenceId. Do not retry the blocked payment. Direct the payer to the agency.

504 PAYMENT_TIMEOUT

The outcome is unknown. The card may have been charged. Check the payment status before retrying. If details.id is present, call GET /payments/{id} with it. Otherwise, list recent payments (GET /payments with portalId and a from/to window) to see whether the payment succeeded before trying again. If the original request carried an Idempotency-Key, retrying with the same key returns 409 IDEMPOTENCY_RECONCILIATION_REQUIRED rather than charging twice. See Idempotency.

502 PAYMENT_GATEWAY_ERROR

The gateway reported an error and the payment did not go through. It is safe to retry after a short delay.

422 INVALID_STATE / VOID_FAILED

The payment does not allow the requested operation. It may already be voided or fully refunded, or the refund may exceed the remaining amount. The message states the remaining amount in cents. For VOID_FAILED, check details.suggestedAction: "refund" means the batch has settled and a refund is the correct next step; "retry_void" means part of the void succeeded and the void should be retried.

502 PARTIAL_REFUND_PENDING

The principal was refunded, but the separate service-fee refund failed. Retry the same refund; details.remainingRefundableAmountCents shows what is still outstanding.

409 idempotency codes

For IDEMPOTENCY_MISMATCH, use a new key for a different operation. For IDEMPOTENCY_IN_PROGRESS, wait for the interval in Retry-After and retry with the same key. For IDEMPOTENCY_RECONCILIATION_REQUIRED, follow the idempotency guidance.

501 CAPTURE_NOT_SUPPORTED / VAULT_NOT_SUPPORTED

The feature is not supported. Send capture: "sale" (the default) and a card or card_token payment method.

503 GATEWAY_NOT_CONFIGURED

The portal has no payment gateway configured. Contact the agency or GroGov support before retrying.

503 IDEMPOTENCY_UNAVAILABLE

GroGov cannot record the Idempotency-Key for this request right now, so it was refused before anything was charged or refunded. Contact GroGov support; retry the same request with the same key once they confirm it is fixed.

403 PORTAL_ACCESS_DENIED

Your API account may not use the portalId in the request. Unknown portal IDs return the same code, so the response does not reveal whether a portal exists. Check the portalId, and contact GroGov if you expected access.