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

# Cancel an Intent

> Cancel all or part of an authorized Intent

You can use this endpoint to cancel all or part of an Intent **before** it has been captured. You can only call this endpoint if the Intent has the `Status` of `AUTHORIZED`. You cannot cancel an Intent if it has been captured in part (`PARTIALLY_CAPTURED`) or full (`CAPTURED`).

### Path parameters

<ParamField path="IntentId" type="string" required>
  The unique identifier of the Intent.
</ParamField>

<Tabs>
  <Tab title="Full cancellation">
    If you send an empty body or only the `ExternalData`, then the full `Amount` of the intent is canceled (all line items). The `ExternalData` is optional and can be provided if the cancellation follows an event from the third-party PSP.

    In a full cancellation, the Status becomes `CANCELLED`, indicating that no further actions are possible on the Intent.

    ### Body parameters

    <ParamField body="ExternalData" type="object">
      Information about the cancellation processed by the third-party PSP.

      <Expandable defaultOpen>
        <ParamField body="ExternalProcessingDate" type="Unix timestamp" required>
          The date at which the cancellation was created.
        </ParamField>

        <ParamField body="ExternalProviderReference" type="string">
          The unique identifier of the cancellation at the provider level
        </ParamField>

        <ParamField body="ExternalMerchantReference" type="string">
          The unique identifier of the cancellation at the merchant level
        </ParamField>

        <ParamField body="ExternalProviderName" type="string">
          The [supported third-party PSP](/api-reference/echo/supported-providers) processing the transaction.
        </ParamField>

        <ParamField body="ExternalProviderPaymentMethod" type="string">
          One of the [supported payment methods](/api-reference/echo/supported-payment-methods) used to process the cancellation.
        </ParamField>
      </Expandable>
    </ParamField>
  </Tab>

  <Tab title="Partial cancellation">
    Part of the original Intent `Amount` is canceled from one or more line items. Any amount can be canceled from any line item(s). The cancellation `Amount` must equal the sum of its line items.

    ### Body parameters

    <ParamField body="Amount" type="integer" required>
      The amount of the cancellation.
    </ParamField>

    <ParamField body="PlatformFees" type="integer">
      The amount of fees to be diverted to the platform's Fees Wallet when the Intent is split. This value can be overridden when the Split is created.

      The `PlatformFees` value must the sum of all line item `Seller.FeesAmount` values.
    </ParamField>

    <ParamField body="ExternalData" type="object">
      Information about the cancellation processed by the third-party PSP.

      <Expandable defaultOpen>
        <ParamField body="ExternalProcessingDate" type="Unix timestamp" required>
          The date at which the cancellation was created.
        </ParamField>

        <ParamField body="ExternalProviderReference" type="string">
          The unique identifier of the cancellation at the provider level
        </ParamField>

        <ParamField body="ExternalMerchantReference" type="string">
          The unique identifier of the cancellation at the merchant level
        </ParamField>

        <ParamField body="ExternalProviderName" type="string">
          The [supported third-party PSP](/api-reference/echo/supported-providers) processing the transaction.
        </ParamField>

        <ParamField body="ExternalProviderPaymentMethod" type="string">
          One of the [supported payment methods](/api-reference/echo/supported-payment-methods) used to process the cancellation.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="LineItems" type="array (object)" required>
      Information about the items canceled, required for a partial cancellation.

      <Expandable defaultOpen>
        <ParamField body="Id" type="string" required>
          The unique identifier of the line item in Mangopay ecosystem.
        </ParamField>

        <ParamField body="Amount" type="integer" required>
          The amount of the cancellation. The sum of the cancellation's `LineItems.Amount` values must equal the `Amount` of the cancellation.
        </ParamField>
      </Expandable>
    </ParamField>
  </Tab>
</Tabs>

### Responses

