Stable Pro

Stable Pro API · v1

Payments, credit and advances

Read customers' money and credit movements: money_amount, customer_credit_amount, reversals and advances already invoiced.

The documented operations are available for the real stable and for its test environment, at the same address. Use the key for the environment you are working in.Availability and changes · 2026-12-03

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; 0 if no money moved (use of credit, move to credit, offset). The sum of money_amount is 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; 0 if credit is not involved.

For every movement this always holds:

money_amount = sum(allocations[].amount) + customer_credit_amount
Casetypemoney_amountallocationscustomer_credit_amount
€130.00 payment on a €100.00 chargepayment13000+100003000
€100.00 advance, with no chargespayment10000none10000
€60.00 lesson paid with creditcredit_applied0+6000-6000
Refund of €20.00 of creditrefund-2000none-2000
Refund of €30.00 paid on a chargerefund-3000-30000
€100.00 advance recorded by mistake and reversedreversal-10000none-10000
€20.00 taken off a charge and left as creditmoved_to_credit0-20002000

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

FieldMeaning
directioncredit: the credit is created or grows; debit: it is used or refunded
amountalways positive: direction gives the direction
sourcewhere the credit comes from, for example acconto_pagamenti for an advance. Open list: the names are in /codes (credit_source)
spendabletrue for a credit the customer can use
remaining_amountfor a credit, how much of it is left to use now
funded_byfor a use, which credits it comes from
accounting_monththe 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:

FieldMeaning
amount_invoicedinvoiced directly, with documents that cover the charge
amount_invoiced_through_advancealready invoiced through an invoiced advance
invoiced_through_advanceswhich advances that part comes from
amount_to_invoicehow much is left to invoice: the price minus the two previous parts
amount_paid_with_creditthe 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 +6000 on the lesson and -6000 on the advance: the lesson is invoiced directly for €60.00, only once.
  • If instead €30.00 of the advance is refunded, awaiting_correction is 3000 until you record the -3000 credit note on the advance, with corrects.id of 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.