MENU navbar-image

Introduction

Documentación de la API del proyecto Payment Rocketbot

Esta documentación proporciona toda la información necesaria para trabajar con la API de Payment Rocketbot.

<aside>A medida que navegas, verás ejemplos de código para trabajar con la API en diferentes lenguajes de programación en el área oscura a la derecha.
Puedes cambiar el lenguaje usando las pestañas en la parte superior derecha.</aside>

## Exportar a Postman / OpenAPI

<a href="collection.json" target="_blank" style="display: inline-block; padding: 10px 20px; background-color: #FF6C37; color: white; text-decoration: none; border-radius: 5px; margin-right: 10px;">📥 Descargar Colección Postman</a>
<a href="openapi.yaml" target="_blank" style="display: inline-block; padding: 10px 20px; background-color: #6BA539; color: white; text-decoration: none; border-radius: 5px;">📄 Descargar OpenAPI Spec</a>

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {ACCESS_TOKEN}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

Obtén tu token de acceso mediante el endpoint POST /api/auth/login. Usa el token en el header Authorization como Bearer token.

Autenticación

APIs para autenticación de usuarios

Registrar usuario

Crea un nuevo usuario y devuelve un token de acceso.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/auth/register" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Juan Pérez\",
    \"username\": \"juan_perez\",
    \"email\": \"juan@ejemplo.com\",
    \"password\": \"password123\",
    \"password_confirmation\": \"password123\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/auth/register"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Juan Pérez",
    "username": "juan_perez",
    "email": "juan@ejemplo.com",
    "password": "password123",
    "password_confirmation": "password123"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201, Éxito):


{
    "message": "Usuario creado",
    "user": {
        "id": 1,
        "name": "Juan Pérez",
        "username": "juan_perez",
        "email": "juan@ejemplo.com",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    },
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
    "token_type": "Bearer"
}
 

Example response (422, Error de validación):


{
    "message": "Error de validación",
    "errors": {
        "username": [
            "El campo username ya ha sido tomado."
        ]
    }
}
 

Request      

POST api/auth/register

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

Nombre completo del usuario. Example: Juan Pérez

username   string     

Nombre de usuario único (solo letras, números, guiones). Example: juan_perez

email   string  optional    

Correo electrónico (opcional pero único si se proporciona). Example: juan@ejemplo.com

password   string     

Contraseña (mínimo 8 caracteres). Example: password123

password_confirmation   string     

Confirmación de contraseña. Example: password123

Iniciar sesión

Autentica al usuario y devuelve un token de acceso.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"username\": \"juan_perez\",
    \"password\": \"password123\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/auth/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "username": "juan_perez",
    "password": "password123"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "user": {
        "id": 1,
        "name": "Juan Pérez",
        "username": "juan_perez",
        "email": "juan@ejemplo.com",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    },
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
    "token_type": "Bearer"
}
 

Example response (422, Credenciales inválidas):


{
    "message": "The given data was invalid.",
    "errors": {
        "username": [
            "Las credenciales son incorrectas"
        ]
    }
}
 

Request      

POST api/auth/login

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

username   string     

Nombre de usuario. Example: juan_perez

password   string     

Contraseña del usuario. Example: password123

Cerrar sesión

requires authentication

Revoca el token de acceso actual del usuario.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/auth/logout" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/auth/logout"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "message": "Sesión cerrada"
}
 

Request      

POST api/auth/logout

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Obtener usuario autenticado

requires authentication

Devuelve los datos del usuario actualmente autenticado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/auth/user" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/auth/user"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "user": {
        "id": 1,
        "name": "Juan Pérez",
        "username": "juan_perez",
        "email": "juan@ejemplo.com",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
}
 

Request      

GET api/auth/user

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Bancos

APIs para gestionar bancos (origen y destino)

Listar todos los bancos

requires authentication

Obtiene todos los bancos sin filtrar por compañía ni estado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/bank/all" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank/all"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Banco Nacional",
        "type": "origin",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/bank/all

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Listar bancos origen por compañía

requires authentication

Obtiene todos los bancos de tipo origen activos de una compañía.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/bank/origin/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank/origin/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Banco Nacional",
        "type": "origin",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/bank/origin/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Listar bancos destino por compañía

requires authentication

