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

# Buscar Pagos

> Aprende a listar los pagos de una tienda usando el endpoint GET /stores/{storeId}/payments.

## 📌 Endpoint

`GET /stores/{storeId}/payments`

Devuelve los pagos vinculados a la tienda.

***

## 🔐 Autenticación

* **Ruta privada**.
* Requiere header `Authorization` con tu API key y plan activo.

```json theme={null}
{
	"Authorization": "TU_API_KEY_AQUI"
}
```

***

## 🧾 Parámetros de ruta

| Parámetro | Tipo | Obligatorio | Descripción |
| - | - | - | - |
| `storeId` | string | Sí | ID de la tienda |

***

## ✅ Ejemplo de solicitud

```bash theme={null}
curl -X GET "https://api.cabrapi.com.br/v1/stores/STORE_ID/payments?page=1&limit=20" \
	-H "Authorization: TU_API_KEY_AQUI"
```

***

## 🔎 Query params

| Parámetro | Tipo | Obligatorio | Descripción |
| - | - | - | - |
| `page` | number | No | Página actual (por defecto: `1`) |
| `limit` | number | No | Elementos por página (por defecto: `20`, máximo: `100`) |
| `cursor` | string | No | Cursor opaco para paginación por cursor. Usa el `nextCursor` de la respuesta anterior. No puede usarse junto con `page` |

***

## 🔄 Paginación por cursor

Para listas grandes (más de \~100 elementos), prefiere la paginación por **cursor** en lugar de `page`:

1. Realiza la primera llamada **sin** `cursor`.
2. Si `hasMore` es `true`, la respuesta trae el campo `nextCursor`.
3. Envía ese `nextCursor` en el parámetro `cursor` de la siguiente solicitud para buscar la página siguiente.

```bash theme={null}
curl -X GET "https://api.cabrapi.com.br/v1/stores/STORE_ID/payments?cursor=v1:TU_CURSOR_AQUI&limit=20" \
	-H "Authorization: TU_API_KEY_AQUI"
```

En modo cursor, la paginación se devuelve solo con `nextCursor`, `hasMore` y `limit`:

```json theme={null}
{
	"code": "PAYMENTS_RETRIEVED",
	"payments": [],
	"pagination": {
		"nextCursor": "v1:e2xFn...",
		"hasMore": true,
		"limit": 20
	}
}
```

* `cursor` y `page` **no pueden** usarse juntos (`400 INVALID_PAGINATION`).
* `nextCursor: null` con `hasMore: false` indican el fin de la lista (la API responde `200` con array vacío).

***

## Snippet estándar (cURL)

Usa el ejemplo cURL de la sección Ejemplo de solicitud anterior como snippet oficial.

***

## 📦 Respuesta de éxito (200)

```json theme={null}
{
	"code": "PAYMENTS_RETRIEVED",
	"payments": [
		{
			"id": "PAYMENT_ID",
			"uuid": "8cf7de6e-4c92-4baf-b978-2f9195f2e0e2",
			"status": "APPROVED",
			"name": "João da Silva",
			"email": "joao@email.com",
			"cpf": "12345678909",
			"price": 49.9,
			"coupon": true,
			"gateway": "MERCADOPAGO",
			"shipment": "PENDING",
			"metadata": {
				"items": [
					{
						"product": {
							"id": "PRODUCT_ID",
							"name": "Curso de Marketing",
							"position": 1,
							"description": "Aprenda marketing digital",
							"price": 49.9,
							"image": "https://cdn.cabrapi.com.br/imagem.jpg",
							"delivery": "DIGITAL",
							"stock": 100,
							"sold": 1,
							"storeId": "STORE_ID",
							"disabled": false,
							"metadata": {},
							"createdAt": "2026-01-01T10:00:00Z",
							"updatedAt": "2026-01-01T10:00:00Z",
							"categories": []
						},
						"quantity": 1,
						"price": 44.91,
						"coupon": "BEMVINDO10",
						"billingCycleMonths": null
					}
				],
				"gateway": {
					"Type": "MERCADOPAGO",
					"Method": "MERCADOPAGO_ORDER_PIX",
					"Payment": "PIX",
					"FeePercentage": 0,
					"FeeAmount": 0
				}
			},
			"affiliateCode": null,
			"storeId": "STORE_ID",
			"createdAt": "2026-09-08T19:30:00Z",
			"updatedAt": "2026-09-08T19:30:00Z",
			"products": [
				{
					"id": "PRODUCT_ID",
					"name": "Curso de Marketing",
					"price": 49.9,
					"image": "https://cdn.cabrapi.com.br/imagem.jpg",
					"description": "Aprenda marketing digital"
				}
			],
			"affiliateCommission": null
		}
	],
	"pagination": {
		"page": 1,
		"limit": 20,
		"total": 1,
		"totalPages": 1,
		"nextCursor": null,
		"hasMore": false
	}
}
```

