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

# Cancel Checkout Session

> Cancels an active checkout session before confirmation.



## OpenAPI

````yaml /api-reference/driver/openapi.json post /api/v1/driver/checkout-sessions/{checkoutSessionId}/cancel
openapi: 3.0.0
info:
  title: DEVMOB Driver API
  description: DEVMOB API
  version: '1.0'
  contact: {}
servers: []
security: []
tags:
  - name: Auth
    description: Authentication and token lifecycle
  - name: Checkout
    description: QR checkout sessions
  - name: Invite
    description: Driver invitation preview and acceptance
  - name: Notification
    description: Driver inbox notifications
  - name: OTP
    description: One-time password flows
  - name: Profile
    description: Authenticated driver profile
  - name: Session
    description: Authenticated sessions
  - name: Storage
    description: Storage uploads
  - name: Trip
    description: Driver trips
  - name: Trip Boarding
    description: Ticket boarding
  - name: Trip Event
    description: Trip operational events
  - name: Trip Manifest
    description: Trip passenger manifest
  - name: Trip Tracking
    description: Driver GPS tracking
paths:
  /api/v1/driver/checkout-sessions/{checkoutSessionId}/cancel:
    post:
      tags:
        - Checkout
      summary: Cancel Checkout Session
      description: Cancels an active checkout session before confirmation.
      operationId: cancelCheckoutSession
      parameters:
        - name: checkoutSessionId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Checkout session identifier.
        - name: fields
          in: query
          required: false
          description: >-
            Comma-separated list of fields to include in the response. Supports
            dot notation.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelCheckoutSessionRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSession'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '409':
          $ref: '#/components/responses/ConflictError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearer: []
components:
  schemas:
    CancelCheckoutSessionRequest:
      type: object
      description: Cancel checkout session payload.
      properties:
        reason:
          type: string
          nullable: true
          description: Cancellation reason.
    CheckoutSession:
      type: object
      description: Checkout session linked by the customer app through a QR token.
      properties:
        checkoutSessionId:
          type: string
          format: uuid
          nullable: false
          description: Checkout session identifier.
        tripId:
          type: string
          format: uuid
          nullable: false
          description: Trip selected for this session.
        tripItineraryId:
          type: string
          format: uuid
          nullable: true
          description: Trip itinerary selected by the customer during preparation.
        seatId:
          type: string
          format: uuid
          nullable: true
          description: Seat selected by the customer during preparation.
        paymentMethod:
          type: string
          enum:
            - CASH
            - CREDIT_GRANT
          description: Payment method selected for this checkout.
        qrToken:
          type: string
          nullable: true
          description: >-
            Raw QR token. Returned only when creating an active session; never
            persisted in plain text.
        status:
          type: string
          enum:
            - CREATED
            - LINKED
            - PREPARED
            - CONFIRMED
            - EXPIRED
            - CANCELED
          description: Computed session status derived from timestamps.
        passengerDraft:
          allOf:
            - $ref: '#/components/schemas/CheckoutPassengerDraft'
          nullable: true
          description: Passenger draft prepared by the customer before Passenger creation.
        requestedCreditAmount:
          type: integer
          minimum: 0
          nullable: true
          description: Credit amount requested by the customer for this session.
        promotionalCode:
          type: string
          nullable: true
          description: Promotional code requested by the customer, when applicable.
        expiresAt:
          type: string
          format: date-time
          nullable: false
          description: QR token expiration date.
        linkedAt:
          type: string
          format: date-time
          nullable: true
          description: Date when the customer linked the session.
        preparedAt:
          type: string
          format: date-time
          nullable: true
          description: Date when the customer prepared ticket context.
        confirmedAt:
          type: string
          format: date-time
          nullable: true
          description: Date when checkout was confirmed.
        canceledBy:
          type: string
          format: uuid
          nullable: true
          description: User that canceled the session, when applicable.
        canceledAt:
          type: string
          format: date-time
          nullable: true
          description: Date when the session was canceled.
        createdBy:
          type: string
          format: uuid
          nullable: true
          description: User that created the session.
        createdAt:
          type: string
          format: date-time
          nullable: false
          description: Creation date.
        updatedBy:
          type: string
          format: uuid
          nullable: true
          description: User that last updated the session.
        updatedAt:
          type: string
          format: date-time
          nullable: false
          description: Last update date.
      required:
        - checkoutSessionId
        - tripId
        - paymentMethod
        - status
        - expiresAt
        - createdAt
        - updatedAt
    CheckoutPassengerDraft:
      type: object
      description: Passenger information prepared by the customer before ticket creation.
      properties:
        name:
          type: string
          description: Passenger name.
          example: Mariana Costa
        document:
          type: string
          description: Passenger document.
          example: '12345678909'
        documentType:
          type: string
          enum:
            - CPF
            - CNPJ
            - RG
          description: Passenger document type.
          example: CPF
        birthDate:
          type: string
          format: date
          nullable: true
          description: Passenger birth date.
          example: '1992-04-18'
      required:
        - name
        - document
        - documentType
    ValidationError:
      type: object
      properties:
        statusCode:
          type: integer
          description: HTTP status code.
          example: 400
        message:
          type: string
          description: Error message.
          example: Bad Request Error
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: Validation code.
                example: invalid_type
              message:
                type: string
                description: Validation message.
                example: Required
              path:
                type: string
                description: Invalid field path.
                example: name
            required:
              - code
              - message
              - path
      required:
        - statusCode
        - message
        - errors
      description: Validation error response.
    ApiError:
      type: object
      properties:
        statusCode:
          type: integer
          description: HTTP status code.
          example: 404
        error:
          type: string
          description: HTTP error name.
          example: Not Found
        message:
          type: string
          description: Machine-readable error code.
          example: resource.not_found
      required:
        - statusCode
        - error
        - message
      description: Domain error response.
  responses:
    BadRequestError:
      description: Validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    UnauthorizedError:
      description: Authentication required.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ForbiddenError:
      description: Forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFoundError:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ConflictError:
      description: State conflict.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````