---
title: "Cancel a transaction"
method: POST
path: "/v1/transactions/cancellation"
tags: ["Transactions"]
---

# Cancel a transaction

`POST /v1/transactions/cancellation`

## Request

- The document declares no server URL.
- Auth: API key in header `Ocp-Apim-Subscription-Key`

Cancel a previously submitted transaction.

Cancellation must reference the transaction you want to cancel. It can be the original transaction, a credit note or an adjustment.

Use /cancellation endpoint to cancel a transaction.

## Request body

- TransactionCancelRequest
  - `country_code` string, required: ISO 3166-1 alpha-2 uppercase country code the transaction is taking place in. Validations: - Country code must be uppercase ISO 3166-1 alpha-2. - Required property
  - `country_subdivision_code` string: ISO 3166-2 uppercase code of the principal country subdivision (province, state, region) the transaction is taking place in. Validations: - Values allowed are (letter case matters): AB, BC, MB, NB, NL, NS, NT, NU, ON, PE, QC, SK, YT - Country subdivision code is only supported for Canada.
  - `note` string: A text note attached to a transaction. Notes are HTML enabled and will be displayed on the visual document. Validations: - Maximum length: 3000
  - `reference_transaction_id` string, required: The external transaction identifier of the original transaction the cancellation is referencing. e.g., MY_ORIGINAL_IDENTIFIER_0001 Validations: - Maximum length: 150 - Either reference_transaction_id or reference_transactions must be provided.
  - `reference_transactions` TransactionReference[], required: The referenced transactions for the cancellation. Validations: - Either reference_transaction_id or reference_transactions must be provided.
    - `transaction_id` string, required: External transaction identifier provided by the customer. e.g., MY_CREDIT_IDENTIFIER_0001 Validations: - Required property - Maximum length: 150
  - `supplier` union: Supplier entity referenced by either Fonoa ID or customer provided ID. If both values are provided, Fonoa ID has precedance over external ID. Validations: - Supplier entity should be onboarded. For more information about onboarding refer to the public documentation.
    - object
      - `external_id` string: External resource identifier provided by the customer. e.g., MY_EXTERNAL_ID_001 Validations: - Maximum length: 150
      - `id` string, required: Fonoa id representing a resource within the system. e.g., a7cc64422fc247069aa64d4fe8b387c5 Validations: - Exact length: 32 - Supplier reference must be provided. Either supplier.id or supplier.external_id must be provided.
    - object
      - `address` TransactionEntityAddress
        - `address_line_1` string: Street name and number of the company. Validations: - Length between 0 and 450
        - `address_line_2` string: Validations: - Length between 0 and 450
        - `canton` string: Validations: - Length between 0 and 100
        - `city` string: The city where the legal entity that is being onboarded is registered. Validations: - Length between 0 and 100
        - `city_code` string: Validations: - Length between 0 and 20
        - `country_code` string, required: ISO 3166-1 alpha-2 uppercase country code of the country where entity is registered. Validations: - Required property - Country code must be uppercase ISO 3166-1 alpha-2.
        - `district` string: Validations: - Length between 0 and 100
        - `neighbourhood` string: Validations: - Length between 0 and 100
        - `number` string: Validations: - Length between 0 and 20
        - `postal_code` string: Postal code of the city where the company is registered. Validations: - Length between 0 and 100
        - `prefix` string: Validations: - Length between 0 and 20
        - `province` string: Validations: - Length between 0 and 100
        - `region` string: Validations: - Length between 0 and 100
        - `state` string: Validations: - Length between 0 and 100
        - `suffix` string: Validations: - Length between 0 and 20
      - `contact_details` TransactionEntityContactDetails
        - `attention_to` string: The person or department to direct the document to.
        - `email` string, required: Value to be used by the Tax Authority to forward messages to the customer. Validations: - Required property - Must be a valid email address.
        - `phone_number` string: The customer's phone number.
      - `entity_number` string: This is a company registration number if entity is a business or personal identifier if entity is an individual. e.g., 011589551 Validations: - Maximum length: 50
      - `entity_number_issuing_authority` string: Name of the authority that issued the registration document. e.g., Trade License issuing Authority Validations: - Maximum length: 200
      - `entity_number_type` string: This is company or individual number type. e.g., 93 (Argentina - birth certificate) Validations: - Maximum length: 50
      - `legal_name` string, required: Full legal name of the company (or the individual). e.g., Acme LLC; John Fitzgerald Kennedy Validations: - Required property - Maximum length: 450
      - `role` string, required: Role of the entity in the transaction (e.g., RECIPIENT). Used to distinguish different types of secondary entities. Validations: - Must be provided for secondary entities.
      - `tax_information` TransactionEntityTaxInformation
        - `activity_code` string: Code representing the activity of the entity. Validations: - Maximum length: 50
        - `additional_tax_numbers` TransactionEntityTaxNumberCountrySpecific[]: Additional tax numbers used by the entity in domestic or foreign operations Validations: - This field is only supported in specific use cases, refer to country-specific integration guides in the Fonoa dashboard.
          - `business_model` string[]: Applicable transaction business models (optional).
          - `country_code` string: Country where provided tax number should be used.
          - `country_subdivision_code` string: Country subdivision code where tax number should be used (optional).
          - `tax_number` string: Tax number.
          - `type` string: The tax number type (optional).
        - `distribution_address` string: Value to be used by the Tax Authority to forward the reported invoice to the customer/buyer Validations: - Maximum length: 256
        - `regime` string: Tax regime the entity is registered with. e.g., VAT Validations: - Maximum length: 10
        - `tax_code` string: Tax code that complements tax number.
        - `tax_number` string: Tax number of tax registered entity. e.g., 69061864-2-99 Validations: - Maximum length: 50
      - `trade_name` string: The name the company (or the individual) uses to do business. e.g., Acme; John F Kennedy Validations: - Maximum length: 450
      - `type` string, required: Entity type defining the type of the transaction (B2B, B2C, B2G). Validations: - Required property - Values allowed are (ignore case): BUSINESS, INDIVIDUAL, ECONOMIC_OPERATOR
  - `tax_reason` TransactionTaxReason
    - `code` string, required: The specific code to be used as the tax reason for the transaction. e.g., S01 - indicating no tax effect in Mexican jurisdiction Validations: - Maximum length: 15 - Required property
    - `description` string: Further explanation of the tax reason for the code provided Validations: - Maximum length: 450
    - `tax_reason_details` TransactionTaxReasonDetail[]: Additional details to be provided for the tax reason code. Validations: - This field is only supported in specific use cases, refer to country-specific integration guides in the Fonoa dashboard.
      - `code` string: Additional code that complements the tax reason code. For example, specific refusal code for refusal tax reason. Validations: - Maximum length: 30
      - `note` string: Further explanation of the tax reason detail for the code provided Validations: - Maximum length: 450
  - `transaction_date` string, required: RFC3339 datetime string representing the point in time when transaction is executed. Validations: - Required property - Must be an RFC3339 format date
  - `transaction_id` string, required: External transaction identifier provided by the customer. e.g., MY_CANCELLATION_IDENTIFIER_0001 Validations: - Maximum length: 150 - Required property

