> ## Documentation Index
> Fetch the complete documentation index at: https://docs.equalsmoney.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Simulate card authorisations

> Learn how to test authorisations and authorisation clearings.

<Info>
  These endpoints are for sandbox only. They won't work in production.
</Info>

## Simulate an authorisation

<Note>
  **POST** `/v2/cards/simulations/transaction/authorization`
</Note>

### Request

Use this request to simulate a card authorisation.

<CodeGroup>
  ```bash Sample request theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization?accountId=F50081' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "cardId": "53494ad2-6477-402c-9f6e-dd50ea11f851",
      "amount": 10.00,
      "network": "VISA",
      "cardAcceptor": {
        "mid": "11111"
      }
    }'
  ```

  ```bash Request structure theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization?accountId=F50081' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "cardId": "string",
      "amount": number,
      "network": "string",
      "cardAcceptor": {
        "mid": "string"
      }
    }'
  ```
</CodeGroup>

#### Request body schema

<ParamField body="cardId" type="string (uuid)" required>
  The ID of the card to work with.

  Allowable values: An existing `cardId` (≤ 36 characters)
</ParamField>

<ParamField body="amount" type="number">
  The amount of the transaction.

  Allowable values: A valid number (`>= 0`)
</ParamField>

<ParamField body="cardAcceptor" type="object" required>
  Details about the card acceptor.

  Allowable values: A valid `cardAcceptor` object containing the following field: `mid`

  <Expandable title="cardAcceptor properties">
    <ParamField body="cardAcceptor.mid" type="string" required>
      The Merchant Identifier (MID).

      Allowable values: ≤ 36 characters
    </ParamField>
  </Expandable>
</ParamField>

### Response

If your request is successful, you'll receive a `201` response.

<CodeGroup>
  ```json Sample response theme={null}
  {
    "type": "authorization",
    "state": "PENDING",
    "token": "7bff9f48-8c68-4937-917a-bf7cf4f0de27",
    "userToken": "f0d5cae0-fb3f-417f-8f1c-51c5fb66259a",
    "cardToken": "53494ad2-6477-402c-9f6e-dd50ea11f851",
    "response": {
      "code": 0,
      "memo": "Approved or completed successfully"
    },
    "createdTime": "2022-12-06T21:41:48Z",
    "userTransactionTime": "2022-12-06T21:41:49Z",
    "settlementDate": "2022-12-06T21:41:50Z",
    "amount": 10.00,
    "gpa": {
      "ledgerBalance": 240.00,
      "availableBalance": 240.00,
      "impactedAmount": -10.00
    },
    "currencyCode": "GBP",
    "currencyConversion": {
      "originalAmount": 10.00,
      "conversionRate": 1.00,
      "originalCurrencyCode": 826
    },
    "precedingRelatedTransactionToken": "8a6d911e-cb3d-41d2-b843-5f9dc97d503c",
    "network": "VISA",
    "subnetwork": "VISANET",
    "cardAcceptor": {
      "mid": "11111",
      "mcc": "6411",
      "name": "EM",
      "city": "Seattle",
      "state": "WA",
      "countryCode": "USA"
    }
  }
  ```

  ```json Response structure theme={null}
  {
    "type": "string",
    "state": "string",
    "token": "string",
    "userToken": "string",
    "cardToken": "string",
    "response": {
      "code": number,
      "memo": "string"
    },
    "createdTime": "string",
    "userTransactionTime": "string",
    "settlementDate": "string",
    "amount": number,
    "gpa": {
      "ledgerBalance": number,
      "availableBalance": number,
      "impactedAmount": number,
    },
    "currencyCode": "string",
    "currencyConversion": {
      "originalAmount": number,
      "conversionRate": number,
      "originalCurrencyCode": number
    },
    "precedingRelatedTransactionToken": "string",
    "network": "string",
    "subnetwork": "string",
    "cardAcceptor": {
      "mid": "string",
      "mcc": "string",
      "name": "string",
      "city": "string",
      "state": "string",
      "countryCode": "string"
    }
  }
  ```
</CodeGroup>

For more detailed information about this request and its response, [see the API reference](/api-reference/simulations/simulate-a-card-authorisation).

## Simulate an authorisation advice

<Note>
  **POST** `/v2/cards/simulations/transaction/authorization/advice`
</Note>

### Request

Use this request to simulate a card authorisation advice.

<CodeGroup>
  ```bash Sample request theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization/advice' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "precedingRelatedTransactionToken": "9d3dee7c-19df-4b71-bbb9-521bb04307bf",
      "amount": 10.00
    }'
  ```

  ```bash Request structure theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization/advice' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "precedingRelatedTransactionToken": "string",
      "amount": number
    }'
  ```
</CodeGroup>

#### Request body schema

<ParamField body="precedingRelatedTransactionToken" type="string" required>
  The token of the transaction to work with. This is the `token` received in the response to the authorisation request.

  Allowable values: A valid string
