# Carbon Footprint Test Cases
source: https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md

This article provides test cases that show some example requests sent to the Consumer Clarity API and the responses you can expect to receive, which include `carbonFootprint` data.
Note: The carbon footprint score returned in production might be different than what is displayed in these test cases. Our library is updated on a quarterly basis, and numbers can change based on the updated library.

## Test Cases {#test-cases}

Following are the types of test cases provided in this article:

* [TC1: Request sent without a country code](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc1-request-without-a-country-code)
* [TC2: Request sent without a region code](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc2-request-without-a-region-code)
* [TC3: Response for a similar request returns a different industry](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc3-response-for-similar-request-returns-different-industry)   

This table shows the request fields that are part of each test case and lists the values that are used in each one.

|                                                                                    Test Case                                                                                    | cardAcceptor Name | cardAcceptor Location | cardAcceptor RegionCode | cardAcceptor CountryCode | acquirer ReferenceNumber | transactionAmount value | currencyCode | payment Type |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-----------------------|-------------------------|--------------------------|--------------------------|-------------------------|--------------|--------------|
| [TC1](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc1-request-without-a-country-code)                          | SHOE STORE 1234   | AUSTIN                | TX                      | null                     | 00000000000000000001234  | 362.10                  | USD          | VISA         |
| [TC2](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc2-request-without-a-region-code)                           | ZZZ\*ACADEMY      | NEW YORK              | null                    | USA                      | 00000000000000000001234  | 789.10                  | CAD          | VISA         |
| [TC3](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc3-response-for-similar-request-returns-different-industry) | ANT\*156LE        | Leeds                 | null                    | GBR                      | 00000000000000000001234  | 8699.00                 | GBP          | VISA         |

### TC1: Request without a country code {#tc1-request-without-a-country-code}

In this scenario, a request is sent that doesn't include a value for the `cardAcceptorCountryCode` field. But because it does include other required `merchantCriteria` as well as a `transactionAmount` (`value` and `currencyCode`), we are able to return merchant details along with data for the `carbonFootprint` of the transaction.

#### Request {#request}

```JSON
{
  "locale": "en-US",  
  "searchCriteria": [
    {
      "merchantCriteria": {
        "cardAcceptorName": "SHOE STORE 1234",
        "cardAcceptorLocation": "AUSTIN",
        "cardAcceptorRegionCode": "TX",
        "cardAcceptorCountryCode": null,
        "merchantCategoryCode": "5661"
      },
      "transactionCriteria": {
        "acquirerReferenceNumber":"00000000000000000001234",
        "paymentType": "VISA",
        "transactionAmount": {
            "value": "362.10",
            "currencyCode": "USD"
        }
      }
    }
  ]
}
```

#### Expected response {#expected-response}

```JSON
{
  "searchResults": [
    {
      "recordId": "0.cef8da17.1669322998.3c08dbe8-01",
      "resultStatus": {
        "code": "OK",
        "message": "OK."
      },
      "merchantResult": {
        "merchantName": "The Shoe Store",
        "address": {
          "line1": "100 Main St",
          "city": "Austin",
          "postalCode": "78701",
          "countryCode": "USA",
          "countryName": "United States",
          "countrySubdivisionCode": "TX"
        },
        "merchantCategory": {
          "code": "5661",
          "description": "SHOE STORES"
        },
        "logos": [
          {
            "height": 200,
            "width": 200,
            "url": "https://sandbox.content.ethoca.com/b/industry/61d0cd49-f86b-4c55-afbc-ccdc30abf990.png?size=200",
            "type": "INDUSTRY",
            "altTextTag": "Shoe Stores Logo"
          },
          {
            "height": 400,
            "width": 400,
            "url": "https://sandbox.content.ethoca.com/b/industry/61d0cd49-f86b-4c55-afbc-ccdc30abf990.png?size=400",
            "type": "INDUSTRY",
            "altTextTag": "Shoe Stores Logo"
          }
        ],
        "merchantLocation": {
          "latitude": "30.309558",
          "longitude": "-97.759881"
        },
        "resultStatus": {
          "code": "MERCHANT_FOUND",
          "message": "Merchant results provided."
        }
      },
      "purchaseReceipt": {
        "resultStatus": {
          "code": "RECEIPT_NOT_AVAILABLE",
          "message": "Purchase Receipt not available for this merchant."
        }
      },
      "carbonFootprint": {
        "carbonEmissionInGrams": 77886.54,
        "carbonEmissionInOunces": 2747.37,
        "category": {
          "mainCategory": "Shopping",
          "subCategory": "Department Store",
          "sector": "Specialty Retail & Services",
          "sectorCode": "302"
        }
      }
    }
  ]
}
```

