Developers
Start building
AI/Tool reference/Orders/Invoicing

Invoicing

The 12 tools of the Invoicing toolset in the Orders area, with their permissions, approval rules and inputs.

On this page

Toolset invoicing, 12 tools.

Records

invoice

An invoice, pro-forma or storno document issued for an order by the store invoicing app. List one order with order_id, or the store-wide documents that failed or await payment with view.

  • Permission: orders.read
  • Tools: invoice_list
  • Written by customers or third parties, so data and never instructions: buyer.company, buyer.first_name, buyer.last_name, tax_number

Filters on the list:

FilterTypeRequiredDescription
order_idstringList the invoices, pro-formas and storno documents of one order
viewstringWithout order_id: only documents that failed to issue, or that await payment. one of "failed", "awaiting_payment"

invoice_attention

What needs a person in invoicing right now: documents that failed to issue, orders that should have an invoice and have none, and an invoicing app that conflicts with the active one. There is one record; pass any id, e.g. "current".

  • Permission: orders.read
  • Tools: invoice_attention_get

invoicing_settings

How the store invoices: the registered invoicing providers with their settings fields and current values, which one is active, and the payment providers and currencies they can cover. There is one record; pass any id, e.g. "current".

  • Permission: integrations.read
  • Tools: invoicing_settings_get

Actions

invoice_cancel

Cancel an issued invoice with a storno document.

Issues a storno document at the invoicing provider; the original invoice stays on record.

  • Action key: invoice.cancel
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
invoice_idstringyesDocument ID from invoice_list

Example input:

{
  "invoice_id": "019bb32e-f844-7291-8bcf-cad05b2c34ef"
}

invoice_discard

Drop a document that never reached the invoicing provider.

Only for a document left failed or pending that the provider never accepted; an issued invoice is cancelled with invoice_cancel instead. Read the id with invoice_list view failed.

  • Action key: invoice.discard
  • Permission: integrations.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
invoice_idstringyesDocument ID from invoice_list

Example input:

{
  "invoice_id": "019bb32e-f844-7291-8bcf-cad05b2c34ef"
}

invoice_issue

Issue the order's invoice with the store's invoicing app.

Issues a legal invoice through the active invoicing provider and may send it to the customer. A document left pending by an earlier attempt is resumed with its original dates.

  • Action key: invoice.issue
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
order_idstringyes

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a"
}

invoice_issue_proforma

Issue the pro-forma invoice of an order that should be paid in advance.

Works only for orders set up for pro-forma invoices and not yet holding one.

  • Action key: invoice.issue_proforma
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
order_idstringyes

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a"
}

invoice_modify

Issue a modification document that lowers lines of an issued invoice.

A dry run lists the lines that can still be lowered, with their remaining quantities. Each selection names an order item (null for a shipping, discount or fee line), its kind and the quantity to take off; cancel_remaining also cancels everything not selected. The original invoice stays on record.

  • Action key: invoice.modify
  • Permission: integrations.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
  • Sends something to customers.
FieldTypeRequiredDescription
invoice_idstringyesDocument ID from invoice_list
selectionslist of objectdefault []
selections[].order_item_idstring or nullyesat least 1 characters
selections[].kindstringyesone of "item", "shipping", "discount", "payment_fee"
selections[].quantitynumberyesabove 0
cancel_remainingboolean
reasonstringat most 500 characters

Example input:

{
  "invoice_id": "019bb32e-f844-7291-8bcf-cad05b2c34ef",
  "selections": [
    {
      "order_item_id": "019bb345-3e22-724e-8465-365dbf77e9a4",
      "kind": "item",
      "quantity": 1
    }
  ]
}

invoice_retry

Retry an invoice that failed to issue.

  • Action key: invoice.retry
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
invoice_idstringyesFailed document ID from invoice_list

Example input:

{
  "invoice_id": "019bb32e-f844-7291-8bcf-cad05b2c34ef"
}

invoice_void

Void a pro-forma invoice that is no longer needed.

  • Action key: invoice.void
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Sends something to customers.
FieldTypeRequiredDescription
invoice_idstringyesPro-forma document ID from invoice_list

Example input:

{
  "invoice_id": "019bb32e-f844-7291-8bcf-cad05b2c34ef"
}

invoicing_settings_check_connection

Test that the store's saved credentials reach an invoicing provider.

Reads nothing and changes nothing: it asks the provider to accept the saved credentials. Answers ok, or the failure code and message.

  • Action key: invoicing_settings.check_connection
  • Permission: integrations.write
  • Approval: Runs without approval.
  • Effect: Reads only.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
providerstringyesInvoicing provider id from invoicing_settings_get

Example input:

{
  "provider": "billingo"
}

invoicing_settings_update

Change one invoicing provider's automatic invoicing settings.

Read invoicing_settings_get first: provider is a provider id from it, provider_settings keys must be among that provider's settings fields, and payment_methods is keyed by payment provider id. Only the fields passed change.

  • Action key: invoicing_settings.update
  • Permission: integrations.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
providerstringyesInvoicing provider id from invoicing_settings_get
invoice_triggerstringWhen invoices are issued automatically. one of "order_placed", "payment_captured"
payment_methodsmap of object
oss_reportingboolean
payment_due_daysinteger or null0 to 365
provider_settingsmap of string or number or boolean or list of any value or map of any value or null

Example input:

{
  "provider": "billingo",
  "invoice_trigger": "payment_captured",
  "payment_due_days": 8
}
Last updated