# Retail Sales Analytics
source: https://developer.mastercard.com/small-business-credit-analytics/documentation/use-cases/retail-sales-analytics/index.md

## Overview {#overview}

Retail Sales Analytics metrics provides a weekly or monthly breakdown of an individual merchant location performance across 45 metrics for the last 12 months. Lenders can utilize these metrics to better determine a small business' identity and sales health.

|   Metrics Category    |                              Description                              |                       Sample Metrics                       |
|-----------------------|-----------------------------------------------------------------------|------------------------------------------------------------|
| **Business Metadata** | Metrics on small business identity and operations                     | `Last seen transaction date` `First seen transaction date` |
| **Merchant Sales**    | Metrics on business retail sales and sales growth                     | `Trend on average card spend`                              |
| **Channel Sales**     | Metrics on customer's preferred channel at the business location      | `% Spend from online channels`                             |
| **Customer Loyalty**  | Metrics on recurring customer activity at the small business location | `% of repeat customers`                                    |
| **Returns**           | Metrics on the rate of returned purchases                             | `% of returned transactions`                               |
| **Business Risk**     | Metrics on business authorization and fraud rates                     | `Historical weekly or monthly card spend`                  |

## Pre-requisites {#pre-requisites}

Prior to accessing the Retail Sales Analytics metrics, clients or lenders must meet the following pre-requisites:

### 1. Merchant Matching {#1-merchant-matching}

The client or lender needs to have the below basic details for Small Business (SMB) merchant location. Small Business Credit Analytics performs the merchant match operation based on the necessary details shared for the merchant location. The best matches are shared with the client for them to decide on which is the intended merchant location they want to request data on.

* Country
* ID Type
* ID Value
* Merchant Location Name
* Address
* City
* State
* Zip Code

**Note** - The Small Business Credit Analytics API provides clients with access to business metrics pertaining to a distinct merchant location. In case if a merchant has presence across multiple locations, client will need to request details for each merchant location separately.

### 2. Retail Sales Analytics Metrics {#2-retail-sales-analytics-metrics}

* The client needs to have consent from the merchant before requesting the API to request merchant metrics
* The Location ID returned in the merchant match response in the previous step is needed to request merchant metrics
* To request metrics (weekly or monthly), the client needs to specify "retail_sales_analytics" for the metrics_type parameter, and "weekly" or "monthly" for the metrics_frequency parameter in the request.

## Sequence Diagram {#sequence-diagram}

## Execution Steps {#execution-steps}

### 1. Merchant Matching {#1-merchant-matching-1}

1. Small business or retailer provides their details to the lender for credit purposes

2. The lender makes the Small Business Credit Analytics API call for merchant match. The request for merchant match can be made in one of following two ways:

   1. By providing ID parameters (Recommended)
      * country
      * id type
      * id value
   2. By providing Name and Address details
      * country
      * merchant location name
      * address
      * city
      * state
      * zip code
3. Small Business Credit Analytics API takes the input to check-in merchant database for location:

   * In the case of multiple matches found it returns the location details in decreasing order of similarity between input and match found
     * A maximum of 10 matches could be shared as part of the API response
   * The response consists of the additional parameters for Location ID (unique ID for location in the Mastercard system)
   * You will receive an error response for an invalid request or any missing request parameter.
4. The lender would need to perform a check to identify whether the intended merchant location is in the API response or not

   * In case of a validation error or no match found or intended merchant location not in API response, the lender needs to update the input and perform step 2 again

### 2. Retail Sales Analytics Metrics {#2-retail-sales-analytics-metrics-1}

1. The lender makes the API call for metrics on the identified location from the merchant match response. The request requires the following input parameters:

   * Location ID
   * Consent Flag
   * Metrics Type (Optional)- Default value: "retail_sales_analytics"
   * Metrics Frequency- "weekly" or "monthly"
2. The API validates the inputs and responds with metrics for the selected merchant location. You will receive an error response for an invalid request or any missing request parameter. You can receive the following valid responses for all metrics:

   * 0: In the event that there were no transactions observed to calculate the respective metrics
   * null: In the event that the minimum number of transactions needed to calculate the respective metrics was not met in that period, or for YoY metrics when there were no data points in the previous year
   * -1: For YoY metrics only, in the event that there were no data points for the current year
3. The lender processes the returned metrics and other data sources for credit decisions, performs internal credit decisioning and communicates the credit decision outcome to small businesses or retailers.

Retail Sales Benchmarks
