# Code and Formats source: https://developer.mastercard.com/payment-account-management/documentation/code-and-formats/error-codes/index.md ## Return Codes {#return-codes} All APIs return an HTTP response code of 200 if the call was successfully received and accepted for processing. The exceptions are a duplicate `requestId`, which returns HTTP 400, and certain scenarios where HTTP 503 is returned. Any errors that subsequently occur during processing are returned in the response payload. The error message format returned will depend on which API generated the error and at what point the request failed. Error messages will be in one of two formats depending on the type of error. 1. [Application Error Messages](https://developer.mastercard.com/payment-account-management/documentation/code-and-formats/error-codes/index.md#application-error-codes) - returned from the service application and typically occur for incorrect input or cryptography errors. 2. [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/) - returned from the gateway and typically occur when OAUTH authentication fails. Alert: To ensure forward-compatibility, client implementations must be resilient to new elements being added to the API responses in the future. ## Application Error Codes {#application-error-codes} | Reason Code | Description | Detail | |-------------------------------------------------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| | INVALID_JSON | Invalid JSON | The JSON could not be parsed. | | AUTHORIZATION_FAILED | Authorization failed | The request failed to present a valid certificate to access the API. | | BAD_REQUEST | Duplicate requestId | Duplicate requestIds are not allowed. An HTTP 400 status code is returned for this reason code. | | INVALID_FIELD_FORMAT | Invalid Field Format - {fieldName} | The field is not in the correct format. For instance, it should be a number but is a string. | | INVALID_FIELD_LENGTH | Invalid Field Length - {fieldName} | The value does not fall between the minimum and maximum length for the field. | | INVALID_FIELD_VALUE | Invalid Field Value - {fieldName} | The value is not allowed for the field. | | MISSING_REQUIRED_FIELD | Missing Required Field - {fieldName} | A required field is missing. | | CRYPTOGRAPHY_ERROR | Cryptography Error | There was an error decrypting the encrypted payload. | | INTERNAL_SERVICE_FAILURE | Internal Service Failure | Payment Account API had an internal exception. | | PAYMENT_ACCOUNT_REFERENCE_FOUND_FOR_NEW_ACCOUNT | Payment Account reference has already been assigned for the new card. | Payment Account reference has already been assigned for the new card. | | PAYMENT_ACCOUNT_REFERENCE_NOT_FOUND | No PAR Found | No PAR has been found for the supplied PAN or Token | ### Where Each Error Occurs {#where-each-error-occurs} The table below shows which operations return each reason code and the stage of your workflow where it occurs. All operations except `/account-maintenance/requestStatus` carry an encrypted payload. | Reason Code | Returned By | Workflow Stage | |-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| | INVALID_JSON | All operations | Request parsing, before any processing | | AUTHORIZATION_FAILED | All operations | Access check, after OAuth authentication succeeds | | BAD_REQUEST | `/addAccount`, `/updateAccount`, `/closeAccount`, `/overrideForDeleteAccount`, `/getPaymentAccountReference` | Request validation, when the `requestId` was already used | | INVALID_FIELD_FORMAT, INVALID_FIELD_LENGTH, INVALID_FIELD_VALUE, MISSING_REQUIRED_FIELD | All operations | Request validation. For encrypted operations, this includes fields inside the decrypted payload. | | CRYPTOGRAPHY_ERROR | All operations except `/account-maintenance/requestStatus` | Payload decryption | | INTERNAL_SERVICE_FAILURE | All operations | Processing inside the PAM API | | PAYMENT_ACCOUNT_REFERENCE_FOUND_FOR_NEW_ACCOUNT | `/updateAccount` | PAR mapping, when the new card already has a PAR | | PAYMENT_ACCOUNT_REFERENCE_NOT_FOUND | `/getPaymentAccountReference` | PAR lookup, when no PAR exists and `assignPar` is not `true` | Errors from ABU, MDES, and the PAR Vault are not returned in the first response. They are reported later by `/account-maintenance/requestStatus`. See [requestStatus Return Codes](https://developer.mastercard.com/payment-account-management/documentation/code-and-formats/error-codes/index.md#requeststatus-return-codes). ### General Application Error format {#general-application-error-format} All the errors that the application returns follow the same data format: #### HTTP status code {#http-status-code} `200` ```json { "responseId": "", "errors": [ { "source": "INPUT", "description": "", "reasonCode": "", "recoverable": false } ] } ``` Field explanations: * **source** - The application that generated this error. Every error message that is generated and returned by the application will have this field equal to `INPUT`. When the value of the source field is something else, it means the error was generated elsewhere. * **description** - Description of the Reason Code field with additional details * **reasonCode** - A unique constant identifying the error case encountered during transaction processing. * **recoverable** - Indicates whether this error will always be returned for this request, or retrying could change the outcome. For example, if the request contains an invalid signature, retrying will never result in a success. However, if the error is related to some unexpected timeout with the service, retrying the call could result in a successful response. This is boolean type parameter returning either true or false. ### Cryptography Error {#cryptography-error} A cryptography error will occur when the payload has not been encrypted correctly. **HTTP status code** `200` ```json { "responseId": "111111", "errors": [ { "source": "INPUT", "description": "Cryptography Error", "reasonCode": "CRYPTOGRAPHY_ERROR", "recoverable": false } ] } ``` **Resolution** This error usually means the service could not decrypt the payload in the request. Follow these steps: 1. Check that you encrypt the request with the client encryption key for the target environment. Sandbox and MTF use the Sandbox keys, and Production uses separate Production keys. 2. Confirm the `publicKeyFingerprint` in the request matches that key. 3. Confirm the key has not expired or been revoked in your project dashboard. 4. Check your encryption configuration against [Encrypting the Request Payload](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md#encrypting-the-request-payload). ### Invalid Field Format {#invalid-field-format} The API request contains data in a field which is incorrectly formatted. **HTTP status code** `200` ```json { "responseId": "0cc3e0fb-8d7d-4b57-8338-a3911aba4c1f", "errors": [ { "source": "INPUT", "description": "Invalid Field Format - requestId", "reasonCode": "INVALID_FIELD_FORMAT", "recoverable": false } ] } ``` **Resolution** The description will contain details of the field that contains the incorrect format. Send the correct format in accordance with the [API Reference](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md) ### Invalid Field Value {#invalid-field-value} The value is not allowed for the field. **HTTP status code** `200` ```json { "responseId": "123456", "errors": [ { "source": "INPUT", "description": "Invalid Field Value - oaepHashingAlgorithm", "reasonCode": "INVALID_FIELD_VALUE", "recoverable": false } ] } ``` The description names the field with the incorrect value. Correct the value in accordance with the allowed values in the [API Reference](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md), then resubmit with a new `requestId`. ### Invalid Field Length {#invalid-field-length} The value of a field is shorter than the minimum or longer than the maximum length. **HTTP status code** `200` ```json { "responseId": "123456", "errors": [ { "source": "INPUT", "description": "Invalid Field Length - requestId", "reasonCode": "INVALID_FIELD_LENGTH", "recoverable": false } ] } ``` **Resolution** The description names the field with the incorrect length. Check the minimum and maximum length for that field in the [API Reference](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md), correct the value, and resubmit with a new `requestId`. ### Missing Required Field {#missing-required-field} The API request is missing a required mandatory field. **HTTP status code** `200` ```json { "responseId": "1debc552-833f-4bcb-bd3a-5f675a9102a5", "errors": [ { "source": "INPUT", "description": "Missing Required Field - requestId", "reasonCode": "MISSING_REQUIRED_FIELD", "recoverable": false } ] } ``` **Resolution** The description names the missing field. Add every mandatory field described in the [API Reference](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md) and resubmit with a new `requestId`. ### Authorization Failed {#authorization-failed} Returned if the Client ID has not been enabled for the Payment Account Management Service. **HTTP status code** `200` ```json { "responseId": "111111", "errors": [ { "source": "INPUT", "description": "Authorization Failed", "reasonCode": "AUTHORIZATION_FAILED", "recoverable": false } ] } ``` **Resolution** Your client ID may not be enabled for the PAM API in the environment you called. Follow these steps: 1. Confirm you use the client ID for the environment you call. Sandbox and MTF use the Sandbox client ID, and Production uses the Production client ID. 2. Confirm the Payment Account Management API is added to the project that owns the client ID. 3. For MTF and Production, contact your Mastercard CIS implementation manager to confirm all onboarding steps are complete. ### Invalid JSON {#invalid-json} The JSON request is incorrectly formatted. **HTTP status code** `200` ```json { "responseId": "73245138-f976-41ec-8b72-ecde27a503aa", "errors": [ { "source": "INPUT", "description": "Invalid JSON", "reasonCode": "INVALID_JSON", "recoverable": false } ] } ``` **Resolution** Check the message is a correctly formatted JSON and resubmit. ### Duplicate requestId {#duplicate-requestid} The `requestId` was already used by your client ID. Every request must have a unique `requestId`. **HTTP status code** `400` **Reason code** `BAD_REQUEST` **Resolution** 1. Provide a new, unique `requestId` for every request. 2. To learn the outcome of the original request, send the `requestId` to `/account-maintenance/requestStatus` instead of resubmitting it. ## requestStatus Return Codes {#requeststatus-return-codes} The return codes which will be provided by the consuming systems as part of the [**requestStatus**](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md#request-status) response are detailed below. * The 0100 Error codes are associated with ABU * The 0200 Error codes are associated with MDES * The 0300 Error codes are associated with the PAR Vault **HTTP status code** `200` ```json { "statuses": [ { "requestId": "123456", "services": [ { "serviceName": "APPLICATION_BILLING_UPDATER", "status": "FAILURE", "additionalInformation": 102, }, { "serviceName": "PAN_PAR_Mapping", "status": "FAILURE", "additionalInformation": 302, }, { "serviceName": "PAN_TOKEN_MAPPING", "status": "FAILURE", "additionalInformation": 201, } ] } ] } ``` **Resolution** Please refer to the tables below for specific resolutions for each service name. ### PAR Vault {#par-vault} | Error Code | Description | Recommendation | |------------|-------------------------------------------|-----------------------------------------| | 301 | Invalid Request | Do not resubmit | | 302 | Record not found with old Account Number | Check supplied card number and resubmit | | 303 | PAR Operation Failed | Do not resubmit | | 304 | PAR already exists for new Account Number | Do not resubmit | | 305 | Not PAR eligible | Do not resubmit | ### Token Vault {#token-vault} | Error Code | Description | Recommendation | |------------|-------------------------------------------------------------------|----------------------------| | 201 | Input Validation error on Token Vault | Verify Inputs and resubmit | | 202 | Token Delete operation Failed | Do not resubmit | | 203 | Token Update operation Failed | Do not resubmit | | 204 | No Active or suspended Tokens found for given account information | Do not resubmit | ### ABU {#abu} | Error Code | Description | Recommendation | |------------|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------| | 100 | Account override for delete request, but not on Mastercard files | Do not resubmit | | 101 | Old Account Number is not numeric | Provide numeric account number and resubmit | | 102 | Old Account Number is not valid length | Correct old account number length and resubmit | | 104 | New Account Number is not numeric | Provide numeric value for new account number and resubmit | | 105 | New Account Number not valid length | Correct new account number length and resubmit | | 107 | New Account Number is not in the issuer BIN range | Do not resubmit | | 108 | Old Expiration Date is invalid | Correct old expiration date and resubmit | | 109 | New Expiration Date is invalid | Correct new expiration date and resubmit | | 110 | Invalid Reason Code or Invalid Header or Detail Record ID | Correct reason code or header and resubmit | | 111 | Issuer's customer ID/ICA number not an active issuer ID on Mastercard records | Correct ID/ICA number and resubmit | | 112 | Issuer's customer ID/ICA number is valid only for acquirer customer | Do not resubmit | | 113 | Old Account Number exists in Mastercard database | Do not resubmit | | 114 | New Account Number exists in Mastercard database | Do not resubmit | | 118 | Old Account Number is not in Mastercard database | Do not resubmit | | 119 | New Account Number is not in Mastercard database | Do not resubmit | | 120 | Old Account Number is not in the issuer BIN range for an Initial Load() | Do not resubmit | | 121 | Old Account Number and New Account Number are not the same for an Expiration Date | Ensure old and new account number match for expiration date change and resubmit | ## Gateway Errors {#gateway-errors} Refer to [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/). ## Next Steps {#next-steps} * Reproduce errors safely with the negative test cases in [Testing](https://developer.mastercard.com/payment-account-management/documentation/testing/index.md). * Check field formats and allowed values in the [API Reference](https://developer.mastercard.com/payment-account-management/documentation/api-reference/index.md). * Find answers to common setup questions in [Support](https://developer.mastercard.com/payment-account-management/documentation/support/index.md).