invoiceCreditHeadroom
Requires permission sales:credit_note:create.
Returns how much of a sales invoice has already been credited and how much is left to credit: the same figures the credit note create and update limit enforces. Pass excludeCreditNoteId to leave out a credit note you are editing.
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 InvoiceCreditHeadroom($invoiceId: ID!) {
invoiceCreditHeadroom(invoiceId: $invoiceId) {
invoiceNumber
alreadyCredited
creditNoteCount
currency
invoiceId
invoiceStatus
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query InvoiceCreditHeadroom($invoiceId: ID!) {\n invoiceCreditHeadroom(invoiceId: $invoiceId) {\n invoiceNumber\n alreadyCredited\n creditNoteCount\n currency\n invoiceId\n invoiceStatus\n }\n}",
"variables": {
"invoiceId": "id"
}
}
EOF
Variables:
{
"invoiceId": "id"
}
Response:
{
"data": {
"invoiceCreditHeadroom": {
"invoiceNumber": "string",
"alreadyCredited": 0,
"creditNoteCount": 0,
"currency": "string",
"invoiceId": "id",
"invoiceStatus": "string"
}
}
}
invoiceCreditHeadroom(
excludeCreditNoteId: ID
invoiceId: ID!
): InvoiceCreditHeadroom!
Arguments
invoiceCreditHeadroom.excludeCreditNoteId ● ID scalar
A credit note to leave out of the already-credited total, such as the one being edited.
invoiceCreditHeadroom.invoiceId ● ID! non-null scalar
The ID of the sales invoice.
Type
InvoiceCreditHeadroom object
How much of a sales invoice has been credited and how much is left to credit.