Obtiene todos los bancos de tipo destino activos de una compañía.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/bank/destination/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank/destination/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 2,
        "company_id": 1,
        "name": "Banco Internacional",
        "type": "destination",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/bank/destination/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Listar bancos activos por compañía

requires authentication

Obtiene todos los bancos activos de una compañía específica.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/bank/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Banco Nacional",
        "type": "origin",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/bank/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Crear banco

requires authentication

Crea un nuevo banco en el sistema.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/bank" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"company_id\": 1,
    \"name\": \"Banco Nacional\",
    \"type\": \"origin\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "company_id": 1,
    "name": "Banco Nacional",
    "type": "origin",
    "status": "active"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Banco Nacional",
    "type": "origin",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al crear el banco",
    "errors": {
        "name": [
            "El campo name es obligatorio."
        ]
    }
}
 

Request      

POST api/bank

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

company_id   integer     

ID de la compañía a la que pertenece el banco. Example: 1

name   string     

Nombre del banco. Example: Banco Nacional

type   string  optional    

Tipo de banco. Valores permitidos: origin, destination. Example: origin

status   string  optional    

Estado del banco. Valores permitidos: active, inactive. Example: active

Actualizar banco

requires authentication

Actualiza los datos de un banco existente.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/bank" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"company_id\": 1,
    \"name\": \"Banco Nacional Actualizado\",
    \"type\": \"origin\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "company_id": 1,
    "name": "Banco Nacional Actualizado",
    "type": "origin",
    "status": "active"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Banco Nacional Actualizado",
    "type": "origin",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T12:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al actualizar el banco",
    "errors": {
        "id": [
            "El campo id es obligatorio."
        ]
    }
}
 

Request      

PUT api/bank

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID del banco a actualizar. Example: 1

company_id   integer     

ID de la compañía. Example: 1

name   string     

Nombre del banco. Example: Banco Nacional Actualizado

type   string     

Tipo de banco. Valores permitidos: origin, destination. Example: origin

status   string     

Estado del banco. Valores permitidos: active, inactive. Example: active

Eliminar banco

requires authentication

Elimina un banco (soft delete - cambia el estado a 'deleted').

Example request:
curl --request DELETE \
    "https://pagos.agrocentro.site/api/bank/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Banco Nacional",
    "type": "origin",
    "status": "deleted",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T14:00:00.000000Z"
}
 

Request      

DELETE api/bank/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID del banco a eliminar. Example: 1

Obtener un banco

requires authentication

Obtiene los datos de un banco específico por su ID.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/bank/single/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/bank/single/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Banco Nacional",
    "type": "origin",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Request      

GET api/bank/single/{bank}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

bank   integer     

ID del banco. Example: 1

Compañías

APIs para gestionar compañías

Listar compañías activas

requires authentication

Obtiene todas las compañías con estado activo.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/company" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/company"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "name": "Empresa ABC",
        "format_name": "empresa_abc",
        "data_base": "db_abc",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/company

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Listar todas las compañías

requires authentication

Obtiene todas las compañías sin filtrar por estado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/company/all" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/company/all"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "name": "Empresa ABC",
        "format_name": "empresa_abc",
        "data_base": "db_abc",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/company/all

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Crear compañía

requires authentication

Crea una nueva compañía en el sistema.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/company" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Empresa XYZ\",
    \"format_name\": \"empresa_xyz\",
    \"data_base\": \"db_xyz\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/company"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Empresa XYZ",
    "format_name": "empresa_xyz",
    "data_base": "db_xyz",
    "status": "active"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 2,
    "name": "Empresa XYZ",
    "format_name": "empresa_xyz",
    "data_base": "db_xyz",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al crear la compañia",
    "errors": {
        "name": [
            "El campo name es obligatorio."
        ]
    }
}
 

Request      

POST api/company

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

Nombre de la compañía. Example: Empresa XYZ

format_name   string     

Nombre formateado (sin espacios ni caracteres especiales). Example: empresa_xyz

data_base   string     

Nombre de la base de datos (único). Example: db_xyz

status   string  optional    

Estado de la compañía. Valores permitidos: active, inactive. Example: active

Actualizar compañía

requires authentication

