# Integration and Testing
source: https://developer.mastercard.com/places/documentation/integration-and-testing/index.md

Testing in Sandbox gives you access to a broad mocked dataset that represents the structure of Production data.
The Sandbox dataset contains realistic merchant location records, but you must not use it in a Production system because its location values do not represent real-world merchant configurations.
Warning: The merchant location data in Sandbox is randomly generated and must not be treated as an accurate representation of real-world merchant 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/location-intelligence/places-locator/`
* 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/places/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 | **Get Location Details by Location ID**              | `GET /places/200406839` | Pass the `location_id` as the final path parameter in the request URL. Confirm HTTP 200 and a JSON response containing location details. See [Sandbox Test Data](https://developer.mastercard.com/places/documentation/integration-and-testing/index.md#sandbox-test-data) for test data, and refer to [Places by ID](https://developer.mastercard.com/places/documentation/api-reference/index.md) for an overview of the endpoint.                  |
| 2 | **Get Location Details with an Invalid Location ID** | `GET /places/abcd`      | Pass a non-numeric `location_id` as the final path parameter in the request URL. Confirm HTTP 400 and a JSON error response containing `INVALID_REQUEST`. See [Sandbox Test Data](https://developer.mastercard.com/places/documentation/integration-and-testing/index.md#sandbox-test-data) for test data, and refer to [Places by ID](https://developer.mastercard.com/places/documentation/api-reference/index.md) for an overview of the endpoint. |
| 3 | **Get Location Details by Latitude and Longitude**   | `POST /places/searches` | Send latitude, longitude, and country in the request body. Confirm HTTP 200 and a JSON response containing location details. See [Sandbox Test Data](https://developer.mastercard.com/places/documentation/integration-and-testing/index.md#sandbox-test-data) for test data, and refer to [Places Search](https://developer.mastercard.com/places/documentation/api-reference/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}

Run this multi-operation journey to confirm that both endpoints work together and that the identifier returned by a search can be reused for a details lookup.

| Step |              Operation              |                                             Request                                             |                                                                                        Expected Result                                                                                        |
|------|-------------------------------------|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1    | **Search for nearby locations**     | `POST /places/searches` with a valid `latitude`, `longitude`, and `country` in the request body | HTTP 200 with a list of matching locations. Each item contains a `location_id`.                                                                                                               |
| 2    | **Capture a `location_id`**         | Read the `location_id` of the first result returned in Step 1                                   | A numeric `location_id` value is available for reuse. If the list is empty, widen the search radius or choose a different set of coordinates.                                                 |
| 3    | **Retrieve details for that place** | `GET /places/{location_id}` using the value captured in Step 2 as the final path parameter      | HTTP 200 with the full location details for that place.                                                                                                                                       |
| 4    | **Verify the data is consistent**   | Compare the details response with the matching entry from the search response                   | The `location_id`, merchant name, and address values match across both responses.                                                                                                             |
| 5    | **Negative check**                  | `GET /places/abcd` using a non-numeric value as the path parameter                              | HTTP 400 with an `INVALID_REQUEST` error message. See [Troubleshooting](https://developer.mastercard.com/places/documentation/integration-and-testing/index.md#troubleshooting) for guidance. |

Complete all five steps before moving to production. A successful journey confirms that your OAuth signing, request formatting, and response handling work for both search and details operations.

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

Review the [Sandbox test data](https://static.developer.mastercard.com/content/places/uploads/places_sandbox_data.xlsx) for valid Places records to use in these tests.

## Troubleshooting {#troubleshooting}

For a full list of error codes and their meanings, see [Codes and Formats](https://developer.mastercard.com/places/documentation/codes-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 `location_id` value (must be numeric).
* Invalid `INVALID_LATITUDE` (Latitude outside the range of -90 to 90).
* Invalid `INVALID_LONGITUDE` (Longitude outside the range of -180 to 180).

<br />

To resolve this error, try the following:

1. Validate your JSON payload with a JSON linter.
2. For location lookup, ensure `location_id` is numeric.
3. For location search, 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/places/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/places/documentation/quick-start-guide/index.md) if you still need credentials or project setup.
* Use [Developer Tools](https://developer.mastercard.com/places/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.
