Skip to content

08.03 Error Code Dictionary

Статус: черновик для обсуждения

1. Назначение документа

Этот документ описывает internal error codes для MVP.

Error codes нужны, чтобы:

  • merchant получал единый безопасный error response;
  • merchant webhooks содержали безопасную причину failed/rejected/canceled transaction;
  • Back Office показывал consistent error information;
  • provider raw errors не раскрывались merchant users;
  • support/platform users могли расследовать transaction через mapping.

2. Где показываются error codes

Error codes показываются в:

  • Merchant API response;
  • Merchant webhook payload, если transaction status связан с ошибкой / rejection / cancellation;
  • Merchant Portal / Back Office transaction details;
  • Platform Back Office transaction details;
  • transaction timeline;
  • transaction export, если user имеет permission видеть эти поля.

3. Где error codes не показываются

Error codes не показываются:

  • customer на hosted payment form;
  • provider-facing requests;
  • public provider callback URLs/docs;
  • customer-facing generic error screen.

Customer на hosted payment form видит только:

  • generic message;
  • reference ID.

4. Merchant-facing principle

Merchant всегда видит только:

  • internal error code;
  • safe human-readable description.

Merchant не должен видеть:

  • real provider error;
  • raw provider response;
  • provider stack trace;
  • internal exception;
  • hidden routing internals;
  • provider credentials/config.

5. Platform visibility

Platform user с permission видит:

  • internal error code;
  • description;
  • category;
  • provider raw error, если есть;
  • provider error -> internal error mapping;
  • source;
  • timeline event;
  • raw payload/request/response, если permission позволяет.

6. Error code fields

Каждый error code должен иметь:

  • code;
  • category;
  • description;
  • recommended HTTP status;
  • visibility notes, если нужно.

Field retryable в MVP не нужен.

Retry behavior может быть определен development team отдельно, если понадобится в API docs.

7. Categories

Error categories:

  • VALIDATION;
  • AUTH;
  • CONFIGURATION;
  • ROUTING;
  • VELOCITY;
  • PROVIDER;
  • CALLBACK;
  • EXPIRED;
  • CANCELED;
  • WEBHOOK;
  • SYSTEM.

8. Validation errors

CodeCategoryDescriptionRecommended HTTP status
VALIDATION_ERRORVALIDATIONRequest validation failed.400
MISSING_REQUIRED_FIELDVALIDATIONRequired field is missing.400
INVALID_FIELD_VALUEVALIDATIONField value is invalid.400
DUPLICATE_TRANSACTION_IDVALIDATIONTransaction with this transactionId already exists.409
INVALID_AMOUNTVALIDATIONAmount is invalid.400
INVALID_CURRENCYVALIDATIONCurrency is invalid.400
INVALID_WEBHOOK_URLVALIDATIONWebhook URL is invalid.400
INVALID_REDIRECT_URLVALIDATIONRedirect URL is invalid.400

9. Auth/signature errors

CodeCategoryDescriptionRecommended HTTP status
AUTHENTICATION_FAILEDAUTHAuthentication failed.401
INVALID_SIGNATUREAUTHRequest signature is invalid.401
API_KEY_REVOKEDAUTHAPI key has been revoked.401
API_KEY_EXPIREDAUTHAPI key has expired.401

10. Merchant/configuration errors

CodeCategoryDescriptionRecommended HTTP status
MERCHANT_INACTIVECONFIGURATIONMerchant is inactive.403
BRAND_INACTIVECONFIGURATIONBrand is inactive.403
PAYMENT_METHOD_INACTIVECONFIGURATIONPayment method is inactive.403
PAYMENT_METHOD_NOT_FOUNDCONFIGURATIONPayment method was not found.404
BRAND_NOT_FOUNDCONFIGURATIONBrand was not found.404

11. Routing errors

CodeCategoryDescriptionRecommended HTTP status
ROUTING_NOT_FOUNDROUTINGRouting configuration was not found.422
NO_MATCHING_ROUTING_RULEROUTINGNo matching routing rule was found.422
NO_AVAILABLE_MASTER_MIDROUTINGNo available MASTER MID was found.422
NO_AVAILABLE_SUB_MIDROUTINGNo available SUB MID was found.422
ROUTING_EXHAUSTEDROUTINGTransaction could not be routed.422

12. Velocity errors

CodeCategoryDescriptionRecommended HTTP status
VELOCITY_LIMIT_EXCEEDEDVELOCITYTransaction was rejected because velocity limit was exceeded.422

13. Provider errors

