SolariumSolariumDocs
Browse The Docs

Docs/API Reference

Invoices

Bill customers, send the invoice, and track what's owed until it's paid.

Invoices run through ops: previewOp shows what would happen and keeps nothing; runOp with apply: true does it. Your AI app calls the same ops by name over MCP.

The flow: create_invoice makes a draft. send_invoice gives it the next number in your series, books it to the customer's A/R (revenue and tax collected), and emails the customer the PDF and a link to view it. test_send_invoice emails you the same email and PDF first, marked as a test, with nothing booked or numbered. get_invoice returns a preview_pdf_url (good for 7 days) to download a draft's PDF without sending it. record_invoice_payment clears the A/R when money comes in (never revenue a second time). void_invoice takes a sent invoice off the books.

Changing the date of a sent invoice: while nothing is paid on it (sent, viewed or overdue), update_invoice with just issue_date moves it to another date. The number stays the same, the due date follows its terms, and its A/R entry moves to the new date. If a tax rate changed between the two dates, the tax is worked out again. In another currency it's booked at the Bank of Canada rate for the new date, or at your own if you pass fx_rate. The preview lists the old and new date, rate and amount in your books. Nothing is emailed, and the invoice's note (which prints on the PDF) isn't touched. It's refused for a partly paid, paid or void invoice, when either date is in a closed period, and for an invoice in QuickBooks (change it there first). Anything else on a sent invoice can't change: void it and make a new one.

What the customer sees: the amount due and its due date first, then how to pay. When your payment instructions name an Interac e-Transfer address, the page offers to copy it and the invoice number. Solarium shows how to pay and never takes the money. The invoice prints your legal name exactly as entered ("Harbour Studio Inc."). Set a trade_name in invoice_settings and the page, PDF and email lead with it, with "A trade name of" your legal name under it. One legal entity running more than one business can give each invoice its own: pass trade_name to create_invoice or update_invoice for another name, or an empty string for your legal name alone. use_default_trade_name puts a draft back on the settings' name. get_invoice returns the trade_name it prints and trade_name_source (settings or override). Like the rest of a sent invoice, its trade name can't change once it's sent. Billed To prints the customer's legal name (or their name), an Attn: line for their contact person, their billing address and every email the invoice goes to. Set those with create_contact or update_contact.

Changing a draft's customer: pass contact_id, or customer_name matching a customer you already have (their name or legal name, any case). A name that matches no one is refused, never added as a new empty customer. Add them first with create_contact.

Numbers come from one series per business (INV-00001 by default). Change the prefix or continue an existing series with invoice_settings. A number already used is never handed out again.

Invoices made elsewhere: import_invoice_pdf reads your own PDF and keeps your number and your tax as printed.

An invoice you already booked by hand: when the A/R is already in your books (DR A/R, CR revenue, CR tax collected), pass that entry as adopt_event_id to import_invoice_pdf, or tie a draft to it with link_invoice_to_entry. The invoice uses that entry as its booking instead of booking A/R a second time. It's marked sent on the entry's date, and payments you record later clear that A/R. Nothing new is posted, nothing goes to QuickBooks and no email is sent. It's refused unless the entry is booked and not voided, isn't already an invoice's, is in the invoice's currency with its whole total on A/R, has the same tax, is for the same customer and has the same date. An entry with no customer gets the invoice's, and the preview says so. Pass date_tolerance_days to accept an entry a few days off the invoice's date.

Getting paid: when a deposit in the bank feed matches an open invoice, invoice_payment_matches suggests it, and invoice_deposit_matches finds the deposit from the invoice's side. Nothing is marked paid until you record it, with the deposit as source_event_id. A deposit already booked as income in Solarium can still be linked (that booking is undone). A customer's payment already booked another way (as a transfer, or a deposit already in QuickBooks) is linked in place: its credit becomes that customer's A/R and nothing is booked twice. remove_invoice_payment undoes a payment, and puts a payment linked in place back as it was.

Writing to the Solarium team: message_solarium_team posts to your conversation with the team (the same one as your texts and emails), and get_solarium_messages reads it back with their replies.

Other currencies: an invoice can be in USD, EUR, GBP, AUD or JPY while your books stay in your own currency. Sending books it at the Bank of Canada rate on the issue date (get_fx_rate shows it), or at your own rate if you pass fx_rate. A payment into an account in your books' currency records what landed (amount_home). A payment into an account in the invoice's currency (a USD account) is valued at that day's rate, since nothing was converted. Any bank fee (fee, in the account's currency) goes to Bank Fees & Charges. Landed plus the fee is what the payment converted to. Only its difference from the invoice's rate goes to Exchange Gain or Loss, and the customer's A/R clears exactly.

Reminders go out 3 days before the due date, on it, and 7 and 14 days after, unless they're turned off for the invoice or the customer.

Endpoints

POSTCreate An InvoiceA draft invoice. Lines are before tax. Tax is worked out from each line's sales_tax_code at the rates where the customer is, on the issue date.POSTSend An InvoiceNumbers it, books the A/R, and emails the PDF and view link. Sending again just emails it again.POSTSend Yourself A TestEmails you the exact email and PDF your customer gets, for a draft or a sent invoice. The subject starts with [Test], a banner says your customer didn't get it, and the PDF is stamped TEST. A draft shows Draft where the number goes. Nothing else changes: no number is used, nothing is booked, and the status, sent date and reminders stay as they are. Its View Invoice link is a preview that lasts 7 days and never marks the invoice viewed. Up to 10 a day per invoice. A read-only accountant can't send one.POSTChange A Sent Invoice's DateMoves a sent invoice with nothing paid on it to another issue date. Same number, due date from its terms, and its A/R entry moved and (in another currency) translated again at the new date's rate. Nothing is emailed.POSTRecord A PaymentAll or part of what's owed. DR the bank / CR the customer's A/R. Pass source_event_id to use a bank-feed deposit. A payment already booked (as a transfer, or a deposit already in QuickBooks) becomes the payment in place and is never booked twice. Its credit moves to this customer's A/R, so A/R with no customer clears. Money credited to another account is moved to A/R in Solarium only, and is refused when that entry is in QuickBooks. It must be in the invoice's currency, for the same customer or none, no more than what's owed, and not already another invoice's. QuickBooks isn't changed.POSTFind The Deposit That Paid ItBank deposits that could have paid an invoice, best first: exact amounts first, then payers whose name looks like the customer's. Includes deposits still in review, ones booked as income in Solarium only (that income booking is undone when you link it, so it isn't counted twice), and payments already booked as a transfer into a bank (linked in place). Link one with record_invoice_payment, passing its event_id as source_event_id. Read only.POSTRemove A PaymentUndo a payment: what it paid is owed again. A payment from a bank deposit puts the deposit back in review with its own payee and memo. One recorded by hand has its entry voided. An invoice's entries can't be edited, rejected or merged anywhere else, so this is how a payment changes.POSTList InvoicesNewest first, with a total count, counts per status group, and the money bar: overdue, not due yet, drafts and paid in the last 30 days, each with a count and an amount in your books' currency. Read only, so previewOp is enough.POSTInvoice SettingsReads or changes what every invoice says: the number series, how to pay, your address and email, a trade name, days to pay and reminders. Pass nothing to just read them.POSTImport Your Own Invoice PDFReads the number, dates, customer, lines and tax off your PDF and keeps them as printed. The preview shows what was read.POSTTie An Invoice To An Entry Already BookedFor an invoice whose A/R you already booked by hand. The draft uses that entry as its booking, so the A/R is never counted twice. Nothing new is posted, pushed to QuickBooks or emailed.