Skip to content

When an error occurs, the xMoney API will return an error response in JSON format. The response will include a status code, a message, and an array of errors.

Error response format

The error response will be in the following format:

{
  "code": 400,
  "message": "Bad Request",
  "errors": [
    {
      "code": 1651,
      "message": "Invalid email address provided",
      "type": "Validation",
      "field": "email"
    }
  ]
}

The errors array will contain a list of errors that occurred. Each error will have the following fields:

FieldDescription
codeThe error code.
messageA human-readable message describing the error.
typeThe type of error Exception or Validation.
fieldThe field that the error occurred in (if applicable).

HTTP Status Codes

These are standard HTTP status codes used to indicate the general category of the response.

CodeConstantDescription
200HTTP_OKThe request was successful
201HTTP_CREATEDA new resource was successfully created
202HTTP_ACCEPTEDThe request has been accepted for processing
303HTTP_SEE_OTHERRedirect to another resource
400HTTP_BAD_REQUESTThe request was invalid or cannot be processed
401HTTP_UNAUTHORIZEDAuthentication is required or has failed
402HTTP_PAYMENT_REQUIREDPayment is required to proceed
403HTTP_FORBIDDENYou don't have permission to access this resource
404HTTP_NOT_FOUNDThe requested resource was not found
409HTTP_CONFLICTThe request conflicts with the current state of the resource
500HTTP_SYSTEM_ERRORAn internal server error occurred
502HTTP_BAD_GATEWAYThe server received an invalid response from an upstream server
504HTTP_GATEWAY_TIMEOUTThe server did not receive a timely response from an upstream server

General Purpose Errors (6xx)

These errors relate to general API usage, authentication, and common validation issues.

CodeConstantDescriptionField(s)
601API_KEY_INVALIDThe provided API key is invalid or malformedapiKey
602PAGE_INVALIDInvalid page number for pagination (must be between 1 and 1,000,000,000)page
603PER_PAGE_INVALIDInvalid items per page value (must be between 1 and 1,000)perPage
604TAG_MISSINGThe tag field is required but was not providedtag
605TAG_INVALIDThe tag value is invalid (must be alphanumeric, max 100 chars)tag
606IP_INVALIDThe IP address format is invalidip
607CURRENCY_NOT_SUPPORTEDThe specified currency is not supportedcurrency
609DATABASE_ERRORA database error occurred while processing the request
610CURRENCY_MISSINGThe currency field is required but was not providedcurrency
611CURRENCY_INVALIDThe currency code is invalid (must be 3 uppercase letters)currency
612DESCRIPTION_MISSINGThe description field is required but was not provideddescription
613DESCRIPTION_INVALIDThe description is invalid (max 65,535 characters)description
614DATE_INVALIDThe date format is invalid (use ISO 8601 format)Various
615TAG_NOT_FOUNDThe specified tag was not foundtag
616TAG_EXISTSA tag with this value already existstag
617GREATER_THEN_ID_INVALIDInvalid greaterThanId value for paginationgreaterThanId
618SITE_ID_MISSINGThe siteId field is required but was not providedsiteId
619JSON_VALUE_MISSINGA required JSON field is missingVarious
620JSON2_VALUE_INVALIDThe JSON value is invalid or malformedVarious
621URL_MISSINGThe URL field is required but was not providedurl
622URL_INVALIDThe URL format is invalid (must be 10-250 characters)url
623BOOLEAN_MISSINGA required boolean field is missingVarious
624BOOLEAN_INVALIDThe boolean value is invalid (use true/false, yes/no, 1/0)Various
625PUBLIC_KEY_MISSINGThe public key field is required but was not providedpublicKey
626PUBLIC_KEY_INVALIDThe public key is invalidpublicKey
627SITE_ID_INVALIDThe siteId format is invalid (must be numeric)siteId
634JSON_VALUE_INVALIDThe JSON value is invalid or malformedVarious
638DELETE_MESSAGE_MISSINGThe deletion message is required but was not providedmessage
639DELETE_MESSAGE_INVALIDThe deletion message is invalid (max 65,535 characters)message
640BASE64_VALUE_MISSINGA required Base64 encoded field is missingVarious
641BASE64_VALUE_INVALIDThe Base64 encoded value is invalid or malformedVarious
642SITE_DISABLEDThe specified site is disabled and cannot be usedsiteId