Actualiza los datos de una compañía existente.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/company" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"name\": \"Empresa ABC Actualizada\",
    \"format_name\": \"empresa_abc_actualizada\",
    \"data_base\": \"db_abc\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/company"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "name": "Empresa ABC Actualizada",
    "format_name": "empresa_abc_actualizada",
    "data_base": "db_abc",
    "status": "active"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "name": "Empresa ABC Actualizada",
    "format_name": "empresa_abc_actualizada",
    "data_base": "db_abc",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T12:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al actalizar la compañia",
    "errors": {
        "id": [
            "El campo id es obligatorio."
        ]
    }
}
 

Request      

PUT api/company

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID de la compañía a actualizar. Example: 1

name   string     

Nombre de la compañía. Example: Empresa ABC Actualizada

format_name   string     

Nombre formateado. Example: empresa_abc_actualizada

data_base   string     

Nombre de la base de datos. Example: db_abc

status   string     

Estado de la compañía. Valores permitidos: active, inactive. Example: active

Eliminar compañía

requires authentication

Elimina una compañía (soft delete - cambia el estado a 'deleted').

Example request:
curl --request DELETE \
    "https://pagos.agrocentro.site/api/company/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/company/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "name": "Empresa ABC",
    "format_name": "empresa_abc",
    "data_base": "db_abc",
    "status": "deleted",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T14:00:00.000000Z"
}
 

Request      

DELETE api/company/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

El ID de la compañía a eliminar. Example: 1

Obtener una compañía

requires authentication

Obtiene los datos de una compañía específica por su ID.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/company/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/company/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "name": "Empresa ABC",
    "format_name": "empresa_abc",
    "data_base": "db_abc",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Request      

GET api/company/{company}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

company   integer     

El ID de la compañía. Example: 1

Endpoints

GET api/user

requires authentication

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/user" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/user"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/user

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Monedas

APIs para gestionar monedas/divisas

Listar todas las monedas

requires authentication

Obtiene todas las monedas sin filtrar por compañía ni estado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/money/all" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/money/all"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Dólar Estadounidense",
        "initials": "USD",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/money/all

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Obtener una moneda

requires authentication

Obtiene los datos de una moneda específica por su ID.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/money/single/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/money/single/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Dólar Estadounidense",
    "initials": "USD",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Request      

GET api/money/single/{money}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

money   integer     

ID de la moneda. Example: 1

Listar monedas activas por compañía

requires authentication

Obtiene todas las monedas activas de una compañía específica.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/money/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/money/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Dólar Estadounidense",
        "initials": "USD",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/money/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Crear moneda

requires authentication

Crea una nueva moneda en el sistema.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/money" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"company_id\": 1,
    \"name\": \"Dólar Estadounidense\",
    \"initials\": \"USD\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/money"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "company_id": 1,
    "name": "Dólar Estadounidense",
    "initials": "USD",
    "status": "active"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Dólar Estadounidense",
    "initials": "USD",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al crear la moneda",
    "errors": {
        "name": [
            "El campo name es obligatorio."
        ]
    }
}
 

Request      

POST api/money

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

company_id   integer     

ID de la compañía a la que pertenece la moneda. Example: 1

name   string     

Nombre de la moneda. Example: Dólar Estadounidense

initials   string     

Siglas/código de la moneda (máximo 10 caracteres). Example: USD

status   string  optional    

Estado de la moneda. Valores permitidos: active, inactive. Example: active

Actualizar moneda

requires authentication

Actualiza los datos de una moneda existente.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/money" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"company_id\": 1,
    \"name\": \"Dólar Americano\",
    \"initials\": \"USD\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/money"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "company_id": 1,
    "name": "Dólar Americano",
    "initials": "USD",
    "status": "active"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Dólar Americano",
    "initials": "USD",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T12:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al actualizar la moneda",
    "errors": {
        "id": [
            "El campo id es obligatorio."
        ]
    }
}
 

Request      

PUT api/money

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID de la moneda a actualizar. Example: 1

company_id   integer     

ID de la compañía. Example: 1

name   string     

Nombre de la moneda. Example: Dólar Americano

initials   string     

Siglas/código de la moneda. Example: USD

status   string     

Estado de la moneda. Valores permitidos: active, inactive. Example: active

Eliminar moneda

requires authentication

Elimina una moneda (soft delete - cambia el estado a 'deleted').

Example request:
curl --request DELETE \
    "https://pagos.agrocentro.site/api/money/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/money/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Dólar Estadounidense",
    "initials": "USD",
    "status": "deleted",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T14:00:00.000000Z"
}
 

