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

# Abort a payment attempt

> <p/>

Abort a payment attempt that is awaiting merchant approval. No payment is created. The tokenised payment instrument associated with the attempt is invalidated.

Call this endpoint when, after tokenisation, a business decision is made that the payment should not proceed (e.g. a merchant-side fraud check flagged the transaction, the customer cancelled on the merchant's own UI, or an inventory check failed between tokenisation and approval).




## OpenAPI

````yaml https://api.schemas.primer.io/api-reference/v2.4/openapi.yaml post /payment-attempts/{id}/abort
openapi: 3.0.2
info:
  x-logo:
    url: https://apidocs.primer.io/docs/assets/images/primer-logo.svg
  title: Primer API
  version: '2.4'
  description: >-
    This API enforces a timeout of 90 seconds for all requests. A 504 response
    indicates a timeout has occurred.
servers:
  - url: https://api.sandbox.primer.io
  - url: https://api.primer.io
security:
  - ApiKeyAuth: []
tags:
  - name: Client Session API
  - name: Payments API
  - name: Payment Methods API
  - name: Payment Attempts API
paths:
  /payment-attempts/{id}/abort:
    post:
      tags:
        - Payment Attempts API
      summary: Abort a payment attempt
      description: >
        <p/>


        Abort a payment attempt that is awaiting merchant approval. No payment
        is created. The tokenised payment instrument associated with the attempt
        is invalidated.


        Call this endpoint when, after tokenisation, a business decision is made
        that the payment should not proceed (e.g. a merchant-side fraud check
        flagged the transaction, the customer cancelled on the merchant's own
        UI, or an inventory check failed between tokenisation and approval).
      operationId: abort_payment_attempt_payment_attempts__id__abort_post
      parameters:
        - required: true
          schema:
            title: Payment Attempt ID
            type: string
            format: uuid
          name: id
          description: ID of the payment attempt to abort.
          in: path
        - $ref: '#/components/parameters/ApiVersionHeader'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AbortPaymentAttemptRequest'
            example:
              reason: fraud-check-failed
        required: false
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AbortPaymentAttemptResponse'
              example:
                paymentAttemptId: 6c5d3a30-3c2e-4f55-9d8e-5b3d5e3a5c7f
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400ErrorResponse'
              example:
                error:
                  errorId: BadRequest
                  description: The request body could not be parsed.
                  diagnosticsId: '1234567898'
        '404':
          description: >-
            Payment attempt not found, or its client session belongs to another
            tenant
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/404ErrorResponse'
              example:
                error:
                  errorId: PaymentAttemptNotFound
                  description: The payment attempt could not be found.
                  diagnosticsId: '1234567898'
        '409':
          description: Payment attempt cannot be aborted in its current state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/409ErrorResponse'
              example:
                error:
                  errorId: InvalidPaymentAttemptTransition
                  description: >-
                    The payment attempt is not in REQUIRES_APPROVAL — it has
                    already been approved or aborted.
                  diagnosticsId: '1234567898'
        '410':
          description: Payment attempt has expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/410ErrorResponse'
              example:
                error:
                  errorId: PaymentAttemptExpired
                  description: >-
                    The payment attempt has expired and can no longer be
                    aborted.
                  diagnosticsId: '1234567898'
        '422':
          description: Request failed validation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/422ErrorResponse'
              example:
                error:
                  errorId: RequestValidationError
                  description: >-
                    We were unable to validate your request, please check your
                    payload against /docs/api.
                  diagnosticsId: '1234567898'
components:
  parameters:
    ApiVersionHeader:
      required: true
      schema:
        title: X-API-VERSION
        type: string
        example: '2.4'
      name: X-API-VERSION
      description: Specifies the version of the API to use. This must be set to `2.4`.
      in: header
  schemas:
    AbortPaymentAttemptRequest:
      title: AbortPaymentAttemptRequest
      type: object
      additionalProperties: false
      properties:
        reason:
          title: Reason
          type: string
          description: >-
            Free-text reason for aborting the payment attempt. Optional; useful
            for observability into abort patterns.
    AbortPaymentAttemptResponse:
      title: AbortPaymentAttemptResponse
      type: object
      required:
        - paymentAttemptId
      properties:
        paymentAttemptId:
          title: Payment Attempt ID
          type: string
          format: uuid
          description: ID of the aborted payment attempt.
    400ErrorResponse:
      title: 400ErrorResponse
      type: object
      required:
        - error
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorObject'
            - type: object
              properties:
                paymentId:
                  title: Payment ID
                  type: string
                  description: Payment ID of the related pay
                paymentStatus:
                  title: Status
                  type: string
                  description: Status of the related payment
    404ErrorResponse:
      title: 404ErrorResponse
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    409ErrorResponse:
      title: 409ErrorResponse
      type: object
      required:
        - error
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorObject'
            - type: object
              properties:
                paymentId:
                  title: Payment ID
                  type: string
                  description: Payment ID of the related payment
                paymentStatus:
                  title: Status
                  type: string
                  description: Status of the related payment
    410ErrorResponse:
      title: 410ErrorResponse
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    422ErrorResponse:
      title: 422ErrorResponse
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ErrorObject:
      title: Error
      type: object
      description: An object containing information about the error that occurred.
      required:
        - errorId
        - description
      properties:
        errorId:
          title: Error ID
          type: string
          description: An error ID
        description:
          title: Error description
          type: string
          description: A human readable description of the error
        recoverySuggestion:
          title: Recovery Suggestion
          type: string
          description: A suggestion on how to recover from the error.
        diagnosticsId:
          title: Error diagnostics ID
          type: string
          description: >-
            An ID that you can quote when contacting the Primer support team via
            our [Support
            Portal](https://primerapi.atlassian.net/servicedesk/customer/portal/11).
        validationErrors:
          title: Validation Errors
          type: array
          items:
            type: object
          description: Returned in case of a badly formed request
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````