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

# Cancel an unpaid payment group



## OpenAPI

````yaml /openapi.en.json post /api/v2/orders/{shopId}/groups/{groupId}/cancel
openapi: 3.0.0
info:
  title: ItemShop v2 API
  description: >-
    REST API platformy ItemShop v2 (NestJS + Fastify). Wszystkie ścieżki mają
    prefiks /api/v2.
  version: 2.0.0
  contact: {}
servers:
  - url: https://itemshop.dev
    description: Production (API under /api/v2, same origin as the panel)
  - url: http://localhost:3000
    description: Local
security: []
tags: []
paths:
  /api/v2/orders/{shopId}/groups/{groupId}/cancel:
    post:
      tags:
        - Orders
      summary: Cancel an unpaid payment group
      operationId: OrderController_cancelCheckoutGroup
      parameters:
        - name: shopId
          required: true
          in: path
          schema:
            type: string
          description: Shop ID (ObjectId)
        - name: groupId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelCheckoutGroupDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/CheckoutGroup'
                  message:
                    type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    CancelCheckoutGroupDto:
      type: object
      properties:
        reason:
          type: string
          minLength: 0
          maxLength: 500
          description: Reason (status history)
    CheckoutGroup:
      type: object
      description: 'Payment group: N single-line orders paid with one transaction'
      properties:
        _id:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        groupNumber:
          type: string
          example: 7K2M9QX4R8T1V6W3Y5Z0
        shopId:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        orderIds:
          type: array
          items:
            type: string
            example: 664f1a2b3c4d5e6f7a8b9c0d
        status:
          type: string
          enum:
            - pending
            - paid
            - failed
            - cancelled
            - partially_refunded
            - refunded
          example: paid
        subtotal:
          type: number
          example: 59.97
        total:
          type: number
          example: 53.97
        currency:
          type: string
          example: PLN
        refundedAmount:
          type: number
          example: 0
        lines:
          type: array
          items:
            type: object
            properties:
              orderId:
                type: string
                example: 664f1a2b3c4d5e6f7a8b9c0d
              productId:
                type: string
                example: 664f1a2b3c4d5e6f7a8b9c0d
              name:
                type: string
                example: Ranga VIP
              variant:
                type: string
                example: 30 dni
              quantity:
                type: integer
                example: 1
              subtotal:
                type: number
                example: 19.99
              discountShare:
                type: number
                example: 2
              amount:
                type: number
                example: 17.99
        discount:
          type: object
          properties:
            code:
              type: string
              example: LATO10
            amount:
              type: number
              example: 6
        payment:
          type: object
          properties:
            amount:
              type: number
            provider:
              type: string
            transactionId:
              type: string
            completedAt:
              type: string
              format: date-time
        orders:
          type: array
          items:
            $ref: '#/components/schemas/Order'
          description: Only in GET of one group
        createdAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          example: 400
        error:
          type: string
          example: Error message
        timestamp:
          type: string
          format: date-time
        path:
          type: string
          example: /api/v2/...
    Order:
      type: object
      properties:
        _id:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        orderNumber:
          type: string
          example: 3a7b9c2d
        status:
          type: string
          enum:
            - pending
            - paid
            - processing
            - completed
            - cancelled
            - failed
            - dispute
            - refunded
          example: paid
        groupId:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
          description: Payment group (multi-line cart); absent = single-line order
        product:
          type: object
          properties:
            id:
              type: string
              example: 664f1a2b3c4d5e6f7a8b9c0d
            name:
              type: string
            price:
              type: number
        customer:
          type: object
          properties:
            nickname:
              type: string
              example: Steve
            email:
              type: string
        payment:
          type: object
          properties:
            amount:
              type: number
              example: 19.99
            currency:
              type: string
              example: PLN
            fee:
              type: object
              properties:
                percentage:
                  type: number
                amount:
                  type: number
                netAmount:
                  type: number
        vat:
          type: object
          properties:
            enabled:
              type: boolean
            rate:
              type: number
              example: 23
            amount:
              type: number
            netAmount:
              type: number
        quantity:
          type: integer
          example: 1
        createdAt:
          type: string
          format: date-time
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    bearerAuth:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.