Request      

DELETE api/money/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID de la moneda a eliminar. Example: 1

Pagos (Detalles)

APIs para gestionar los detalles de pagos

Listar todos los detalles

requires authentication

Obtiene todos los detalles de pago sin filtrar por encabezado ni estado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-detail/all" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-detail/all"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "payment_header_id": 1,
        "DocNum": "DOC-001",
        "amount": "500.00",
        "payment_type": "partial",
        "status": "active",
        "status_recketbot": "pending",
        "comment": "Pago parcial",
        "comment_response": null,
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/payment-detail/all

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Obtener un detalle de pago

requires authentication

Obtiene los datos de un detalle de pago específico con su encabezado relacionado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-detail/single/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-detail/single/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "payment_header_id": 1,
    "DocNum": "DOC-001",
    "amount": "500.00",
    "payment_type": "partial",
    "status": "active",
    "status_recketbot": "pending",
    "comment": "Pago parcial",
    "comment_response": null,
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z",
    "payment_header": {
        "id": 1,
        "company_id": 1,
        "amount": "1000.00"
    }
}
 

Request      

GET api/payment-detail/single/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID del detalle de pago. Example: 1

Listar detalles de un pago

requires authentication

Obtiene todos los detalles activos de un encabezado de pago específico.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-detail/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-detail/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "payment_header_id": 1,
        "DocNum": "DOC-001",
        "amount": "500.00",
        "payment_type": "partial",
        "status": "active",
        "status_recketbot": "pending",
        "comment": "Pago parcial",
        "comment_response": null,
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/payment-detail/{paymentHeaderId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

paymentHeaderId   integer     

ID del encabezado de pago. Example: 1

Actualizar detalle de pago

requires authentication

Actualiza los datos de un detalle de pago existente.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/payment-detail" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"DocNum\": \"DOC-001\",
    \"amount\": 500,
    \"payment_type\": \"partial\",
    \"status\": \"active\",
    \"comment\": \"Pago parcial de factura\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-detail"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "DocNum": "DOC-001",
    "amount": 500,
    "payment_type": "partial",
    "status": "active",
    "comment": "Pago parcial de factura"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "payment_header_id": 1,
    "DocNum": "DOC-001",
    "amount": "500.00",
    "payment_type": "partial",
    "status": "active",
    "status_recketbot": "pending",
    "comment": "Pago parcial de factura",
    "comment_response": null,
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T12:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al actualizar el detalle",
    "errors": {
        "id": [
            "El campo id es obligatorio."
        ]
    }
}
 

Request      

PUT api/payment-detail

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID del detalle a actualizar. Example: 1

DocNum   string     

Número de documento. Example: DOC-001

amount   number     

Monto del detalle (mínimo 0.0001). Example: 500

payment_type   string     

Tipo de pago. Valores permitidos: partial, full. Example: partial

status   string     

Estado del detalle. Valores permitidos: active, inactive. Example: active

comment   string  optional    

Comentario adicional. Example: Pago parcial de factura

Actualizar estado Rocketbot del detalle

requires authentication

Actualiza el estado de procesamiento Rocketbot de un detalle de pago. Si el estado es 'rejected', el campo comment_response es obligatorio.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/payment-detail/status" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"status_recketbot\": \"inserted\",
    \"comment_response\": \"Documento no encontrado en el sistema\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-detail/status"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "status_recketbot": "inserted",
    "comment_response": "Documento no encontrado en el sistema"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito - Insertado):


{
    "message": "Estado actualizado exitosamente",
    "data": {
        "id": 1,
        "payment_header_id": 1,
        "DocNum": "DOC-001",
        "amount": "500.00",
        "payment_type": "partial",
        "status": "active",
        "status_recketbot": "inserted",
        "comment": "Pago parcial",
        "comment_response": null,
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T16:00:00.000000Z"
    }
}
 

Example response (200, Éxito - Rechazado):


{
    "message": "Estado actualizado exitosamente",
    "data": {
        "id": 1,
        "payment_header_id": 1,
        "DocNum": "DOC-001",
        "amount": "500.00",
        "payment_type": "partial",
        "status": "active",
        "status_recketbot": "rejected",
        "comment": "Pago parcial",
        "comment_response": "Documento no encontrado en el sistema",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T16:00:00.000000Z"
    }
}
 

