# Cancel a charge

Cancel an existing charge.

Endpoint: POST /charges/{charge_id}/cancel
Version: V5
Security: bearerAuth, basicAuth

## Path parameters:

  - `charge_id` (string, required)
    ID of the charge to cancel

## Response 200 fields (application/json):

  - `id` (string)
    Unique identifier for the charge.
    Example: "PMMlaE5wbg0"

  - `amount` (number)
    Authorized amount of the charge in USD.
    Example: 1000

  - `customer_id` (string)
    Unique identifier of the customer.
    Example: "X50sgfRd"

  - `amount_refunded` (number)
    Total refunded amount for the charge in USD.

  - `canceled` (boolean)
    Indicates whether the charge is canceled.

  - `canceled_at` (string)
    Date the charge was canceled.

  - `captured` (boolean)
    Indicates whether the charge has been captured.
    Example: true

  - `captured_at` (string)
    Date the charge was captured.
    Example: "2020-01-02T00:00:00.730Z"

  - `created_at` (string)
    Date the charge was created.
    Example: "2020-01-01T00:00:00.730Z"

  - `invoice_url` (string)
    URL of the invoice document associated with this charge.
    Example: "https://example.com/invoice.pdf"

  - `metadata` (object)
    Custom metadata attached to the charge.
    Example: {"source":"checkout"}

  - `number` (string)
    Charge number identifier.
    Example: "ch_100001"

  - `terms` (string)
    Payment terms associated with the charge.
    Enum: "due_upon_receipt", "net7", "net10", "net10th", "net15", "net20", "net30", "net45", "net60", "net75", "net90", "net120", "net180"

  - `updated_at` (string)
    Date the charge was last updated.
    Example: "2020-01-02T00:00:00.730Z"

  - `merchant_invoice_id` (string)
    ID of the merchant invoice associated with the charge.
    Example: "INabc123"

  - `order_number` (string)
    Order number associated with the charge.
    Example: "5055"

  - `po_number` (string)
    PO number associated with the charge.
    Example: "PO-555"

  - `fee` (number)
    Fee amount associated with the charge in USD.
    Example: 25.5

  - `fee_refunded` (number)
    Refunded fee amount for the charge in USD.

## Response 400 fields (application/json):

  - `body` (Validation error (object) or Invalid request error (object)) — one of:
    - Validation error:
      - `error` (object)
      - `error.message` (string)
        A short string, describing error details
        Example: "Validation error"
      - `error.type` (string)
        A short string, describing error type
        Enum: "validation_error"
      - `error.details` (array)
      - `error.details.path` (string)
        Path to the field failed validation
        Example: "path.to.field"
      - `error.details.message` (string)
        Detailed description of the error
        Example: "`[field]` is required"
    - Invalid request error:
      - `error` (object)
      - `error.message` (string)
        A short string, describing error details
        Example: "[Invalid request message]"
      - `error.type` (string)
        A short string, describing error type
        Enum: "invalid_request"

## Response 401 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: "Invalid merchant credentials"

  - `error.type` (string)
    A short string, describing error type
    Enum: "authentication_error"

## Response 404 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: "[entity] not found"

  - `error.type` (string)
    A short string, describing error type
    Enum: "not_found_error"

## Response 429 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: "Too many requests"

  - `error.type` (string)
    A short string, describing error type
    Enum: "rate_limit_error"


