Skip to content

Mastercard/places-client-tutorial

Repository files navigation

Places API Client

Overview

This project showcases the use case of retrieving location data and related information using the Places API here

Compatibility

References

Tutorial

A tutorial can be found here for setting up and using this service.

Frameworks

Setup

Prerequisites

Application Configuration

  1. Create an account at Mastercard Developers.
  2. Copy the Places API Spec (places-api-spec.yaml) to /src/main/resources.
  3. Create a new project and add the 'Places' API to your project.
  4. Take note of the given consumer key, keyalias, and keystore password given upon the project creation.
  5. Copy the downloaded .p12 file to /src/main/resources.
  6. 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).
  1. run mvn compile exec:java to run the project.

Documentation for API Endpoints

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

Documentation for Models

Support

If you would like further information, please send an email to apisupport@mastercard.com

API Usage

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.

License

Apache 2 License

Copyright © 1994-2020, All Right Reserved by Mastercard.

About

Source code for the Places Client Tutorial.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages