# 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.
Clearing simulation doesn't work with Mastercard.
#### Refund
A refund is a 2-step process: first [authorise](/api-reference/simulation/simulationcardtransactionauthorisation) with `transactionType` set to `REFUND`, then clear using this endpoint with the same transaction type.

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

## Path parameters:

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

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

## Header parameters:

  - `X-External-Correlation-Id` (string)
    Optional UUID for correlating requests across systems. If provided, Wise echoes it back in the response. Maximum 36 characters. [Learn more](/guides/developer/headers/correlation-id).

## 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.

