# Transactions and Documents
source: https://developer.mastercard.com/mastercard-processing-core/documentation/guides/transactions-and-documents/index.md

Transactions are operations which include exchanging data. For example, a card payment transaction that may or may not require authorization leads to the fund flow. Other types of transactions are changing the contract's account balance, applying or collecting fees, and even modifying credit limits or activating certain services.

The main parameters of transactions are:

* `serviceClassCode`/`transactionCategory` classifies the category of a transaction. The sample values are:
  * `T` Transaction
  * `M` Fee
  * `I` Interests
* `sourceCategory` and `targetCategory` specify if the source and target were account contract (`Account`), card contract (`Card`), or device (`Device`). For example, for changing PIN, the source is `Device` and the target is `Account`.
* Direction can be debit or credit.
* Transaction type is represented by a few parameters, which values must be defined during the onboarding process:
  * `transactionTypeCode` in the form of a short code, for example, '0300'.
  * `transactionType` in the form of text, for example, 'ATM'.
  * `transactionTypeExtension` is a subcategory of transaction type.
  * `transactionDescription` in the form of easily understandable text, for example, 'Payment from Client Contract'.
  * `customTransactionCondition` and `customTransactionTypeCode` are custom fields for further determination of transaction type.
* `transactionConditions` provide additional information, for example, if card reader was used in POS or a PIN was entered through a PIN-pad, which is filled based on the transaction message received from the device. ![Transactions and documents](https://static.developer.mastercard.com/content/mastercard-processing-core/uploads/trans-docs.png)

Transactions are registered and represented in our systems in the form of documents. The documents are created as a result of the following:

* receiving information from you through an API, receiving a message from payment networks, or other external systems
* execution of our Card Management System (CMS) processes, for example, activation of contract usage limiters calling a fee to be charged
* manual input of data into our CRM by your employee, for example, through Workbench

The Mastercard Processing API lets you retrieve a list of transactions related to a specific card contract or account contract. You can specify the time, type, or direction of the transaction. You can also define other dimensions, such as whether transactions were cleared or impacted the account balance. Some operations allow you to retrieve all transaction documents easily and search for documents based on identifiers generated according to payment scheme rules or assigned by the sender.

Moreover, the Mastercard Processing API enables posting internal debit and credit transactions, with some fees applied, and additional transaction descriptions if needed. Despite general fee settings, a single ad-hoc fee can be charged by a specific Mastercard Processing API operation, although fee type must be defined earlier during onboarding.

With the Mastercard Processing API, you can reverse your transactions and release funds for the pending transactions.

Documents are classified in our system and processed respectively based on some transaction properties, among others:

* Service class: describes the type of transaction, for example, Interest, Fee, or Verification
* Request Category: for differentiation requests (for processing transactions) from advice
* `transactionDocumentCategory`: is the category of financial or authorization documents, such as `Auth` (for example, the document generated when credit limit changes), `PreAuth` (for example, balance request), or `PostAuth` (the document generated by the acquirer after exporting the card transaction cryptogram).

Documents contain a large group of parameters which describe transactions efficiently in detail. An important group of them are document identifiers, occurring in abundance, and they give plenty of combinations for transaction search and investigation:

* transactionId: the CMS's transaction document identifier
* Acquirer Reference Number (ARN): the transaction identification number generated by the acquirer according to payment scheme rules
* Retrieval Reference Number (RRN): the transaction identifier generated by the acquirer (in most cases), merchant or payment terminal
* Source Registration Number (SRN): the document registration number assigned by the sender
* `originalTransactionDocumentId`: in case of chained documents (for example, formed during a dispute), this number, linking to the original transaction, is assigned by us to all documents in a chain
* `paymentSchemeReferenceNumber`: the number related to DE63 of ISO 8583 protocol

The most significant document parameter group refers to the transaction itself, the card or account contract involved, the payment network, the amount and currencies, and all data relating to certain transaction conditions.

The transaction is carried out in a specific currency. However, the document contains comprehensive data, such as settlement amount, settlement currency and date, reconciliation amount and currency, and a fee collected from the target account or card contract.

Documents processed in the CMS at the end of each stage of the process obtain data referring to the posting process: `postingDate`, `postingStatus`, `responseCode`, and `responseCodeDescription`. During the processing of document in the CMS, the `postingStatus` is updated at the end of each phase.
