> ## 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 Company Credit Purchase

> Cancels a company credit purchase.



## OpenAPI

````yaml /api-reference/ops/openapi.json post /api/v1/ops/company-credit-purchases/{companyCreditPurchaseId}/cancel
openapi: 3.0.0
info:
  title: OABUS OPS API
  description: OABUS API
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /api/v1/ops/company-credit-purchases/{companyCreditPurchaseId}/cancel:
    post:
      tags:
        - CompanyCreditPurchase
      summary: Cancel Company Credit Purchase
      description: Cancels a company credit purchase.
      operationId: cancelCompanyCreditPurchase
      parameters:
        - name: companyCreditPurchaseId
          required: true
          in: path
          schema:
            type: string
            format: uuid
        - name: fields
          required: false
          in: query
          description: >-
            Comma-separated list of fields to include in the response. Supports
            dot notation for nested projection (e.g.
            `id,name,user.email,trips.route.id`). Unknown fields are silently
            dropped.
          schema:
            type: string
      requestBody:
        $ref: '#/components/requestBodies/CancelCompanyCreditPurchaseRequestBody'
      responses:
        '200':
          $ref: '#/components/responses/CancelCompanyCreditPurchase200Response'
        '400':
          $ref: '#/components/responses/CancelCompanyCreditPurchase400Response'
        '401':
          $ref: '#/components/responses/CancelCompanyCreditPurchase401Response'
        '403':
          $ref: '#/components/responses/CancelCompanyCreditPurchase403Response'
        '500':
          $ref: '#/components/responses/CancelCompanyCreditPurchase500Response'
      security:
        - bearer: []
        - bearer: []