Example response (422, Error - Rechazo sin comentario):


{
    "message": "Error de validacion",
    "errors": {
        "comment_response": [
            "El campo comment response es obligatorio cuando status recketbot es rejected."
        ]
    }
}
 

Request      

PUT api/payment-detail/status

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID del detalle de pago. Example: 1

status_recketbot   string     

Estado del procesamiento. Valores permitidos: inserted, rejected. Example: inserted

comment_response   string  optional    

Comentario de respuesta (obligatorio si status_recketbot es 'rejected'). Example: Documento no encontrado en el sistema

Eliminar detalle de pago

requires authentication

Elimina un detalle de pago (soft delete - cambia el estado a 'inactive').

Example request:
curl --request DELETE \
    "https://pagos.agrocentro.site/api/payment-detail/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-detail/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "payment_header_id": 1,
    "DocNum": "DOC-001",
    "amount": "500.00",
    "payment_type": "partial",
    "status": "inactive",
    "status_recketbot": "pending",
    "comment": "Pago parcial",
    "comment_response": null,
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T14:00:00.000000Z"
}
 

Request      

DELETE api/payment-detail/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID del detalle de pago a eliminar. Example: 1

Pagos (Encabezados)

APIs para gestionar encabezados de pagos

Listar todos los pagos

requires authentication

Obtiene todos los pagos sin filtrar por compañía ni estado, con sus relaciones.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-header/all" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header/all"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "user_id": 1,
        "company_id": 1,
        "card_code": "CLI001",
        "amount": "1000.0000",
        "status_rocketbot": "pending",
        "status": "active",
        "company": {
            "id": 1,
            "name": "Empresa ABC"
        },
        "transfer_type": {
            "id": 1,
            "name": "Transferencia"
        },
        "money": {
            "id": 1,
            "name": "USD",
            "initials": "USD"
        },
        "bank_origin": {
            "id": 1,
            "name": "Banco Nacional"
        },
        "bank_destination": {
            "id": 2,
            "name": "Banco Internacional"
        },
        "user": {
            "id": 1,
            "name": "Admin"
        }
    }
]
 

Request      

GET api/payment-header/all

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Listar pagos pendientes por compañía

requires authentication

Obtiene todos los pagos con status_rocketbot = 'pending' de una compañía, incluyendo detalles y nombres de todas las relaciones.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-header/pending/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header/pending/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "user_id": 1,
        "company_id": 1,
        "card_code": "CLI001",
        "transfer_type_id": 1,
        "money_id": 1,
        "bank_origin_id": 1,
        "bank_destination_id": 2,
        "reference": "REF-001",
        "amount": "1000.0000",
        "path_payment": "payments/1/file.pdf",
        "status_rocketbot": "pending",
        "status": "active",
        "company": {
            "id": 1,
            "name": "Empresa ABC"
        },
        "transfer_type": {
            "id": 1,
            "name": "Transferencia"
        },
        "money": {
            "id": 1,
            "name": "USD",
            "initials": "USD"
        },
        "bank_origin": {
            "id": 1,
            "name": "Banco Nacional"
        },
        "bank_destination": {
            "id": 2,
            "name": "Banco Internacional"
        },
        "user": {
            "id": 1,
            "name": "Admin"
        },
        "details": [
            {
                "id": 1,
                "payment_header_id": 1,
                "DocNum": "DOC001",
                "amount": "1000.0000",
                "payment_type": "full"
            }
        ]
    }
]
 

Request      

GET api/payment-header/pending/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Obtener un pago

requires authentication

Obtiene los datos de un pago específico con sus relaciones y detalles.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-header/single/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header/single/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "user_id": 1,
    "company_id": 1,
    "card_code": "CLI001",
    "transfer_type_id": 1,
    "money_id": 1,
    "bank_origin_id": 1,
    "bank_destination_id": 2,
    "reference": "REF-001",
    "amount": "1000.0000",
    "path_payment": "payments/1/file.pdf",
    "status_rocketbot": "pending",
    "status": "active",
    "company": {
        "id": 1,
        "name": "Empresa ABC"
    },
    "transfer_type": {
        "id": 1,
        "name": "Transferencia"
    },
    "money": {
        "id": 1,
        "name": "USD",
        "initials": "USD"
    },
    "bank_origin": {
        "id": 1,
        "name": "Banco Nacional"
    },
    "bank_destination": {
        "id": 2,
        "name": "Banco Internacional"
    },
    "user": {
        "id": 1,
        "name": "Admin"
    },
    "details": [
        {
            "id": 1,
            "payment_header_id": 1,
            "DocNum": "DOC001",
            "amount": "1000.0000",
            "payment_type": "full",
            "status": "active"
        }
    ]
}
 

