createCreditNote
Issue a credit note against an issued or paid invoice, to reduce or give back what the customer was billed. Returns the created credit note. It is issued at once: it gets its number, the customer is emailed it, and only its internal note can change afterwards. The part of the total the customer has not paid yet (prePaymentAmount) lowers the invoice's amount due, and the invoice becomes paid when nothing is left to pay. The part already paid (postPaymentAmount) must be given back in full: refunds, creditAmount and outOfBandAmount together must add up to exactly postPaymentAmount, so first compute it with previewCreditNote. refunds give money back on payments of the invoice: { transactionRef, amount }, with transactionRef from the invoice's payments, sends that amount back through the payment gateway the customer paid with, while { id } records a refund already made on a payment. Refunds cannot be used on an invoice billed in an alt currency. creditAmount adds money to the customer's balance, which pays their next invoices. outOfBandAmount records money given back outside Spacebring, such as by bank transfer. A draft invoice, a voided invoice and an invoice with a payment in progress cannot be credited. Get creditNote.invoiceRef from getInvoices. Each line credits one invoice item: invoiceItemRef is the id of one of that invoice's items (from getInvoiceItems with invoiceRef), with either quantity, a whole number of units up to the item's quantity, or amount, a share of the item's total before discount in major units of the invoice currency, with exclusive tax added on top. Never pass both, and credit each item at most once. The route is not idempotent: after a failure or timeout, check the result with the list tool before calling again, or a second record is created. Never invent UUIDs; only use values from prior tool responses.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"creditNote": "<creditNote>"
},
"name": "createCreditNote"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| creditNote | Yes | Credit note to create. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| creditNote | Yes |