Skip to main content
The Invoices API manages the complete invoice lifecycle — from creation and issuance through payment collection, discounts, refunds, and voids. Invoices are always associated with an order and a customer, and track exactly how much has been billed, paid, and remains outstanding.

Invoice states

Invoices move through a defined set of states. Understanding which state an invoice is in determines which actions you can take on it.
Voiding and cancelling are both irreversible. A voided invoice is removed from AR; a cancelled invoice retains its record. Use void for erroneous invoices and cancel for legitimate business cancellations.

The invoice object

string
Unique identifier for the invoice (GUID).
string
The tenant organization this invoice belongs to.
string
The ID of the order this invoice is associated with.
string
Human-readable order number.
string
Human-readable invoice number (e.g. INV-00892). Supply your own on import to preserve existing numbers.
string
Your system’s identifier for this invoice.
string
Current invoice state: Draft, Issued, PartiallyPaid, Paid, Voided, or Cancelled.
string (ISO 8601)
The date the invoice was created.
string (ISO 8601)
The payment due date.
string
Payment terms (e.g. Net30).
string
ISO 4217 currency code (e.g. USD).
string
Customer’s purchase order number.
string
Free-text notes on the invoice.
object
Customer details. Includes customerNumber, companyName, companyEmail, companyPhone, billingAddress, and shippingAddress.
object
Sales rep details. Includes repNumber, firstName, lastName, fullName, email, phoneNumber.
array
Invoice line items.
array
Payment records attached to this invoice.

Endpoints

List invoices

Returns a paginated list of invoices. Filter by customer, order, or status using query parameters.

Query parameters

string
Filter invoices by customer ID.
string
Filter invoices by order ID. Use this to retrieve all invoices for a specific order.
string
Filter by invoice status: Draft, Issued, PartiallyPaid, Paid, Voided, or Cancelled.
integer
Page number. Defaults to 1.
integer
Results per page. Defaults to 25.

Example request

Response


Get an invoice

Retrieves a single invoice by its ID, including all line items and payment history.

Path parameters

string
required
The unique identifier (GUID) of the invoice.

Example request

Response

Returns 200 OK with the full invoice object.

Create an invoice

Creates a new invoice in Draft status. Invoices are normally created automatically when an order ships, but you can use this endpoint to create them manually or to import invoices from another system.
Supply invoiceNumber to preserve an existing invoice number on import. Supply both importedInvoiceTotal and importedBalance when importing invoices whose payment history is tracked in another system — Nymble Commerce will use those values directly rather than computing them from line items.

Request body

string
required
The ID of the order this invoice is for.
string
The order number. Optional — used for display purposes.
string
Supply an existing invoice number to import it. When omitted, Nymble Commerce generates one automatically.
object
required
Customer details for the invoice.
object
required
Sales rep details.
string
Customer’s purchase order number.
string (ISO 8601)
required
The invoice date.
string (ISO 8601)
required
The payment due date.
string
required
Payment terms (e.g. Net30, Net60).
string
required
ISO 4217 currency code (e.g. USD).
string
Free-text notes.
array
required
Invoice line items.
number
Tax amount to apply.
object
Order-level discount. Fields: code, type (Percentage or Amount), value, description.
number
Authoritative total from an external system. When supplied, overrides the computed line-item total.
number
Outstanding balance from an external system. Supply alongside importedInvoiceTotal — Nymble Commerce derives the amount paid as importedInvoiceTotal − importedBalance.
boolean
Set to false to soft-delete the matching invoice on import. Defaults to true.

Example request

Response

Returns 201 Created with the new invoice object in Draft status.

Bulk create invoices

Creates multiple invoices in a single request. Follows the same rules as the single create endpoint. Use invoiceNumber on each entry to make the import idempotent.

Request body

array
required
An array of invoice objects. Each follows the same shape as POST /api/invoices.

Example request


Update an invoice

Updates an existing invoice. You can update most fields while the invoice is in Draft status.

Path parameters

string
required
The unique identifier of the invoice to update.

Request body

Accepts the same fields as POST /api/invoices. Only supply fields you want to change.

Example request

Response

Returns 200 OK with the updated invoice object.