[Back to top](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#test-cases)

### TC2: Request without a region code {#tc2-request-without-a-region-code}

For this test case, a request is sent that doesn't include a value for the `cardAcceptorRegionCode` field, but includes the necessary `merchantCriteria` as well as a `value` and `currencyCode` for the `transactionAmount`. A merchant and transaction are found that match and a `carbonFootprint` value is returned in the response along with the merchant details.

#### Request {#request-1}

```JSON
{
  "locale": "en-US",  
  "searchCriteria": [
    {
      "merchantCriteria": {
        "cardAcceptorName": "ZZZ*ACADEMY",
        "cardAcceptorLocation": "NEW YORK",
        "cardAcceptorRegionCode": null,
        "cardAcceptorCountryCode": "USA",
        "merchantCategoryCode": null
      },
      "transactionCriteria": {
        "acquirerReferenceNumber":"00000000000000000001234",
        "paymentType": "VISA",
        "transactionAmount": {
            "value": "789.10",
            "currencyCode": "CAD"
        }
      }
    }
  ]
}
```

#### Expected response {#expected-response-1}

```JSON
{
  "searchResults": [
    {
      "recordId": "0.53680117.1669324202.1793bf96-01",
      "resultStatus": {
        "code": "OK",
        "message": "OK."
      },
      "merchantResult": {
        "merchantName": "Ziggy's School Center",
        "address": {
          "line1": "99 Elm St",
          "city": "New York",
          "postalCode": "10001",
          "countryCode": "USA",
          "countryName": "United States",
          "countrySubdivisionCode": "NY"
        },
        "merchantCategory": {
          "code": "7911",
          "description": "DANCE HALLS  SCHOOLS  AND STUDIOS"
        },
        "logos": [
          {
            "height": 400,
            "width": 400,
            "url": "https://sandbox.content.ethoca.com/b/industry/68c4ed8b-236d-4436-abca-657fb52345b4.png?size=400",
            "type": "INDUSTRY",
            "altTextTag": "Elementary, Middle, High Schools Logo"
          },
          {
            "height": 200,
            "width": 200,
            "url": "https://sandbox.content.ethoca.com/b/industry/68c4ed8b-236d-4436-abca-657fb52345b4.png?size=200",
            "type": "INDUSTRY",
            "altTextTag": "Elementary, Middle, High Schools Logo"
          }
        ],
        "resultStatus": {
          "code": "MERCHANT_FOUND",
          "message": "Merchant results provided."
        }
      },
      "purchaseReceipt": {
        "resultStatus": {
          "code": "RECEIPT_NOT_AVAILABLE",
          "message": "Purchase Receipt not available for this merchant."
        }
      },
      "carbonFootprint": {
        "carbonEmissionInGrams": 60518.48,
        "carbonEmissionInOunces": 2134.73,
        "category": {
          "mainCategory": "Lesure & Entertainment",
          "subCategory": "Sports & Workout",
          "sector": "Athletic Fields & Sports Clubs",
          "sectorCode": "312"
        }
      }
    }
  ]
}
```

[Back to top](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#test-cases)

### TC3: Response for similar request returns different industry {#tc3-response-for-similar-request-returns-different-industry}

This test case is similar to [Test case 2](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#tc2-request-without-a-region-code), but you can see that different industry information is returned in the response for the `carbonFootprint:category` fields.

#### Request {#request-2}

```JSON
{
  "locale": "en-US",  
  "searchCriteria": [
    {
      "merchantCriteria": {
        "cardAcceptorName": "ANT*156LE",
        "cardAcceptorLocation": "Leeds",
        "cardAcceptorRegionCode": null,
        "cardAcceptorCountryCode": "GBR",
        "merchantCategoryCode": null
      },
      "transactionCriteria": {
        "acquirerReferenceNumber":"00000000000000000001234",
        "paymentType": "VISA",
        "transactionAmount": {
            "value": "8699.00",
            "currencyCode": "GBP"
        }
      }
    }
  ]
}
```

#### Expected response {#expected-response-2}

```JSON
{
  "searchResults": [
    {
      "recordId": "0.53680117.1669324240.1793c1d5-01",
      "resultStatus": {
        "code": "OK",
        "message": "OK."
      },
      "merchantResult": {
        "merchantName": "Antler's Bakery",
        "address": {
          "line1": "2 Trevelyan Sq",
          "city": "Leeds",
          "postalCode": "LS1 6ED",
          "countryCode": "GBR",
          "countryName": "United Kingdom"
        },
        "websiteUrl": "www.antlersbakery.com",
        "merchantCategory": {
          "code": "5812",
          "description": "EATING PLACES  RESTAURANTS"
        },
        "logos": [
          {
            "height": 200,
            "width": 200,
            "url": "https://sandbox.content.ethoca.com/b/industry/83433225-0188-4d92-9bf3-19b599ebf21a.png?size=200",
            "type": "INDUSTRY",
            "altTextTag": "T+E Restaurants Logo"
          },
          {
            "height": 400,
            "width": 400,
            "url": "https://sandbox.content.ethoca.com/b/industry/83433225-0188-4d92-9bf3-19b599ebf21a.png?size=400",
            "type": "INDUSTRY",
            "altTextTag": "T+E Restaurants Logo"
          }
        ],
        "merchantLocation": {
          "latitude": "53.796152",
          "longitude": "-1.543300",
          "type": "ROOFTOP"
        },
        "resultStatus": {
          "code": "MERCHANT_FOUND",
          "message": "Merchant results provided."
        }
      },
      "purchaseReceipt": {
        "resultStatus": {
          "code": "RECEIPT_NOT_AVAILABLE",
          "message": "Purchase Receipt not available for this merchant."
        }
      },
      "carbonFootprint": {
        "carbonEmissionInGrams": 4669118.86,
        "carbonEmissionInOunces": 164698.50,
        "category": {
          "mainCategory": "Food & Beverages",
          "subCategory": "Restaurants & Fast Food",
          "sector": "Restaurants",
          "sectorCode": "104"
        }
      }
    }
  ]
}
```

[Back to top](https://developer.mastercard.com/consumer-clarity/documentation/testing/test-cases-carbon-footprint/index.md#test-cases)

## Next Steps {#next-steps}

* [Testing](https://developer.mastercard.com/consumer-clarity/documentation/testing/index.md) shows you where to find other types of test cases that you can run.
* [API Reference](https://developer.mastercard.com/consumer-clarity/documentation/api-reference/index.md#apis) provides details about all of the fields and values in the Consumer Clarity API.
* See [Code and Formats](https://developer.mastercard.com/consumer-clarity/documentation/code-and-formats/index.md) for detailed information about error response handling.