components:
  requestBodies:
    CancelCompanyCreditPurchaseRequestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              reason:
                nullable: true
                type: string
            additionalProperties: false
            description: Cancel company credit purchase payload
  responses:
    CancelCompanyCreditPurchase200Response:
      content:
        application/json:
          schema:
            type: object
            properties:
              companyCreditPurchaseId:
                type: string
                format: uuid
              companyCreditAccountId:
                type: string
                format: uuid
              organizationId:
                type: string
                format: uuid
              companyId:
                type: string
                format: uuid
              cooperativeId:
                type: string
                format: uuid
                description: Cooperative identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
              cooperative:
                type: object
                properties:
                  cooperativeId:
                    type: string
                    format: uuid
                    description: Cooperative identifier
                    example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                  organizationId:
                    type: string
                    format: uuid
                    description: Organization identifier
                    example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                  organization:
                    type: object
                    properties:
                      document:
                        description: CNPJ
                        example: 45.723.174/0001-10
                      documentType:
                        type: string
                        enum:
                          - CPF
                          - CNPJ
                          - RG
                        description: Document type
                        example: CNPJ
                      email:
                        description: Contact email
                        example: contato@estrela.com
                        nullable: true
                      legalName:
                        description: Legal name
                        example: Cooperativa Metropolitana de Transporte Ltda.
                        nullable: true
                        type: string
                      logo:
                        description: Logo object key
                        example: >-
                          organizations/0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a/logo/0195e7b2-4a3c-7d3e-9f4a-2c6b8d0e1f3b.png
                        nullable: true
                        type: string
                      name:
                        type: string
                        description: Display name
                        example: Cooperativa Metropolitana
                      organizationId:
                        type: string
                        format: uuid
                        description: Organization identifier
                        example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                      tradeName:
                        description: Trade name
                        example: Metropolitana
                        nullable: true
                        type: string
                      type:
                        type: string
                        enum:
                          - COOPERATIVE
                          - COMPANY
                        description: Organization type
                        example: COOPERATIVE
                    required:
                      - document
                      - documentType
                      - name
                      - organizationId
                      - type
                    additionalProperties: false
                    description: Organization identity
                required:
                  - cooperativeId
                  - organizationId
                  - organization
                additionalProperties: false
                description: Cooperative
              paymentId:
                description: Payment identifier
                example: null
                nullable: true
                type: string
                format: uuid
              purchasedByUserId:
                nullable: true
                type: string
                format: uuid
              code:
                type: string
              amount:
                type: integer
                exclusiveMinimum: true
              createdBy:
                nullable: true
                type: string
                format: uuid
              updatedBy:
                nullable: true
                type: string
                format: uuid
              canceledAt:
                nullable: true
                type: string
                format: date-time
              createdAt:
                type: string
                format: date-time
              creditedAt:
                nullable: true
                type: string
                format: date-time
              payment:
                nullable: true
                type: object
                properties:
                  paymentId:
                    type: string
                    format: uuid
                    description: Payment identifier
                    example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                  orderId:
                    description: Order identifier
                    example: null
                    nullable: true
                    type: string
                    format: uuid
                  organizationId:
                    type: string
                    format: uuid
                    description: Organization identifier
                    example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                  organization:
                    type: object
                    properties:
                      document:
                        description: CNPJ
                        example: 45.723.174/0001-10
                      documentType:
                        type: string
                        enum:
                          - CPF
                          - CNPJ
                          - RG
                        description: Document type
                        example: CNPJ
                      email:
                        description: Contact email
                        example: contato@estrela.com
                        nullable: true
                      legalName:
                        description: Legal name
                        example: Cooperativa Metropolitana de Transporte Ltda.
                        nullable: true
                        type: string
                      logo:
                        description: Logo object key
                        example: >-
                          organizations/0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a/logo/0195e7b2-4a3c-7d3e-9f4a-2c6b8d0e1f3b.png
                        nullable: true
                        type: string
                      name:
                        type: string
                        description: Display name
                        example: Cooperativa Metropolitana
                      organizationId:
                        type: string
                        format: uuid
                        description: Organization identifier
                        example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                      tradeName:
                        description: Trade name
                        example: Metropolitana
                        nullable: true
                        type: string
                      type:
                        type: string
                        enum:
                          - COOPERATIVE
                          - COMPANY
                        description: Organization type
                        example: COOPERATIVE
                    required:
                      - document
                      - documentType
                      - name
                      - organizationId
                      - type
                    additionalProperties: false
                    description: Organization
                  cooperativeId:
                    type: string
                    format: uuid
                    description: Cooperative identifier
                    example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                  cooperative:
                    type: object
                    properties:
                      cooperativeId:
                        type: string
                        format: uuid
                        description: Cooperative identifier
                        example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                      organizationId:
                        type: string
                        format: uuid
                        description: Organization identifier
                        example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                      organization:
                        type: object
                        properties:
                          document:
                            description: CNPJ
                            example: 45.723.174/0001-10
                          documentType:
                            type: string
                            enum:
                              - CPF
                              - CNPJ
                              - RG
                            description: Document type
                            example: CNPJ
                          email:
                            description: Contact email
                            example: contato@estrela.com
                            nullable: true
                          legalName:
                            description: Legal name
                            example: Cooperativa Metropolitana de Transporte Ltda.
                            nullable: true
                            type: string
                          logo:
                            description: Logo object key
                            example: >-
                              organizations/0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a/logo/0195e7b2-4a3c-7d3e-9f4a-2c6b8d0e1f3b.png
                            nullable: true
                            type: string
                          name:
                            type: string
                            description: Display name
                            example: Cooperativa Metropolitana
                          organizationId:
                            type: string
                            format: uuid
                            description: Organization identifier
                            example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                          tradeName:
                            description: Trade name
                            example: Metropolitana
                            nullable: true
                            type: string
                          type:
                            type: string
                            enum:
                              - COOPERATIVE
                              - COMPANY
                            description: Organization type
                            example: COOPERATIVE
                        required:
                          - document
                          - documentType
                          - name
                          - organizationId
                          - type
                        additionalProperties: false
                        description: Organization identity
                    required:
                      - cooperativeId
                      - organizationId
                      - organization
                    additionalProperties: false
                    description: Cooperative
                  cashSettlementId:
                    description: Cash settlement identifier
                    example: null
                    nullable: true
                    type: string
                    format: uuid
                  externalProvider:
                    type: string
                    description: External provider name
                    example: mock
                  externalProviderId:
                    type: string
                    description: External payment identifier
                    example: pay_a1b2c3d4
                  externalOrderId:
                    description: External order identifier
                    example: order_a1b2c3d4
                    nullable: true
                    type: string
                  description:
                    description: Payment description
                    example: Order payment
                    nullable: true
                    type: string
                  method:
                    type: string
                    enum:
                      - CASH
                      - PIX
                      - CREDIT_CARD
                      - DEBIT_CARD
                    description: Payment method
                    example: PIX
                  channel:
                    type: string
                    enum:
                      - ONLINE
                      - POS
                      - DRIVER_APP
                    description: Payment channel
                    example: ONLINE
                  card:
                    description: Card details
                    nullable: true
                    type: object
                    additionalProperties: {}
                  pix:
                    description: Pix details
                    nullable: true
                    type: object
                    additionalProperties: {}
                  amount:
                    type: integer
                    description: Total amount in cents
                    example: 15000
                  canceledBy:
                    description: Canceled by
                    example: null
                    nullable: true
                    type: string
                    format: uuid
                  status:
                    type: string
                    enum:
                      - ANTIFRAUD_APPROVED
                      - ANTIFRAUD_MANUAL
                      - ANTIFRAUD_PENDING
                      - ANTIFRAUD_REPROVED
                      - CANCELED
                      - CHARGEDBACK
                      - OVERPAID
                      - PAID
                      - PARTIAL_CANCELED
                      - PAYMENT_FAILED
                      - PENDING
                      - PROCESSING
                      - REFUNDED
                      - UNDERPAID
                    description: Payment status
                    example: PENDING
                  createdBy:
                    description: Created by
                    example: null
                    nullable: true
                    type: string
                    format: uuid
                  updatedBy:
                    description: Updated by
                    example: null
                    nullable: true
                    type: string
                    format: uuid
                  canceledAt:
                    nullable: true
                    type: string
                    format: date-time
                  createdAt:
                    type: string
                    format: date-time
                  dueDate:
                    nullable: true
                    type: string
                    format: date-time
                  issuedAt:
                    type: string
                    format: date-time
                  overdueAt:
                    nullable: true
                    type: string
                    format: date-time
                  paidAt:
                    nullable: true
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
                required:
                  - paymentId
                  - orderId
                  - organizationId
                  - organization
                  - cooperativeId
                  - cooperative
                  - externalProvider
                  - externalProviderId
                  - externalOrderId
                  - method
                  - channel
                  - amount
                  - status
                  - createdAt
                  - issuedAt
                  - updatedAt
                additionalProperties: false
              updatedAt:
                type: string
                format: date-time
            required:
              - companyCreditPurchaseId
              - companyCreditAccountId
              - organizationId
              - companyId
              - cooperativeId
              - cooperative
              - code
              - amount
              - createdAt
              - updatedAt
            additionalProperties: false
            description: Company credit purchase
      description: OK
    CancelCompanyCreditPurchase400Response:
      content:
        application/json:
          example:
            errors:
              - message: required
                path: name
            message: Bad Request Error
            statusCode: 400
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 400
                type: number
              errors:
                items:
                  properties:
                    message:
                      type: string
                    path:
                      type: string
                  required:
                    - message
                    - path
                  type: object
                type: array
            required:
              - message
              - statusCode
            type: object
      description: Bad Request Error
    CancelCompanyCreditPurchase401Response:
      content:
        application/json:
          example:
            message: Missing or invalid access token
            statusCode: 401
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 401
                type: number
            required:
              - message
              - statusCode
            type: object
      description: Unauthorized
    CancelCompanyCreditPurchase403Response:
      content:
        application/json:
          example:
            message: Insufficient permissions
            statusCode: 403
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 403
                type: number
            required:
              - message
              - statusCode
            type: object
      description: Forbidden
    CancelCompanyCreditPurchase500Response:
      content:
        application/json:
          example:
            message: Internal Server Error
            statusCode: 500
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 500
                type: number
            required:
              - message
              - statusCode
            type: object
      description: Internal Server Error
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````