Issue an invoice

Transitions an invoice from Draft to Issued. Once issued, the invoice is payable and visible to the customer. You cannot issue an already-issued, paid, voided, or cancelled invoice.

Path parameters

string
required
The unique identifier of the invoice to issue.

Example request

Response

Returns 200 OK with the updated invoice object in Issued status.

Record an offline payment

Records a payment made outside the hosted payment flow — such as a bank transfer (EFT), cheque, or wire transfer. The invoice status updates automatically to PartiallyPaid or Paid based on the resulting balance.

Path parameters

string
required
The unique identifier of the invoice being paid.

Request body

number
required
Payment amount.
string
required
ISO 4217 currency code (e.g. USD).
string
required
Payment method (e.g. EFT, Check, Wire, Cash).
string (ISO 8601)
required
Date the payment was received.
string
External reference number (e.g. cheque number, wire reference, bank trace ID).
string
Internal notes about this payment.
string
If paid using a saved card on file, the payment profile ID.
string
Card brand if applicable (e.g. Visa, Mastercard).
string
Last four digits of the card if applicable.
string
Payment status to record. Defaults to Completed.

Example request

Response

Returns 200 OK with the updated invoice object, now in Paid status.

Complete a hosted payment

Marks a pending payment as complete after a successful hosted payment transaction (e.g. WorldPay). Nymble Commerce calls this internally after receiving the payment provider callback, but you can also call it directly if you need to complete a payment that was initiated via POST /api/payments/worldpay/transaction-setup.

Path parameters

string
required
The unique identifier of the invoice.
string
required
The ID of the pending payment record to complete.

Example request

Response

Returns 200 OK with the updated invoice object.

Refund a payment

Issues a partial or full refund against a specific payment on the invoice. The invoice balance and status update to reflect the refund. Multiple refunds can be applied to the same payment up to the original payment amount.

Path parameters

string
required
The unique identifier of the invoice.
string
required
The ID of the payment to refund.

Request body

number
required
Amount to refund. Must not exceed the payment’s net amount.
string
Refund reference number.
string
Reason or notes for the refund.

Example request

Response

Returns 200 OK with the updated invoice object, including the new refund record.

Mark a payment as failed

Marks a pending payment attempt as failed. Use this when the payment provider reports a declined or failed transaction that was initiated through the hosted payment flow.

Path parameters

string
required
The unique identifier of the invoice.

Example request

Response

Returns 200 OK. The payment record is updated to Failed status; the invoice balance is unchanged.

Apply a discount

Applies an order-level discount to an invoice. You can apply a fixed amount or a percentage. Applying a discount to an invoice that already has one replaces the existing discount.

Path parameters

string
required
The unique identifier of the invoice.

Request body

object
required
The discount to apply.

Example request

Response

Returns 200 OK with the updated invoice object reflecting the new discountAmount and invoiceTotal.

Remove a discount

Removes the order-level discount from an invoice. Line-item discounts are not affected.

Path parameters

string
required
The unique identifier of the invoice.

Example request

Response

Returns 200 OK with the updated invoice object.

Void an invoice

Voids an invoice that is in Draft or Issued status. Voiding removes the invoice from accounts receivable. You cannot void an invoice that has recorded payments — refund all payments first.
Voiding is irreversible. Once voided, an invoice cannot be reinstated. Use void for invoices that were created in error.

Path parameters

string
required
The unique identifier of the invoice to void.

Example request

Response

Returns 200 OK with the invoice object in Voided status.

Cancel an invoice

Cancels an invoice. Unlike voiding, cancellation retains the full invoice record for audit and reporting purposes. Use cancel for legitimate business cancellations (e.g. order cancelled by customer).
Cancellation is irreversible. The invoice record is preserved but no further actions can be taken on it.

Path parameters

string
required
The unique identifier of the invoice to cancel.

Example request

Response

Returns 200 OK with the invoice object in Cancelled status.

Delete an invoice

Permanently deletes a Draft invoice. You cannot delete an invoice that has been issued or has any payment history — void or cancel it instead.

Path parameters

string
required
The unique identifier of the draft invoice to delete.

Example request

Response

Returns 204 No Content on success.