Order Errors (7xx)

These errors relate to order creation, updates, and management.

CodeConstantDescriptionField(s)
700ORDER_ID_MISSINGThe orderId field is required but was not providedorderId
701ORDER_ID_INVALIDThe orderId format is invalid (must be numeric, max 32 digits)orderId
702ORDER_TYPE_MISSINGThe orderType field is required but was not providedorderType
703ORDER_TYPE_INVALIDThe orderType value is invalidorderType
712FIRST_BILL_DATE_MISSINGThe firstBillDate is required for recurring ordersfirstBillDate
713FIRST_BILL_DATE_INVALIDThe firstBillDate format is invalid (use ISO 8601 format)firstBillDate
714INTERVAL_TYPE_MISSINGThe intervalType is required for recurring ordersintervalType
715INTERVAL_TYPE_INVALIDThe intervalType is invalid (use 'day' or 'month')intervalType
716INTERVAL_VALUE_MISSINGThe intervalValue is required for recurring ordersintervalValue
717INTERVAL_VALUE_INVALIDThe intervalValue is invalid (must be 1-365)intervalValue
718TRIAL_AMOUNT_MISSINGThe trialAmount is required but was not providedtrialAmount
719TRIAL_AMOUNT_INVALIDThe trialAmount format is invalidtrialAmount
720TRANSACTION_METHOD_ID_MISSINGThe transactionMethodId is required but was not providedtransactionMethodId
721TRANSACTION_METHOD_ID_INVALIDThe transactionMethodId format is invalidtransactionMethodId
722ORDER_UPDATE_CONFLICTCannot update the order due to a conflict with its current state
723ORDER_INSUFFICIENT_DATAInsufficient data provided to create or process the order
724ORDER_REQUEST_BODY_INVALIDThe order request body is invalid
725ORDER_NOT_FOUNDThe specified order was not foundorderId
730ORDER_STATUS_MISSINGThe orderStatus field is required but was not providedorderStatus
731ORDER_STATUS_INVALIDThe orderStatus value is invalidorderStatus
732ORDER_RETRY_PAYMENT_MISSINGThe retryPayment field is required but was not providedretryPayment
733ORDER_RETRY_PAYMENT_INVALIDThe retryPayment format is invalid (use ISO 8601 duration format)retryPayment
734ORDER_CREATE_CONFLICTCannot create order due to a conflict (e.g., duplicate)
735NEXT_DUE_DATE_MISSINGThe nextDueDate is required but was not providednextDueDate
736NEXT_DUE_DATE_INVALIDThe nextDueDate format is invalid (use ISO 8601 format)nextDueDate
737ORDER_EXTERNAL_ORDER_ID_MISSINGThe externalOrderId is required but was not providedexternalOrderId
740LEVEL3_DATA_INVALIDThe Level 3 transaction data is invalidlevel3Data
741ORDER_EXTERNAL_ORDER_ID_INVALIDThe externalOrderId format is invalid (alphanumeric, max 32 chars)externalOrderId

Transaction Errors (8xx)

These errors relate to payment transactions, including authorizations, captures, and refunds.

