# Integration and Testing
source: https://developer.mastercard.com/locations/documentation/integration-and-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 ATM locations data, but should not be used in any production system, the values for each location are not applicable to real world configurations.
Warning: The ATM locations data used in sandbox are randomly generated mocked data and should not be treated as being an accurate representation of real world ATM locations.

## Prerequisites {#prerequisites}

Confirm the following before you send any requests:

* Your project is created and Sandbox credentials are available.
* You are using the Sandbox base URL: `https://sandbox.api.mastercard.com/locations/atms`
* OAuth 1.0a signing is configured correctly.

If you still need onboarding or credential setup, start with the [Quick Start Guide](https://developer.mastercard.com/locations/documentation/quick-start-guide/index.md).

## Testing Workflow {#testing-workflow}

Follow this ordered checklist to validate your integration end-to-end.

| # |                        Test                        |     Endpoint     |                                                                                                                                                                                                                   What to Verify                                                                                                                                                                                                                    |
|---|----------------------------------------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | **Retrieve ATMs by Address**                       | `POST /searches` | Send address in the post body. Confirm HTTP 200 and a JSON with location details. See [Sandbox Test Data](https://developer.mastercard.com/locations/documentation/integration-and-testing/index.md#sandbox-test-data) for testing data, and refer to [ATM Search by Address](https://developer.mastercard.com/locations/documentation/use-cases/intelligent-atm-discovery/index.md) for an overview of the endpoint                                |
| 2 | **Retrieve ATMs by GeoCode**                       | `POST /searches` | Send latitude/longitude in the post body. Confirm HTTP 200 and a JSON with location details. See [Sandbox Test Data](https://developer.mastercard.com/locations/documentation/integration-and-testing/index.md#sandbox-test-data) for testing data, and refer to [ATM Search by GeoCode](https://developer.mastercard.com/locations/documentation/use-cases/atm-network-optimization/index.md) for an overview of the endpoint                      |
| 3 | **Retrieve ATMs by GeoCode with missing lat/long** | `POST /searches` | Send latitude without longitude in post body. Confirm HTTP 400 and a JSON error message saying INVALID_REQUEST. See [Sandbox Test Data](https://developer.mastercard.com/locations/documentation/integration-and-testing/index.md#sandbox-test-data) for testing data, and refer to \[[ATM Search by GeoCode](https://developer.mastercard.com/locations/documentation/use-cases/atm-network-optimization/index.md) for an overview of the endpoint |

## End-to-End Test Journey: Search then Retrieve Details {#end-to-end-test-journey-search-then-retrieve-details}

Complete both steps before moving to production. A successful journey confirms your OAuth signing, request formatting, and response handling work for the search operation.

| Step |         Operation          |                                         Request                                          |                                                                                         Expected Result                                                                                          |
|------|----------------------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1    | **Search for nearby ATMs** | `POST /searches` with a valid `latitude`, `longitude`, and `country` in the request body | HTTP 200 with a list of matching ATM locations.                                                                                                                                                  |
| 2    | **Negative check**         | `POST /searches` using an empty `latitude`                                               | HTTP 400 with an `INVALID_REQUEST` error message. See [Troubleshooting](https://developer.mastercard.com/locations/documentation/integration-and-testing/index.md#troubleshooting) for guidance. |

## Sandbox Test Data {#sandbox-test-data}

For a list of sandbox ATM locations including sample input payloads please click [here](https://static.developer.mastercard.com/content/locations/uploads/locations_atms_sandbox_data.xlsx)

## Troubleshooting {#troubleshooting}

For a full list of error codes and their meanings, see [Codes and Formats](https://developer.mastercard.com/locations/documentation/code-and-formats/index.md).

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

The following are common causes of authentication errors:

* 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.

<br />

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:

* Missing or malformed JSON request body.
* Invalid `Valid address or latitude and longitude must be provided` value (must be numeric).
* Invalid `Longitude must be between -180 and 180`.
* Invalid `Latitude must be between -90 and 90`.

<br />

To resolve this error, try the following:

1. Validate your JSON payload with a JSON linter.
2. Ensure either a valid address or latitude and longitude is provided in the request body.
3. Ensure `latitude` is between -90 and 90, and `longitude` is between -180 and 180.

## Environment Guidance {#environment-guidance}

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

* Start in sandbox and complete your positive and negative validation there.
* Move to production only after sandbox testing is complete and production access has been approved.

## Next Steps {#next-steps}

* Start with the [Quick Start Guide](https://developer.mastercard.com/locations/documentation/quick-start-guide/index.md) if you still need credentials or project setup.
* Use [Developer Tools](https://developer.mastercard.com/locations/documentation/developer-tools/index.md) if you want ready-to-run collections.
* Follow the endpoint tutorials when you are ready to run detailed positive and negative test cases.
