# API Reference

Full parameter and response details for every Settlement API operation. For connection and authentication instructions, see the [introduction](/reporting/introduction).

## GetSettlementsByMerchant

Retrieves all settlements for a merchant within a specified date range. Use this operation to get a list of settlements for reconciliation or reporting purposes.

**Parameters**

| Name         | Type    | Required | Description                                         |
|--------------|---------|----------|-----------------------------------------------------|
| `merchantId` | string | Yes      | Merchant ID (MID)                                   |
| `dateFrom`   | date    | Yes      | Start date of the settlement date range (inclusive) |
| `dateTo`     | date    | Yes      | End date of the settlement date range (inclusive)   |

**Response**

Returns an array of `Settlement[]` objects. Each settlement includes the settlement date, run number, amounts, deductions, and payment information.

| Field                  | Type                        | Description                                                    |
|------------------------|-----------------------------|----------------------------------------------------------------|
| `MerchantID`           | string                      | Merchant ID (MID)                                              |
| `SettlementDate`       | date                        | Date and time when the settlement was created                  |
| `SettlementRunNumber` | string                      | Unique settlement run number (also known as SettleCode)        |
| `Amount`               | decimal                     | Total gross amount of all transactions in the settlement       |
| `Deduction`            | decimal                     | Total amount of all deductions and fees applied                |
| `Commission`           | decimal                     | Total commission amount deducted from the settlement           |
| `Payment`              | decimal                     | Net amount paid to the merchant (Amount - Deduction)           |
| `JcbAmount`            | decimal                     | Total amount for JCB card transactions                         |
| `AmexAmount`           | decimal                     | Total amount for American Express card transactions            |
| `MasterCardAmount`     | decimal                     | Total amount for MasterCard transactions                       |
| `CupAmount`            | decimal                     | Total amount for China UnionPay transactions                   |
| `VisaAmount`           | decimal                     | Total amount for Visa transactions                             |
| `DinersAmount`         | decimal                     | Total amount for Diners Club transactions                      |
| `CurrencyCode`         | string                      | Settlement currency (ISO 4217 currency code)                   |
| `SlipCount`            | int                         | Total number of transaction slips (receipts) in the settlement |
| `DeductionItems`       | SettlementDeduction[]       | Array of deduction items (fees and adjustments)                |
| 
## GetSettlementByRunNumber

Retrieves a specific settlement by its settlement run number. Use this operation when you know the exact settlement you need to examine.

**Parameters**

| Name            | Type   | Required | Description                                      |
|-----------------|--------|----------|--------------------------------------------------|
| `merchantId`    | string | Yes      | Merchant ID (MID)                                |
| `runNumber`     | string | Yes      | Settlement run number (also known as SettleCode) |

**Response**

Returns a single `Settlement` object. The settlement includes all associated batches and deduction items.

| Field                   | Type                    | Description                                                    |
|-------------------------|-------------------------|----------------------------------------------------------------|
| `MerchantID`            | string                  | Merchant ID (MID)                                              |
| `SettlementDate`        | date                    | Date and time when the settlement was created                  |
| `SettlementRunNumber`   | string                  | Unique settlement run number (also known as SettleCode)        |
| `Amount`                | decimal                 | Total gross amount of all transactions in the settlement       |
| `Deduction`             | decimal                 | Total amount of all deductions and fees applied                |
| `Commission`            | decimal                 | Total commission amount deducted from the settlement           |
| `Payment`               | decimal                 | Net amount paid to the merchant (Amount - Deduction)           |
| `JcbAmount`             | decimal                 | Total amount for JCB card transactions                         |
| `AmexAmount`            | decimal                 | Total amount for American Express card transactions            |
| `MasterCardAmount`      | decimal                 | Total amount for MasterCard transactions                       |
| `CupAmount`             | decimal                 | Total amount for China UnionPay transactions                   |
| `VisaAmount`            | decimal                 | Total amount for Visa transactions                             |
| `DinersAmount`          | decimal                 | Total amount for Diners Club transactions                      |
| `CurrencyCode`          | string                  | Settlement currency (ISO 4217 currency code)                   |
| `SlipCount`             | int                     | Total number of transaction slips (receipts) in the settlement |
| `DeductionItems`        | SettlementDeduction[]   | Array of deduction items (fees and adjustments)                |
| 

## GetTransactionsByRunNumber

Retrieves all transactions included in a specific settlement. This operation provides the most detailed transaction information, including fee breakdowns at the transaction level.

**Parameters**

| Name         | Type   | Required | Description                                      |
|--------------|--------|----------|--------------------------------------------------|
| `merchantId` | string | Yes      | Merchant ID (MID)                                |
| `runNumber` | string | Yes      | Settlement run number (also known as SettleCode) |

**Response**

Returns an array of `Transaction[]` objects. Transactions returned by this operation include detailed fee information (card scheme fees, commission amounts, and interchange fees) that are not available when using `GetTransactionsByBatch`.

