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:
- GraphQL
- cURL
query InvoiceCancellationPreview($id: ID!) {
invoiceCancellationPreview(id: $id) {
invoiceNumber
orderNumber
blockers
canCancel
creditUsedElsewhereAmount
currentOrderStatus
allocations {
id
paymentNumber
amount
paymentId
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query InvoiceCancellationPreview($id: ID!) {\n invoiceCancellationPreview(id: $id) {\n invoiceNumber\n orderNumber\n blockers\n canCancel\n creditUsedElsewhereAmount\n currentOrderStatus\n allocations {\n id\n paymentNumber\n amount\n paymentId\n }\n }\n}",
"variables": {
"id": "id"
}
}
EOF
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.