---
agentTools:
  projectIndex: https://zafepay.readme.io/llms.txt
---

# Reports

The Zafepay application supports direct downloads of displayed tables and bulk processing with automated email delivery. For programmatic access, this endpoint provides the same table data in JSON format. For bulk operations, the API response will include a download link to the report once the generation process is complete

**Base URL**: `/api/v1/integration/reports`\
**Authentication**: Required (integration token)

All endpoints are **read-only** and return JSON. Pagination is provided via standard query params:

* `page` – Page number (default: `1`)
* `per_page` – Items per page (default: implementation-dependent)

***

## Tables information

Returns the information of the tables in Zafepay via API. The columns of the responses are the same that in the application and is a JSON with 50 elements paginated. You can filter the result using the same params as the one of the model in the #index (for example, integration/reports/buyer allows the same params as buyers#Index endpoint)

### GET `/api/v1/integration/reports/buyers`

Returns a **paginated list of buyers (customers)** belonging to the authenticated company.

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "nombre": "Juan Pérez",
      "correo": "juan.perez@cliente.cl",
      "estado": "Al día",
      "suscripciones": 2,
      "pagos_unicos": 1,
      "planes_de_pago": 0,
      "cuotas_pagadas": 5,
      "total_pagado": 150000,
      "cuotas_en_deuda": 0,
      "total_deuda": 0
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 120
  }
}
```

***

### GET `/api/v1/integration/reports/subscriptions`

Returns a **paginated list of subscriptions** for the authenticated company.

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "nombre": "Suscripción Premium",
      "descripcion": "Acceso mensual al plan premium",
      "periodicidad": "Mensual",
      "valor": 9900,
      "estado": "Activa",
      "fecha_expiracion": "31/12/24 23:59",
      "duracion": 12,
      "dia_de_pago": 5,
      "prorrateo": "NO",
      "fecha_inicio_cobro": "01/01/24",
      "acumula_deuda": "SI",
      "limite_de_inscripciones": 100,
      "clientes_activos": 35,
      "creado_por": "admin@empresa.cl",
      "campos_extra": "Canal:Online,Segmento:Premium"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 80
  }
}
```

***

### GET `/api/v1/integration/reports/single_payments`

Returns a **paginated list of single (one‑off) payments**.

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "nombre": "Inscripción evento",
      "descripcion": "Pago único por inscripción",
      "valor": 19900,
      "estado": "Activa",
      "fecha_limite": "15/02/24",
      "stock_limite": 200,
      "canasta": "NO",
      "pagos_recibidos": 120,
      "pagos_pendientes": 15,
      "total_inscritos": 135,
      "creado_por": "operaciones@empresa.cl",
      "campos_extra": "Canal:Online,Segmento:Empresa"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 40
  }
}
```

***

### GET `/api/v1/integration/reports/statements`

Returns a **paginated list of statements (installments)** associated with payment plans.

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "id_pago": "stmt_123",
      "servicio": "Suscripción Premium",
      "descripcion_servicio": "Acceso mensual al plan premium",
      "tipo_servicio": "Suscripción",
      "nombre_cliente": "Juan Pérez",
      "correo_cliente": "juan.perez@cliente.cl",
      "nombre_cuota": "Cuota 1",
      "moneda": "CLP",
      "monto": 5000,
      "estado_servicio": "Activo",
      "estado_pago": "Pendiente",
      "fecha_vencimiento": "2024-02-01",
      "fecha_de_pago": null,
      "metodo_pago": "No pagado",
      "grupo": "Grupo 1",
      "codigo_autorizacion": null,
      "monto_en_clp": 5000,
      "referencia_externa": null
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 200
  }
}
```

***

### GET `/api/v1/integration/reports/transfers`

Returns a **paginated list of transfers (payouts)** for the company. Only transfers with status `pending`, `paid` or `error` are returned, ordered from newest to oldest.

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "monto": 1500000,
      "estado": "Pagado",
      "fecha_deposito": "05/01/24",
      "numero_de_cuotas": 25
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 15
  }
}
```

***

### GET `/api/v1/integration/reports/products`

Returns a **paginated list of products** belonging to the company.

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "nombre": "Plan Premium",
      "descripcion": "Suscripción mensual premium",
      "estado": "Activo",
      "valor": 9900,
      "moneda": "CLP",
      "referencia_externa": "SKU-123",
      "suscripciones": 40,
      "pagos_unicos": 10
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 35
  }
}
```

***

### GET `/api/v1/integration/reports/payment_plans`

Returns a **paginated list of payment plans** (installment-based products).

**Query parameters (examples)**

* `page`, `per_page`

**Response**

```json
{
  "data": [
    {
      "id": "plan_123",
      "nombre": "Plan de Pago Laptop",
      "descripcion": "Plan en cuotas para laptop",
      "proyecto": "Proyecto Retail",
      "nombre_cliente": "Juan Pérez",
      "correo_cliente": "juan.perez@cliente.cl",
      "estado": "Al día",
      "cuotas_pagadas": 2,
      "cuotas_en_deuda": 0,
      "total_cuotas": 6,
      "monto_pagado": 100000,
      "monto_en_deuda": 200000,
      "total_monto": 300000,
      "creado_por": "admin@empresa.cl",
      "campos_extra": "Canal:Online;Segmento:Retail"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 50
  }
}
```

***

## Masive Actions Reports

In the web app, /seller/subscription route includes two 'bulk actions' that generate Excel reports delivered via email.

With this endpoints you can request those reports. When making the request, the API will return a unique Process ID and you must use the /api/v1/integration/reports/job\_status endpoint to poll the status of the report. If the status is 'processing,' the report is still being generated; once finished, the response will provide a direct download link.

### GET `/api/v1/integration/reports/next_sales`

Starts the generation of a **“next sales” report** (for upcoming subscription sales) and returns a job identifier that can be used to check the status later.

**Response**

```json
{
  "job_id": "7b5a5d0e-8d7e-4d1e-9d19-9d3c3a2c0a5b",
  "status": "processing"
}
```

***

### GET `/api/v1/integration/reports/subscription_buyers_report`

Starts the generation of a **“subscription buyers” report** and returns a job identifier that can be used to check the status later.

**Response**

```json
{
  "job_id": "5a2c2fc8-89a0-4f2b-9f3c-1a2b3c4d5e6f",
  "status": "processing"
}
```

***

### GET `/api/v1/integration/reports/job_status`

Checks the **status of an asynchronous report job** created by:

* `GET /api/v1/integration/reports/next_sales`
* `GET /api/v1/integration/reports/subscription_buyers_report`

**Query parameters**

* `job_id` (required) – The job identifier returned by the creation endpoint.

**Responses**

* **Success**

**Job is processing**

```json
{
  "status": "processing"
}
```

**Job is done**

```json
{
    "status": "completed",
    "url": "https://example.com/kobe.xlsx"
}
```

Depending on the implementation, the status value can be for example: `processing`, `finished`, `failed`, etc.

* **Job not found or expired**

Jobs\_ids expire 24 hours after completion. After this period, the endpoint will return an error message.

```json
{
  "error": "Job not found or expired"
}
```