| Field                      | Type    | Description                                                                          |
|----------------------------|---------|--------------------------------------------------------------------------------------|
| `MerchantID`               | string | Merchant ID (MID)                                                                    |
| `TransactionDate`          | date    | Date and time when the transaction was processed                                     |
| `Amount`                   | decimal | Transaction amount                                                                   |
| `CurrencyCode`             | string | Transaction currency (ISO 4217 currency code)                                        |
| `SlipNumber`               | string | Unique slip (receipt) identifier for this transaction                                |
| `CardNumber`               | string | Masked card number (first 6 digits + last 4 digits)                                  |
| `CardBrand`                | string | Card brand name (e.g., "Visa", "MasterCard", "American Express")                     |
| `OriginalAmount`           | decimal | Original transaction amount before currency conversion (if applicable)               |
| `OriginalCurrencyCode`     | string | Original currency code before conversion (if applicable)                             |
| `SettlementRunNumber`      | string | Settlement run number this transaction belongs to                                    |
| `BatchNumber`              | string | Batch number this transaction belongs to                                             |
| `BatchDate`                | date    | Date of the batch containing this transaction                                        |
| `AuthorizationCode`        | string | Authorization code from the card issuer                                              |
| `TransactionType`          | string | Transaction type code (see [Transaction Type Codes](#transaction-type-codes))        |
| `RRN`                      | string | Retrieval Reference Number                                                           |
| `IsCorporate`              | boolean | Indicates whether the card used was a corporate card                                 |
| `TerminalId`               | string | Card Machine identifier where the transaction was processed                              |
| `CardholderCountry`        | string | ISO country code of the card issuer (if available)                                   |
| `ARN`                      | string | Acquirer Reference Number                                                            |
| `TransactionReference`     | string | Merchant reference linking the device to settlement (up to 36 characters)            |
| `CardSchemeFeeAmount`      | decimal | Card scheme fee amount (returned by GetTransactionsByRunNumber only)                 |
| `CardSchemeFeeCurrency`    | string | Currency of the card scheme fee                                                      |
| `CardSchemeFeeDescription` | string | Description of the card scheme fee                                                   |
| `CommissionAmount`         | decimal | Commission amount for this transaction (returned by GetTransactionsByRunNumber only) |
| `CommissionCurrency`       | string | Currency of the commission                                                           |
| `CommissionDescription`    | string | Description of the commission                                                        |
| `InterchangeFeeAmount`     | decimal | Interchange fee amount (returned by GetTransactionsByRunNumber only)                 |
| `InterchangeFeeCurrency`   | string | Currency of the interchange fee                                                      |

## GetSettlementDeductionItems

Retrieves all deduction items (fees and adjustments) applied to a specific settlement. Use this to understand what fees and charges were deducted from the settlement amount.

**Parameters**

| Name         | Type   | Required | Description                                      |
|--------------|--------|----------|--------------------------------------------------|
| `merchantId` | string | Yes      | Merchant ID (MID)                                |
| `runNumber` | string | Yes      | Settlement run number (also known as SettleCode) |

**Response**

Returns an array of `SettlementDeduction[]` objects. Each deduction item includes the fee code, amount, description, and the number of transactions it applies to.

| Field                  | Type    | Description                                                                                                           |
|------------------------|---------|-----------------------------------------------------------------------------------------------------------------------|
| `MerchantID`           | string | Merchant ID (MID)                                                                                                     |
| `SettlementRunNumber` | string | Settlement run number this deduction applies to                                                                       |
| `Amount`               | decimal | Total deduction amount                                                                                                |
| `Code`                 | string | Deduction code indicating the type of fee or adjustment (see [Deduction Codes Reference](#deduction-codes-reference)) |
| `CurrencyCode`         | string | Currency of the deduction (ISO 4217)                                                                                  |
| `Text`                 | string | Human-readable description of the deduction                                                                           |
| `Fee`                  | string | Exact amount of a single fee or the fee percentage, depending on the type of fee                                      |
| `FeeCount`             | double | Transaction count the fee applies to (if applicable)                                                                  |
| `InterchangeFee`       | decimal | Total interchange fee amount included in this deduction                                                               |

## Transaction Type Codes

Transaction type codes indicate the nature of a card transaction. These codes are returned in the `TransactionType` field of transaction objects.

| Code      | Description        |
|-----------|--------------------|
| `PAYMENT` | Retail sales       |
| `REFUND` | Credit transaction |

## Deduction Codes Reference

Each deduction item in a settlement includes a code that identifies the type of fee or adjustment being applied. The deduction code is returned in the `Code` field of `SettlementDeduction` objects.

The following table lists the deduction codes and their descriptions:

| Code                    | Description             |
|-------------------------|-------------------------|
| MERCHANT_SERVICE_CHARGE | Merchant service charge |
| INTERCHANGE_FEES        | Interchange fees        |
| SCHEME_FEES             | Scheme fees             |
| CHARGEBACK_FEES         | Chargeback Fees         |
| ISO_FEES                | Iso fees                |
| FEES                    | Fees                    |
| REFUNDS                 | Refunds                 |
| MEAL_CARDS              | Meal Cards              |
| CHARGEBACK              | Chargebacks             |
| REFUNDS                 | Refunds                 |
| TEYA_CASH_ADVANCE       | Teya cash advance       |