> La primera llamada (sin `cursor`) ya devuelve `nextCursor` y `hasMore` en la paginación, permitiendo iniciar la paginación por cursor sin llamadas extras.

***

## ⚠️ Posibles errores

* `400 INVALID_DATA` → parámetros inválidos
* `400 INVALID_PAGINATION_LIMIT` → `limit` fuera del intervalo permitido (`1` a `100`)
* `400 INVALID_PAGINATION_PAGE` → `page` inválida
* `400 INVALID_PAGINATION_CURSOR` → `cursor` inválido o malformado
* `400 INVALID_PAGINATION` → `page` y `cursor` usados juntos
* `401 API_KEY_NOT_PROVIDED` → header `Authorization` no enviado
* `401 INVALID_API_KEY` → API key inválida
* `401 UNAUTHENTICATED` → usuario no autenticado
* `403 USER_DISABLED` → usuario desactivado o eliminado
* `403 NO_ACTIVE_SUBSCRIPTION` → plan inactivo o expirado
* `404 STORE_NOT_FOUND` → tienda no encontrada
* `429 RATE_LIMIT_EXCEEDED` → límite de solicitudes por minuto del plan excedido
* `500 INTERNAL_SERVER_ERROR` → error interno
* `503 SERVICE_UNAVAILABLE` → servicio temporalmente no disponible


## OpenAPI

````yaml GET /stores/{storeId}/payments
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /stores/{storeId}/payments:
    get:
      tags:
        - Payments
      summary: List payments
      operationId: listPayments
      parameters:
        - $ref: '#/components/parameters/StoreId'
        - in: query
          name: page
          schema:
            default: 1
            minimum: 1
            type: integer
        - in: query
          name: limit
          schema:
            default: 20
            maximum: 100
            minimum: 1
            type: integer
        - description: Opaque cursor from previous page (do not combine with page).
          in: query
          name: cursor
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: PAYMENTS_RETRIEVED
                    type: string
                  payments:
                    type: array
                    items:
                      $ref: '#/components/schemas/Payment'
                  pagination:
                    $ref: '#/components/schemas/Pagination'
                required:
                  - code
                  - payments
                  - pagination
                type: object
          description: List payments.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid API key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden (inactive plan or insufficient permissions).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Rate limit exceeded.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Service unavailable.
      security:
        - ApiKey: []
components:
  parameters:
    StoreId:
      in: path
      name: storeId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
  schemas:
    Payment:
      description: Store payment/charge.
      properties:
        affiliateCode:
          nullable: true
          type: string
        affiliateCommission:
          nullable: true
          type: object
          properties:
            code:
              type: string
            name:
              type: string
            email:
              nullable: true
              type: string
            value:
              type: number
          required:
            - code
            - name
            - value
        coupon:
          type: boolean
        cpf:
          nullable: true
          type: string
        createdAt:
          format: date-time
          type: string
        email:
          format: email
          type: string
        gateway:
          type: string
        id:
          format: uuid
          type: string
        metadata:
          nullable: true
          type: object
        name:
          type: string
        price:
          type: number
        products:
          items:
            properties:
              description:
                nullable: true
                type: string
              id:
                format: uuid
                type: string
              image:
                nullable: true
                type: string
              name:
                type: string
              price:
                type: number
            required:
              - id
              - name
              - price
            type: object
          type: array
        shipment:
          enum:
            - PENDING
            - PREPARING
            - SHIPPED
            - DELIVERED
            - RETURNED
            - CANCELLED
          type: string
        status:
          enum:
            - PENDING
            - APPROVED
            - REJECTED
            - CANCELLED
            - REFUNDED
            - CHARGED_BACK
            - EXPIRED
          type: string
        storeId:
          format: uuid
          type: string
        updatedAt:
          format: date-time
          type: string
        uuid:
          format: uuid
          type: string
      required:
        - id
        - uuid
        - status
        - name
        - email
        - price
        - coupon
        - gateway
        - shipment
        - storeId
        - createdAt
        - updatedAt
        - products
      type: object
    Pagination:
      properties:
        hasMore:
          type: boolean
        limit:
          type: integer
        nextCursor:
          nullable: true
          type: string
        page:
          type: integer
        total:
          type: integer
        totalPages:
          type: integer
      type: object
    Error:
      properties:
        code:
          example: STORE_NOT_FOUND
          type: string
      required:
        - code
      type: object
  securitySchemes:
    ApiKey:
      in: header
      name: Authorization
      type: apiKey
      x-default: YOUR_API_KEY_HERE

````

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