> ## 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.

# Odbiór treści cyfrowej (klucze, plik, wiadomość)

> Te same numer i klucz co status. Tylko opłacone pozycje z dostawą cyfrową (`items[].delivery` w statusie); dla grupy — wszystkie takie pozycje. Opłacone, a jeszcze niewydane zostają wydane przy tym wywołaniu. Pusta pula kluczy = `state: awaiting_stock` i `pendingUnits` > 0 (sprzedawca dostaje powiadomienie, klucze dojdą e-mailem). `text` to zwykły tekst — renderuj bez HTML. Link pobrania liczy każde otwarcie.



## OpenAPI

````yaml /openapi.pl.json get /api/v2/storefront/v1/orders/by-number/{orderNumber}/delivery
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: Produkcja (API pod /api/v2, ten sam origin co panel)
  - url: http://localhost:3000
    description: Lokalnie
security: []
tags: []
paths:
  /api/v2/storefront/v1/orders/by-number/{orderNumber}/delivery:
    get:
      tags:
        - Storefront v1
      summary: Odbiór treści cyfrowej (klucze, plik, wiadomość)
      description: >-
        Te same numer i klucz co status. Tylko opłacone pozycje z dostawą
        cyfrową (`items[].delivery` w statusie); dla grupy — wszystkie takie
        pozycje. Opłacone, a jeszcze niewydane zostają wydane przy tym
        wywołaniu. Pusta pula kluczy = `state: awaiting_stock` i `pendingUnits`
        > 0 (sprzedawca dostaje powiadomienie, klucze dojdą e-mailem). `text` to
        zwykły tekst — renderuj bez HTML. Link pobrania liczy każde otwarcie.
      operationId: getOrderDelivery
      parameters:
        - name: orderNumber
          required: true
          in: path
          description: Numer zamówienia albo grupy
          schema:
            example: 8K2M4N6P9QRSTVWX1Y3Z
            type: string
        - name: key
          required: true
          in: query
          description: Klucz statusu (`statusKey`)
          schema:
            example: k3m9x2p7qa
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontDeliveryResponseDto'
        '403':
          description: Pochodzenie (Origin) spoza domen sklepu (`ORIGIN_NOT_ALLOWED`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '404':
          description: '`ORDER_NOT_FOUND` (także zły klucz), `NO_DIGITAL_DELIVERY`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '409':
          description: '`ORDER_NOT_PAID`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '410':
          description: '`DELIVERY_REVOKED` — zwrot albo spór (chargeback)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '429':
          description: Przekroczony limit żądań (`RATE_LIMITED`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
components:
  schemas:
    StorefrontDeliveryResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/StorefrontDeliveryDto'
      required:
        - success
        - data
    StorefrontErrorDto:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: number
          example: 404
        code:
          enum:
            - VALIDATION_FAILED
            - BAD_REQUEST
            - NOT_FOUND
            - SHOP_NOT_FOUND
            - PRODUCT_NOT_FOUND
            - ORDER_NOT_FOUND
            - PRODUCT_UNAVAILABLE
            - PRODUCT_VARIANT_REQUIRED
            - INVALID_PRODUCT_VARIANT
            - INVALID_QUANTITY
            - OUT_OF_STOCK
            - CART_EMPTY
            - NICK_REQUIRED
            - EMAIL_REQUIRED
            - CART_TOO_LARGE
            - DISCOUNT_INVALID
            - LEGAL_CONSENT_REQUIRED
            - LEGAL_DOCUMENTS_CHANGED
            - SHOP_PAYMENT_NOT_READY
            - PAYMENT_INIT_FAILED
            - ORDER_BLOCKED
            - RETURN_URL_NOT_ALLOWED
            - VOUCHER_NOT_FOUND
            - VOUCHER_USED
            - VOUCHER_EXPIRED
            - IDEMPOTENCY_KEY_REQUIRED
            - IDEMPOTENCY_KEY_REUSED
            - CHECKOUT_ATTEMPT_CLOSED
            - CHECKOUT_IN_PROGRESS
            - CAPTCHA_REQUIRED
            - ORIGIN_NOT_ALLOWED
            - FORBIDDEN
            - UNAUTHORIZED
            - PAYLOAD_TOO_LARGE
            - CONFLICT
            - RATE_LIMITED
            - SERVICE_UNAVAILABLE
            - INTERNAL_ERROR
          type: string
          description: Maszynowy kod błędu — tłumacz po nim komunikat w UI
          example: SHOP_NOT_FOUND
        message:
          type: string
          description: >-
            Komunikat dla dewelopera (język nieustalony, nie pokazuj go
            kupującemu)
          example: Shop not found
        error:
          type: string
          description: To samo co `message` (zgodność z resztą API)
          example: Shop not found
          deprecated: true
        details:
          type: object
          description: Szczegóły walidacji
        timestamp:
          type: string
          format: date-time
          example: '2026-10-27T12:00:00.000Z'
        path:
          type: string
          example: /api/v2/storefront/v1/shops/moj-sklep
      required:
        - success
        - statusCode
        - code
        - message
        - error
        - timestamp
        - path
    StorefrontDeliveryDto:
      type: object
      properties:
        orderNumber:
          type: string
          description: Numer zamówienia albo grupy
          example: A1B2C3D4
        items:
          description: Opłacone pozycje z treścią cyfrową
          type: array
          items:
            $ref: '#/components/schemas/StorefrontDeliveryItemDto'
      required:
        - orderNumber
        - items
    StorefrontDeliveryItemDto:
      type: object
      properties:
        orderId:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        orderNumber:
          type: string
          example: A1B2C3D4
        productName:
          type: string
          example: Licencja Pro
        variant:
          type: string
          nullable: true
          example: null
        quantity:
          type: number
          example: 1
        kind:
          type: string
          enum:
            - license_keys
            - download
            - text
          example: license_keys
        state:
          type: string
          enum:
            - pending
            - awaiting_stock
            - delivered
            - revoked
          example: delivered
        keys:
          description: Klucze licencyjne
          example:
            - AAAA-BBBB-CCCC-DDDD
          type: array
          items:
            type: string
        pendingUnits:
          type: number
          description: Sztuki czekające na uzupełnienie puli
          example: 0
        text:
          type: string
          nullable: true
          description: Wiadomość sprzedawcy (zwykły tekst — renderuj jako tekst, nie HTML)
          example: 'Dziękujemy! Zaproszenie: https://discord.gg/…'
        download:
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/StorefrontDownloadDto'
        deliveredAt:
          type: string
          nullable: true
          format: date-time
          example: '2026-10-27T12:00:00.000Z'
      required:
        - orderId
        - orderNumber
        - productName
        - variant
        - quantity
        - kind
        - state
        - keys
        - pendingUnits
        - text
        - download
        - deliveredAt
    StorefrontDownloadDto:
      type: object
      properties:
        url:
          type: string
          nullable: true
          description: >-
            Jednorazowo liczony link (każde otwarcie zużywa jedno pobranie).
            null po wygaśnięciu/limicie
          example: >-
            https://api.itemshop.pl/api/v2/storefront/v1/downloads/664f1a2b3c4d5e6f7a8b9c0d.Xy…
        fileName:
          type: string
          example: plugin-1.4.2.zip
        size:
          type: number
          nullable: true
          example: null
        expiresAt:
          type: string
          nullable: true
          format: date-time
          example: '2026-10-30T12:00:00.000Z'
        maxDownloads:
          type: number
          example: 5
        remaining:
          type: number
          example: 4
        expired:
          type: boolean
          example: false
      required:
        - url
        - fileName
        - size
        - expiresAt
        - maxDownloads
        - remaining
        - expired

````

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