# Widget Error Codes
source: https://developer.mastercard.com/eligibility-api/documentation/code-and-formats/widget-error-codes/index.md

## Widget Error Codes {#widget-error-codes}

Error codes specific to Widget API are listed below.

| **Error/Reason Code** |                                                 **Scenario**                                                 |                                         **Resolution Steps**                                         |
|-----------------------|--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| 40000001              | The card number entered is either missing, incomplete, or contains invalid characters.                       | Provide a valid card number with 16 digits                                                           |
| 40303002              | The authentication token provided in the request header has expired or is malformed.                         | Generate a new token and retry the request                                                           |
| 40300102              | The token authentication process failed due to invalid credentials or token mismatch.                        | Verify token generation process and provide a valid token                                            |
| 50000001              | An internal server error occurred while fetching benefits information from the backend system.               | Retry the request after a few moments. If the issue persists, contact support                        |
| 40301002              | The authenticated user or application does not have sufficient permissions to access the requested resource. | Verify your access permissions and domain with your administrator                                    |
| 50000002              | The system was unable to retrieve card details, likely due to an unrecognized or invalid card number.        | Verify the card number is correct and belongs to a supported card network                            |
| 40300104              | The token provided in the request could not be parsed, possibly due to corruption or expiration.             | Generate a new token and retry the request                                                           |
| 40001001              | The request was sent without an authorization token in the header, so authentication could not be performed. | Include a valid authorization token in the request header when invoking the initialization function. |
| 50003001              | The backend system encountered an unexpected error while generating a new authentication token.              | Retry the request after a few moments. If the issue persists, contact support                        |
| CONFIG-NOT-FOUND      | The system could not find configuration data for the specified consumer, which may be missing or incorrect.  | Verify the configuration key is correct and if still issue still persist contact support             |

### No Benefits Found {#no-benefits-found}

If there are no benefits found that meet the request criteria the HTTP Status code will be **200 OK** and the return body will have the following structure:

```json
{
  "listOfBenefits": [],
  "products": [
    {
      "productCd": "MCB",
      "productGrpCd": "2223",
      "productGrpName": "World",
      "productName": "Single Product"
    }
  ],
  "issuerDetails": {
    "externalReference": "USA Reference",
    "parentICACode": "8996",
    "icaBusinessName": "Skyline Distributors",
    "icaCode": "8996",
    "icaCountry": "USA",
    "icaLegalName": "Skyline Distributors",
    "icaRegion": "US",
    "icaState": "Indiova"
  },
  "responseCode": "200",
  "responseMessage": "Benefits data not Found."
}
```

### UI Error Messages {#ui-error-messages}

1. **Client-Side Validation Error** : When an invalid, empty, or incorrectly formatted card number is submitted, the widget triggers a configurable validation error with the default message **"Please enter a valid card number"** . This error message can be programmatically customized via the `errorMessage` configuration property within the submit button object.

2. **Real-Time PAN Validation** : When an invalid or incorrectly formatted card number is entered during input (real-time validation), the widget displays a configurable validation error with the default message **"Please enter a valid card number"** . This error message can be programmatically customized via the `errorMessage` configuration property within the pan input object.

3. **Widget Initialization Token Validation** : When the widget loads and the `/initialize` endpoint call fails due to an invalid or expired token, all widget functionality is disabled and a tooltip displays the default message **"Please refresh the page to reinitiate the widget."** This error message can be programmatically customized via the `message` configuration property within the tooltip configuration object.

4. **Domain Whitelist Error** : When embedding the widget via iframe, the iframe may fail to load if the domain is not whitelisted or the server returns restrictive security headers such as `Content-Security-Policy: frame-ancestors none`. To resolve this issue, ensure your domain is whitelisted with Mastercard and verify that the server does not enforce overly restrictive iframe embedding policies. Contact your Mastercard coordinator to confirm domain whitelisting status and review your Content-Security-Policy headers to allow the widget iframe to load properly.

**Note** : The widget error messages can be customized programmatically using the configuration properties mentioned above. For more details, refer to the [Widget Customization](https://developer.mastercard.com/eligibility-api/documentation/tutorials-and-guides/widget-tutorial/widget-customization/index.md) guide.
