swagger: '2.0'
info:
title: Mastercard Bill Payment Validator Account Opening Environmental Impact API
description: This service is provided on behalf of the Mastercard Remote Payment and Presentment (RPPS) Bill Payment Processing Network, which supports consumer to business "push" bill payments (i.e. those which are not funded by debit/credit card transactions) in the U.S.
version: '1.0'
x-artifactId: billpay-api
contact:
name: Bill Pay Development Support
email: Bill_Pay_Development_Support@mastercard.com
host: sandbox.api.mastercard.com
basePath: /billpayAPI/v1
schemes:
- https
consumes:
- application/json
produces:
- application/json
tags:
- name: Environmental Impact
paths:
/transaction-footprints:
post:
tags:
- Environmental Impact
summary: Calculate Transaction Footprints
description: "Calculates carbon emission based on the payment transaction amount, the merchant category code and the AIIA code. You can send **one or more transactions** together to get the transaction footprints.
Below is the approach to deliver **MCC** or **AIIA** based scoring.
If only `mcc` field provided in the request with required fields : MCC based scoring will be delivered.\n If `type` and `additionalInformation` field provided in the request with required fields : AIIA based scoring will be delivered."
operationId: FootprintsByTransactionData
requestBody:
$ref: '#/components/requestBodies/Transactions'
responses:
'200':
$ref: '#/components/responses/TransactionFootprintsData'
'400':
$ref: '#/components/responses/BadRequestError'
'415':
$ref: '#/components/responses/UnsupportedMediaTypeError'
components:
schemas:
TransactionData:
title: TransactionData
type: object
description: Object which holds information about payment transaction for carbon scoring and other properties.
allOf:
- $ref: '#/components/schemas/Transaction'
TransactionId:
type: string
description: A unique ID associated with a payment transaction, For example, original payment transaction ID. The same ID will be returned in the response corresponding to its payment transaction.
minLength: 1
maxLength: 100
pattern: ^[\w\-\_]{1,100}
X-MC-Correlation-ID:
type: string
example: X-MC-Correlation-ID:5e4b7f904d2820f688c67ef9fc0035
CardBrand:
title: CardBrand
type: string
minLength: 1
maxLength: 3
pattern: ^(MA|OTH|NC)$
example: MA
description: 'Brand type of the payment card through which transaction done. Possible values are,
* MA = Mastercard branded payment card.
* OTH = Payment card brand other than Mastercard.
* NC = Non card based transaction.'
ClimateProfile:
description: Represents a Climate Profile for a User. Always use updated profile present in the response, which might include benchmarks, comparisons, insights and surveys.
properties:
userAttributes:
description: Attributes defining this profile
properties:
country:
type: string
description: country of issuer
example: IN
minLength: 2
maxLength: 3
demo:
type: number
description: demo of user / score for user demo
example: 65
diet:
type: number
description: diet type of user
example: 512
energy:
type: number
description: energy consumption type of user
example: 12288
lifestyle:
type: number
description: lifestyle type of user
example: 1
transport:
type: number
description: transport type of user
example: 12357
required:
- country
- demo
- diet
- energy
- lifestyle
- transport
type: object
benchmarks:
description: Tracks benchmarks data. This value is sourced from benchmarks API.
type: object
additionalProperties: true
example:
key1:
key2: 1
key3: 2
comparisons:
description: Tracks comparison data. This value is sourced from comparisons by id API.
type: object
additionalProperties: true
example:
key1:
key2: 1
key3: 2
insights:
description: Tracks which insights have been displayed. This value is sourced from insights by id API.
type: object
additionalProperties: true
example:
key1:
key2: 1
key3: 2
created:
description: represents creation date of user profile
type: string
format: date-time
example: '2023-08-07T12:39:35.087Z'
persona:
description: Representation of user persona type
type: string
example: '5'
minLength: 1
maxLength: 1
surveys:
description: Tracks surveys data. This value is sourced from /surveys API.
type: object
additionalProperties: true
example:
key1:
key2: 1
key3: 2
traits:
description: Scores for knowledge, lifestyle, and motivation
properties:
knowledge:
type: number
example: 0.575
description: score for user knowledge
minLength: 1
lifestyle:
type: number
example: 0.324
description: score for user lifestyle
minLength: 1
motivated:
type: number
example: 0.617
description: score for user motivation
minLength: 1
required:
- knowledge
- lifestyle
- motivated
type: object
version:
description: Version for this profile
type: string
example: 1
required:
- userAttributes
- created
- persona
- traits
- version
type: object
TransactionFootprintsData:
title: TransactionFootprintsData
type: array
description: List of transaction footprints corresponding to each transaction in Transactions request.
minItems: 1
maxItems: 5000
items:
$ref: '#/components/schemas/TransactionFootprintData'
AdditionalInformation:
title: AdditionalInformation
description: Additional Information object with key value pair.
type: object
properties:
key:
type: string
minLength: 1
maxLength: 50
example: aiiaCode
description: A unique key within `AdditionalInformation` which describes a specific input. For example aiiaCode.
value:
type: string
minLength: 1
maxLength: 50
example: '101'
description: A value against particular key.
Transactions:
title: Transactions
type: array
description: List of payment transactions from API consumer for calculating transaction footprint.
minItems: 1
maxItems: 5000
items:
$ref: '#/components/schemas/TransactionData'
example:
- transactionId: ee421c25-f928-4bf6-b884-3600b76b860d
mcc: 3997
cardBrand: OTH
amount:
currencyCode: USD
value: 123
profile:
traits:
knowledge: 0.65
lifestyle: 0.445
motivated: 0.683
userAttributes:
demo: 66
diet: 256
lifestyle: 4
energy: 12288
transport: 36933
country: AX
created: '2024-01-31T10:57:36.161Z'
surveys:
key1:
key2: 1
key3: 2
persona: '3'
benchmarks:
key1:
key2: 1
key3: 2
comparisons:
key1:
key2: 1
key3: 2
insights:
key1:
key2: 1
key3: 2
version: '1.0'
- transactionId: fdc4626c-f51e-4ba6-9728-c79ac1d9aec8
mcc: 3000
cardBrand: OTH
amount:
currencyCode: USD
value: 10.35
- transactionId: 0218BC0251FEB8F8E063C6979E0AE0DD
mcc: 1234
cardBrand: OTH
amount:
currencyCode: USD
value: 123
- transactionId: odc4626c-f51e-4ba6-9728-c79ac1d9aec9
mcc: 3997
type: AIIA
amount:
value: 100
currencyCode: USD
cardBrand: OTH
additionalInformation:
- key: aiiaCode
value: '101'
ErrorWrapper:
title: ErrorWrapper
type: object
description: The error response object gets returned in case of any error.
required:
- Errors
properties:
Errors:
$ref: '#/components/schemas/Errors'
TransactionFootprint:
title: TransactionFootprint
type: object
description: A single transaction footprint calculated for a corresponding payment transaction.
required:
- transactionId
- mcc
allOf:
- $ref: '#/components/schemas/CarbonUsage'
- type: object
properties:
transactionId:
$ref: '#/components/schemas/TransactionId'
mcc:
type: string
description: Merchant category code of a payment transaction that uniquely defines a merchant business (same as in request).
minLength: 1
maxLength: 4
pattern: ^\d{1,4}
category:
$ref: '#/components/schemas/Category'
scoreReference:
type: string
description: Score Reference defines transaction scoring type, based on which score has been generated. Possible values are MCC or AIIA.
minLength: 3
maxLength: 4
Amount:
title: Amount
type: object
description: The value and the currency of a payment transaction.
required:
- currencyCode
- value
properties:
value:
type: number
description: Actual amount of a payment transaction
maximum: 1000000000
exclusiveMaximum: false
minimum: -1000000000
exclusiveMinimum: false
example: 100
currencyCode:
$ref: '#/components/schemas/CurrencyCode'
Type:
title: Type
type: string
minLength: 3
maxLength: 4
example: AIIA
description: Type defines transaction scoring type, based on which score has been generated.Allowed value is AIIA.
Category:
title: Category
type: object
description: User understandable information about an MCC categorization.
properties:
mainCategory:
title: mainCategory
type: string
description: Main category to which an MCC belongs.
minLength: 5
maxLength: 100
pattern: ^[\w\-\_\&\,]+[\w\-\_\&\,\ ]{5,100}
example: Shopping
subCategory:
title: subCategory
type: string
description: Sub-category of a category to which an MCC belongs.
minLength: 5
maxLength: 100
pattern: ^[\w\-\_\&\,]+[\w\-\_\&\,\ ]{5,100}
example: Department Store
sector:
title: sector
type: string
description: Sector of a category to which an MCC belongs.
minLength: 5
maxLength: 100
pattern: ^[\w\-\_\&\,]+[\w\-\_\&\,\ ]{5,100}
example: Specialty Retail & Services
sectorCode:
title: sectorCode
type: string
description: Unique code assigned to each sector.
minLength: 3
maxLength: 3
pattern: ^\d{3}
example: '302'
CarbonUsage:
title: CarbonUsage
type: object
description: Object to hold carbon usage data.
properties:
carbonEmissionInGrams:
title: carbonEmissionInGrams
type: number
description: The transaction's CO2 emission in grams.
example: 48.52
carbonEmissionInOunces:
title: carbonEmissionInOunces
type: number
description: The transaction's CO2 emission in ounces.
example: 1.71
ClassificationType:
type: string
minLength: 3
maxLength: 5
pattern: ^(mcc|docc|MCC|plaid)$
example: MCC
description: 'Classification for this transaction. Possible values are,
* mcc * docc * MCC * plaid'
Errors:
title: Errors
type: object
description: Error object which returns a list of Error objects.
required:
- Error
properties:
Error:
$ref: '#/components/schemas/ErrorList'
Transaction:
title: Transaction
type: object
description: A single payment transaction for carbon scoring.
required:
- transactionId
- amount
properties:
transactionId:
$ref: '#/components/schemas/TransactionId'
type:
$ref: '#/components/schemas/Type'
mcc:
type: string
description: Merchant category code of a payment transaction that uniquely defines a merchant business.
minLength: 1
maxLength: 4
pattern: ^\d{1,4}
example: '3997'
amount:
$ref: '#/components/schemas/Amount'
profile:
$ref: '#/components/schemas/ClimateProfile'
additionalInformation:
type: array
items:
$ref: '#/components/schemas/AdditionalInformation'
ErrorList:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Error'
TransactionFootprintData:
title: TransactionFootprintData
type: object
description: A single transaction footprint calculated for a corresponding transaction.
allOf:
- $ref: '#/components/schemas/TransactionFootprint'
properties:
cardBrand:
$ref: '#/components/schemas/CardBrand'
scoreStatus:
type: string
example: SUCCESS
description: 'scoreStatus defines the status of carbon scoring for a given transaction. Possible values are,
* SUCCESS = Transaction is scored successfully.
* FAILURE = Transaction scoring is failed.'
minLength: 5
maxLength: 7
errorCode:
type: string
example: INVALID_MCC
description: A unique constant identifying the error case encountered during carbon scoring for a given transaction.
minLength: 1
maxLength: 100
errorMessage:
type: string
example: MCC Provided in the request is Invalid. Kindly Request again with valid MCC.
description: Short description of the errorCode field.
minLength: 10
maxLength: 1000
profile:
$ref: '#/components/schemas/ClimateProfile'
classification:
title: Classification
type: object
description: Classification for this transaction.
properties:
type:
$ref: '#/components/schemas/ClassificationType'
id:
type: string
example: '5411'
description: specifies Id of Classification
required:
- id
- type
spendingAreaId:
type: number
description: Spending area id
example: 30
CurrencyCode:
type: string
description: Currency code as per ISO 4217
minLength: 3
maxLength: 3
pattern: ^[A-Za-z]{3}$
Error:
title: Error
type: object
description: Error object which contains details about the error.
required:
- Source
- ReasonCode
- Description
- Recoverable
properties:
Source:
type: string
description: The application name that generated this error. Every error message that is generated and returned by the gateway will have this field equal to Gateway. Other possible values are 'Carbon-Calculator' and 'Service-Provider'.
minLength: 1
maxLength: 100
example: Service-Provider-Mgmt
ReasonCode:
type: string
description: A unique constant identifying the error case encountered during request processing.
minLength: 1
maxLength: 100
example: INVALID_REQUEST_PARAMETER
Description:
type: string
description: Short description of the ReasonCode field.
minLength: 10
maxLength: 1000
example: One of the request parameters is invalid, try again with correct request.
Recoverable:
type: boolean
description: Indicates whether this error will always be returned for this request, or retrying could change the outcome.
example: false
Details:
type: string
description: (Optional) Where appropriate, indicates detailed information about data received and calculated during the request processing, to help the user with diagnosing errors.
minLength: 0
maxLength: 5000
example: paymentCardId size must be between 36 and 36
examples:
TransactionFootprintsData:
value:
- transactionId: ee421c25-f928-4bf6-b884-3600b76b860d
mcc: 3997
cardBrand: OTH
scoreReference: MCC
carbonEmissionInGrams: 48.52
carbonEmissionInOunces: 1.71
category:
mainCategory: Leisure & Entertainment
subCategory: Hotels & Vacation
sector: Hotels, Motels & Resorts
sectorCode: '604'
scoreStatus: SUCCESS
profile:
traits:
knowledge: 0.65
lifestyle: 0.445
motivated: 0.683
userAttributes:
demo: 66
diet: 256
lifestyle: 4
energy: 12288
transport: 36933
country: AX
created: '2024-01-31T10:57:36.161Z'
surveys:
key1:
key2: 1
key3: 2
persona: '3'
benchmarks:
key1:
key2: 1
key3: 2
comparisons:
key1:
key2: 1
key3: 2
insights:
key1:
key2: 1
key3: 2
version: '1.0'
classification:
type: mcc
id: '5411'
spendingAreaId: 20
- transactionId: fdc4626c-f51e-4ba6-9728-c79ac1d9aec8
mcc: 3000
scoreReference: MCC
carbonEmissionInGrams: 11941.95,
carbonEmissionInOunces: 421.24,
category:
mainCategory: Transport
subCategory: Flights
sector: Flights
sectorCode: '351'
- transactionId: 0218BC0251FEB8F8E063C6979E0AE0DD
mcc: 1234
scoreReference: null
scoreStatus: FAILURE
errorCode: INVALID_MCC
errorMessage: MCC Provided in the request is Invalid. Kindly Request again with valid MCC.
- transactionId: odc4626c-f51e-4ba6-9728-c79ac1d9aec9
mcc: 3997
scoreReference: AIIA
carbonEmissionInGrams: 27.98
carbonEmissionInOunces: 0.99
category:
mainCategory: Shopping
subCategory: Department Store
sector: Specialty Retail & Services
sectorCode: '302'
scoreStatus: SUCCESS
UnsupportedMediaTypeError:
value:
Errors:
Error:
- Source: Carbon-Calculator
ReasonCode: UNSUPPORTED_MEDIA_TYPE
Description: Requested media type is not supported, try again with the supported media type.
Recoverable: false
Details: ''
BadRequestError:
value:
Errors:
Error:
- Source: Carbon-Calculator
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with the correct request.
Recoverable: false
Details: 'footprintsByTransactionData.transactionData[0].mcc: size must be between 1 and 4'
- Source: Carbon-Calculator
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with the correct request.
Recoverable: false
Details: 'footprintsByTransactionData.transactionData[0].mcc: must match "^\d{1,4}"'
responses:
TransactionFootprintsData:
description: This response code is returned when a request is accepted and successfully processed. A corresponding response will be returned for the API caller.
headers:
X-MC-Correlation-ID:
$ref: '#/components/headers/X-MC-Correlation-ID'
content:
application/json:
schema:
$ref: '#/components/schemas/TransactionFootprintsData'
examples:
TransactionFootprints:
$ref: '#/components/examples/TransactionFootprintsData'
UnsupportedMediaTypeError:
description: This response code is returned when the MediaType in the request is other than application/json.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorWrapper'
examples:
UnsupportedMediaTypeError:
$ref: '#/components/examples/UnsupportedMediaTypeError'
BadRequestError:
description: This response code is returned when one or more request parameters is either missing or is invalid. A caller should update his request as per error details before trying again.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorWrapper'
examples:
BadRequestError:
$ref: '#/components/examples/BadRequestError'
requestBodies:
Transactions:
description: List of payment transactions which needs to be scored.
content:
application/json:
schema:
$ref: '#/components/schemas/Transactions'
required: true
headers:
X-MC-Correlation-ID:
description: This id is unique per request and is used to co-relate a request to its response. Customers must share this id while raising any incident for this API.
schema:
$ref: '#/components/schemas/X-MC-Correlation-ID'