CodeConstantDescriptionField(s)
800TRANSACTION_ID_MISSINGThe transactionId is required but was not providedtransactionId
801TRANSACTION_ID_INVALIDThe transactionId format is invalid (must be numeric, max 32 digits)transactionId
802TRANSACTION_METHOD_MISSINGThe transactionMethod is required but was not providedtransactionMethod
803TRANSACTION_METHOD_INVALIDThe transactionMethod value is invalidtransactionMethod
804AMOUNT_MISSINGThe amount is required but was not providedamount
805AMOUNT_INVALIDThe amount format is invalid (must be positive numeric)amount
808CARD_HOLDER_NAME_MISSINGThe cardHolderName is required but was not providedcardHolderName
809CARD_HOLDER_NAME_INVALIDThe cardHolderName is invalid (max 250 characters)cardHolderName
814CARD_TYPE_MISSINGThe cardType is required but was not providedcardType
815CARD_TYPE_INVALIDThe cardType value is invalidcardType
816CARD_NUMBER_MISSINGThe cardNumber is required but was not providedcardNumber
817CARD_NUMBER_INVALIDThe cardNumber is invalid (invalid format, checksum, or issuer)cardNumber
818CARD_EXPIRY_DATE_MISSINGThe cardExpiryDate is required but was not providedcardExpiryDate
819CARD_EXPIRY_DATE_INVALIDThe cardExpiryDate is invalid (use MM/YY format)cardExpiryDate
820CARD_CVV_MISSINGThe cardCvv is required but was not providedcardCvv
821CARD_CVV_INVALIDThe cardCvv is invalid (must be 3-4 digits)cardCvv
822CARD_BLACKLISTEDThe card has been blacklisted and cannot be used
824TRANSACTION_NOT_FOUNDThe specified transaction was not foundtransactionId
825TRANSACTION_EXISTSA transaction with this identifier already exists
826TRANSACTION_UPDATE_CONFLICTCannot update the transaction due to a conflict
827TRANSACTION_TYPE_MISSINGThe transactionType is required but was not providedtransactionType
828TRANSACTION_TYPE_INVALIDThe transactionType value is invalidtransactionType
829TRANSACTION_STATUS_MISSINGThe transactionStatus is required but was not providedtransactionStatus
830TRANSACTION_STATUS_INVALIDThe transactionStatus value is invalidtransactionStatus
834TRANSACTION_FRAUD_SUSPECTEDThe transaction was declined due to suspected fraud
835TRANSACTION_INSUFFICIENT_FUNDSThe transaction was declined due to insufficient funds
836TRANSACTION_DECLINEDThe transaction was declined by the issuing bank
837TRANSACTION_REJECTEDThe transaction was rejected by the payment provider
838TRANSACTION_TIMED_OUTThe transaction timed out (try again later)
839TRANSACTION_SOFT_DECLINEDThe transaction with saved card was soft declined by the issuing bank
840TRANSACTION_PENDINGThe transaction is pending (waiting for async response)
841TRANSACTION_SOURCE_MISSINGThe transaction source is required but was not providedsource
842TRANSACTION_SOURCE_INVALIDThe transaction source value is invalidsource
843PROVIDER_RESPONSE_TIMEOUTThe payment provider did not respond in time
844PROVIDER_RESPONSE_INVALIDThe payment provider returned an invalid response
845DATE_TYPE_MISSINGThe dateType field is required but was not provideddateType
846DATE_TYPE_INVALIDThe dateType value is invaliddateType
848EXTERNAL_CUSTOM_DATA_MISSINGThe externalCustomData is required but was not providedexternalCustomData
849EXTERNAL_CUSTOM_DATA_INVALIDThe externalCustomData format is invalidexternalCustomData
855TRANSACTION_CREDIT_INSUFFICIENT_FUNDSThe credit transaction failed due to insufficient funds
856PROVIDER_RESPONSE_CODE_INVALIDThe payment provider returned an invalid response code
857CARD_DATA_MISSINGThe card data is required but was not provided
858CARD_DATA_INVALIDThe card data is invalid
859TRANSACTION_MODE_INVALIDThe transaction mode is invalidtransactionMode
860TRANSACTION_OPTION_INVALIDThe transactionOption is invalidtransactionOption
861TRANSACTION_OPTION_MISSINGThe transactionOption is required but was not providedtransactionOption
862TO_SITE_MISSINGThe toSite field is required for split paymentstoSite
863TO_SITE_INVALIDThe toSite value is invalidtoSite
864PROVIDER_REQUEST_VALIDATION_ERRORThe request to the payment provider failed validation
865PROVIDER_RESPONSE_VALIDATION_ERRORThe response from the payment provider failed validation

