swagger: '2.0'
info:
title: Mastercard Bill Payment Validator Account Opening Transaction 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: Transaction
paths:
/payment-cards/{payment_card_id}/transaction-footprints:
get:
tags:
- Transaction
summary: Fetches Historical Transactions and its Transaction Footprints
description: Allows a Service Provider to fetch historical transactions for a payment card. Note that a maximum of one year of transactions can be retrieved using this API. Also, the payment card has to be registered first using /payment-cards service.
operationId: GetPaymentCardTransactionHistory
parameters:
- $ref: '#/components/parameters/PaymentCardId'
- $ref: '#/components/parameters/FromDate'
- $ref: '#/components/parameters/ToDate'
- $ref: '#/components/parameters/Offset'
- $ref: '#/components/parameters/Limit'
responses:
'200':
$ref: '#/components/responses/HistoricalTransactionFootprints'
'400':
$ref: '#/components/responses/TransactionHistoryBadRequestError'
'404':
$ref: '#/components/responses/ServiceProviderNotFoundError'
/payment-cards/transaction-footprints/aggregates:
post:
tags:
- Transaction
summary: Fetches carbon score for payment cards and aggregates the same on a weekly and monthly basis. The result will be in descending order.
description: 'Allows a Service Provider to fetch aggregate carbon score for a single or multiple payment cards. A payment card has to be registered first using /service-providers/payment-cards endpoint before this endpoint can be called. The aggregate can be requested weekly, or monthly. Note that **ONLY** cleared transactions will be returned.
If any of the paymentCardIds is not valid or not registered, then the entire request will be rejected, and no aggregate will be returned.
If no transaction is found for a particular paymentCardId then the response will have an empty list against that paymentCardId.
The date range is valid for 26 weeks for weekly aggregate and 12 months for monthly aggregate.
'
operationId: GetPaymentCardAggregateTransactions
requestBody:
$ref: '#/components/requestBodies/AggregateSearchCriteria'
responses:
'200':
$ref: '#/components/responses/AggregateTransactionFootprints'
'400':
$ref: '#/components/responses/AggregateTransactionBadRequestError'
'404':
$ref: '#/components/responses/ServiceProviderNotFoundError'
'415':
$ref: '#/components/responses/ServiceProviderUnsupportedMediaTypeError'
/transaction-footprints:
post:
tags:
- Transaction
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:
responses:
TransactionHistoryBadRequestError:
description: This response code is returned when a request is invalid or data in the request is not valid.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorWrapper'
examples:
TransactionHistoryPaymentCardNotFoundError:
$ref: '#/components/examples/TransactionHistoryPaymentCardNotFoundError'
TransactionHistoryInvalidDateRangeError:
$ref: '#/components/examples/TransactionHistoryInvalidDateRangeError'
TransactionHistoryInvalidDateFormatError:
$ref: '#/components/examples/TransactionHistoryInvalidDateFormatError'
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'
AggregateTransactionFootprints:
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/AggregateTransactionFootprints'
examples:
WeeklyAggregateTransactionFootprints:
$ref: '#/components/examples/WeeklyAggregateTransactionFootprints'
MonthlyAggregateTransactionFootprints:
$ref: '#/components/examples/MonthlyAggregateTransactionFootprints'
MonthlyCategoryAggregateTransactionFootprints:
$ref: '#/components/examples/MonthlyCategoryAggregateTransactionFootprints'
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'
HistoricalTransactionFootprints:
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/HistoricalTransactionFootprints'
examples:
HistoricalTransactionFootprints:
$ref: '#/components/examples/HistoricalTransactionFootprints'
ServiceProviderUnsupportedMediaTypeError:
description: This response code is returned when the value of provided Content-Type parameter is other than expected.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorWrapper'
examples:
ServiceProviderUnsupportedMediaTypeError:
$ref: '#/components/examples/ServiceProviderUnsupportedMediaTypeError'
AggregateTransactionBadRequestError:
description: This response code is returned when a request is invalid or data in the request is not valid.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorWrapper'
examples:
InvalidPaymentCardError:
$ref: '#/components/examples/InvalidPaymentCardError'
AggregateTransactionInvalidDateFormatError:
$ref: '#/components/examples/AggregateTransactionInvalidDateFormatError'
AggregateTransactionInvalidDateRangeError:
$ref: '#/components/examples/AggregateTransactionInvalidDateRangeError'
AggregateTransactionInvalidAggregateTypeError:
$ref: '#/components/examples/AggregateTransactionInvalidAggregateTypeError'
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'
ServiceProviderNotFoundError:
description: This response code is returned when the server cannot find the account which has been used to call this API.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorWrapper'
examples:
ServiceProviderNotFoundError:
$ref: '#/components/examples/ServiceProviderNotFoundError'
UnsupportedMediaTypeError_2:
description: This response code is returned when the MediaType in request is other than application/json.
content:
application/json:
schema:
$ref: '#/components/schemas/MCErrorResponseObject'
examples:
UnsupportedMediaTypeError:
$ref: '#/components/examples/UnsupportedMediaTypeError_2'
BadRequestError_2:
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/MCErrorResponseObject'
examples:
BadRequestError:
$ref: '#/components/examples/BadRequestError_2'
MCTransactionFootprints:
description: This response code is returned when a request is accepted and successfuly processed. A corresponding response will be returned for the API caller.
content:
application/json:
schema:
$ref: '#/components/schemas/MCTransactionFootprints'
examples:
MCTransactionFootprints:
$ref: '#/components/examples/MCTransactionFootprints'
examples:
TransactionHistoryInvalidDateRangeError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_DATE_RANGE
Description: Requested date range is either invalid or exceeds one year limits. Try again with a valid date range.
Recoverable: false
Details: ''
MonthlyAggregateTransactionFootprints:
value:
aggregateTransactionFootprint:
- paymentCardId: 8a581a55-bcea-4c3e-8e0f-9b4726e5e6d3
footprintAggregation:
- carbonEmissionInGrams: 616.35
carbonEmissionInOunces: 31.28
aggregateValue: October|2019
- carbonEmissionInGrams: 898.64
carbonEmissionInOunces: 32.54
aggregateValue: September|2019
- paymentCardId: 328b62d4-287c-4c9f-a05d-6d4a67f208d8
footprintAggregation:
- carbonEmissionInGrams: 614.24
carbonEmissionInOunces: 32.21
aggregateValue: October|2019
- carbonEmissionInGrams: 612.24
carbonEmissionInOunces: 33.65
aggregateValue: September|2019
crossPANAggregation:
- carbonEmissionInGrams: 1230.59
carbonEmissionInOunces: 63.49
aggregateValue: October|2019
- carbonEmissionInGrams: 1510.88
carbonEmissionInOunces: 66.19
aggregateValue: September|2019
ServiceProviderUnsupportedMediaTypeError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: UNSUPPORTED_MEDIA_TYPE
Description: Requested media type is not supported, try again with the supported media type.
Recoverable: false
Details: ''
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
AggregateTransactionInvalidDateRangeError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_DATE_RANGE
Description: Requested date range is either invalid or exceeds supported limit (i.e. 26 weeks for weekly aggregate and 12 months for monthly aggregate).
Recoverable: false
Details: ''
ServiceProviderNotFoundError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: ACCOUNT_NOT_FOUND
Description: We cannot find the account which you are using to access this service. Kindly register your account or contact your Mastercard associate if you have already registered with us earlier.
Recoverable: false
Details: ''
WeeklyAggregateTransactionFootprints:
value:
aggregateTransactionFootprint:
- paymentCardId: 8a581a55-bcea-4c3e-8e0f-9b4726e5e6d3
footprintAggregation:
- carbonEmissionInGrams: 140.52
carbonEmissionInOunces: 7.19
aggregateValue: Week-26|2019
- carbonEmissionInGrams: 142.67
carbonEmissionInOunces: 6.94
aggregateValue: Week-25|2019
- paymentCardId: 328b62d4-287c-4c9f-a05d-6d4a67f208d8
footprintAggregation:
- carbonEmissionInGrams: 143.64
carbonEmissionInOunces: 6.97
aggregateValue: Week-26|2019
- carbonEmissionInGrams: 218.31
carbonEmissionInOunces: 7.19
aggregateValue: Week-25|2019
crossPANAggregation:
- carbonEmissionInGrams: 284.16
carbonEmissionInOunces: 14.16
aggregateValue: Week-26|2019
- carbonEmissionInGrams: 360.98
carbonEmissionInOunces: 14.13
aggregateValue: Week-25|2019
HistoricalTransactionFootprints:
value:
count: 2
offset: 1
limit: 5
total: 5
items:
- transactionMetadata:
id: ee421c25-f928-4bf6-b884-3600b76b860d
traceId: 9f52386ce297173ecfeb9120aabb0805bbeeb1350ce1de640864852e800bd206
banknetReferenceNumber: MPL0R6B2R
banknetDate: '0525'
retrievalRefNumber: MCC000100
processingCode: '00'
authCode: 52717Z
dateAndTime: 2018-07-02T00:00+00:00
merchantName: ABC Store
acquiringInstitutionCountryCode: USA
acquiringInstitutionCode: '12312312312'
amount: '25.50'
currencyCode: USD
indicator: CL
transactionFootPrint:
mcc: 3997
carbonEmissionInGrams: 48.52
carbonEmissionInOunces: 1.71
category:
mainCategory: Leisure & Entertainment
subCategory: Hotels & Vacation
sector: Hotels, Motels & Resorts
sectorCode: '604'
scoreReference: MCC
- transactionMetadata:
id: fdc4626c-f51e-4ba6-9728-c79ac1d9aec8
traceId: gf55386ce297173ecfeb9120aabb0805bbeeb1350ce1de640864852e8002343
banknetReferenceNumber: MPL0B6B23
banknetDate: '0725'
retrievalRefNumber: MCC000480
processingCode: '01'
authCode: K3C161
dateAndTime: 2019-12-25T00:00+00:00
merchantName: ABC Store
acquiringInstitutionCountryCode: USA
acquiringInstitutionCode: '23423423423'
amount: '30.00'
currencyCode: USD
indicator: CL
transactionFootPrint:
mcc: 5962
carbonEmissionInGrams: 27.98
carbonEmissionInOunces: 0.99
category:
mainCategory: Shopping
subCategory: Department Store
sector: Specialty Retail & Services
sectorCode: '302'
scoreReference: MCC
- transactionMetadata:
id: '9000010131662'
traceId: af55386ce297173ecfeb9120aabb0805bbeeb1350ce1de640864852e800bd854
banknetReferenceNumber: MPL0R8C2A
banknetDate: '0624'
retrievalRefNumber: '801220'
processingCode: '00'
authCode: '16'
dateAndTime: 2022-01-26T00:00+00:00
merchantName: Test Sandbox Merchant
acquiringInstitutionCountryCode: USA
acquiringInstitutionCode: '12311878333'
amount: 20
currencyCode: GBP
indicator: RFT
transactionFootprint:
carbonEmissionInGrams: -3398.54
carbonEmissionInOunces: -119.88
transactionId: '9000010131662'
mcc: '9311'
category:
mainCategory: Government Services
subCategory: Public Services
sector: Government Services
sectorCode: '801'
scoreReference: MCC
AggregateTransactionInvalidDateFormatError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request.
Recoverable: false
Details: fromDate must match "^((?:19|20)[0-9][0-9])-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$"
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request.
Recoverable: false
Details: fromDate size must be between 10 and 10
TransactionHistoryInvalidDateFormatError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request.
Recoverable: false
Details: 'getPaymentCardTransactionHistory.fromDate: must match "^((?:19|20)[0-9][0-9])-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$"'
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request..
Recoverable: false
Details: 'getPaymentCardTransactionHistory.fromDate: size must be between 10 and 10'
InvalidPaymentCardError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: Payment card id - [b86fd2ba-c095-4acb-b9df-f3805655ba24,d30f6223-b15d-4663-8e6a-247475c596dd ] is/are invalid or not found. Please try again with a valid payment card id.
Recoverable: false
Details: ''
MonthlyCategoryAggregateTransactionFootprints:
value:
aggregateTransactionFootprint:
- paymentCardId: 8a581a55-bcea-4c3e-8e0f-9b4726e5e6d3
footprintAggregation:
- carbonEmissionInGrams: 345.35
carbonEmissionInOunces: 15.28
aggregateValue: October|2019|Shopping
- carbonEmissionInGrams: 261.64
carbonEmissionInOunces: 16.54
aggregateValue: October|2019|Hospital
- carbonEmissionInGrams: 898.64
carbonEmissionInOunces: 32.54
aggregateValue: September|2019|Shopping
- paymentCardId: 328b62d4-287c-4c9f-a05d-6d4a67f208d8
footprintAggregation:
- carbonEmissionInGrams: 614.24
carbonEmissionInOunces: 32.21
aggregateValue: October|2019|Foods
- carbonEmissionInGrams: 612.24
carbonEmissionInOunces: 33.65
aggregateValue: September|2019|Hospital
crossPANAggregation:
- carbonEmissionInGrams: 345.35
carbonEmissionInOunces: 15.28
aggregateValue: October|2019|Shopping
- carbonEmissionInGrams: 898.64
carbonEmissionInOunces: 32.54
aggregateValue: October|2019|Hospital
- carbonEmissionInGrams: 614.24
carbonEmissionInOunces: 32.21
aggregateValue: October|2019|Foods
- carbonEmissionInGrams: 898.64
carbonEmissionInOunces: 32.54
aggregateValue: September|2019|Shopping
- carbonEmissionInGrams: 612.24
carbonEmissionInOunces: 33.65
aggregateValue: September|2019|Hospital
AggregateTransactionInvalidAggregateTypeError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request.
Recoverable: false
Details: aggregateType must be less than or equal to 3
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: ''
TransactionHistoryPaymentCardNotFoundError:
value:
Errors:
Error:
- Source: Service-Provider-Mgmt
ReasonCode: INVALID_REQUEST_PARAMETER
Description: Payment card id - c2c76ec0-4056-44ba-b14f-6654c9ba5722 is/are invalid or not found. Please try again with valid payment card id.
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}"'
MCTransactionFootprints:
value:
transactionFootprints:
- transactionId: ee421c25-f928-4bf6-b884-3600b76b860d
carbonEmissionInGrams: 48.52
carbonEmissionInOunces: 1.71
carbonSocialCost:
currencyCode: USD
value: 40.5
- transactionId: fdc4626c-f51e-4ba6-9728-c79ac1d9aec8
carbonEmissionInGrams: 27.98
carbonEmissionInOunces: 0.99
carbonSocialCost:
currencyCode: EUR
value: 30.5
UnsupportedMediaTypeError_2:
value:
Errors:
Error:
- Source: Carbon-Calculator-Proxy
ReasonCode: UNSUPPORTED_MEDIA_TYPE
Description: Requested media type is not supported, try again with supported media type.
Recoverable: false
Details: ''
BadRequestError_2:
value:
Errors:
Error:
- Source: Carbon-Calculator-Proxy
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request.
Recoverable: false
Details: transactions[0].mcc size must be between 1 and 4
- Source: Carbon-Calculator-Proxy
ReasonCode: INVALID_REQUEST_PARAMETER
Description: One of the request parameters is invalid, try again with correct request.
Recoverable: false
Details: transactions[0].mcc must match "^\d{1,4}"
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
AggregateSearchCriteria:
title: AggregateSearchCriteria
type: object
description: Request object which holds the criteria (that is, list of payment card IDs and aggregate type) for retrieving aggregate transactions.
required:
- paymentCardIds
- aggregateType
properties:
paymentCardIds:
type: array
items:
$ref: '#/components/schemas/PaymentCardId'
minItems: 1
maxItems: 5
example: c5d88571-ac15-465a-a0d8-1ad1327b9a06
description: Unique ID provided in the response while registering a payment card.
aggregateType:
type: integer
minimum: 1
maximum: 3
example: 1
description: 'Aggregate type for which aggregate needs to be calculated. Supported values are:
1 = Weekly Transactions aggregated for last 26 weeks 2 = Monthly transactions aggregated for last 12 months 3 = Monthly category-wise transactions aggregated for last 12 months
'
crossPANAggregate:
type: string
minLength: 1
maxLength: 1
pattern: ^(?:Y|N|y|n)$
example: Y
description: 'Wheter to retrieve cross PAN aggregate carbon footprint or not. Supported values are:
Y = Retrieve cross PAN aggregate. N = Do not retrieve cross PAN aggregate.
If not provided then default will be considered as ''N''.
'
fromDate:
$ref: '#/components/schemas/Day'
toDate:
$ref: '#/components/schemas/Day'
example:
aggregateType: 1
crossPANAggregate: Y
paymentCardIds:
- 328b62d4-287c-4c9f-a05d-6d4a67f208d8
- b86fd2ba-c095-4acb-b9df-f3805655ba24
fromDate: '2020-07-01'
toDate: '2020-08-30'
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.'
TransactionMetadata:
title: TransactionMetadata
type: object
description: Metadata about a transaction.
required:
- id
- retrievalRefNumber
- processingCode
- dateAndTime
- merchantName
- acquiringInstitutionCountryCode
- acquiringInstitutionCode
- amount
- currencyCode
- indicator
properties:
id:
title: id
type: string
description: A unique ID associated with a transaction.
maxLength: 100
minLength: 1
pattern: ^[\w\-\_]{1,100}
example: ee421c25-f928-4bf6-b884-3600b76b860d
traceId:
title: traceId
type: string
description: A unique ID associated with a transaction.
maxLength: 100
minLength: 65
pattern: ([A-Za-z0-9]{10,100})
example: 9A52386ce297173Ecfeb9120aabb0805bbeeb1350ce1de640864852e800bd2067
banknetReferenceNumber:
title: banknetReferenceNumber
type: string
description: DE 63, subfield 2 (Banknet Reference Number) is generated by the Authorization Platform for each originating message it routes. The reference number is guaranteed to be a unique value for any transaction within the specified financial network on any processing day.
maxLength: 13
minLength: 6
pattern: ([A-Za-z0-9]{6,13})
example: MPL0R6B2R
banknetDate:
title: banknetDate
type: string
description: DE 7 subelement 1 (POS_BANKNET_DATE) is a date when transaction message enters into Mastercard network.
maxLength: 4
minLength: 4
pattern: ([0-9]{4})
example: '0525'
retrievalRefNumber:
title: retrievalRefNumber
type: string
description: DE 37 (Retrieval Reference Number) is a document reference number supplied by the system retaining the original source document of the transaction and assists in locating that source document or a copy thereof. DE 37 is made available for use by automated merchant POS systems that may be interconnected into the interchange system. Merchant POS systems may assign a unique receipt or sales document ID to be used to satisfy regulatory or legal requirements when the merchant performs source document capture and truncation. DE 37 may be used to relay source document reference numbers to the issuer at the time each transaction is processed. Number assigned by the acquirer. When present, DE 37 must contain a value other than all zeros or all spaces. DE 37 can have trailing spaces if the transaction is not a Visa or EMV chip transaction.
maxLength: 12
minLength: 12
example: MCC000100120
processingCode:
title: processingCode
type: string
description: DE 3, subfield 1 (Cardholder Transaction Type Code) describes the specific transaction type.
maxLength: 2
minLength: 2
example: '00'
authCode:
title: authCode
type: string
description: DE 38 (Authorization ID Response) is a transaction response ID code that the authorizing institution assigns. DE 38 is used to transmit a card issuers authorization code for Authorization transactions.
maxLength: 6
minLength: 1
example: 01423Z
dateAndTime:
title: dateAndTime
type: string
description: This is the date and time when transaction acquire at the Merchant. (For example, YYYY-MM-DDThh:mmTZD).
maxLength: 25
minLength: 22
example: 2018-07-02T00:00+00:00
merchantName:
title: merchantName
type: string
description: DE 43 (Card Acceptor Name/Location for All Transactions), subfield 1 (Card Acceptor Name) is the merchant doing business as name.
maxLength: 25
minLength: 1
example: ABC Store
acquiringInstitutionCountryCode:
title: acquiringInstitutionCountryCode
type: string
description: DE 19 (Acquiring Institution Country Code) is the code of the country where the acquiring institution is located. Refer to the ISO 3166 specification for more information.
maxLength: 3
minLength: 3
example: USA
acquiringInstitutionCode:
title: acquiringInstitutionCode
type: string
description: DE 32 (Acquiring Institution ID Code) identifies the acquiring institution (for example, merchant bank) or its agent.
maxLength: 11
minLength: 11
example: '12312312312'
amount:
title: amount
type: number
description: Transaction amount for the given transaction.
maxLength: 10
minLength: 1
example: 25.5
currencyCode:
$ref: '#/components/schemas/CurrencyCode'
indicator:
title: indicator
type: string
description: Transaction type (CLEAR = CL or REFUND = RFT).
maxLength: 8
minLength: 2
example: CL
PaymentCardId:
type: string
minLength: 36
maxLength: 36
pattern: ^[0-9A-Fa-f\-]{36}
description: Unique ID provided in the response while registering a payment card.
example: c5d88571-ac15-465a-a0d8-1ad1327b9a06
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'
HistoricalTransactionFootprint:
title: HistoricalTransactionFootprint
type: object
description: A single transaction footprint along with transaction info for a corresponding payment transaction.
required:
- transactionMetadata
- transactionFootprint
properties:
transactionMetadata:
$ref: '#/components/schemas/TransactionMetadata'
transactionFootprint:
$ref: '#/components/schemas/TransactionFootprint'
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'
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
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'
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'
HistoricalTransactionFootprints:
title: HistoricalTransactionFootprints
description: Response object which holds all the transaction footprints for historical transactions.
properties:
count:
description: The number of items in this batch (the size of the item array).
type: integer
example: 2
offset:
description: The number of items you asked the start of the list to be offset from.
type: integer
minimum: 0
example: 1
limit:
description: The number of items you asked the list to be limited to.
type: integer
minimum: 5
maximum: 50
example: 5
total:
description: The total number of items in the collection.
type: integer
example: 5
items:
description: 'List of `HistoricalTransactionFootprint` objects.
'
type: array
minItems: 1
maxItems: 5000
items:
$ref: '#/components/schemas/HistoricalTransactionFootprint'
AggregateTransactionFootprints:
title: AggregateTransactionFootprints
type: object
description: List of AggregateTransactionFootprint.
required:
- aggregateTransactionFootprints
properties:
aggregateTransactionFootprints:
description: Array of `crossPANAggregations` based on given aggregation level.
type: array
minItems: 1
maxItems: 100
items:
$ref: '#/components/schemas/AggregateTransactionFootprint'
crossPANAggregations:
description: Array of `crossPANAggregations` based on given aggregation level.
type: array
minItems: 1
maxItems: 100
items:
$ref: '#/components/schemas/CrossPANAggregation'
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'
AggregateTransactionFootprint:
title: AggregateTransactionFootprint
type: object
description: Aggregate transaction footprint for a single payment card ID.
required:
- paymentCardId
- footprintAggregations
properties:
paymentCardId:
$ref: '#/components/schemas/PaymentCardId'
footprintAggregations:
description: Array of FootprintAggregation based on given aggregation level.
type: array
minItems: 1
maxItems: 186
items:
$ref: '#/components/schemas/FootprintAggregation'
ErrorList:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Error'
CrossPANAggregation:
title: CrossPANAggregation
description: Cross PAN aggregated carbon footprint for given aggregate type.
properties:
aggregateValue:
type: string
minLength: 10
maxLength: 25
description: 'Aggregate duration for which aggregate has been calculated.
* Weekly = Week-26|2019 (i.e.,Starting from week 1 to week 26).
* Monthly = July|2019
'
example: Week-26|2019
allOf:
- $ref: '#/components/schemas/CarbonUsage'
Day:
type: string
minLength: 10
maxLength: 10
pattern: ^((?:19|20)[0-9][0-9])-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$
example: '2020-09-19'
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
FootprintAggregation:
title: FootprintAggregation
type: object
description: Aggregation of carbon score for a payment card ID and given aggregation level.
allOf:
- $ref: '#/components/schemas/CarbonUsage'
- type: object
properties:
aggregateValue:
type: string
minLength: 10
maxLength: 25
description: 'Aggregate duration for which aggregate has been calculated.
* Weekly = Week-22|2019 (i.e., Week of the year).
* Monthly = July|2019
'
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
MCTransactionFootprints:
title: TransactionFootprints
type: object
description: Response object which holds all the transaction footprints corresponding to each transaction in Transactions request.
required:
- transactionFootprints
properties:
transactionFootprints:
type: array
minItems: 1
maxItems: 5000
items:
$ref: '#/components/schemas/MCTransactionFootprint'
example: []
MCErrors:
title: Errors
type: object
description: Error object which returns list of Error objects
required:
- Error
properties:
Error:
type: array
items:
$ref: '#/components/schemas/MCError'
example: []
TransactionId_2:
type: string
description: A unique id associated with a payment transaction, e.g. 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}
MCError:
title: Error
type: object
description: Error object which contains details about 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 Doconomy-Proxy and Doconomy.
minLength: 1
maxLength: 100
example: Carbon-Calculator-Proxy
ReasonCode:
type: string
description: A unique constant identifying the error case encountered during request processing.
minLength: 1
maxLength: 100
example: UNSUPPORTED_MEDIA_TYPE
Description:
type: string
description: Short description of the ReasonCode field.
minLength: 10
maxLength: 1000
example: Requested media type is not supported, try again with supported media type.
Recoverable:
type: boolean
description: Indicates whether this error will always be returned for this request, or retrying could change the outcome.
example: true
Details:
type: string
description: (Optional) Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
minLength: 0
maxLength: 5000
example: Supported media type is application/json.
MCTransactions:
title: Transactions
type: object
description: Request object which holds all the payment transactions from API consumer for calculating transaction footprint.
required:
- transactions
properties:
transactions:
minItems: 1
maxItems: 5000
type: array
items:
$ref: '#/components/schemas/MCTransaction'
example:
- transactionId: ee421c25-f928-4bf6-b884-3600b76b860d
mcc: 3997
amount:
value: 100
currencyCode: USD
- transactionId: fdc4626c-f51e-4ba6-9728-c79ac1d9aec8
mcc: 5962
amount:
value: 50
currencyCode: EUR
MCTransaction:
title: Transaction
type: object
description: This object holds data corresponding to a single payment transaction.
required:
- amount
- mcc
- transactionId
properties:
transactionId:
$ref: '#/components/schemas/TransactionId_2'
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/MCAmount'
MCTransactionFootprint:
title: TransactionFootprint
type: object
description: This object holds the transaction footprint for a payment transaction.
required:
- transactionId
properties:
transactionId:
$ref: '#/components/schemas/TransactionId_2'
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
carbonSocialCost:
title: carbonSocialCost
type: object
description: The transaction's CO2 emission cost
properties:
currencyCode:
title: currencyCode
type: string
description: The transaction Currency Code
example: USD
value:
title: value
type: number
description: The transaction Currency value
example: 40.51
example: example_value
MCErrorResponseObject:
title: ErrorResponse
type: object
description: The error response object which gets returned in case of any error.
required:
- Errors
properties:
Errors:
$ref: '#/components/schemas/MCErrors'
CurrencyCode_2:
type: string
description: Currency code as per ISO 4217
minLength: 3
maxLength: 3
pattern: ^[A-Za-z]{3}$
example: USD
MCAmount:
title: Amount
type: object
description: Amount object that includes the value and the currency in which a payment transaction has been performed
required:
- currencyCode
- value
properties:
value:
type: number
description: Actual amount of a payment transaction
maximum: 1000000000
exclusiveMaximum: false
minimum: -1000000000
exclusiveMinimum: false
example: 104
currencyCode:
$ref: '#/components/schemas/CurrencyCode_2'
requestBodies:
AggregateSearchCriteria:
description: "The request should contain a list of *paymentCardIds* for which aggregate carbon score needs to be retrieved and *aggregateType* as one of the following:\n 1 = Weekly Transactions aggregated for last 26 weeks 2 = Monthly transactions aggregated for last 12 months 3 = Monthly category-wise transactions aggregated for last 12 months\n\n\n In order to retrieve aggregate for custom duration, please provide `fromDate` and `toDate`. Note that the duration should not exceed 26 weeks (for weekly aggregate) and 12 months (for monthly aggregate).\n"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AggregateSearchCriteria'
Transactions:
description: List of payment transactions which needs to be scored.
content:
application/json:
schema:
$ref: '#/components/schemas/Transactions'
required: true
MCTransactions:
description: Request object which holds all the payment transactions from API consumer for calculating transaction footprint.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MCTransactions'
parameters:
Limit:
name: limit
in: query
description: The number of items you asked the list to be limited to.
required: false
example: 50
schema:
type: integer
default: 50
minimum: 5
maximum: 50
PaymentCardId:
name: payment_card_id
in: path
description: Unique ID provided in the response while registering a payment card.
required: true
example: 83c0711e-1851-4771-950a-055dded7f168
schema:
$ref: '#/components/schemas/PaymentCardId'
Offset:
name: offset
in: query
description: The number of items you need the start of the list to be offset from.
required: false
example: 50
schema:
type: integer
default: 0
minimum: 0
ToDate:
name: to_date
in: query
description: End date for searching transaction (Format- YYYY-MM-DD).
required: true
example: '2021-05-07'
schema:
$ref: '#/components/schemas/Day'
FromDate:
name: from_date
in: query
description: Start date for searching transaction (Format- YYYY-MM-DD).
required: true
example: '2018-05-07'
schema:
$ref: '#/components/schemas/Day'
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'