Request      

GET api/payment-header/single/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID del pago. Example: 1

Listar pagos activos por compañía

requires authentication

Obtiene todos los pagos activos de una compañía con sus relaciones.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/payment-header/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "user_id": 1,
        "company_id": 1,
        "card_code": "CLI001",
        "transfer_type_id": 1,
        "money_id": 1,
        "bank_origin_id": 1,
        "bank_destination_id": 2,
        "reference": "REF-001",
        "amount": "1000.0000",
        "path_payment": "payments/1/file.pdf",
        "reported_platform": "local",
        "status_rocketbot": "pending",
        "status": "active",
        "comment": null,
        "comment_response": null,
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z",
        "company": {
            "id": 1,
            "name": "Empresa ABC"
        },
        "transfer_type": {
            "id": 1,
            "name": "Transferencia"
        },
        "money": {
            "id": 1,
            "name": "USD",
            "initials": "USD"
        },
        "bank_origin": {
            "id": 1,
            "name": "Banco Nacional"
        },
        "bank_destination": {
            "id": 2,
            "name": "Banco Internacional"
        },
        "user": {
            "id": 1,
            "name": "Admin"
        }
    }
]
 

Request      

GET api/payment-header/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Crear pago con archivo y detalles

requires authentication

Crea un nuevo pago con su comprobante (archivo) y detalles. La suma de los montos de los detalles debe ser igual al monto del encabezado.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/payment-header" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "company_id=1"\
    --form "card_code=CLI001"\
    --form "transfer_type_id=1"\
    --form "money_id=1"\
    --form "bank_origin_id=1"\
    --form "bank_destination_id=2"\
    --form "reference=REF-001"\
    --form "amount=1000"\
    --form "reported_platform=web"\
    --form "comment=Pago por servicios"\
    --form "details[]=architecto"\
    --form "file=@/tmp/phpzePnqR" 
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('company_id', '1');
body.append('card_code', 'CLI001');
body.append('transfer_type_id', '1');
body.append('money_id', '1');
body.append('bank_origin_id', '1');
body.append('bank_destination_id', '2');
body.append('reference', 'REF-001');
body.append('amount', '1000');
body.append('reported_platform', 'web');
body.append('comment', 'Pago por servicios');
body.append('details[]', 'architecto');
body.append('file', document.querySelector('input[name="file"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());

Example response (201, Éxito):


{
    "message": "Pago creado exitosamente",
    "data": {
        "id": 1,
        "user_id": 1,
        "company_id": 1,
        "card_code": "CLI001",
        "amount": "1000.0000",
        "status_rocketbot": "pending",
        "status": "active",
        "details": [
            {
                "id": 1,
                "DocNum": "DOC001",
                "amount": "1000.0000"
            }
        ]
    }
}
 

Example response (422, Montos no coinciden):


{
    "message": "Error de validacion",
    "errors": {
        "amount": [
            "La suma de los montos de los detalles (500.0000) no coincide con el monto del encabezado (1000.0000)"
        ]
    }
}
 

Example response (422, Error de validación):


{
    "message": "Error de validacion",
    "errors": {
        "company_id": [
            "El campo company_id es obligatorio."
        ]
    }
}
 

Request      

POST api/payment-header

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: multipart/form-data

Accept        

Example: application/json

Body Parameters

company_id   integer     

ID de la compañía. Example: 1

card_code   string     

Código del cliente/tarjeta. Example: CLI001

transfer_type_id   integer     

ID del tipo de transferencia. Example: 1

money_id   integer     

ID de la moneda. Example: 1

bank_origin_id   integer     

ID del banco origen. Example: 1

bank_destination_id   integer     

ID del banco destino. Example: 2

reference   string     

Referencia del pago. Example: REF-001

amount   number     

Monto total del pago. Example: 1000

file   file     

Comprobante de pago (PDF, JPG, JPEG, PNG. Máximo 10MB). Example: /tmp/phpzePnqR

reported_platform   string  optional    

Plataforma desde donde se reporta. Example: web

comment   string  optional    

Comentario adicional. Example: Pago por servicios

details   string[]     

Lista de detalles del pago.

DocNum   string     

Número de documento. Example: DOC001

amount   number     

Monto del detalle. Example: 1000

payment_type   string  optional    

Tipo de pago. Valores: partial, full. Example: full

comment   string  optional    

Comentario del detalle. Example: Pago factura

Actualizar pago

requires authentication

Actualiza los datos de un pago existente (sin modificar el archivo ni los detalles).

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/payment-header" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"company_id\": 1,
    \"card_code\": \"CLI001\",
    \"transfer_type_id\": 1,
    \"money_id\": 1,
    \"bank_origin_id\": 1,
    \"bank_destination_id\": 2,
    \"reference\": \"REF-001-UPDATED\",
    \"amount\": 1500,
    \"reported_platform\": \"web\",
    \"status\": \"active\",
    \"comment\": \"Pago actualizado\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "company_id": 1,
    "card_code": "CLI001",
    "transfer_type_id": 1,
    "money_id": 1,
    "bank_origin_id": 1,
    "bank_destination_id": 2,
    "reference": "REF-001-UPDATED",
    "amount": 1500,
    "reported_platform": "web",
    "status": "active",
    "comment": "Pago actualizado"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "card_code": "CLI001",
    "reference": "REF-001-UPDATED",
    "amount": "1500.0000",
    "status": "active"
}
 

Example response (422, Error de validación):


{
    "message": "Error al actualizar el pago",
    "errors": {
        "id": [
            "El campo id es obligatorio."
        ]
    }
}
 

Request      

PUT api/payment-header

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID del pago a actualizar. Example: 1

company_id   integer     

ID de la compañía. Example: 1

card_code   string     

Código del cliente/tarjeta. Example: CLI001

transfer_type_id   integer     

ID del tipo de transferencia. Example: 1

money_id   integer     

ID de la moneda. Example: 1

bank_origin_id   integer     

ID del banco origen. Example: 1

bank_destination_id   integer     

ID del banco destino. Example: 2

reference   string     

Referencia del pago. Example: REF-001-UPDATED

amount   number     

Monto total del pago. Example: 1500

reported_platform   string  optional    

Plataforma desde donde se reporta. Example: web

status   string     

Estado del pago. Valores: active, inactive. Example: active

comment   string  optional    

Comentario adicional. Example: Pago actualizado

Actualizar estado de Rocketbot

requires authentication

Actualiza el estado de procesamiento de un pago (inserted o rejected). Si el estado es 'rejected', el campo comment_response es obligatorio. También actualiza el estado de todos los detalles asociados.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/payment-header/status" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"status_rocketbot\": \"inserted\",
    \"comment_response\": \"Datos incorrectos\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header/status"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "status_rocketbot": "inserted",
    "comment_response": "Datos incorrectos"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "message": "Estado actualizado exitosamente",
    "data": {
        "id": 1,
        "status_rocketbot": "inserted",
        "comment_response": null,
        "details": [
            {
                "id": 1,
                "status_recketbot": "inserted"
            }
        ]
    }
}
 

