Skip to content

Create Invoice

Creates an invoice for one or more order items. The same eligibility checks as the admin Invoice screen apply (the order must not be closed, marked fraud, or paid through PayPal Standard). Each item's requested quantity is validated against its still-invoiceable quantity, qty_to_invoice (rejected per-SKU with a message carrying the requested vs available quantity) before the invoice is created.

Endpoint

EndpointMethod
/api/admin/orders/{orderId}/invoicesPOST

Request body

FieldTypeRequiredNotes
itemsarray of { orderItemId, quantity }yesAt least one entry with quantity > 0. Each quantity must be ≤ that item's qty_to_invoice.
can_create_transactionbooleannoDefault false. The admin Create Transaction checkbox — when true, also records an order transaction for the invoice amount against the order's payment method.

Errors

HTTPMessage
422Closed orders cannot be invoiced.
422Fraud orders cannot be invoiced.
422Invoices cannot be created for orders paid through PayPal Standard.
422There is nothing to invoice on this order.
422You do not have permission to create invoices.
422At least one item with a positive quantity is required.
422Requested quantity exceeds the available quantity for the given SKU (the message names the SKU and both quantities).
422Could not create the invoice.

Sample 422 response

json
{
    "type": "/errors/422",
    "title": "Bad Request",
    "status": 422,
    "detail": "Requested quantity (5) exceeds available quantity (3) for SKU WS-12-S."
}

Released under the MIT License.