</ParamField>

<ParamField body="amount" type="number" required>
  The authorisation clearing amount.

  Allowable values: A valid number (`>= 0`)
</ParamField>

### Response

If your request is successful, you'll receive a `201` response.

<CodeGroup>
  ```json Sample response theme={null}
  {
    "type": "authorization.advice",
    "state": "PENDING",
    "token": "7bff9f48-8c68-4937-917a-bf7cf4f0de27",
    "userToken": "f0d5cae0-fb3f-417f-8f1c-51c5fb66259a",
    "cardToken": "53494ad2-6477-402c-9f6e-dd50ea11f851",
    "response": {
      "code": 0,
      "memo": "Approved or completed successfully"
    },
    "createdTime": "2022-12-06T21:41:48Z",
    "userTransactionTime": "2022-12-06T21:41:49Z",
    "settlementDate": "2022-12-06T21:41:50Z",
    "amount": 10.00,
    "gpa": {
      "ledgerBalance": 240.00,
      "availableBalance": 240.00,
      "impactedAmount": -10.00
    },
    "currencyCode": "GBP",
    "currencyConversion": {
      "originalAmount": 10.00,
      "conversionRate": 1.00,
      "originalCurrencyCode": 826
    },
    "precedingRelatedTransactionToken": "8a6d911e-cb3d-41d2-b843-5f9dc97d503c",
    "network": "VISA",
    "subnetwork": "VISANET",
    "cardAcceptor": {
      "mid": "11111",
      "mcc": "6411",
      "name": "EM",
      "city": "Seattle",
      "state": "WA",
      "countryCode": "USA"
    }
  }
  ```

  ```json Response structure theme={null}
  {
    "type": "string",
    "state": "string",
    "token": "string",
    "userToken": "string",
    "cardToken": "string",
    "response": {
      "code": number,
      "memo": "string"
    },
    "createdTime": "string",
    "userTransactionTime": "string",
    "settlementDate": "string",
    "amount": number,
    "gpa": {
      "ledgerBalance": number,
      "availableBalance": number,
      "impactedAmount": number,
    },
    "currencyCode": "string",
    "currencyConversion": {
      "originalAmount": number,
      "conversionRate": number,
      "originalCurrencyCode": number
    },
    "precedingRelatedTransactionToken": "string",
    "network": "string",
    "subnetwork": "string",
    "cardAcceptor": {
      "mid": "string",
      "mcc": "string",
      "name": "string",
      "city": "string",
      "state": "string",
      "countryCode": "string"
    }
  }
  ```
</CodeGroup>

For more detailed information about this request and its response, [see the API reference](/api-reference/simulations/simulate-a-card-authorisation-advice).

## Simulate an authorisation clearing

<Note>
  **POST** `/v2/cards/simulations/transaction/authorization/clearing?accountId=F52903`
</Note>

### Request

Use this request to simulate a card authorisation clearing.

<CodeGroup>
  ```bash Sample request theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization/clearing?accountId=F52903' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "precedingRelatedTransactionToken": "9d3dee7c-19df-4b71-bbb9-521bb04307bf",
      "amount": 10.00
    }'
  ```

  ```bash Request structure theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization/clearing?accountId=F52903' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "precedingRelatedTransactionToken": "string",
      "amount": number
    }'
  ```
</CodeGroup>

#### Request body schema

<ParamField body="precedingRelatedTransactionToken" type="string" required>
  The token of the transaction to work with. This is the `token` received in the response to the authorisation request.

  Allowable values: A valid string
</ParamField>

<ParamField body="amount" type="number" required>
  The authorisation clearing amount.

  Allowable values: A valid number (`>= 0`)
</ParamField>

### Response

If your request is successful, you'll receive a `201` response.

<CodeGroup>
  ```json Sample response theme={null}
  {
    "type": "authorization.clearing",
    "state": "COMPLETION",
    "token": "7bff9f48-8c68-4937-917a-bf7cf4f0de27",
    "userToken": "f0d5cae0-fb3f-417f-8f1c-51c5fb66259a",
    "cardToken": "53494ad2-6477-402c-9f6e-dd50ea11f851",
    "response": {
      "code": 0,
      "memo": "Approved or completed successfully"
    },
    "createdTime": "2022-12-06T21:41:48Z",
    "userTransactionTime": "2022-12-06T21:41:49Z",
    "settlementDate": "2022-12-06T21:41:50Z",
    "amount": 10.00,
    "gpa": {
      "ledgerBalance": 240.00,
      "availableBalance": 240.00,
      "impactedAmount": -10.00
    },
    "currencyCode": "GBP",
    "currencyConversion": {
      "originalAmount": 10.00,
      "conversionRate": 1.00,
      "originalCurrencyCode": 826
    },
    "precedingRelatedTransactionToken": "8a6d911e-cb3d-41d2-b843-5f9dc97d503c",
    "network": "VISA",
    "subnetwork": "VISANET",
    "cardAcceptor": {
      "mid": "11111",
      "mcc": "6411",
      "name": "EM",
      "city": "Seattle",
      "state": "WA",
      "countryCode": "USA"
    }
  }
  ```

  ```json Response structure theme={null}
  {
    "type": "string",
    "state": "string",
    "token": "string",
    "userToken": "string",
    "cardToken": "string",
    "response": {
      "code": number,
      "memo": "string"
    },
    "createdTime": "string",
    "userTransactionTime": "string",
    "settlementDate": "string",
    "amount": number,
    "gpa": {
      "ledgerBalance": number,
      "availableBalance": number,
      "impactedAmount": number,
    },
    "currencyCode": "string",
    "currencyConversion": {
      "originalAmount": number,
      "conversionRate": number,
      "originalCurrencyCode": number
    },
    "precedingRelatedTransactionToken": "string",
    "network": "string",
    "subnetwork": "string",
    "cardAcceptor": {
      "mid": "string",
      "mcc": "string",
      "name": "string",
      "city": "string",
      "state": "string",
      "countryCode": "string"
    }
  }
  ```