CodeCategoryDescriptionRecommended HTTP status
PROVIDER_ERRORPROVIDERTransaction failed due to payment provider error.502
PROVIDER_TIMEOUTPROVIDERPayment provider did not respond in time.504
PROVIDER_UNAVAILABLEPROVIDERPayment provider is unavailable.503
PROVIDER_REJECTEDPROVIDERPayment provider rejected the transaction.422
PROVIDER_INVALID_RESPONSEPROVIDERPayment provider returned invalid response.502

Provider descriptions must stay generic and safe.

Merchant must not see real provider response.

14. Callback processing errors

CodeCategoryDescriptionRecommended HTTP status
CALLBACK_VALIDATION_FAILEDCALLBACKProvider callback validation failed.200
CALLBACK_AMOUNT_MISMATCHCALLBACKProvider callback amount does not match transaction amount.200
CALLBACK_CURRENCY_MISMATCHCALLBACKProvider callback currency does not match transaction currency.200
CALLBACK_SIGNATURE_INVALIDCALLBACKProvider callback signature is invalid.200
CALLBACK_DUPLICATECALLBACKProvider callback was already processed.200
CALLBACK_IGNOREDCALLBACKProvider callback was ignored.200

Provider callback endpoint should accept callback quickly and respond OK after storing/queueing it.

Business validation errors are stored internally and do not necessarily change HTTP response to provider.

15. Expiration/cancel errors

CodeCategoryDescriptionRecommended HTTP status
TRANSACTION_EXPIREDEXPIREDTransaction has expired.422
PAYMENT_SESSION_EXPIREDEXPIREDPayment session has expired.422
TRANSACTION_CANCELEDCANCELEDTransaction was canceled.422

16. Webhook delivery errors

CodeCategoryDescriptionRecommended HTTP status
WEBHOOK_DELIVERY_FAILEDWEBHOOKWebhook delivery failed.502
WEBHOOK_RETRY_EXHAUSTEDWEBHOOKWebhook retry attempts were exhausted.502

These codes are mostly internal/platform/merchant Back Office visibility.

They are not provider-facing.

17. System errors

CodeCategoryDescriptionRecommended HTTP status
INTERNAL_ERRORSYSTEMInternal system error occurred.500
SERVICE_UNAVAILABLESYSTEMService is temporarily unavailable.503
PROCESSING_ERRORSYSTEMTransaction processing failed due to internal error.500

System error descriptions must not reveal stack traces or internal exception details.

18. Error codes in Merchant API response

Example:

json
{
  "errorCode": "DUPLICATE_TRANSACTION_ID",
  "description": "Transaction with this transactionId already exists."
}

Merchant API response should not include provider raw error.

19. Error codes in merchant webhooks

Merchant webhook payload всегда содержит:

  • errorCode;
  • errorDescription.

Если transaction не связана с ошибкой:

  • errorCode = null;
  • errorDescription = null.

Merchant webhook payload must not include:

  • provider raw error;
  • provider raw response;
  • internal exception details;
  • hidden routing details.

20. Error codes in Back Office

Merchant user can see:

  • status;
  • error code;
  • description.

Platform user with permission can also see:

  • provider raw error;
  • provider code;
  • provider status;
  • mapping details;
  • raw payload/request/response.

21. Error codes in hosted payment form

Hosted payment form must not show internal error code to customer.

Customer sees:

text
Payment could not be completed. Please contact support and provide reference ID: {referenceId}.

Exact reference ID format is technical/design follow-up.

22. Acceptance Criteria

Error Code Dictionary считается согласованным для MVP, если:

  • Error codes показываются в Merchant API response.
  • Error codes показываются в merchant webhook payload через errorCode and errorDescription.
  • Error codes показываются в Merchant Portal / Back Office transaction details.
  • Error codes показываются в Platform Back Office transaction details.
  • Error codes могут быть частью timeline/export visibility.
  • Error codes не показываются customer на hosted payment form.
  • Merchant видит только internal error code + safe description.
  • Provider raw errors хранятся отдельно.
  • Platform user с permission видит provider raw error and mapping details.
  • Каждый error code имеет category.
  • Каждый error code имеет recommended HTTP status.
  • retryable field не входит в MVP.
  • Validation errors описаны.
  • Auth/signature errors описаны.
  • Configuration errors описаны.
  • Routing errors описаны.
  • Velocity errors описаны.
  • Provider errors описаны.
  • Callback processing errors описаны.
  • Expiration/cancel errors описаны.
  • Webhook delivery errors описаны.
  • System errors описаны.

23. Open Questions

Product open questions отсутствуют.

Technical/design follow-up:

  1. Уточнить final HTTP status mapping.
  2. Определить exact JSON error schema.
  3. Определить reference ID format для hosted payment form.
  4. Определить provider error -> internal error mapping per provider.
  5. Определить where callback validation error codes are stored in callback/timeline model.