# Testing
source: https://developer.mastercard.com/eligibility-api/documentation/testing/index.md

Testing in Sandbox provides access to a rich set of data that mimics what is available in production. The data in sandbox is entirely mocked information that uses realistic card numbers, but should not be used in any production system, the values for each identifiers are not applicable to real world configurations.

You can test your integration in Sandbox using the test data listed below.

## Sample Test Data {#sample-test-data}

* cardNumber: 5341676355168133
* serviceProviderCode: 6
* cardIdentifier: 550e8400-e29b-41d4-a716-446655440000

## Test Cases {#test-cases}

### Benefits {#benefits}

#### Retrieve Benefits Active Today {#retrieve-benefits-active-today}

* Using the cardNumber listed under test data send a request to *benefits/searches*
* Get a response object that contains a list of benefits associated with that card number that are active today

#### Retrieve Benefits Specific to a Vendor {#retrieve-benefits-specific-to-a-vendor}

* Using the cardNumber and serviceProviderCode listed under test data send a request to *benefits/searches*
* Get a response object that contains a list of benefits associated with the cardNumber/serviceProviderCode that are active today

### Products {#products}

#### Retrieve Products Associated with a Card Number {#retrieve-products-associated-with-a-card-number}

* Using the cardNumber listed under test data send a request to *products/searches*
* Get a response object that contains a list of products associated with that card number that are active today

### Card Identifier {#card-identifier}

#### Generate Card Identifier for a provided a Card Number {#generate-card-identifier-for-a-provided-a-card-number}

* Using the cardNumber listed under test data send a request to */card-identifiers*
* Get a response object that contains unique identifier for the given card number

## Troubleshooting {#troubleshooting}

For a full list of error codes and their descriptions, please refer to the [Code and Formats](https://developer.mastercard.com/eligibility-api/documentation/code-and-formats/generic-code-and-formats/index.md) page.

### Authentication Errors (HTTP 401) {#authentication-errors-http-401}

The following are common causes of authentication errors when using the Mastercard APIs:

* Consumer key does not match the one in your Mastercard Developers project.
* Signing key (.p12 file) password is incorrect or the file is corrupted.
* OAuth timestamp is too far from the server time (must be within 5 minutes).
* The request body was modified after the OAuth signature was computed.

To resolve this error, try the following:

1. Verify your consumer key matches the value on your Mastercard Developers project page.
2. Re-download your .p12 keystore file and confirm the password is correct.
3. Ensure your system clock is synchronized.
4. If using a custom HTTP client, ensure the OAuth signature is computed over the final request body.

### Bad Request Errors (HTTP 400) {#bad-request-errors-http-400}

The following are common causes of bad request errors when using the Mastercard APIs:

* Malformed request body (e.g., invalid JSON).
* Missing required parameters in the request.
* Invalid parameter values (e.g., incorrect data types, out-of-range values).

To resolve this error, try the following:

1. Verify that all required parameters are included in the request.
2. Check the data types and values of the parameters to ensure they are valid.
3. Ensure the request body is properly formatted (e.g., valid JSON).

## Environment Guidance {#environment-guidance}

For environment URLs and descriptions, see [API Basics - Environments](https://developer.mastercard.com/eligibility-api/documentation/api-basics/index.md#environments).

* Start in sandbox to test your integration and validate your requests and responses to complete the positive and negative validations.
* Move to production only after you have successfully tested your integration in sandbox and have received production access for your project.

## Next Steps {#next-steps}

* Start with the [Quickstart Guide](https://developer.mastercard.com/eligibility-api/documentation/tutorials-and-guides/guide-quickstart/index.md) if you still need credentials or project setup.
* Follow the [Eligibility Tutorial](https://developer.mastercard.com/eligibility-api/documentation/tutorials-and-guides/eligibility-tutorial/index.md) for step-by-step instructions on how to integrate with the Mastercard Eligibility API.
