# Charge a Fee
source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/transactions-and-fees-management/charge-fee/index.md

## Test case -- Success {#test-case--success}

This test case describes charging a fee for a specified contract (account contract or card contract).

For this test case, use the following information in the request:

|    Field    | Available value |
|-------------|-----------------|
| `feeTypeId` | MB_1            |

**Sample request**

`POST /contracts/60001/charge-fees`

```JSON
{
  "amount": 1200,
  "currency": "EUR",
  "feeTypeId": "MB_1",
  "postingDate": "2031-06-25",
  "uniqueReferenceNumber": "212357021766"
}
```

**Sample response**

`201`  

`Location: /transaction-documents?transaction_selector_type=ID&transaction_selector_value=90001`

```JSON
{
  "transactionId": 90001
}
```

## Test case -- Fail -- Incorrect feeTypeId {#test-case--fail--incorrect-feetypeid}

This test case describes an attempt to charge a fee for a specified contract with the incorrect `feeTypeId` send in the request.

For this test case, use the following information in the request:

|    Field    | Available value |
|-------------|-----------------|
| `feeTypeId` | INVALID         |

**Sample request**

`POST /contracts/60001/charge-fees`

```JSON
{
  "amount": 1200,
  "currency": "EUR",
  "feeTypeId": "INVALID",
  "postingDate": "2031-06-25",
  "uniqueReferenceNumber": "212357021766"
}
```

**Sample response**

`404`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "FEE_TYPE_DOES_NOT_EXIST",
        "Description": "The given fee type identifier INVALID does not exists.",
        "Recoverable": false
      }
    ]
  }
}
```

## Test case -- Fail -- Not unique reference number {#test-case--fail--not-unique-reference-number}

This test case describes an attempt to charge a fee for a specified contract (account contract or card contract) by sending in the request the `uniqueReferenceNumber` value that already exists in the CMS.

For this test case, use the following information in the request:

|          Field          | Available value |
|-------------------------|-----------------|
| `feeTypeId`             | MB_1            |
| `uniqueReferenceNumber` | 111111          |

**Sample request**

`POST /contracts/60001/charge-fees`

```JSON
{
  "amount": 1200,
  "currency": "EUR",
  "feeTypeId": "MB_1",
  "postingDate": "2031-06-25",
  "uniqueReferenceNumber": "111111"
}
```

**Sample response**

`400`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "NOT_UNIQUE_REFERENCE_NUMBER",
        "Description": "UniqueReferenceNumber 111111 already exists.",
        "Recoverable": false
      }
    ]
  }
}
```