<AccordionGroup>
  <Accordion title="200 - Response parameters">
    <ResponseField name="Id" type="string">
      The unique identifier of the intent.
    </ResponseField>

    <ResponseField name="Amount" type="integer">
      The full amount authorized in the Intent, which must equal the sum of the total amounts of all `LineItems`.
    </ResponseField>

    <ResponseField name="AvailableAmountToSplit" type="integer">
      The remaining amount of the Intent that can be split and transferred to the sellers' wallets.
    </ResponseField>

    <ResponseField name="UnfundedAmount" type="integer">
      The amount needing to be settled to the Platform's escrow wallet before the Intent Splits can be executed.
    </ResponseField>

    <ResponseField name="Currency" type="integer">
      The currency of the intent.
    </ResponseField>

    <ResponseField name="PlatformFees" type="integer">
      The amount of fees to be diverted to the platform's Fees Wallet when the Intent is split. This value can be overridden when the Split is created.

      The `PlatformFees` value must the sum of all line item `Seller.FeesAmount` values.
    </ResponseField>

    <ResponseField name="Status" type="string">
      The status of the Intent, as declared by the platform through Intent Captures, Refunds (and reversals), or Disputes (and decisions). Where partial actions occur, the top-level Intent `Status` may differ from the `Status` of Intent `LineItems`.

      Intent `Status` values:

      * `AUTHORIZED` – The Intent `Amount` was authorized for acquisition by the PSP and can be captured or canceled.
      * `PARTIALLY_CAPTURED` – Part of the Intent `Amount` from one or more `LineItems` was captured. The other parts are either still available for capture or cancel.
      * `CAPTURED` – All of the Intent `Amount` was captured. Part of it may have been subsequently refunded or disputed.
      * `CANCELLED` – All of the Intent `Amount` was canceled.
      * `REFUNDED` – All of the `CapturedAmount` of all `LineItems` was refunded.
      * `REFUND_REVERSED` – The refund could not be completed and the funds were returned to the platform.
      * `DISPUTED` – All of the `CapturedAmount` of all `LineItems` was disputed.
      * `DEFENDED` – The dispute is being defended by the platform.
      * `DISPUTED_WON` – The dispute was resolved in favor of the platform.
      * `DISPUTED_LOST` – The dispute was resolved against the platform.
    </ResponseField>

    <ResponseField name="ExternalData" type="object">
      Information about the cancellation processed by the third-party PSP.

      <Expandable>
        <ResponseField name="ExternalProcessingDate" type="Unix timestamp">
          The date at which the cancellation was created
        </ResponseField>

        <ResponseField name="ExternalProviderReference" type="string">
          The unique identifier of the cancellation at the provider level
        </ResponseField>

        <ResponseField name="ExternalMerchantReference" type="string">
          The unique identifier of the cancellation at the merchant level
        </ResponseField>

        <ResponseField name="ExternalProviderName" type="string">
          The [supported third-party PSP](/api-reference/echo/supported-providers) processing the transaction.

          **Note:** The uppercase value is expected. The API returns the sentence-case value.
        </ResponseField>

        <ResponseField name="ExternalProviderPaymentMethod" type="string">
          One of the [supported payment methods](/api-reference/echo/supported-payment-methods) used to process the cancellation.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Buyer" type="object">
      Information about the buyer.

      <Expandable>
        <ResponseField name="Id" type="string">
          If it exists, the unique identifier of the Mangopay user making the payment via the third-party PSP. Must be a valid Mangopay `UserId`.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="LineItems" type="array (object)">
      Information about the items purchased in the transaction.

      The sum of all line item amounts must equal the Intent `Amount` value. The total for each line items is calculated as ((`UnitAmount` x `Quantity`) - `DiscountAmount`), which is shown in the `TotalLineItemAmount` returned. The `TaxAmount` is indicative and included in the `UnitAmount`.

      The sum of all line item `Seller.FeesAmount` values must equal the Intent `PlatformFees` value.

      <Expandable>
        <ResponseField name="Seller" type="object">
          Information about the seller of the line item.

          <Expandable>
            <ResponseField name="AuthorId" type="string">
              The unique identifier of the seller of the line item.

              Required if `WalletId` not sent.
            </ResponseField>

            <ResponseField name="WalletId" type="string">
              The unique identifier of the wallet to credit the seller's funds.

              Required if `AuthorId` not sent.
            </ResponseField>

            <ResponseField name="FeesAmount" type="integer">
              The amount of fees that will be diverted to the platform's Fees Wallet when the Intent is split. This value can be overridden when the Split is created.
            </ResponseField>

            <ResponseField name="TransferDate" type="Unix timestamp">
              The future date when the funds are to be automatically transferred to the seller's wallet.
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="Id" type="string">
          The unique identifier of the line item in Mangopay's ecosystem.
        </ResponseField>

        <ResponseField name="Sku" type="string">
          The stock keeping unit (SKU) or other unique identifier of the item.
        </ResponseField>

        <ResponseField name="Name" type="string">
          The name of the item.
        </ResponseField>

        <ResponseField name="Description" type="string">
          The description of the item.
        </ResponseField>

        <ResponseField name="Quantity" type="integer">
          The number of units in the line item.
        </ResponseField>

        <ResponseField name="UnitAmount" type="integer">
          The cost of each unit, including `TaxAmount` and excluding `DiscountAmount`.
        </ResponseField>

        <ResponseField name="TaxAmount" type="integer">
          The amount of the `UnitAmount` which is tax.
        </ResponseField>

        <ResponseField name="DiscountAmount" type="integer">
          The amount of discount applied to the line item.
        </ResponseField>

        <ResponseField name="Category" type="string">
          The category of the item, as defined by the platform.
        </ResponseField>

        <ResponseField name="ShippingAddress" type="object">
          Information about the shipping address.

          <Expandable>
            <ResponseField name="AddressLine1" type="string">
              The first line of the address.
            </ResponseField>

            <ResponseField name="AddressLine2" type="string">
              The second line of the address.
            </ResponseField>

            <ResponseField name="City" type="string">
              The city of the address
            </ResponseField>

            <ResponseField name="Region" type="string">
              The region of the address.
            </ResponseField>

            <ResponseField name="PostalCode" type="string">
              The postal code of the address
            </ResponseField>

            <ResponseField name="Country" type="string">
              The country of the address
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="CapturedAmount" type="integer">
          The item total `CAPTURED` amount
        </ResponseField>

        <ResponseField name="RefundedAmount" type="integer">
          The item total `REFUNDED` amount
        </ResponseField>

        <ResponseField name="DisputedAmount" type="integer">
          The item total `DISPUTED` amount.
        </ResponseField>

        <ResponseField name="SplitAmount" type="integer">
          The item total `COMPLETED` amount.
        </ResponseField>

        <ResponseField name="CancelledAmount" type="integer">
          The item total `CANCELLED` amount.
        </ResponseField>

        <ResponseField name="TotalLineItemAmount" type="integer">
          The total amount of the line item calculated as ((`UnitAmount` x `Quantity`) - `DiscountAmount`).
        </ResponseField>

        <ResponseField name="UnfundedSellerAmount" type="integer">
          The amount needing to be settled to the Platform's escrow wallet before the Intent Splits can be executed for this seller.
        </ResponseField>

        <ResponseField name="SplitOriginWalletId" type="string">
          The unique identifier of the wallet from which the split will be debited.

          This parameter is required for Intents where `ExternalProviderName` is `Mangopay`. If it is not defined in the Intent it must be defined at Split creation.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="CreationDate" type="string">
      The date and time at which the Intent was created.
    </ResponseField>

    <ResponseField name="ExecutionDate" type="Unix timestamp">
      The date and time at which the Intent moved to `AUTHORIZED`.
    </ResponseField>

    <ResponseField name="Dispute" type="object">
      Information about the Dispute.

      <Expandable>
        <ResponseField name="Id" type="string">
          The unique identifier of the Dispute.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="400 - Intent must be AUTHORIZED to be canceled">
    ```json theme={null}
    {
        "Message": "Action on the Intent resource is not permitted",
        "Id": "1a9c4474-6da1-473f-9659-99edb7a00884",
        "Date": 1756458918,
        "Type": "invalid_action",
        "Errors": {
            "Status": "Intent cannot be cancelled because it is not in AUTHORIZED status."
        }
    }
    ```
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json Full cancel theme={null}
  {
      "Id": "int_019c0ff6-7334-7217-9a1d-3f029defb965",
      "Amount": 20000,
      "AvailableAmountToSplit": 0,
      "UnfundedAmount": 0,
      "Currency": "EUR",
      "PlatformFeesAmount": 0,
      "Status": "CANCELLED",
      "ExternalData": {
          "ExternalProcessingDate": 1769794335,
          "ExternalProviderReference": "auth-stripe-07d87474-61ab-4054-8f9c-99d9b6478b00",
          "ExternalMerchantReference": "order-27cd989a-220f-486a-8714-b3120913dac4",
          "ExternalProviderName": "Stripe",
          "ExternalProviderPaymentMethod": "MASTERCARD"
      },
      "Buyer": {
          "Id": "user_m_01KF3087EDXEAK8VPD9DTMZW8N"
      },
      "LineItems": [
          {
              "Id": "int_li_019c0ff6-7339-73b9-aa3f-4b657d8629c0",
              "TotalLineItemAmount": 10000,
              "CapturedAmount": 0,
              "RefundedAmount": 0,
              "DisputedAmount": 0,
              "SplitAmount": 0,
              "CancelledAmount": 10000,
              "UnfundedSellerAmount": 0
          },
          {
              "Id": "int_li_019c0ff6-7339-73b9-aa3f-4b657d8629c1",
              "TotalLineItemAmount": 10000,
              "CapturedAmount": 0,
              "RefundedAmount": 0,
              "DisputedAmount": 0,
              "SplitAmount": 0,
              "CancelledAmount": 10000,
              "UnfundedSellerAmount": 0
          }
      ],
      "CreationDate": 1769794335,
      "ExecutionDate": 1769794339,
      "Cancel": {
          "Id": "int_cancel_019c0ff6-8493-7efd-a303-40ec83b1b7a8"
      }
  }
  ```

  ```json Partial cancel theme={null}
  {
      "Id": "int_019c0ff8-b375-7c3a-858c-8422007b8b23",
      "Amount": 20000,
      "AvailableAmountToSplit": 0,
      "UnfundedAmount": 0,
      "Currency": "EUR",
      "PlatformFeesAmount": 0,
      "Status": "AUTHORIZED",
      "NextActions": "CAPTURE, PARTIALLY_CAPTURE, CANCEL",
      "ExternalData": {
          "ExternalProcessingDate": 1769794487,
          "ExternalProviderReference": "cancel-stripe-d2ee9b52-0eed-48a2-9b36-36032b8c6be4",
          "ExternalMerchantReference": "cancel-order-608db682-4b52-4f55-8c8c-f8d93315f726",
          "ExternalProviderName": "Stripe",
          "ExternalProviderPaymentMethod": "MASTERCARD"
      },
      "Buyer": {
          "Id": "user_m_01KF3087EDXEAK8VPD9DTMZW8N"
      },
      "LineItems": [
          {
              "Id": "int_li_019c0ff8-b377-7130-bc58-e1270e6e11b3",
              "TotalLineItemAmount": 10000,
              "CapturedAmount": 0,
              "RefundedAmount": 0,
              "DisputedAmount": 0,
              "SplitAmount": 0,
              "CancelledAmount": 5000,
              "UnfundedSellerAmount": 0
          },
          {
              "Id": "int_li_019c0ff8-b377-7130-bc58-e1270e6e11b4",
              "TotalLineItemAmount": 10000,
              "CapturedAmount": 0,
              "RefundedAmount": 0,
              "DisputedAmount": 0,
              "SplitAmount": 0,
              "CancelledAmount": 0,
              "UnfundedSellerAmount": 0
          }
      ],
      "CreationDate": 1769794483,
      "ExecutionDate": 1769794487,
      "Cancel": {
          "Id": "int_cancel_019c0ff8-c4a1-717d-ba09-c8e187d6f31b"
      }
  }
  ```
</ResponseExample>

<RequestExample>
  ```json Full cancel theme={null}
  { 
      "ExternalData": {
          "ExternalProcessingDate": 1769794421,
          "ExternalProviderReference": "cancel-stripe-01f82162-1fe2-4921-a322-1de2680ec995",
          "ExternalMerchantReference": "cancel-order-e76ec48d-9285-42fc-bd83-3e43d91352a0",
          "ExternalProviderName": "Stripe",
          "ExternalProviderPaymentMethod": "MASTERCARD"
      }
  }
  ```

  ```json Partial cancel theme={null}
  {
      "Amount": 5000,
      "Currency": "EUR",
      "PlatformFeesAmount": 0,
      "ExternalData": {
          "ExternalProcessingDate": 1769794487,
          "ExternalProviderReference": "cancel-stripe-d2ee9b52-0eed-48a2-9b36-36032b8c6be4",
          "ExternalMerchantReference": "cancel-order-608db682-4b52-4f55-8c8c-f8d93315f726",
          "ExternalProviderName": "Stripe",
          "ExternalProviderPaymentMethod": "MASTERCARD"
      },
      "LineItems": [
          {
              "Id": "int_li_019c0ff8-b377-7130-bc58-e1270e6e11b3",
              "Amount": 5000
          }
      ]
  }
  ```
</RequestExample>
