Overview
The Payments & Charges API provides comprehensive functionality for managing financial transactions within residential communities. This includes creating and tracking charges for residents, processing payments, and maintaining detailed payment histories.Authentication
All endpoints require authentication using Bearer tokens. Different role levels provide access to different operations:- ADMIN_COMPANY, SYSTEM_ADMIN: Full access to all payment and charge operations
- Resident users: Limited access to view their own payments and submit payment records
Key Features
Community Charges & Payments
Manage charges and payments at the community and contract level.- Statements: View comprehensive statements showing charges (cargos) and payments (pagos) for contracts or communities
- Community Charges: Track charges associated with contracts and communities, including late fees
- Community Payments: Record payments and automatically apply them to outstanding charges
- Charge Status Tracking: Monitor charge status (No vencido, vencido, pagado, pago parcial)
- Payment Application: Link payments to multiple charges with applied amounts
Resident Charges (Cargos)
Manage charges assigned to individual residents, including maintenance fees, utilities, and other community-related costs.- Create and track charges for individual residents
- Monitor charge status (Activo, Pagado, PagoParcial, Cancelado)
- View charges by resident or community
- Update charge details and status
Resident Payments (Pagos)
Process and track payments made by residents towards their charges.- Submit payment records with proof of payment
- Support for payment confirmation workflow
- Flexible payment status tracking (PorConfirmar, Aplicado, Cancelado)
- Role-based payment creation (admin vs resident)
Payment History
Maintain a comprehensive audit trail of all payment transactions linked to contracts.- Track payment methods (transferencia, tarjeta, efectivo, cheque)
- Record payment references and receipts
- Monitor payment states (pendiente, pagado, cancelado, reembolsado)
- Associate payments with specific contracts
Common Workflows
Managing Community Charges and Payments
-
View statement for contract or community:
- Use
/api/charges/contrato/{contratoId}or/api/charges/comunidad/{comunidadId} - Returns all charges (cargos) and payments (pagos)
- Shows charge status, amounts, late fees, and payment applications
- Use
-
Track charge status:
- Charges automatically track status based on payment date and amount
- Status values: “No vencido”, “vencido”, “pagado”, “pago parcial”
- Late fees (MontoRecargos) can be applied to overdue charges
-
Apply payments to charges:
- Payments can be applied to multiple charges
- System tracks the amount applied to each charge via PagoCargoComunidad
- Charge status updates automatically based on payment application
Creating a Charge for a Resident
- Identify the resident ID
- Create a charge with amount, description, and due date
- Charge is created with “Activo” (Active) status by default
- Resident can view their charges and submit payments
Processing a Resident Payment
- Resident submits payment:
- Creates payment record with “PorConfirmar” (Pending Confirmation) status
- Includes payment amount, date, and proof of payment URL
- Admin reviews payment:
- Views pending payments
- Updates status to “Aplicado” (Applied) once verified
- Admin updates charge:
- Updates corresponding charge status based on payment amount
- Marks as “Pagado” (Paid) or “PagoParcial” (Partially Paid)
Recording Payment History
Administrators can create detailed payment history records that track:- Contract-specific payments
- Payment methods and references
- Transaction dates and amounts
- Administrative notes and updates
API Endpoints Structure
Community Charges & Payments
/api/charges/*- Community charge statements and queries
Resident Operations
/api/CargosResidente/*- Resident charge management/api/PagosResidente/*- Resident payment submissions
Contract Payments
/api/PaymentHistories/*- Contract payment history tracking
Response Formats
All endpoints return JSON responses with consistent structures:- Success: Returns the requested resource(s) with HTTP 200 OK
- Created: Returns the created resource with HTTP 201 Created
- Not Found: Returns HTTP 404 when resource doesn’t exist
- Bad Request: Returns HTTP 400 with error details for invalid operations
- Forbidden: Returns HTTP 403 for unauthorized access attempts
Date Formats
All dates are handled consistently across the API:- Request dates: DateTime objects or ISO 8601 strings
- Response dates: ISO 8601 datetime strings
- Fields:
CreatedAt,UpdatedAt,Fecha,FechaPago,FechaDePago
Error Handling
The API returns standard HTTP status codes:200 OK- Request successful201 Created- Resource created successfully204 No Content- Resource deleted successfully400 Bad Request- Invalid input data401 Unauthorized- Missing or invalid authentication403 Forbidden- Insufficient permissions404 Not Found- Resource not found
Next Steps
- Review Community Charges for statement and charge tracking endpoints
- Learn about Payment History for contract payment tracking and resident payment submissions