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

# Entregar un canje

> Marca el canje como entregado. Es el paso que se ejecuta en el mostrador cuando el cliente presenta su código y se le da el producto.

Antes de llamar acá, usá `GET /external/purchase/code/{code}` para mostrarle al operador qué producto tiene que entregar.



## OpenAPI

````yaml /api-reference/openapi.json post /external/purchase/redeem/{code}
openapi: 3.0.0
info:
  title: API de Tienda de Puntos
  description: >-
    API pública de Tienda de Puntos. Permite sumar puntos por compra, consultar
    clientes, validar canjes y consumir cupones desde tu POS, ERP o e-commerce.


    Todas las llamadas se autentican con el header `x-api-key`.
  version: 0.0.1
  contact: {}
servers:
  - url: https://api.tiendadepuntos.com
    description: Producción
  - url: https://apidev.tiendadepuntos.com
    description: Desarrollo
security:
  - ApiKeyAuth: []
tags: []
paths:
  /external/purchase/redeem/{code}:
    post:
      tags:
        - Canjes
      summary: Entregar un canje
      description: >-
        Marca el canje como entregado. Es el paso que se ejecuta en el mostrador
        cuando el cliente presenta su código y se le da el producto.


        Antes de llamar acá, usá `GET /external/purchase/code/{code}` para
        mostrarle al operador qué producto tiene que entregar.
      operationId: ExternalPurchaseController_redeem
      parameters:
        - name: code
          required: true
          in: path
          description: Código del canje que presenta el cliente.
          schema:
            type: string
            example: A1B2C3
        - name: x-branch-id
          in: header
          description: >-
            ID de la sucursal en la que se registra la operación. Si se omite,
            la operación queda asociada al comercio sin sucursal.
          required: false
          schema:
            type: integer
            example: 1972
      responses:
        '201':
          description: >-
            Canje entregado. El envelope trae `status: 200` aunque el código
            HTTP sea 201.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  status:
                    type: integer
                    example: 201
                  message:
                    type: string
                    example: Request was successful
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 45012
                      code:
                        type: string
                        example: A1B2C3
                      points:
                        type: integer
                        example: 500
                      status:
                        type: string
                        example: PENDING
                      createdAt:
                        format: date-time
                        type: string
                        example: '2026-07-28T18:05:00.000Z'
                      redeemedAt:
                        type: string
                        format: date-time
                        nullable: true
                        example: '2026-07-29T10:12:00.000Z'
                      product:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 771
                          name:
                            type: string
                            example: Café gratis
                          points:
                            type: integer
                            example: 500
                      client:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 84213
                          firstName:
                            type: string
                            example: Juan Manuel
                          lastName:
                            type: string
                            example: Pérez
                          email:
                            type: string
                            example: juanma@mailinator.com
                required:
                  - success
                  - status
                  - message
        '400':
          description: >-
            El canje ya fue entregado, está vencido o no está en un estado
            entregable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                    example: 400
                  timestamp:
                    type: string
                    format: date-time
                    example: '2026-07-31T14:05:12.431Z'
                  path:
                    type: string
                    example: /external/tags/add
                  method:
                    type: string
                    example: POST
                  message:
                    type: string
                    example: El canje ya fue realizado
                  errors:
                    type: array
                    nullable: true
                    items:
                      type: object
                  data:
                    type: object
                    nullable: true
        '404':
          description: >-
            Falta el header `x-api-key` (`Api Key is required`) o la API key no
            corresponde a ningún comercio (`Business not found`). También se usa
            cuando el recurso pedido no existe.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                    example: 404
                  timestamp:
                    type: string
                    format: date-time
                    example: '2026-07-31T14:05:12.431Z'
                  path:
                    type: string
                    example: /external/tags/add
                  method:
                    type: string
                    example: POST
                  message:
                    type: string
                    example: Api Key is required
                  errors:
                    type: array
                    nullable: true
                    items:
                      type: object
                  data:
                    type: object
                    nullable: true
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key del comercio. Se genera desde el panel de Tienda de Puntos, en
        Configuración → Integraciones.

````