</CodeGroup>

For more detailed information about this request and its response, [see the API reference](/api-reference/simulations/simulate-a-card-authorisation-clearing).

## Simulate an authorisation reversal

<Note>
  **POST** `/v2/cards/simulations/transaction/authorization/reversal`
</Note>

### Request

Use this request to simulate a card authorisation reversal.

<CodeGroup>
  ```bash Sample request theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization/reversal' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "precedingRelatedTransactionToken": "9d3dee7c-19df-4b71-bbb9-521bb04307bf",
      "amount": 10.00
    }'
  ```

  ```bash Request structure theme={null}
  curl -i -X POST \
    'https://api.equalsmoney.com/v2/cards/simulations/transaction/authorization/reversal' \
    -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
    -H 'Content-Type: application/json' \
    -d '{
      "precedingRelatedTransactionToken": "string",
      "amount": number
    }'
  ```
</CodeGroup>

#### Request body schema

<ParamField body="precedingRelatedTransactionToken" type="string" required>
  The token of the transaction to work with. This is the `token` received in the response to the authorisation request.

  Allowable values: A valid string
</ParamField>

<ParamField body="amount" type="number" required>
  The authorisation reversal amount.

  Allowable values: A valid number (`>= 0`)
</ParamField>

### Response

If your request is successful, you'll receive a `201` response.

<CodeGroup>
  ```json Sample response theme={null}
  {
    "type": "authorization.reversal",
    "state": "CLEARED",
    "token": "7bff9f48-8c68-4937-917a-bf7cf4f0de27",
    "userToken": "f0d5cae0-fb3f-417f-8f1c-51c5fb66259a",
    "cardToken": "53494ad2-6477-402c-9f6e-dd50ea11f851",
    "response": {
      "code": 0,
      "memo": "Approved or completed successfully"
    },
    "createdTime": "2022-12-06T21:41:48Z",
    "userTransactionTime": "2022-12-06T21:41:49Z",
    "settlementDate": "2022-12-06T21:41:50Z",
    "amount": 10.00,
    "gpa": {
      "ledgerBalance": 240.00,
      "availableBalance": 240.00,
      "impactedAmount": -10.00
    },
    "currencyCode": "GBP",
    "currencyConversion": {
      "originalAmount": 10.00,
      "conversionRate": 1.00,
      "originalCurrencyCode": 826
    },
    "precedingRelatedTransactionToken": "8a6d911e-cb3d-41d2-b843-5f9dc97d503c",
    "network": "VISA",
    "subnetwork": "VISANET",
    "cardAcceptor": {
      "mid": "11111",
      "mcc": "6411",
      "name": "EM",
      "city": "Seattle",
      "state": "WA",
      "countryCode": "USA"
    }
  }
  ```

  ```json Response structure theme={null}
  {
    "type": "string",
    "state": "string",
    "token": "string",
    "userToken": "string",
    "cardToken": "string",
    "response": {
      "code": number,
      "memo": "string"
    },
    "createdTime": "string",
    "userTransactionTime": "string",
    "settlementDate": "string",
    "amount": number,
    "gpa": {
      "ledgerBalance": number,
      "availableBalance": number,
      "impactedAmount": number,
    },
    "currencyCode": "string",
    "currencyConversion": {
      "originalAmount": number,
      "conversionRate": number,
      "originalCurrencyCode": number
    },
    "precedingRelatedTransactionToken": "string",
    "network": "string",
    "subnetwork": "string",
    "cardAcceptor": {
      "mid": "string",
      "mcc": "string",
      "name": "string",
      "city": "string",
      "state": "string",
      "countryCode": "string"
    }
  }
  ```
</CodeGroup>

For more detailed information about this request and its response, [see the API reference](/api-reference/simulations/simulate-a-card-authorisation-reversal).
