# Cancel a payment run

Cancel a payment run.
Note that a payment run can be cancelled when it is in the states `QUEUED`, `PENDING_CONFIRMATION`, `PENDING_CHALLENGE`, OR `PENDING_FUNDING`
Required user roles: `CONTROLLER` OR `CREATOR`

Endpoint: POST /v1/payment_runs/{payment_run_id}/cancel
Version: v1
Security: apiKey

## Path parameters:

  - `payment_run_id` (string, required)
    The unique identifier of the payment run.

## Header parameters:

  - `idempotency-ref` (string)
    A unique call reference generated by the caller that, taking into consideration the payload as well as the operation itself, helps avoid duplicate operations. Idempotency reference uniqueness is maintained for at least 24 hours.

## Response 400 fields (application/json):

  - `message` (string)
    When present helps to identify and fix the problem.

  - `syntaxErrors` (object)
    Is returned as part of an HTTP error response whenever a syntax error is detected. A list of the fields together with their syntax error will be provided.

  - `syntaxErrors.invalidFields` (array)

  - `syntaxErrors.invalidFields.params` (array)

  - `syntaxErrors.invalidFields.fieldName` (string)

  - `syntaxErrors.invalidFields.error` (string)
    Enum: "REQUIRED", "HAS_TEXT", "REQUIRES", "SIZE", "RANGE", "IN", "NOT_IN", "REGEX", "EXACTLY", "AT_LEAST", "AT_MOST", "ALL_OR_NONE"

## Response 403 fields (application/json):

  - `errorCode` (string)
    Enum: "INSUFFICIENT_PERMISSIONS"

## Response 404 fields (application/json):

  - `code` (string)

  - `message` (string)

## Response 409 fields (application/json):

  - `errorCode` (string)
    Enum: "CANNOT_CANCEL_PAYMENT_RUN", "IDEMPOTENT_REQUEST_IN_PROGRESS"

## Response default fields (application/json):

  - `code` (string)

  - `message` (string)

