Skip to main content

applyCreditNote

Requires permission sales:credit_note:update.

Applies an amount of an APPROVED credit note to a sales invoice, reducing what the customer owes on it. The amount must be positive and cannot exceed the note's remaining amount. The invoice must be a sales invoice of the same customer, in the same currency, and in a status that can still take payment.

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:

mutation ApplyCreditNote($amount: Float!, $id: ID!, $invoiceId: ID!) {
applyCreditNote(amount: $amount, id: $id, invoiceId: $invoiceId) {
id
creditNoteNumber
partnerName
status
type
createdAt
createdBy {
name
}
}
}

Variables:

{
"amount": 0,
"id": "id",
"invoiceId": "id"
}

Response:

{
"data": {
"applyCreditNote": {
"id": "id",
"creditNoteNumber": "string",
"partnerName": "string",
"status": "string",
"type": "string",
"createdAt": "2025-01-15T00:00:00Z",
"createdBy": {
"name": "string"
}
}
}
}

Apply a credit note to an invoice:

mutation ApplyCreditNote($id: ID!, $invoiceId: ID!, $amount: Float!) {
applyCreditNote(id: $id, invoiceId: $invoiceId, amount: $amount) {
id
creditNoteNumber
status
}
}

Variables:

{
"id": "CREDIT_NOTE_ID",
"invoiceId": "INVOICE_ID",
"amount": 100
}

Response:

{
"data": {
"applyCreditNote": {
"id": "CREDIT_NOTE_ID",
"creditNoteNumber": "CREDIT_NOTE_NUMBER",
"status": "APPROVED"
}
}
}
applyCreditNote(
amount: Float!
id: ID!
invoiceId: ID!
): CreditNote!

Arguments​

applyCreditNote.amount ● Float! non-null scalar​

The amount to apply against the invoice.

applyCreditNote.id ● ID! non-null scalar​

The ID of the credit note.

applyCreditNote.invoiceId ● ID! non-null scalar​

The ID of the sales invoice to apply the credit to.

Type​

CreditNote object​

A credit note: money owed back to a customer, from a sales return, a price adjustment or goodwill.