Skip to main content

Error Reference

This page is a complete lookup for every error type you may encounter when integrating with AccruPay, including API-level errors, transaction outcomes, and provider decline reasons.


API errors

API errors appear in the GraphQL errors array. The response data is null or the failing field resolves to null.

{
"errors": [
{
"message": "Authentication error.",
"extensions": {
"code": "UNAUTHORIZED"
}
}
],
"data": null
}

Always check extensions.code — the message field is for human reading only and may change between releases.

extensions.code is either one of the fixed framework codes below, or a namespaced AppError key of the form @domain/REASON (e.g. @general/INTERNAL_SERVER_ERROR) for business-rule failures. Branch on the code; treat any @…/… key as a business error and read message for detail.

CodeCauseFix
UNAUTHORIZEDThe accrupay-api-secret header is missing, malformed, or the secret has been rotatedVerify the API secret value in your environment; ensure the header name is lowercase accrupay-api-secret
FORBIDDENThe credentials are valid but the authenticated merchant is not permitted to access the requested resourceConfirm the API key belongs to the correct merchant account; check that the resource was created by this merchant
GRAPHQL_VALIDATION_FAILEDA required argument is missing or a value fails type/format validationCheck the message for field-level detail; correct the input and retry
GRAPHQL_PARSE_FAILEDThe GraphQL document is malformedFix the query syntax
@domain/REASON (AppError key)A business rule was violated (e.g. resource not found, duplicate merchantInternalTransactionCode, provider selection failure)The key identifies the specific reason; read message and correct the request
INTERNAL_SERVER_ERRORUnexpected server-side failure not caused by the inputRetry with exponential backoff; if it persists, open a support ticket with the full error response body

Transaction errors

Transaction declines and failures are not GraphQL errors. The mutation resolves with HTTP 200 and a successful GraphQL response. The failure is indicated by transaction.status in the response data.

{
"data": {
"merchantApiServerPaymentMethodTransactionCreate": {
"id": "txn-uuid",
"status": "DECLINED",
"providerError": "Do not honor"
}
}
}
StatusCauseWhat to show the customer
DECLINEDThe card network or issuer rejected the charge (e.g. insufficient funds, card blocked, card expired)"Your payment was declined. Please try a different payment method."
FAILEDA processing failure prevented the transaction from being submitted (e.g. invalid card data, provider timeout, configuration error)"Something went wrong processing your payment. Please try again or contact support."

Neither status is retryable with the same payment method without customer action. For DECLINED, prompt the customer to re-enter payment details or use a different card. For FAILED, a retry may succeed if the cause was transient (e.g. a provider timeout), but you must use a new merchantInternalTransactionCode — a code from a failed attempt is permanently consumed. See Idempotency for the exact rule.


providerError field

Most transaction return types include a providerError field. It is populated when status is DECLINED or FAILED.

{
id
status
providerError
}

providerError contains the raw reason string from the provider (e.g. "Insufficient funds", "Do not honor", "Invalid card number", "Expired card").

How to use providerError

UseRecommendation
Internal loggingLog the full providerError value for every non-approved transaction
Support ticketsInclude providerError in support context to help diagnose declines
Customer-facing messagesDo not show providerError directly; map to a user-friendly message
Retry logicUse providerError to distinguish hard declines (do not retry) from soft declines (may retry)

Common hard decline indicators in providerError: "Do not honor", "Stolen card", "Lost card", "Restricted card". These should not be retried.

Common soft decline indicators: "Insufficient funds", "Exceeds withdrawal limit". These may succeed after the customer resolves the underlying issue.


Network and transport errors

HTTP-level failures do not produce a GraphQL response body. Handle these separately from GraphQL errors.

ScenarioBehaviorRecommendation
HTTP 200, errors[] presentGraphQL errorBranch on extensions.code
HTTP 200, data presentSuccessCheck transaction.status
HTTP 401Request rejected before reaching GraphQLCheck the accrupay-api-secret header
HTTP 5xxServer error before GraphQL processingRetry with backoff
Timeout / no responseTransport failureQuery by merchantInternalTransactionCode before retrying to avoid duplicate charges

SDK error handling

The @accrupay/node SDK does not throw typed error classes. It surfaces errors through callbacks you pass to the constructor:

CallbackFires on
onAuthError()Authentication failures (UNAUTHORIZED) — receives no argument
onGraphQLError(errors)A populated GraphQL errors[] — receives ReadonlyArray<GraphQLFormattedError>
onNetworkError(error)Transport-level failures (timeout, DNS, connection refused) — receives an Error

Inspect extensions.code on each entry in onGraphQLError to branch on the codes above. See Node SDK — Error handling.