# Simulate a card transaction clearing

Simulates a transaction clearing request in the sandbox environment. This is done after the authorisation. The ref field can be copied from the reference object in the authorisation response.

To clear a previous authorisation, the ref details must match the previous authorisation request. The amount does not have to match the previous authorisation request, it can be more or less than the authorisation request amount.

{% admonition type="warning" %}
Clearing simulation doesn't work with Mastercard.
{% /admonition %}

#### Refund

A refund is a 2-step process: first authorise with transactionType set to REFUND, then clear using this endpoint with the same transaction type.

Endpoint: POST /v1/simulation/spend/profiles/{profileId}/cards/{cardToken}/transactions/clearing
Security: UserToken

## Path parameters:

  - `profileId` (integer, required)
    The profile ID.

  - `cardToken` (string, required)
    The card token.

## Request fields (application/json):

  - `amount` (object)

  - `amount.value` (number)
    Transaction amount.

  - `amount.currency` (string)
    Currency code.

  - `transactionType` (string)
    The type of the transaction. Use the same transaction type from the previous authorisation request.

  - `ref` (object)
    The transaction reference. This can be obtained from a previous authorisation request.

## Response 200 fields (application/json):

  - `reference` (object)
    The transaction reference.

  - `error` (string,null)
    An error returned by the transaction, if it exists.


