Payment plans in Credith represent the credit agreement attached to anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/RoyGeova07/Credith/llms.txt
Use this file to discover all available pages before exploring further.
INSTALLMENT bill. When an installment bill is created, a BillPaymentPlan record is automatically generated along with one MonthlyPayment record per installment period. The plan tracks totalToPay, payedAmount, and status (PENDING, OVERDUE, or PAYED). These endpoints let store operators view upcoming obligations, record payments distributed across monthly installments, and recalculate the remaining payment schedule when a client wishes to accelerate repayment.
All four endpoints require authentication via a valid JWT (Authorization: Bearer <token>). The pending-payments endpoint additionally requires the ADMIN or OWNER role.
GET /api/payment-plan/pending-payments
Returns all monthly installments that are PENDING or OVERDUE and have a paymentDeadline before the start of the month that is 3 months ahead of today. Results include the associated client’s name, DNI, and phone number, ordered by client name then deadline ascending.
No query parameters required.
Example
Describes the time window covered by this response.
List of pending monthly installment records.
GET /api/payment-plan/:dni
Returns the most recent active payment plan for a client identified by their national ID (dni). Includes all monthly payment records. ADMIN-role users are automatically scoped to bills from their own store.
Path parameter
The client’s national identity number (DNI). Must be non-empty. Example:
"0801-1990-12345".| Status | Cause |
|---|---|
400 | dni path parameter is empty |
404 | No active payment plan found for the given DNI |
POST /api/payment-plan/:planId/pay
Credits a payment amount against a plan, distributing funds across monthly installments starting from a specific month index and working forward in deadline order. A month is marked isPayed = true when payedAmount ≥ paymentAmount + interestToPay. The plan’s payedAmount is re-computed as the sum of all monthly payedAmount values plus the initial payment. The plan is set to PAYED if all installments are covered or if totalToPay ≤ healedPayedAmount.
Path parameter
UUID of the
BillPaymentPlan to apply the payment to.The monetary amount to credit. Distributed sequentially across open installments from
month onward until exhausted.Zero-based index of the monthly payment array from which to start applying the payment. A value of
0 starts from the first installment; a value of 1 skips the first and starts from the second.| Status | Cause |
|---|---|
400 | Plan is already PAYED, or month exceeds the plan’s monthsToPay |
404 | Plan not found |
POST /api/payment-plan/:planId/recalculate
Destroys all existing monthly payment records for a plan and recreates them with a new installment count. The remaining balance (totalToPay - payedAmount) is evenly distributed across the new months, with any rounding adjustment applied to the final installment. The new schedule starts from the current calendar month.
Path parameter
UUID of the
BillPaymentPlan to recalculate.The new total number of monthly installments. Must be greater than zero and must not exceed the plan’s current
monthsToPay.| Status | Cause |
|---|---|
400 | Plan is PAYED, newMonths ≤ 0, newMonths > monthsToPay, or open installments with pending interest exist |
404 | Plan not found |
Payment Plan data model
Primary key of the payment plan.
The full invoice total that must eventually be paid under this plan.
Down-payment made at the time the installment bill was created.
Running total of all payments received (initial payment + sum of monthly
payedAmount).The date from which installment deadlines are calculated.
Current number of installment periods remaining on the plan.
Day of the month (1–31) each installment falls due. Dates are normalized to the last day of the month if the month is shorter.
Annual interest rate as a percentage (stored as SMALLINT). Default is
0.Current plan status. One of
"PENDING", "OVERDUE", or "PAYED".Timestamp of the last payment event, if any.
Ordered list of individual monthly installment records for this plan.