Card Errors (9xx)

These errors relate to saved cards and card management.

CodeConstantDescriptionField(s)
900CARD_ID_MISSINGThe cardId is required but was not providedcardId
901CARD_ID_INVALIDThe cardId format is invalid (must be numeric, max 11 digits)cardId
902CARD_NOT_FOUNDThe specified card was not foundcardId
903CARD_STATUS_MISSINGThe cardStatus is required but was not providedcardStatus
904CARD_STATUS_INVALIDThe cardStatus value is invalidcardStatus

Extra/Resource Errors (10xx)

These errors relate to resource management and extra services.

CodeConstantDescriptionField(s)
1000RESOURCE_TYPE_MISSINGThe resource type is required but was not providedresourceType
1001RESOURCE_TYPE_INVALIDThe resource type value is invalidresourceType
1002RESOURCE_ID_MISSINGThe resource ID is required but was not providedresourceId
1003RESOURCE_ID_INVALIDThe resource ID format is invalidresourceId
1004UPDATES_MESSAGE_MISSINGThe update message is required but was not providedmessage
1005UPDATES_MESSAGE_INVALIDThe update message is invalidmessage
1006DELETE_REASON_MISSINGThe deletion reason is required but was not providedreason
1007DELETE_REASON_INVALIDThe deletion reason is invalidreason
1008DELETE_REASON_ID_MISSINGThe deletion reason ID is required but was not providedreasonId
1009DELETE_REASON_ID_INVALIDThe deletion reason ID is invalidreasonId
1010DELETE_REASON_TYPE_MISSINGThe deletion reason type is required but was not providedreasonType
1011DELETE_REASON_TYPE_INVALIDThe deletion reason type is invalidreasonType
1012DOWNLOAD_NOT_FOUNDThe requested download was not found

Customer Errors (16xx)

These errors relate to customer data and management.

CodeConstantDescriptionField(s)
1620CUSTOMER_ID_MISSINGThe customerId is required but was not providedcustomerId
1621CUSTOMER_ID_INVALIDThe customerId format is invalidcustomerId
1626CUSTOMER_NOT_FOUNDThe specified customer was not foundcustomerId
1627CUSTOMER_EXISTSA customer with this identifier already exists
1630FIRST_NAME_MISSINGThe firstName is required but was not providedfirstName
1631FIRST_NAME_INVALIDThe firstName is invalid (max 100 characters)firstName
1632LAST_NAME_MISSINGThe lastName is required but was not providedlastName
1633LAST_NAME_INVALIDThe lastName is invalid (max 100 characters)lastName
1634COUNTRY_MISSINGThe country is required but was not providedcountry
1635COUNTRY_INVALIDThe country code is invalid (use ISO 3166-1 alpha-2/alpha-3)country
1636STATE_MISSINGThe state is required but was not providedstate
1637STATE_INVALIDThe state code is invalid (use ISO 3166-2)state
1638CITY_MISSINGThe city is required but was not providedcity
1639CITY_INVALIDThe city is invalid (max 100 characters)city
1640ZIP_MISSINGThe zipCode is required but was not providedzipCode
1641ZIP_INVALIDThe zipCode is invalid (alphanumeric, max 100 characters)zipCode
1642ADDRESS_MISSINGThe address is required but was not providedaddress
1643ADDRESS_INVALIDThe address is invalid (max 150 characters)address
1644PHONE_MISSINGThe phone is required but was not providedphone
1645PHONE_INVALIDThe phone is invalid (max 16 digits, optional + prefix)phone
1646EMAIL_MISSINGThe email is required but was not providedemail
1647EMAIL_INVALIDThe email address is invalidemail
1648CUSTOMER_UPDATE_CONFLICTCannot update the customer due to a conflict
1649CUSTOMER_DELETE_CONFLICTCannot delete the customer due to existing dependencies

