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:
- GraphQL
- cURL
mutation ApplyCreditNote($amount: Float!, $id: ID!, $invoiceId: ID!) {
applyCreditNote(amount: $amount, id: $id, invoiceId: $invoiceId) {
id
creditNoteNumber
partnerName
status
type
createdAt
createdBy {
name
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ApplyCreditNote($amount: Float!, $id: ID!, $invoiceId: ID!) {\n applyCreditNote(amount: $amount, id: $id, invoiceId: $invoiceId) {\n id\n creditNoteNumber\n partnerName\n status\n type\n createdAt\n createdBy {\n name\n }\n }\n}",
"variables": {
"amount": 0,
"id": "id",
"invoiceId": "id"
}
}
EOF
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:
- GraphQL
- cURL
mutation ApplyCreditNote($id: ID!, $invoiceId: ID!, $amount: Float!) {
applyCreditNote(id: $id, invoiceId: $invoiceId, amount: $amount) {
id
creditNoteNumber
status
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ApplyCreditNote($id: ID!, $invoiceId: ID!, $amount: Float!) {\n applyCreditNote(id: $id, invoiceId: $invoiceId, amount: $amount) {\n id\n creditNoteNumber\n status\n }\n}",
"variables": {
"id": "CREDIT_NOTE_ID",
"invoiceId": "INVOICE_ID",
"amount": 100
}
}
EOF
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.