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.| State | Description |
|---|---|
Draft | Invoice has been created but not yet sent. Still editable. Not yet payable. |
Issued | Invoice has been issued to the customer and is now payable. |
PartiallyPaid | One or more payments have been recorded, but a balance remains. |
Paid | The invoice has been paid in full (balance = 0). |
Voided | Removed from accounts receivable. Only possible from Draft or Issued. Irreversible. |
Cancelled | Administratively cancelled. The record is preserved for audit purposes. Irreversible. |
The invoice object
Unique identifier for the invoice (GUID).
The tenant organization this invoice belongs to.
The ID of the order this invoice is associated with.
Human-readable order number.
Human-readable invoice number (e.g.
INV-00892). Supply your own on import to preserve existing numbers.Your system’s identifier for this invoice.
Current invoice state:
Draft, Issued, PartiallyPaid, Paid, Voided, or Cancelled.The date the invoice was created.
The payment due date.
Payment terms (e.g.
Net30).ISO 4217 currency code (e.g.
USD).Customer’s purchase order number.
Free-text notes on the invoice.
Customer details. Includes
customerNumber, companyName, companyEmail, companyPhone, billingAddress, and shippingAddress.Sales rep details. Includes
repNumber, firstName, lastName, fullName, email, phoneNumber.Invoice line items.
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
Filter invoices by customer ID.
Filter invoices by order ID. Use this to retrieve all invoices for a specific order.
Filter by invoice status:
Draft, Issued, PartiallyPaid, Paid, Voided, or Cancelled.Page number. Defaults to
1.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
The unique identifier (GUID) of the invoice.
Example request
Response
Returns200 OK with the full invoice object.
Create an invoice
Creates a new invoice inDraft 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.
Request body
The ID of the order this invoice is for.
The order number. Optional — used for display purposes.
Supply an existing invoice number to import it. When omitted, Nymble Commerce generates one automatically.
Customer details for the invoice.
Sales rep details.
Customer’s purchase order number.
The invoice date.
The payment due date.
Payment terms (e.g.
Net30, Net60).ISO 4217 currency code (e.g.
USD).Free-text notes.
Invoice line items.
Tax amount to apply.
Order-level discount. Fields:
code, type (Percentage or Amount), value, description.Authoritative total from an external system. When supplied, overrides the computed line-item total.
Outstanding balance from an external system. Supply alongside
importedInvoiceTotal — Nymble Commerce derives the amount paid as importedInvoiceTotal − importedBalance.Set to
false to soft-delete the matching invoice on import. Defaults to true.Example request
Response
Returns201 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. UseinvoiceNumber on each entry to make the import idempotent.
Request body
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 inDraft status.
Path parameters
The unique identifier of the invoice to update.
Request body
Accepts the same fields asPOST /api/invoices. Only supply fields you want to change.
Example request
Response
Returns200 OK with the updated invoice object.
Issue an invoice
Transitions an invoice fromDraft 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
The unique identifier of the invoice to issue.
Example request
Response
Returns200 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 toPartiallyPaid or Paid based on the resulting balance.
Path parameters
The unique identifier of the invoice being paid.
Request body
Payment amount.
ISO 4217 currency code (e.g.
USD).Payment method (e.g.
EFT, Check, Wire, Cash).Date the payment was received.
External reference number (e.g. cheque number, wire reference, bank trace ID).
Internal notes about this payment.
If paid using a saved card on file, the payment profile ID.
Card brand if applicable (e.g.
Visa, Mastercard).Last four digits of the card if applicable.
Payment status to record. Defaults to
Completed.Example request
Response
Returns200 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 viaPOST /api/payments/worldpay/transaction-setup.
Path parameters
The unique identifier of the invoice.
The ID of the pending payment record to complete.
Example request
Response
Returns200 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
The unique identifier of the invoice.
The ID of the payment to refund.
Request body
Amount to refund. Must not exceed the payment’s net amount.
Refund reference number.
Reason or notes for the refund.
Example request
Response
Returns200 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
The unique identifier of the invoice.
Example request
Response
Returns200 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
The unique identifier of the invoice.
Request body
The discount to apply.
Example request
Response
Returns200 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
The unique identifier of the invoice.
Example request
Response
Returns200 OK with the updated invoice object.
Void an invoice
Voids an invoice that is inDraft or Issued status. Voiding removes the invoice from accounts receivable. You cannot void an invoice that has recorded payments — refund all payments first.
Path parameters
The unique identifier of the invoice to void.
Example request
Response
Returns200 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).Path parameters
The unique identifier of the invoice to cancel.
Example request
Response
Returns200 OK with the invoice object in Cancelled status.
Delete an invoice
Permanently deletes aDraft invoice. You cannot delete an invoice that has been issued or has any payment history — void or cancel it instead.
Path parameters
The unique identifier of the draft invoice to delete.
Example request
Response
Returns204 No Content on success.