## Response `202`

Accepted - transaction was successfully submitted for processing.

- OperationResultResponse
  - `errors` TransactionErrorResponse[]: List of errors in case the request was unsuccessful.
    - `code` string: Error code of the issue. e.g., field_not_valid
    - `doc_link` string: The link for the error documentation. Follow it to gather more details about the error
    - `field` string: Field from the input request that caused the error, in case of validation errors. e.g. transaction_date
    - `message` string: Error message of the issue. e.g., Date must be in RFC3339 format.
    - `type` string: Error type of the issue. e.g., warning, validation, general, tax_authority
  - `message` string: Information about the failure reason in case the request was unsuccessful.
  - `operation_id` string: Auto-generated unique identifier of a transaction operation returned upon async operation request.
  - `transaction_id` string: The unique external transaction identifier provided with the initial request.

## Other responses

- `400`: Bad customer request - some of the provided information is incorrect or mandatory data is missing. Check the message and errors section of the response for more details.
- `401`: Authentication failed - missing or incorrect subscription key
- `429`: Too many requests were sent for a short period of time. Try again a bit later.
- `5XX`: Internal server error. Its not you, its us! We are experiencing a rare and unexpected system disruption. Retry again later. The message field of the response will contain more information for the cause. Feel free to contact us.

---

[API](https://skmtc.dev/fonoa/apis/fonoa-e-invoicing.md) - [All operations](https://skmtc.dev/fonoa/apis/fonoa-e-invoicing/llms.txt) - [OpenAPI document](https://skmtc.dev/fonoa/apis/fonoa-e-invoicing/revisions/d38890cb6fcd?raw)