Limit Exceeded Errors (18xx)

These errors indicate that a transaction or volume limit has been exceeded.

CodeConstantDescription
1800LIMIT_EXCEEDED_SITE_MONTHLY_VOLUMEThe site's monthly transaction volume limit has been exceeded
1801LIMIT_EXCEEDED_SITE_DAILY_VOLUMEThe site's daily transaction volume limit has been exceeded
1802LIMIT_EXCEEDED_SITE_TRANSACTION_VOLUMEThe site's transaction amount limit has been exceeded
1803LIMIT_EXCEEDED_SITE_DAILY_TRANSACTION_NUMBERThe site's daily transaction count limit has been exceeded
1804LIMIT_EXCEEDED_CUSTOMER_DAILY_VOLUMEThe customer's daily transaction volume limit has been exceeded
1805LIMIT_EXCEEDED_CUSTOMER_DAILY_TRANSACTION_NUMBERThe customer's daily transaction count limit has been exceeded

Digital Wallet Errors (228x)

These errors relate to digital wallets (e.g., Google Pay, Apple Pay).

CodeConstantDescriptionField(s)
2280DIGITAL_WALLET_TYPE_NOT_SUPPORTEDThe digital wallet type is not supportedtype
2281DIGITAL_WALLET_ERROR_ON_DECRYPTAn error occurred while decrypting the digital wallet data
2282DIGITAL_WALLET_CANNOT_DECRYPT_DATAUnable to decrypt the digital wallet data
2283DIGITAL_WALLET_DATA_INVALIDThe digital wallet data is invalid
2284DIGITAL_WALLET_MISSING_PARAMA required digital wallet parameter is missing

Other Errors (9xxx)

CodeConstantDescriptionField(s)
9001FUNDS_CONFIRMATION_ERRORAn error occurred while confirming funds availability

Example Error Responses

400 Bad Request - Validation Error

{
  "code": 400,
  "message": "Bad Request",
  "errors": [
    {
      "code": 804,
      "message": "*amount* is a required field",
      "type": "Validation",
      "field": "amount"
    }
  ]
}

404 Not Found

{
  "code": 404,
  "message": "Not Found",
  "errors": [
    {
      "code": 902,
      "message": "Card not found",
      "type": "Exception"
    }
  ]
}

409 Conflict

{
  "code": 409,
  "message": "Conflict",
  "errors": [
    {
      "code": 1627,
      "message": "Customer already exists",
      "type": "Exception"
    }
  ]
}

Transaction Declined

{
  "code": 400,
  "message": "Bad Request",
  "errors": [
    {
      "code": 836,
      "message": "Transaction declined by issuing bank",
      "type": "Exception"
    }
  ]
}

Best Practices for Error Handling

  1. Always check the HTTP status code first to understand the general category of the response.

  2. Iterate through the errors array to handle multiple validation errors in a single request.

  3. Use the error code for programmatic handling rather than parsing the message string.

  4. Log the full error response for debugging purposes.

  5. Display user-friendly messages based on the error code rather than showing raw API messages to end users.

  6. Handle common errors gracefully:

    • 401 Unauthorized: Refresh authentication or re-authenticate
    • 404 Not Found: Verify the resource ID is correct
    • 409 Conflict: Check for duplicate resources or state conflicts
    • 422/400 Validation errors: Display field-specific error messages
  7. Implement retry logic for transient errors like 504 Gateway Timeout or 838 Transaction Timed Out.