appCreateCreditNote
Requires permission sales:credit_note:create.
Propose a goodwill credit note from an installed app, against one of the organization's sales invoices. It is for the invoice's customer, in the invoice's currency, and within what is left to credit on the invoice. It does not exist until a person approves it: the call answers CONTROL_APPROVAL_REQUIRED with the approval request's ID, and the note is written when the request is approved and applied. Needs write_credit_notes.
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 AppCreateCreditNote($input: AppCreateCreditNoteInput!) {
appCreateCreditNote(input: $input) {
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 AppCreateCreditNote($input: AppCreateCreditNoteInput!) {\n appCreateCreditNote(input: $input) {\n id\n creditNoteNumber\n partnerName\n status\n type\n createdAt\n createdBy {\n name\n }\n }\n}",
"variables": {
"input": {
"invoiceId": "id",
"lines": [
{
"description": "string",
"quantity": 0,
"unitPrice": 0
}
],
"reason": "string"
}
}
}
EOF
Variables:
{
"input": {
"invoiceId": "id",
"lines": [
{
"description": "string",
"quantity": 0,
"unitPrice": 0
}
],
"reason": "string"
}
}
Response:
{
"data": {
"appCreateCreditNote": {
"id": "id",
"creditNoteNumber": "string",
"partnerName": "string",
"status": "string",
"type": "string",
"createdAt": "2025-01-15T00:00:00Z",
"createdBy": {
"name": "string"
}
}
}
}
appCreateCreditNote(
input: AppCreateCreditNoteInput!
): CreditNote!
Arguments
appCreateCreditNote.input ● AppCreateCreditNoteInput! non-null input
The invoice, the reason and the credit lines.
Type
CreditNote object
A credit note: money owed back to a customer, from a sales return, a price adjustment or goodwill.