Skip to main content

createCreditNote

Requires permission sales:credit_note:create.

Creates a credit note for a customer, optionally against a sales invoice or a return. It starts as PENDING. A note against an invoice takes that invoice's currency and exchange rate; a standalone note uses the organization's base currency. The server works out the note's money from its lines, and the amount credited across an invoice's notes cannot exceed the invoice; see invoiceCreditHeadroom.

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 CreateCreditNote($input: CreateCreditNoteInput!) {
createCreditNote(input: $input) {
id
creditNoteNumber
partnerName
status
type
createdAt
createdBy {
name
}
}
}

Variables:

{
"input": {
"amount": 0,
"items": [
{
"amount": 0,
"description": "string",
"quantity": 0,
"unitPrice": 0
}
],
"partnerId": "string",
"reason": "string",
"type": "string"
}
}

Response:

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

Issue a credit note for a returned item:

mutation CreateCreditNote($input: CreateCreditNoteInput!) {
createCreditNote(input: $input) {
id
creditNoteNumber
status
currency
totalAmount
}
}

Variables:

{
"input": {
"partnerId": "CUSTOMER_ID",
"type": "SALES_RETURN",
"reason": "Item returned",
"amount": 100,
"originalInvoiceId": "INVOICE_ID",
"items": [
{
"description": "Line description",
"quantity": 1,
"unitPrice": 100,
"amount": 100
}
]
}
}

Response:

{
"data": {
"createCreditNote": {
"id": "CREDIT_NOTE_ID",
"creditNoteNumber": "CREDIT_NOTE_NUMBER",
"status": "DRAFT",
"currency": "CURRENCY_CODE",
"totalAmount": 100
}
}
}
createCreditNote(
input: CreateCreditNoteInput!
): CreditNote!

Arguments​

createCreditNote.input ● CreateCreditNoteInput! non-null input​

The details of the credit note to create.

Type​

CreditNote object​

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