Overview
This API provides two distinct payment tracking systems:- Payment History - Contract-level payment tracking for administrative record-keeping
- Resident Payments (Pagos) - Resident-submitted payments with confirmation workflow
Payment History endpoints require ADMIN_COMPANY or SYSTEM_ADMIN role. Resident Payment endpoints have role-based access.
Payment History
Payment History provides comprehensive tracking of payment transactions associated with contracts. This API maintains a detailed audit trail of all payments, including payment methods, references, and status changes.Payment History Object
Unique identifier for the payment history record
ID of the contract associated with this payment
Payment amount
Date when the payment was made (ISO 8601 format)
Payment method used. Common values:
transferencia- Bank transfertarjeta- Credit/debit cardefectivo- Cashcheque- Check
Payment reference number, transaction ID, or receipt number
Current payment state. Possible values:
pendiente- Payment pendingpagado- Payment completedcancelado- Payment canceledreembolsado- Payment refunded
Additional notes or comments about the payment
Timestamp when the record was created
Timestamp of the last update
ID of the user who last updated the record
Get All Payment Histories
Query Parameters
Whether to include inactive payment records
Example Response
Get Payment Histories by Contract
Path Parameters
The unique identifier of the contract
Query Parameters
Whether to include inactive payment records
Response
Returns an array of payment history objects for the specified contract, ordered by payment date.Get Payment History by ID
Path Parameters
The unique identifier of the payment history record
Query Parameters
Whether to return the record if it’s inactive
Response
Returns a single payment history object or 404 if not found.Create Payment History
Request Body
ID of the contract this payment is associated with
Payment amount (must be positive)
Date when the payment was made (ISO 8601 format)
Payment method (e.g., transferencia, tarjeta, efectivo, cheque)
Payment reference or transaction ID
Initial payment state (pendiente, pagado, cancelado, reembolsado)
Additional notes about the payment
Example Request
Response
Status: 201 Created Returns the created payment history object with aLocation header pointing to the new resource.
Update Payment History
Path Parameters
The unique identifier of the payment history record to update
Request Body
Payment amount
Date when the payment was made (ISO 8601 format)
Payment method
Payment reference or transaction ID
Payment state (pendiente, pagado, cancelado, reembolsado)
Additional notes about the payment
Example Request
Response
Status: 200 OK Returns the updated payment history object, or 404 if the record doesn’t exist.Delete Payment History
Path Parameters
The unique identifier of the payment history record to delete
Response
Status: 204 No Content Returns no content on success, or 404 if the record doesn’t exist.Resident Payments (Pagos)
Resident Payments provide a workflow for residents to submit payment proof and for administrators to confirm and apply those payments. This system is separate from Payment History and focuses on the resident payment submission process.Resident Payment Object
Unique identifier for the payment
ID of the resident who made the payment
Full name of the resident
Resident’s identification number
Date when the payment was made
Payment amount
Payment status:
PorConfirmar- Pending admin confirmationAplicado- Confirmed and applied to chargesCancelado- Canceled payment
Description or concept of the payment
URL to the payment receipt or proof document
Additional notes about the payment
Timestamp when the payment was submitted
Timestamp of the last update
ID of the user who created the payment
ID of the user who last updated the payment
System Comparison
| Feature | Payment History | Resident Payments |
|---|---|---|
| Purpose | Contract payment tracking | Resident payment submissions |
| Created By | Admins only | Admins and residents |
| Associated With | Contracts | Residents |
| Workflow | Direct recording | Confirmation workflow |
| Status Values | pendiente, pagado, cancelado, reembolsado | PorConfirmar, Aplicado, Cancelado |
| Proof Upload | Reference field only | Dedicated urlComprobante field |
| Endpoint | /api/PaymentHistories | /api/PagosResidente |
Get All Resident Payments
Example Response
Get My Payments (Resident)
Response
Returns an array of payment objects for the authenticated resident, or an error if the user is not registered as a resident.Get Payments by Resident
Path Parameters
The unique identifier of the resident
Response
Returns an array of payment objects for the specified resident.Get Payments by Community
Path Parameters
The unique identifier of the community
Response
Returns an array of payment objects for all residents in the specified community.Get Payment by ID
- Admins can view any payment
- Residents can only view their own payments
Path Parameters
The unique identifier of the payment
Response
Returns a single payment object, 404 if not found, or 403 if a resident tries to access another resident’s payment.Create Resident Payment
Role-based behavior:
- Admins: Can create payment with any status and for any resident
- Residents: Can only create payments for themselves with status “PorConfirmar”
Request Body
ID of the resident making the payment
Date when the payment was made
Payment amount (must be positive)
Payment status (residents can only use “PorConfirmar”)
Description of what the payment is for
URL to the uploaded payment receipt or proof
Additional notes about the payment
ID of the user creating the payment
Example Request (Resident)
Example Request (Admin)
Response
Status: 201 Created Returns the created payment object with aLocation header.
Update Resident Payment
Path Parameters
The unique identifier of the payment to update
Request Body
ID of the resident
Date when the payment was made
Payment amount
Payment status (PorConfirmar, Aplicado, Cancelado)
Description of the payment
URL to the payment receipt
Additional notes
ID of the user updating the payment
Example Request
Response
Status: 200 OK Returns the updated payment object, or 404 if not found.Delete Resident Payment
Path Parameters
The unique identifier of the payment to delete
Response
Status: 204 No Content Returns no content on success, or 404 if not found.Payment Workflow
Resident Payment Submission Workflow
-
Resident submits payment:
- Status: “PorConfirmar”
- Includes payment amount, date, and proof (urlComprobante)
-
Admin views pending payments:
- Reviews payment details and proof
-
Admin confirms payment:
- Updates status to “Aplicado”
- Adds verification notes
-
Admin updates corresponding charge:
- Updates charge status to “Pagado” or “PagoParcial”
Error Responses
400 Bad Request
Returned when the request data is invalid:401 Unauthorized
Returned when authentication is missing or invalid.403 Forbidden
Returned when:- User doesn’t have the required role
- Resident tries to access another resident’s payments
- Resident tries to create payment for another resident
404 Not Found
Returned when the requested payment record doesn’t exist.Best Practices
Payment History
- Reference Numbers: Always include payment reference numbers for traceability
- Audit Trail: Avoid deleting payment records; use status updates instead
- Payment Methods: Use consistent metodoPago values across the system
- Notes: Add detailed notes for unusual transactions or refunds
- Contract Validation: Verify contract exists before creating payment history
- Date Accuracy: Use the actual payment date, not the processing date
- Status Tracking: Update estadoPago as payments progress through their lifecycle
Resident Payments
- Upload Proof: Always encourage residents to upload payment receipts (urlComprobante)
- Clear Concepts: Use descriptive payment concepts for easy identification
- Timely Review: Review and confirm resident payments promptly
- Status Updates: Keep residents informed by updating payment status
- Link to Charges: After confirming payment, update corresponding charges
- Audit Notes: Add notes when confirming or canceling payments
- Amount Validation: Verify payment amounts match expected charges before confirming