Example response (422, Falta comentario en rechazo):


{
    "message": "Error de validacion",
    "errors": {
        "comment_response": [
            "El campo comment_response es obligatorio cuando el estado es rejected."
        ]
    }
}
 

Request      

PUT api/payment-header/status

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID del pago a actualizar. Example: 1

status_rocketbot   string     

Nuevo estado. Valores: inserted, rejected. Example: inserted

comment_response   string  optional    

Comentario de respuesta (obligatorio si status_rocketbot es 'rejected'). Example: Datos incorrectos

Eliminar pago

requires authentication

Elimina un pago (soft delete - cambia el estado a 'inactive').

Example request:
curl --request DELETE \
    "https://pagos.agrocentro.site/api/payment-header/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/payment-header/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "status": "inactive"
}
 

Request      

DELETE api/payment-header/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID del pago a eliminar. Example: 1

Tipos de Transferencia

APIs para gestionar tipos de transferencia

Listar todos los tipos de transferencia

requires authentication

Obtiene todos los tipos de transferencia sin filtrar por compañía ni estado.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/transfer-type/all" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/transfer-type/all"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Transferencia Bancaria",
        "description": "Transferencia entre cuentas bancarias",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/transfer-type/all

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Obtener un tipo de transferencia

requires authentication

