Skip to main content

invoiceCancellationPreview

Requires at least one of the permissions payments:invoice:read or purchase:purchase_invoice:read.

Shows what cancelInvoice would do without changing anything: whether it can be cancelled, the blockers that would stop it, the payment allocations it would reverse, and the estimated credit note amount. cancelInvoice acts on the same reading and is rejected if its outcome would differ.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query InvoiceCancellationPreview($id: ID!) {
invoiceCancellationPreview(id: $id) {
invoiceNumber
orderNumber
blockers
canCancel
creditUsedElsewhereAmount
currentOrderStatus
allocations {
id
paymentNumber
amount
paymentId
}
}
}

Variables:

{
"id": "id"
}

Response:

{
"data": {
"invoiceCancellationPreview": {
"invoiceNumber": "string",
"orderNumber": "string",
"blockers": [
"string"
],
"canCancel": true,
"creditUsedElsewhereAmount": 0,
"currentOrderStatus": "string",
"allocations": [
{
"id": "id",
"paymentNumber": "string",
"amount": 0,
"paymentId": "id"
}
]
}
}
}
invoiceCancellationPreview(
id: ID!
): InvoiceCancellationPreview!

Arguments​

invoiceCancellationPreview.id ● ID! non-null scalar​

The ID of the invoice.

Type​

InvoiceCancellationPreview object​

A side-effect-free preview of cancelling an invoice: whether it can be cancelled, what blocks it, and the payments, credit notes, stock and commission effects.