Stable Pro API · v1
Payments, credit and advances
Read customers' money and credit movements: money_amount, customer_credit_amount, reversals and advances already invoiced.
GET /payments lists the customers' movements: payments, uses of credit, refunds, reversals, moves to credit and offsets. GET /credit-entries lists the credit entries. Both need the payments:read permission. All amounts are integers in the currency's minor unit: with EUR, 13000 is €130.00.
The three parts of a movement
Every movement states three things, each with its sign:
money_amount: the money that moved. Positive if it came in, negative if it went out (a refund) or if a payment recorded by mistake is reversed;0if no money moved (use of credit, move to credit, offset). The sum ofmoney_amountis the cash.allocations[]: how the movement changed the settled amount of each charge. Positive raises it, negative lowers it.customer_credit_amount: the customer credit created (positive) or used (negative) by the movement;0if credit is not involved.
For every movement this always holds:
money_amount = sum(allocations[].amount) + customer_credit_amount
| Case | type | money_amount | allocations | customer_credit_amount |
|---|---|---|---|---|
| €130.00 payment on a €100.00 charge | payment | 13000 | +10000 | 3000 |
| €100.00 advance, with no charges | payment | 10000 | none | 10000 |
| €60.00 lesson paid with credit | credit_applied | 0 | +6000 | -6000 |
| Refund of €20.00 of credit | refund | -2000 | none | -2000 |
| Refund of €30.00 paid on a charge | refund | -3000 | -3000 | 0 |
| €100.00 advance recorded by mistake and reversed | reversal | -10000 | none | -10000 |
| €20.00 taken off a charge and left as credit | moved_to_credit | 0 | -2000 | 2000 |
customer_credit_amount comes from the credit entries recorded together with the movement, never calculated as a difference. It is null only when the recorded facts do not explain it: a reversal of a use of credit recorded before 26 November 2026. Its sum is not the customer's credit: for that, read GET /customers/{id}/balance.
A movement with origin: "ENGINE" is written by the Stable Pro engine: today it is only the reallocation that covers a credit already used elsewhere. Its credit is technical and can never be spent.
Reversals
A reversal (type: "reversal") takes back a movement recorded by mistake: it is not a refund. reverses_payment_id identifies the reversed movement. The reversal has the opposite signs of the original: it lowers the settled amount of the charges the original had raised and, if the original had created credit, it removes that credit.
To see the reversed credit, read the credit entries recorded with the reversal:
GET /credit-entries?payment=<reversal id>
In the example of the reversed advance, a direction: "debit" entry of 10000 appears, linked to the reversal by payment_id.
A use of credit can also be reversed. In that case a credit entry with reverses_entry_id is created: it returns the amount to the credits the use came from (their remaining_amount goes back up), and it is not a credit of its own (spendable: false).
Credit entries
| Field | Meaning |
|---|---|
direction | credit: the credit is created or grows; debit: it is used or refunded |
amount | always positive: direction gives the direction |
source | where the credit comes from, for example acconto_pagamenti for an advance. Open list: the names are in /codes (credit_source) |
spendable | true for a credit the customer can use |
remaining_amount | for a credit, how much of it is left to use now |
funded_by | for a use, which credits it comes from |
accounting_month | the stable's month in which the entry was recorded |
reimputazione_pagamenti is a technical credit: the engine creates it and uses it in the same operation, and it is never available to the customer.
Advances already invoiced
Stable Pro does not decide whether and when to invoice an advance: your software decides, according to the rules it applies. If it does, it can also record the document on a credit entry. An entry with invoiceable: true — an advance, an overpayment, a payment moved to credit — can be covered with covers[].object: "credit_entry":
+X: the advance invoice;-X: the final invoice that deducts the advance, or the credit note that corrects the advance invoice.
When the credit of an advance already invoiced pays for a service, Stable Pro counts that part of the service as already invoiced through the advance and does not ask for it a second time. On every charge:
| Field | Meaning |
|---|---|
amount_invoiced | invoiced directly, with documents that cover the charge |
amount_invoiced_through_advance | already invoiced through an invoiced advance |
invoiced_through_advances | which advances that part comes from |
amount_to_invoice | how much is left to invoice: the price minus the two previous parts |
amount_paid_with_credit | the part of the settled amount paid with the customer's credit |
On every invoiceable credit entry, amount_invoiced is the net amount invoiced on the advance, and invoiced_breakdown says where it is now: on_charges (on the services the advance paid for), open (on the advance money not yet used), awaiting_correction (on money refunded or reversed, waiting for a credit note), other and beyond_amount.
Example. A €100.00 advance is invoiced; €60.00 pays for a lesson.
- The lesson:
amount_invoiced: 0,amount_invoiced_through_advance: 6000,amount_to_invoice: 0. - The advance:
amount_invoiced: 10000,invoiced_breakdown.on_charges: 6000,open: 4000. - If your software prefers to issue the final invoice, it records it with
+6000on the lesson and-6000on the advance: the lesson is invoiced directly for €60.00, only once. - If instead €30.00 of the advance is refunded,
awaiting_correctionis3000until you record the-3000credit note on the advance, withcorrects.idof the advance invoice.
The complete cases are in Invoicing examples; the document rules in Documents from connected software.
Who is a customer
GET /customers returns everyone with at least one economic fact on the customer side: a charge, an advance or a credit entry, even with a zero balance. A customer who has only paid an advance is therefore a customer, and your software can address the advance invoice to them. Staff pay does not make anyone a customer.