Obtiene los datos de un tipo de transferencia específico por su ID.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/transfer-type/single/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/transfer-type/single/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Transferencia Bancaria",
    "description": "Transferencia entre cuentas bancarias",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Request      

GET api/transfer-type/single/{transferType}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

transferType   integer     

ID del tipo de transferencia. Example: 1

Listar tipos de transferencia activos por compañía

requires authentication

Obtiene todos los tipos de transferencia activos de una compañía específica.

Example request:
curl --request GET \
    --get "https://pagos.agrocentro.site/api/transfer-type/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/transfer-type/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


[
    {
        "id": 1,
        "company_id": 1,
        "name": "Transferencia Bancaria",
        "description": "Transferencia entre cuentas bancarias",
        "status": "active",
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
]
 

Request      

GET api/transfer-type/{companyId}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

companyId   integer     

ID de la compañía. Example: 1

Crear tipo de transferencia

requires authentication

Crea un nuevo tipo de transferencia en el sistema.

Example request:
curl --request POST \
    "https://pagos.agrocentro.site/api/transfer-type" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"company_id\": 1,
    \"name\": \"Transferencia Bancaria\",
    \"description\": \"Transferencia entre cuentas bancarias\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/transfer-type"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "company_id": 1,
    "name": "Transferencia Bancaria",
    "description": "Transferencia entre cuentas bancarias",
    "status": "active"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Transferencia Bancaria",
    "description": "Transferencia entre cuentas bancarias",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T10:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al crear el tipo de transferencia",
    "errors": {
        "name": [
            "El campo name es obligatorio."
        ]
    }
}
 

Request      

POST api/transfer-type

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

company_id   integer     

ID de la compañía a la que pertenece. Example: 1

name   string     

Nombre del tipo de transferencia. Example: Transferencia Bancaria

description   string  optional    

Descripción del tipo de transferencia. Example: Transferencia entre cuentas bancarias

status   string  optional    

Estado del tipo. Valores permitidos: active, inactive. Example: active

Actualizar tipo de transferencia

requires authentication

Actualiza los datos de un tipo de transferencia existente.

Example request:
curl --request PUT \
    "https://pagos.agrocentro.site/api/transfer-type" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 1,
    \"company_id\": 1,
    \"name\": \"Transferencia ACH\",
    \"description\": \"Transferencia automatizada\",
    \"status\": \"active\"
}"
const url = new URL(
    "https://pagos.agrocentro.site/api/transfer-type"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 1,
    "company_id": 1,
    "name": "Transferencia ACH",
    "description": "Transferencia automatizada",
    "status": "active"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Transferencia ACH",
    "description": "Transferencia automatizada",
    "status": "active",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T12:00:00.000000Z"
}
 

Example response (422, Error de validación):


{
    "message": "Error al actualizar el tipo de transferencia",
    "errors": {
        "id": [
            "El campo id es obligatorio."
        ]
    }
}
 

Request      

PUT api/transfer-type

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

ID del tipo de transferencia a actualizar. Example: 1

company_id   integer     

ID de la compañía. Example: 1

name   string     

Nombre del tipo de transferencia. Example: Transferencia ACH

description   string  optional    

Descripción del tipo de transferencia. Example: Transferencia automatizada

status   string     

Estado del tipo. Valores permitidos: active, inactive. Example: active

Eliminar tipo de transferencia

requires authentication

Elimina un tipo de transferencia (soft delete - cambia el estado a 'deleted').

Example request:
curl --request DELETE \
    "https://pagos.agrocentro.site/api/transfer-type/1" \
    --header "Authorization: Bearer {ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://pagos.agrocentro.site/api/transfer-type/1"
);

const headers = {
    "Authorization": "Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, Éxito):


{
    "id": 1,
    "company_id": 1,
    "name": "Transferencia Bancaria",
    "description": "Transferencia entre cuentas bancarias",
    "status": "deleted",
    "created_at": "2024-01-15T10:00:00.000000Z",
    "updated_at": "2024-01-15T14:00:00.000000Z"
}
 

Request      

DELETE api/transfer-type/{id}

Headers

Authorization        

Example: Bearer {ACCESS_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

ID del tipo de transferencia a eliminar. Example: 1