SolariumSolariumDocs
Browse The Docs

Docs/API Reference/Invoices

POST

Create An Invoice

A 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.

Parameters

organizationIdUUID!required

Organization ID

nameString!required

"create_invoice"

params.customer_nameString

Finds or adds the customer (or pass contact_id). On update_invoice it must match a customer you already have

params.customer_emailString

Who the invoice is emailed to: one or more emails, comma-separated. Saved on the customer, so the next invoice and reminders go there too

params.customer_regionString

The customer's province, as a code (NS) or its name. Saved on the customer. Tax follows it: a Nova Scotia customer pays Nova Scotia HST, and a customer in a GST-only province pays GST alone. Leave it out to tax at your own province's rates

params.lines[Object!]!required

Each: description, unit_price, quantity (default 1), revenue_account_id, sales_tax_code (one of your tax options from invoice_settings, e.g. hst in Ontario, st_ny in New York), tax_amount (needed where tax isn't worked out from a rate, like US sales tax)

params.terms_daysInt

Days to pay (default 30)

params.currencyString

CAD, USD, EUR, GBP, AUD or JPY. Default: the customer's usual currency, else your books' own

params.fx_rateString

Other currencies: your books' currency per 1 of the invoice's (1.3684). Default: the Bank of Canada rate on the issue date

params.numberString

Only to use your own number

params.trade_nameString

The trade name this invoice leads with, instead of the one in invoice_settings. An empty string prints your legal name alone. Default: the settings' trade name. On update_invoice, use_default_trade_name: true goes back to it

applyBoolean

true to keep it

Request
mutation {
  runOp(
    organizationId: "a1b2c3d4-..."
    name: "create_invoice"
    apply: true
    params: {
      customer_name: "Milda K"
      customer_email: "[email protected]"
      terms_days: 15
      lines: [{ description: "October retainer", unit_price: "1000.00", sales_tax_code: "hst" }]
    }
  ) { success applied result }
}
Response
{
  "data": {
    "runOp": {
      "success": true,
      "applied": true,
      "result": {
        "summary": "Draft Invoice For Milda K: CAD 1130.00 (Tax 130.00).",
        "data": { "invoice_id": "9f3c...", "status": "draft", "subtotal": "1000.00", "tax_total": "130.00", "total": "1130.00" }
      }
    }
  }
}