Stable Pro

Stable Pro API · v1

Invoicing examples

Four complete cases: partial invoicing, a credit note, replacing a rejected document and an invoiced advance.

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

These examples show the order of calls to Stable Pro. All identifiers are fictional. Your connected software issues the documents; Stable Pro records their references. With EUR, amounts are in cents.

Before each issue, read the amount still available with GET /charges or GET /adjustments, reserve it with POST /external-documents/reservations and move the reservation to sending. Issue the document in your software only after POST /external-documents/reservations/{id}/sending returns 200. Use a new Idempotency-Key for each POST request. If you repeat the same request after losing its response, reuse the same key. See Connect invoicing software for the full flow.

Invoice a charge in two parts

Charge 11111111-1111-4111-8111-111111111111 is €100.00 and has amount_to_invoice: 10000. You want to issue a €60.00 invoice first.

  1. Reserve 6000 cents. The 201 response contains the reservation id, here 33333333-3333-4333-8333-333333333333.
{
  "key": "invoice-part-1",
  "covers": [
    {
      "object": "charge",
      "id": "11111111-1111-4111-8111-111111111111",
      "amount": 6000
    }
  ]
}
  1. Call POST /external-documents/reservations/{id}/sending. Only after a 200 response, issue the €60.00 invoice in your software.
  2. Record it with POST /external-documents, using the reservation id and the same covers.
{
  "external_id": "invoice-part-1",
  "kind": "invoice",
  "number": "FT-2026-001",
  "issue_date": "2026-11-20",
  "currency": "EUR",
  "reservation_id": "33333333-3333-4333-8333-333333333333",
  "covers": [
    {
      "object": "charge",
      "id": "11111111-1111-4111-8111-111111111111",
      "amount": 6000
    }
  ]
}

Stable Pro returns 201, and the charge now has amount_to_invoice: 4000. For the remaining €40.00, read the charge again and repeat the three steps with a new reservation, a new document and new idempotency keys. The second document covers 4000, not 10000; the first stays recorded.

Record a credit note after a discount

An invoice has already been issued. Stable Pro then records a €15.00 discount: GET /adjustments returns adjustment aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa with amount_to_invoice: -1500. Your software decides how to issue the credit note under the applicable tax rules.

  1. Reserve the adjustment for -1500, then call POST /external-documents/reservations/{id}/sending.
{
  "key": "credit-demo-001",
  "covers": [
    {
      "object": "adjustment",
      "id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
      "amount": -1500
    }
  ]
}
  1. After sending returns 200, issue the credit note in your software. Record it in Stable Pro with kind: credit_note, reservation_id and the same negative coverage.
{
  "external_id": "credit-demo-001",
  "kind": "credit_note",
  "number": "NC-2026-001",
  "issue_date": "2026-11-21",
  "currency": "EUR",
  "reservation_id": "cccccccc-cccc-4ccc-8ccc-cccccccccccc",
  "covers": [
    {
      "object": "adjustment",
      "id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
      "amount": -1500
    }
  ]
}

The example id cccccccc-cccc-4ccc-8ccc-cccccccccccc is returned by the reservation: use the actual id in a real request. The credit note covers the adjustment; it does not create another discount in Stable Pro. If it directly corrects an invoice already recorded, also read the corrects.id rules in Documents from connected software.

Replace a rejected document

The external software definitely rejects an invoice already recorded in Stable Pro. The original document has id eeeeeeee-eeee-4eee-8eee-eeeeeeeeeeee and covered €35.00 of charge bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb.

  1. Report the rejection with POST /external-documents/{id}/status-changes and a new Idempotency-Key.
{
  "status": "rejected"
}
  1. Read the charge again. When amount_to_invoice shows 3500 again, reserve that amount and move the new reservation to sending.
  2. Issue the replacement in the external software and record it with a new external_id. Point replaces_id to the rejected document.
{
  "external_id": "invoice-replacement-001",
  "kind": "invoice",
  "number": "FT-2026-002",
  "issue_date": "2026-11-22",
  "currency": "EUR",
  "reservation_id": "dddddddd-dddd-4ddd-8ddd-dddddddddddd",
  "replaces_id": "eeeeeeee-eeee-4eee-8eee-eeeeeeeeeeee",
  "covers": [
    {
      "object": "charge",
      "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
      "amount": 3500
    }
  ]
}

The example id dddddddd-dddd-4ddd-8ddd-dddddddddddd also stands for the id returned by the new reservation. The rejected document remains in the history and no longer counts toward invoiced amounts. Its number may be reused, but the example uses a new number to make the replacement clear. For a cancelled document, the old number remains reserved.

Invoice an advance and deduct it in the final invoice

A customer pays a €100.00 advance with no charges. GET /payments shows a payment movement with money_amount: 10000 and customer_credit_amount: 10000; GET /credit-entries?payment=<id> shows credit entry 12121212-1212-4121-8121-121212121212, with source: "acconto_pagamenti" and invoiceable: true.

  1. If your software invoices the advance, reserve and record the advance invoice on the credit entry, with the same three steps as the other cases:
{
  "external_id": "advance-001",
  "kind": "invoice",
  "number": "FT-2026-010",
  "issue_date": "2026-12-01",
  "currency": "EUR",
  "reservation_id": "14141414-1414-4141-8141-141414141414",
  "covers": [
    {
      "object": "credit_entry",
      "id": "12121212-1212-4121-8121-121212121212",
      "amount": 10000
    }
  ]
}
  1. Later a €60.00 lesson, charge 13131313-1313-4131-8131-131313131313, is paid with that credit. The charge shows amount_invoiced: 0, amount_invoiced_through_advance: 6000 and amount_to_invoice: 0: it is already covered by the advance invoice, and Stable Pro does not ask for another invoice. On the credit entry, invoiced_breakdown is on_charges: 6000 and open: 4000.

  2. If your software issues the final invoice for the lesson instead, the same invoice deducts the advance with a negative amount. Reserve and record both lines:

{
  "external_id": "final-001",
  "kind": "invoice",
  "number": "FT-2026-011",
  "issue_date": "2026-12-05",
  "currency": "EUR",
  "reservation_id": "15151515-1515-4151-8151-151515151515",
  "covers": [
    {
      "object": "charge",
      "id": "13131313-1313-4131-8131-131313131313",
      "amount": 6000
    },
    {
      "object": "credit_entry",
      "id": "12121212-1212-4121-8121-121212121212",
      "amount": -6000
    }
  ]
}

Now the lesson has amount_invoiced: 6000 and amount_invoiced_through_advance: 0: the €60.00 are invoiced only once. If you record the final invoice without the negative line on the advance, the same amount is documented twice and the owner sees it among the accounting checks.

  1. If €30.00 of the advance still open are refunded to the customer, GET /payments shows a refund with money_amount: -3000 and customer_credit_amount: -3000, and the advance has invoiced_breakdown.awaiting_correction: 3000. Record the credit note that corrects the advance invoice: it covers the advance with -3000 and gives in corrects.id the id of the advance invoice returned by Stable Pro. After the note, awaiting_correction goes back to 0.