# Retail Sales Analytics
source: https://developer.mastercard.com/small-business-credit-analytics/documentation/testing/merchant-metrics/retail-sales-analytics/index.md
## Introduction {#introduction}
The end-point allows the client to retrieve 45 retail sales metrics for the last 12 months for the merchant location identified through merchant match.
## Pre-requisites {#pre-requisites}
Refer to the [Merchant Metrics - Retail Sales Analytics](https://developer.mastercard.com/small-business-credit-analytics/documentation/use-cases/retail-sales-analytics/index.md) use case details.
## RSA Test Cases {#rsa-test-cases}
### Positive Test Cases {#positive-test-cases}
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000001 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000001",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"locationId": "a1b2c3d4-0000-1234-abcd-000000000001",
"merchantCategoryCode": 478,
"naicsCode": "454113",
"industryName": "Arts and Craft Stores",
"firstSeenTxnDate": "2008-08-14",
"lastSeenTxnDate": "2023-02-18",
"metricsFrequency":"Weekly",
"metricsLists": [
{
"periodStartDate": "2022-02-13",
"periodEndDate": "2022-02-19",
"year": 2022,
"metrics": [
{
"name": "txn_amt",
"value": 16198.060138
},
{
"name": "txn_cnt",
"value": 238
},
{
"name": "tkt_size_avg",
"value": 73.562107
},
{
"name": "spend_per_card_avg",
"value": 70.902963
},
{
"name": "txn_per_card_avg",
"value": 1.061457
},
{
"name": "spend_per_card_avg_yoy",
"value": 0.148772
},
{
"name": "txn_amt_yoy",
"value": 0.366001
},
{
"name": "txn_cnt_yoy",
"value": 1.930297
},
{
"name": "tkt_size_avg_yoy",
"value": 0.200143
},
{
"name": "recurring_cnt_yoy",
"value": 0.724743
},
{
"name": "recurring_amt_perc",
"value": 0.543668
},
{
"name": "recurring_cnt_perc",
"value": 0.589989
},
{
"name": "num_repeat_cards_0w_1w_perc",
"value": 0.010122
},
{
"name": "declined_cnt_rate",
"value": 0.024239
},
{
"name": "fraud_chargeback_cnt_perc",
"value": 0.004252
},
{
"name": "cardholder_disputed_chargeback_cnt_perc",
"value": 0.001741
},
{
"name": "reversed_amt",
"value": -670.379661
},
{
"name": "reversed_cnt",
"value": 2
},
{
"name": "reversed_amt_yoy",
"value": 23.143742
},
{
"name": "reversed_cnt_yoy",
"value": 1.524421
},
{
"name": "chp_amt_perc",
"value": 0.003928
},
{
"name": "chp_cnt_perc",
"value": 0.985554
},
{
"name": "chnp_amt_perc",
"value": 0.996072
},
{
"name": "chnp_cnt_perc",
"value": 0.014446
},
{
"name": "online_amt_perc",
"value": 0.933361
},
{
"name": "online_cnt_perc",
"value": 0.913951
},
{
"name": "online_cnt_yoy",
"value": -0.17553
},
{
"name": "credit_amt_perc",
"value": 0.709238
},
{
"name": "debit_amt_perc",
"value": 0.290762
},
{
"name": "small_business_amt_perc",
"value": 0.02267
},
{
"name": "credit_cnt_perc",
"value": 0.631189
},
{
"name": "debit_cnt_perc",
"value": 0.368811
},
{
"name": "small_business_cnt_perc",
"value": 0.036691
},
{
"name": "debit_tkt_size_avg",
"value": 59.045951
},
{
"name": "small_business_tkt_size_avg",
"value": 50.25816
},
{
"name": "debit_spend_per_card_avg",
"value": 58.673031
},
{
"name": "small_business_spend_per_card_avg",
"value": 73.504199
},
{
"name": "debit_num_cards_perc",
"value": 0.406767
},
{
"name": "small_business_num_cards_perc",
"value": 0.084375
},
{
"name": "debit_declined_cnt_rate",
"value": 0.010333
},
{
"name": "small_business_declined_cnt_rate",
"value": 0.020372
},
{
"name": "debit_fraud_chargeback_cnt_perc",
"value": 0.003592
},
{
"name": "small_business_fraud_chargeback_cnt_perc",
"value": 0.001852
},
{
"name": "debit_cardholder_disputed_chargeback_cnt_perc",
"value": 0.001599
},
{
"name": "small_business_cardholder_disputed_chargeback_cnt_perc",
"value": 0.004282
}
]
},
"... (Week 2 to 52 follow the same structure)",
{
"periodStartDate": "2022-02-20",
"periodEndDate": "2022-02-26",
"year": 2022,
"metrics": [
...
]
}
]
}
```
**Validate:**
* HTTP status is `200 OK`
* `locationId` matches the requested `location_id`
* `metricsFrequency` is `Weekly`
* `metricsLists` array contains 52 weekly entries
* Each entry has `periodStartDate`, `periodEndDate`, `year`, and a `metrics` array with 45 metric objects
**Note:** This test case facilitates testing of monthly metrics, and should be used as a reference to test other relevant cases delivering monthly metrics mentioned below.
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000001 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Monthly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000001",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Monthly",
"has_consent": "true"
}
```
Response
```json
{
"locationId": "a1b2c3d4-0000-1234-abcd-000000000001",
"merchantCategoryCode": 478,
"naicsCode": "454113",
"industryName": "Arts and Craft Stores",
"firstSeenTxnDate": "2008-08-14",
"lastSeenTxnDate": "2023-02-18",
"metricsFrequency": "Monthly",
"metricsLists": [
{
"periodStartDate": "2022-02-1",
"periodEndDate": "2022-02-28",
"year": 2022,
"metrics": [
{
"name": "txn_amt",
"value": 64792.24055
},
{
"name": "txn_cnt",
"value": 952
},
{
"name": "tkt_size_avg",
"value": 73.562107
},
{
"name": "spend_per_card_avg",
"value": 70.902963
},
{
"name": "txn_per_card_avg",
"value": 1.061457
},
{
"name": "spend_per_card_avg_yoy",
"value": 0.148772
},
{
"name": "txn_amt_yoy",
"value": 0.366001
},
{
"name": "txn_cnt_yoy",
"value": 1.930297
},
{
"name": "tkt_size_avg_yoy",
"value": 0.200143
},
{
"name": "recurring_cnt_yoy",
"value": 0.724743
},
{
"name": "recurring_amt_perc",
"value": 0.543668
},
{
"name": "recurring_cnt_perc",
"value": 0.589989
},
{
"name": "num_repeat_cards_0m_1m_perc",
"value": 0.010122
},
{
"name": "declined_cnt_rate",
"value": 0.024239
},
{
"name": "fraud_chargeback_cnt_perc",
"value": 0.004252
},
{
"name": "cardholder_disputed_chargeback_cnt_perc",
"value": 0.001741
},
{
"name": "reversed_amt",
"value": -2681.518644
},
{
"name": "reversed_cnt",
"value": 8
},
{
"name": "reversed_amt_yoy",
"value": 23.143742
},
{
"name": "reversed_cnt_yoy",
"value": 1.524421
},
{
"name": "chp_amt_perc",
"value": 0.003928
},
{
"name": "chp_cnt_perc",
"value": 0.985554
},
{
"name": "chnp_amt_perc",
"value": 0.996072
},
{
"name": "chnp_cnt_perc",
"value": 0.014446
},
{
"name": "online_amt_perc",
"value": 0.933361
},
{
"name": "online_cnt_perc",
"value": 0.913951
},
{
"name": "online_cnt_yoy",
"value": -0.17553
},
{
"name": "credit_amt_perc",
"value": 0.709238
},
{
"name": "debit_amt_perc",
"value": 0.290762
},
{
"name": "small_business_amt_perc",
"value": 0.02267
},
{
"name": "credit_cnt_perc",
"value": 0.631189
},
{
"name": "debit_cnt_perc",
"value": 0.368811
},
{
"name": "small_business_cnt_perc",
"value": 0.036691
},
{
"name": "debit_tkt_size_avg",
"value": 59.045951
},
{
"name": "small_business_tkt_size_avg",
"value": 50.25816
},
{
"name": "debit_spend_per_card_avg",
"value": 58.673031
},
{
"name": "small_business_spend_per_card_avg",
"value": 73.504199
},
{
"name": "debit_num_cards_perc",
"value": 0.406767
},
{
"name": "small_business_num_cards_perc",
"value": 0.084375
},
{
"name": "debit_declined_cnt_rate",
"value": 0.010333
},
{
"name": "small_business_declined_cnt_rate",
"value": 0.020372
},
{
"name": "debit_fraud_chargeback_cnt_perc",
"value": 0.003592
},
{
"name": "small_business_fraud_chargeback_cnt_perc",
"value": 0.001852
},
{
"name": "debit_cardholder_disputed_chargeback_cnt_perc",
"value": 0.001599
},
{
"name": "small_business_cardholder_disputed_chargeback_cnt_perc",
"value": 0.004282
}
]
},
"... (Month 2 to 12 follow the same structure)",
{
"periodStartDate": "2022-03-01",
"periodEndDate": "2022-03-31",
"year": 2022,
"metrics": [
...
]
}
]
}
```
**Validate:**
* HTTP status is `200 OK`
* `metricsFrequency` is `Monthly`
* `metricsLists` array contains 12 monthly entries
* Each entry has `periodStartDate`, `periodEndDate`, and a `metrics` array with 45 metric objects
For merchants with low transaction volume, you may receive below valid responses including:
* 0: In the event that no transactions were observed to calculate the respective metrics in that period
* E.g. Zero amount of spend at the merchant location
* null: In the event that the minimum number of transactions needed to calculate the respective metrics was not met in that period
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000002 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000002",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"locationId": "a1b2c3d4-0000-1234-abcd-000000000002",
"merchantCategoryCode": 479,
"naicsCode": "454114",
"industryName": "Arts and Craft Stores",
"firstSeenTxnDate": "2015-08-26",
"lastSeenTxnDate": "2023-02-18",
"metricsFrequency": "Weekly",
"metricsLists": [
{
"periodStartDate": "2022-02-13",
"periodEndDate": "2022-02-19",
"year": 2022,
"metrics": [
{
"name": "txn_amt",
"value": 4739.171374
},
{
"name": "txn_cnt",
"value": 37
},
{
"name": "tkt_size_avg",
"value": 132.78496
},
{
"name": "spend_per_card_avg",
"value": 146.341175
},
{
"name": "txn_per_card_avg",
"value": 1.121212
},
{
"name": "spend_per_card_avg_yoy",
"value": 0.258241
},
{
"name": "txn_amt_yoy",
"value": 0.726118
},
{
"name": "txn_cnt_yoy",
"value": 0.293239
},
{
"name": "tkt_size_avg_yoy",
"value": 0.587345
},
{
"name": "recurring_cnt_yoy",
"value": 0
},
{
"name": "recurring_amt_perc",
"value": 0
},
{
"name": "recurring_cnt_perc",
"value": 0
},
{
"name": "num_repeat_cards_0w_1w_perc",
"value": null
},
{
"name": "declined_cnt_rate",
"value": null
},
{
"name": "fraud_chargeback_cnt_perc",
"value": 0
},
{
"name": "cardholder_disputed_chargeback_cnt_perc",
"value": 0
},
{
"name": "reversed_amt",
"value": 0
},
{
"name": "reversed_cnt",
"value": 0
},
{
"name": "reversed_amt_yoy",
"value": 0
},
{
"name": "reversed_cnt_yoy",
"value": 0
},
{
"name": "chp_amt_perc",
"value": 0.745424
},
{
"name": "chp_cnt_perc",
"value": 0.646145
},
{
"name": "chnp_amt_perc",
"value": null
},
{
"name": "chnp_cnt_perc",
"value": null
},
{
"name": "online_amt_perc",
"value": null
},
{
"name": "online_cnt_perc",
"value": null
},
{
"name": "online_cnt_yoy",
"value": null
},
{
"name": "credit_amt_perc",
"value": 0.973376
},
{
"name": "debit_amt_perc",
"value": null
},
{
"name": "small_business_amt_perc",
"value": null
},
{
"name": "credit_cnt_perc",
"value": 0.964848
},
{
"name": "debit_cnt_perc",
"value": null
},
{
"name": "small_business_cnt_perc",
"value": null
},
{
"name": "debit_tkt_size_avg",
"value": null
},
{
"name": "small_business_tkt_size_avg",
"value": null
},
{
"name": "debit_spend_per_card_avg",
"value": null
},
{
"name": "small_business_spend_per_card_avg",
"value": null
},
{
"name": "debit_num_cards_perc",
"value": null
},
{
"name": "small_business_num_cards_perc",
"value": null
},
{
"name": "debit_declined_cnt_rate",
"value": 0
},
{
"name": "small_business_declined_cnt_rate",
"value": null
},
{
"name": "debit_fraud_chargeback_cnt_perc",
"value": null
},
{
"name": "small_business_fraud_chargeback_cnt_perc",
"value": null
},
{
"name": "debit_cardholder_disputed_chargeback_cnt_perc",
"value": null
},
{
"name": "small_business_cardholder_disputed_chargeback_cnt_perc",
"value": null
}
]
},
"... (Week 2 to 52 follow the same structure)",
{
"periodStartDate": "2022-02-20",
"periodEndDate": "2022-02-26",
"year": 2022,
"metrics": [
...
]
}
]
}
```
**Validate:**
* HTTP status is `200 OK`
* `metricsLists` contains `0`, `null`, or valid numeric values
* `null` indicates insufficient transactions for that period; `0` indicates no transactions observed
For merchants with no data from current or previous year, you may receive below valid responses for YoY metrics including:
* null: In the event that there were no data points in the previous year
* -1: In the event that there were no data points in the current year
* E.g. If there were 50 transactions in the previous year but no transactions in the current year, YoY growth would be calculated as (0-50)/50, which would lead to -1 as a returned response.
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000003 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000003",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"locationId": "a1b2c3d4-0000-1234-abcd-000000000003",
"merchantCategoryCode": 480,
"naicsCode": "454115",
"industryName": "Arts and Craft Stores",
"firstSeenTxnDate": "2012-10-14",
"lastSeenTxnDate": "2023-02-18",
"metricsFrequency": "Weekly",
"metricsLists": [
"... (Week 1 to 3 - Merchant has fully populated metrics for these weeks)",
{
"periodStartDate": "2022-02-27",
"periodEndDate": "2022-03-05",
"year": 2022,
"metrics": [
{
"name": "txn_amt",
"value": 17693.969755
},
{
"name": "txn_cnt",
"value": 190
},
{
"name": "tkt_size_avg",
"value": 98.19319
},
{
"name": "spend_per_card_avg",
"value": 105.365609
},
{
"name": "txn_per_card_avg",
"value": 1.097819
},
{
"name": "spend_per_card_avg_yoy",
"value": 0.118959
},
{
"name": "txn_amt_yoy",
"value": -0.001556
},
{
"name": "txn_cnt_yoy",
"value": 0.127306
},
{
"name": "tkt_size_avg_yoy",
"value": 0.130793
},
{
"name": "recurring_cnt_yoy",
"value": 0.818513
},
{
"name": "recurring_amt_perc",
"value": 0.782535
},
{
"name": "recurring_cnt_perc",
"value": 0.610133
},
{
"name": "num_repeat_cards_0w_1w_perc",
"value": 0.085917
},
{
"name": "declined_cnt_rate",
"value": 0.025397
},
{
"name": "fraud_chargeback_cnt_perc",
"value": 0.000438
},
{
"name": "cardholder_disputed_chargeback_cnt_perc",
"value": 0.00183
},
{
"name": "reversed_amt",
"value": -10.990932
},
{
"name": "reversed_cnt",
"value": 3
},
{
"name": "reversed_amt_yoy",
"value": -1.0
},
{
"name": "reversed_cnt_yoy",
"value": -1.0
},
{
"name": "chp_amt_perc",
"value": 0.005554
},
{
"name": "chp_cnt_perc",
"value": 0.980941
},
{
"name": "chnp_amt_perc",
"value": 0.994446
},
{
"name": "chnp_cnt_perc",
"value": 0.019059
},
{
"name": "online_amt_perc",
"value": 0.930116
},
{
"name": "online_cnt_perc",
"value": 0.911346
},
{
"name": "online_cnt_yoy",
"value": -0.044707
},
{
"name": "credit_amt_perc",
"value": 0.884079
},
{
"name": "debit_amt_perc",
"value": 0.115921
},
{
"name": "small_business_amt_perc",
"value": 0.05182
},
{
"name": "credit_cnt_perc",
"value": 0.785297
},
{
"name": "debit_cnt_perc",
"value": 0.214703
},
{
"name": "small_business_cnt_perc",
"value": 0.043132
},
{
"name": "debit_tkt_size_avg",
"value": 78.509475
},
{
"name": "small_business_tkt_size_avg",
"value": 83.951771
},
{
"name": "debit_spend_per_card_avg",
"value": 88.325635
},
{
"name": "small_business_spend_per_card_avg",
"value": 78.059065
},
{
"name": "debit_num_cards_perc",
"value": 0.252569
},
{
"name": "small_business_num_cards_perc",
"value": 0.045684
},
{
"name": "debit_declined_cnt_rate",
"value": 0.011731
},
{
"name": "small_business_declined_cnt_rate",
"value": 0.019769
},
{
"name": "debit_fraud_chargeback_cnt_perc",
"value": 0.002172
},
{
"name": "small_business_fraud_chargeback_cnt_perc",
"value": 0.004309
},
{
"name": "debit_cardholder_disputed_chargeback_cnt_perc",
"value": 0.00024
},
{
"name": "small_business_cardholder_disputed_chargeback_cnt_perc",
"value": 0.002432
}
]
},
"... (Week 4 to 52 follow the same structure)",
{
"periodStartDate": "2022-03-06",
"periodEndDate": "2022-03-12",
"year": 2022,
"metrics": [
...
]
}
]
}
```
**Validate:**
* HTTP status is `200 OK`
* YoY metrics contain `-1` where current-year data is missing and `null` where previous-year data is missing
* Non-YoY metrics may contain `0` or valid values as appropriate
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000004 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000004",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"locationId": "a1b2c3d4-0000-1234-abcd-000000000004",
"merchantCategoryCode": 481,
"naicsCode": "454116",
"industryName": "Arts and Craft Stores",
"firstSeenTxnDate": "2009-02-28",
"lastSeenTxnDate": "2023-02-18",
"metricsFrequency": "Weekly",
"metricsLists": [
"... (Week 1 to 4 - Merchant has fully populated metrics for these weeks)",
{
"periodStartDate": "2022-03-06",
"periodEndDate": "2022-03-12",
"year": 2022,
"metrics": [
{
"name": "txn_amt",
"value": 2659.51031
},
{
"name": "txn_cnt",
"value": 59
},
{
"name": "tkt_size_avg",
"value": 47.704382
},
{
"name": "spend_per_card_avg",
"value": 51.153779
},
{
"name": "txn_per_card_avg",
"value": 1.157165
},
{
"name": "spend_per_card_avg_yoy",
"value": 0.239646
},
{
"name": "txn_amt_yoy",
"value": 0.240867
},
{
"name": "txn_cnt_yoy",
"value": 0.920762
},
{
"name": "tkt_size_avg_yoy",
"value": -0.009188
},
{
"name": "recurring_cnt_yoy",
"value": 0.920551
},
{
"name": "recurring_amt_perc",
"value": 0.77009
},
{
"name": "recurring_cnt_perc",
"value": 0.50021
},
{
"name": "num_repeat_cards_0w_1w_perc",
"value": 0.060101
},
{
"name": "declined_cnt_rate",
"value": 0.040447
},
{
"name": "fraud_chargeback_cnt_perc",
"value": 0.010047
},
{
"name": "cardholder_disputed_chargeback_cnt_perc",
"value": 0.010563
},
{
"name": "reversed_amt",
"value": -1425.749012
},
{
"name": "reversed_cnt",
"value": 15
},
{
"name": "reversed_amt_yoy",
"value": 30.520026
},
{
"name": "reversed_cnt_yoy",
"value": 18.010531
},
{
"name": "chp_amt_perc",
"value": 0.029654
},
{
"name": "chp_cnt_perc",
"value": 0.059770
},
{
"name": "chnp_amt_perc",
"value": 0.970346
},
{
"name": "chnp_cnt_perc",
"value": 0.940230
},
{
"name": "online_amt_perc",
"value": 0.9305
},
{
"name": "online_cnt_perc",
"value": 0.900873
},
{
"name": "online_cnt_yoy",
"value": -0.189675
},
{
"name": "credit_amt_perc",
"value": 0.600411
},
{
"name": "debit_amt_perc",
"value": 0.399589
},
{
"name": "small_business_amt_perc",
"value": 0.040248
},
{
"name": "credit_cnt_perc",
"value": 0.490271
},
{
"name": "debit_cnt_perc",
"value": 0.509729
},
{
"name": "small_business_cnt_perc",
"value": 0.030165
},
{
"name": "debit_tkt_size_avg",
"value": 41.670816
},
{
"name": "small_business_tkt_size_avg",
"value": 89.150055
},
{
"name": "debit_spend_per_card_avg",
"value": 43.790546
},
{
"name": "small_business_spend_per_card_avg",
"value": 100.010581
},
{
"name": "debit_num_cards_perc",
"value": 0.480127
},
{
"name": "small_business_num_cards_perc",
"value": 0.030852
},
{
"name": "debit_declined_cnt_rate",
"value": 0.020726
},
{
"name": "small_business_declined_cnt_rate",
"value": 0.000338
},
{
"name": "debit_fraud_chargeback_cnt_perc",
"value": 0.000934
},
{
"name": "small_business_fraud_chargeback_cnt_perc",
"value": 0.040591
},
{
"name": "debit_cardholder_disputed_chargeback_cnt_perc",
"value": 0.070059
},
{
"name": "small_business_cardholder_disputed_chargeback_cnt_perc",
"value": 0.070343
}
]
},
"... (Week 5 to 52 - Merchant has no available metrics from this week onwards; all metric values will be populated as 0)",
{
"periodStartDate": "2022-03-13",
"periodEndDate": "2022-03-19",
"year": 2023,
"metrics": [
{
"name": "txn_amt",
"value": 0
},
{
"name": "txn_cnt",
"value": 0
},
{
"name": "tkt_size_avg",
"value": 0
},
...
]
}
]
}
```
**Validate:**
* HTTP status is `200 OK`
* `metricsLists` contains fewer than 52 populated weekly entries
* Remaining weeks return metric values of `0`
### Negative Test Cases {#negative-test-cases}
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000005 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000005",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"Errors": {
"Error": [
{
"Source": "CreditAnalytics",
"ReasonCode": "METRICS_NOT_FOUND",
"Description": "No potential metrics found for the provided merchant information",
"Recoverable": false,
"Details": "Try calling the Metrics API again in a few days as this could be resolved by ongoing data refresh processes."
}
]
}
}
```
**Validate:**
* HTTP status is `404`
* `ReasonCode` is `METRICS_NOT_FOUND`
**Refer:** [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md) for details and structure of error response.
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000006 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000006",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"Errors": {
"Error": [
{
"Source": "CreditAnalytics",
"ReasonCode": "LOCATION_NOT_FOUND",
"Description": "No matched merchant found",
"Recoverable": false,
"Details": "Ensure that the Location ID is consistent with the provided response from Matches API. Otherwise, try calling the Matches API again to get a Location ID."
}
]
}
}
```
**Validate:**
* HTTP status is `404`
* `ReasonCode` is `LOCATION_NOT_FOUND`
**Refer:** [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md) for details and structure of error response.
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000007 |
| metrics_type | retail_sales_analytics |
| metrics_frequency | Weekly |
| has_consent | false |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000007",
"metrics_type": "retail_sales_analytics",
"metrics_frequency": "Weekly",
"has_consent": "false"
}
```
Response
```json
{
"Errors": {
"Error": [
{
"Source": "CreditAnalytics",
"ReasonCode": "CONSENT_NOT_PROVIDED",
"Description": "has_consent parameter was set to 'false'",
"Recoverable": false,
"Details": "Consent from the merchant is required in order to access performance metrics for said merchant."
}
]
}
}
```
**Validate:**
* HTTP status is `403`
* `ReasonCode` is `CONSENT_NOT_PROVIDED`
**Refer:** [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md) for details and structure of error response.
Test Data
Below you may find the query parameters associated with this test case.
| Parameter Name | Value |
|-------------------|--------------------------------------|
| location_id | a1b2c3d4-0000-1234-abcd-000000000011 |
| metrics_type | RSA |
| metrics_frequency | Weekly |
| has_consent | true |
Request
*(`location_id` is passed in the URL path, not the query string.)*
```json
{
"location_id": "a1b2c3d4-0000-1234-abcd-000000000011",
"metrics_type": "RSA",
"metrics_frequency": "Weekly",
"has_consent": "true"
}
```
Response
```json
{
"Errors": {
"Error": [
{
"Source": "CreditAnalytics",
"ReasonCode": "INVALID_DATA: metrics_type",
"Description": "Validation failed for metrics_type parameter",
"Recoverable": false,
"Details": "An invalid value was entered for metrics_type. Valid values are 'retail_sales_analytics' or 'retail_sales_benchmarks'."
}
]
}
}
```
**Validate:**
* HTTP status is `400`
* `ReasonCode` is `INVALID_DATA`
**Refer:** [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md) for details and structure of error response.
## Next Steps {#next-steps}
* [Retail Sales Benchmarks](https://developer.mastercard.com/small-business-credit-analytics/documentation/testing/merchant-metrics/retail-sales-benchmarks/index.md) --- peer-relative metrics test cases
* [Use Cases](https://developer.mastercard.com/small-business-credit-analytics/documentation/use-cases/retail-sales-analytics/index.md) --- the business scenario behind this endpoint
* [Code and Formats](https://developer.mastercard.com/small-business-credit-analytics/documentation/code-and-formats/index.md#metrics-errors) --- error codes and resolution guidance