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

# Redeem a voucher

> Creates a free order for the voucher product for the given nick.



## OpenAPI

````yaml /openapi.en.json post /api/v2/storefront/v1/shops/{shopId}/vouchers/redeem
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/storefront/v1/shops/{shopId}/vouchers/redeem:
    post:
      tags:
        - Storefront v1
      summary: Redeem a voucher
      description: Creates a free order for the voucher product for the given nick.
      operationId: redeemVoucher
      parameters:
        - name: shopId
          required: true
          in: path
          description: >-
            Shop ID (ObjectId). Also accepts the `uniqueName`, an active custom
            domain or `<uniqueName>.<hosting domain>`.
          schema:
            type: string
            example: 664f1a2b3c4d5e6f7a8b9c0d
        - name: cf-turnstile-response
          in: header
          description: >-
            Turnstile token (instead of the `turnstileToken` field). Optional;
            required only after a burst of attempts from one IP
            (`CAPTCHA_REQUIRED`)
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StorefrontRedeemVoucherDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontVoucherRedemptionResponseDto'
        '400':
          description: >-
            `VALIDATION_FAILED`; `VOUCHER_NOT_FOUND` (unknown or disabled —
            product/server unavailable; deliberately the same code),
            `VOUCHER_USED` (redeemed or being redeemed), `VOUCHER_EXPIRED`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '403':
          description: Origin outside the shop domains (`ORIGIN_NOT_ALLOWED`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '404':
          description: >-
            Shop/resource not found or the shop is blocked (`SHOP_NOT_FOUND`,
            `PRODUCT_NOT_FOUND`, `ORDER_NOT_FOUND`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
        '429':
          description: Rate limit exceeded (`RATE_LIMITED`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontErrorDto'
components:
  schemas:
    StorefrontRedeemVoucherDto:
      type: object
      properties:
        code:
          type: string
          pattern: ^[A-Z0-9]{4,12}$
          description: Voucher code (case-insensitive)
          example: ABC123
        nick:
          type: string
          pattern: ^[a-zA-Z0-9_]{3,16}$
          description: Minecraft player nickname
          example: Steve
        email:
          type: string
          maxLength: 254
          format: email
          description: >-
            E-mail for digital content when the voucher product has it
            (`deliveryKind` ≠ `commands`). Without it, collect the content via
            `GET /orders/by-number/{n}/delivery`
          example: jan@example.com
        turnstileToken:
          type: string
          minLength: 1
          maxLength: 4096
          description: >-
            Cloudflare Turnstile token (or the `cf-turnstile-response` header).
            Optional — adaptive like checkout: required only after `403
            CAPTCHA_REQUIRED`
      required:
        - code
        - nick
    StorefrontVoucherRedemptionResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/StorefrontVoucherRedemptionDto'
      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: Machine-readable error code — translate UI messages by this
          example: SHOP_NOT_FOUND
        message:
          type: string
          description: >-
            Developer message (language not guaranteed; do not show it to
            buyers)
          example: Shop not found
        error:
          type: string
          description: Same as `message` (compatibility with the rest of the API)
          example: Shop not found
          deprecated: true
        details:
          type: object
          description: Validation details
        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
    StorefrontVoucherRedemptionDto:
      type: object
      properties:
        orderId:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        orderNumber:
          type: string
          example: A1B2C3D4
        statusKey:
          type: string
          description: Status page secret (as at checkout)
          example: k3m9x2p7qa
        status:
          type: string
          enum:
            - pending
            - paid
            - processing
            - completed
            - cancelled
            - failed
            - dispute
          example: paid
        productName:
          type: string
          example: Ranga VIP
        serverName:
          type: string
          nullable: true
          example: Survival
        nick:
          type: string
          example: Steve
      required:
        - orderId
        - orderNumber
        - statusKey
        - status
        - productName
        - serverName
        - nick

````

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