This project showcases the use case of retrieving location data and related information using the Places API here
- Java 11 or later
A tutorial can be found here for setting up and using this service.
- Mastercard Developers Account
- A text editor or IDE
- Java 11+
- Apache Maven 3.3+
- Set up the
JAVA_HOME
environment variable to match the location of your Java installation.
- Create an account at Mastercard Developers.
- Copy the Places API Spec (
places-api-spec.yaml
) to/src/main/resources
. - Create a new project and add the 'Places' API to your project.
- Take note of the given consumer key, keyalias, and keystore password given upon the project creation.
- Copy the downloaded
.p12
file to/src/main/resources
. - Update the properties found in
src/main/java/com/mastercard/api/places/Main.java
.
private static final String BASE_URL = "https://sandbox.api.mastercard.com/location-intelligence/places-locator";
//Below properties will be required for authentication of API calls.
private static final String CONSUMER_KEY = "Your consumer key"; // This refers to your consumer key. Copy it from "Keys" section on your project page in [Mastercard Developers](https://developer.mastercard.com/dashboard)
private static final String SIGNING_KEY_ALIAS = "your key alias"; // This is the default value of key alias. If it is modified, use the updated one from keys section in [Mastercard Developers](https://developer.mastercard.com/dashboard).
private static final String SIGNING_KEY_FILE_PATH = "path to your.p12 private key file"; // This refers to .p12 file found in the signing key. Please place .p12 file at src\main\resources in the project folder and add classpath for .p12 file.
private static final String SIGNING_KEY_PASSWORD = "your password"; // This is the default value of key alias. If it is modified, use the updated one from keys section in [Mastercard Developers](https://developer.mastercard.com/dashboard).
- run
mvn compile exec:java
to run the project.
All URIs are relative to https://api.mastercard.com/location-intelligence/places-locator
Class | Method | HTTP request | Description |
---|---|---|---|
MerchantCategoryCodesApi | getAllMerchantCategoryCodesUsingGet | GET /merchant-category-codes | Get all active merchant category codes |
MerchantCategoryCodesApi | getByMccCodeUsingGET | GET /merchant-category-codes/mcc-codes/{mcc_code} | Get merchant category code by code |
MerchantIndustryCodesApi | getAllIndustryCodesUsingGET | GET /merchant-industry-codes | Get all active merchant industry codes |
MerchantIndustryCodesApi | getByIndustryUsingGET | GET /merchant-industry-codes/industries/{industry} | Get merchant industry code details by industry code |
PlacesApi | getPlaceByLocationIdUsingGET | GET /places/{location_id} | Get the location details by using location id |
PlacesApi | searchPlacesUsingPOST | POST /places/searches | Search for places |
- Error
- ErrorResponse
- ErrorResponseErrors
- MerchantCategoryCode
- MerchantIndustryCode
- PageResponse
- PagedMerchantCategoryCode
- PagedMerchantCategoryCodeAllOf
- PagedMerchantIndustryCode
- PagedMerchantIndustryCodeAllOf
- PagedPlaceInfo
- PagedPlaceInfoAllOf
- PlaceFilter
- PlaceInfo
- PlaceSearchRequest
If you would like further information, please send an email to apisupport@mastercard.com
Places provides transaction-based location insights to consumers to improve decisions about seasonal businesses, daily store openings, top rated restaurants, and local favorites.
The endpoints /places/{location_id}
and /places/searches
provide place details for the information you provide.
The /merchant-category-codes
, /merchant-category-codes/mcc-codes/{mccCode}
, /merchant-industry-codes
and /merchant-industry-codes/industries/{industryCode}
endpoints will retrieve places related information for you to use in the places search endpoint as a search criteria.
Copyright © 1994-2020, All Right Reserved by Mastercard.