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

# Cancel Charges

> Request the cancellation of Payins by a list of IDs

# Cancel Charges

Request the asynchronous cancellation of one or more Payins (`billet` or `pix`) by sending a list of their IDs.

<Note>
  This is an **asynchronous** request. A `202 Accepted` response means the eligible charges were **queued** for cancellation, not that they were already canceled. Each eligible charge is processed by a background job.
</Note>

## Eligibility

<Warning>
  **Cancellation Restrictions** — an ID is only queued for cancellation when the charge:

  * has `status = created`
  * is of type `pix` or `billet` (credit-card charges are never eligible)
  * respects the minimum time since creation (see below)

  IDs that are not found or not eligible are returned grouped under `errors`; they are **not** canceled.
</Warning>

## Minimum Time Before Cancellation

* **pix**: at least 5 minutes after creation
* **billet**: at least 30 minutes after creation

## Request Body

<ParamField body="ids" type="array" required>
  A list of Payin (charge) IDs to cancel.

  * Minimum: **1** item
  * Maximum: **200** items

  Example: `[32457, 32458, 32459]`
</ParamField>

## Response

The response body is returned **as-is** (it does not use the standard `status`/`data` envelope).

<ResponseField name="send" type="array">
  The IDs that were accepted and queued for cancellation.
</ResponseField>

<ResponseField name="errors" type="object">
  A map keyed by the reason an ID could not be queued, each pointing to the list of affected IDs (e.g. not found, wrong status, minimum time not met, not a pix/billet charge).
</ResponseField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url https://api.sandbox.wepayout.com.br/v2/payin/payments/request-multiple-cancel \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer 123' \
    --header 'Content-Type: application/json' \
    --data '{
      "ids": [32457, 32458, 32459]
    }'
  ```

  ```javascript JavaScript theme={null}
  async function cancelCharges(ids) {
    const response = await fetch(
      'https://api.sandbox.wepayout.com.br/v2/payin/payments/request-multiple-cancel',
      {
        method: 'DELETE',
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer 123',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({ ids })
      }
    );

    return await response.json();
  }

  // Usage — between 1 and 200 IDs
  const ids = [32457, 32458, 32459];
  const result = await cancelCharges(ids);
  console.log('Cancellation result:', result);
  ```

  ```python Python theme={null}
  import requests

  def cancel_charges(ids):
      url = 'https://api.sandbox.wepayout.com.br/v2/payin/payments/request-multiple-cancel'
      headers = {
          'Accept': 'application/json',
          'Authorization': 'Bearer 123',
          'Content-Type': 'application/json'
      }
      data = {'ids': ids}

      response = requests.delete(url, headers=headers, json=data)
      return response.json()

  # Usage — between 1 and 200 IDs
  ids = [32457, 32458, 32459]
  result = cancel_charges(ids)
  print('Cancellation result:', result)
  ```
</CodeGroup>

<ResponseExample>
  ```json 202 Accepted theme={null}
  {
    "send": [32457, 32458, 32459],
    "errors": {
      "Charge status must be 'created' to be canceled": [32460, 32461],
      "Charge not found": [32462]
    }
  }
  ```

  ```json 422 Unprocessable Entity theme={null}
  {
    "message": "The given data was invalid.",
    "errors": {
      "ids": [
        "The ids field is required."
      ]
    }
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "message": "Unable to request the cancellation."
  }
  ```
</ResponseExample>

## Important Notes

<Note>
  **Pix Cancellation**: Pix charges are canceled instantly once the job runs.
</Note>

<Warning>
  **Billet Cancellation**: Billet charges require at least 1 day to move from `drop_requested` to `canceled`, as the process depends on confirmation from the payment processor.
</Warning>

<Tip>
  Send between **1 and 200** IDs per request. To cancel every charge of a merchant within a date range, use [Cancel Charges by Period](/api-reference/cash-in/payin/cancel-by-period) instead.
</Tip>
