Skip to main content

getReturnsByCustomer

Requires permission sales:credit_note:list.

Lists the returns of one customer. Needs the credit notes list permission; a rep sees only their own customers' returns.

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:

query GetReturnsByCustomer($customerId: String!) {
getReturnsByCustomer(customerId: $customerId) {
id
returnNumber
status
type
createdAt
baseTotalAmount
creditNotes {
id
creditNoteNumber
status
type
amount
issueDate
}
}
}

Variables:

{
"customerId": "string"
}

Response:

{
"data": {
"getReturnsByCustomer": [
{
"id": "id",
"returnNumber": "string",
"status": "APPROVED",
"type": "DEFECTIVE_RETURN",
"createdAt": "2025-01-15T00:00:00Z",
"baseTotalAmount": 0,
"creditNotes": [
{
"id": "id",
"creditNoteNumber": "string",
"status": "string",
"type": "string",
"amount": 0,
"issueDate": "2025-01-15T00:00:00Z"
}
]
}
]
}
}
getReturnsByCustomer(
customerId: String!
): [ProductReturn!]!

Arguments​

getReturnsByCustomer.customerId ● String! non-null scalar​

The ID of the customer.

Type​

ProductReturn object​

A return of goods, sales or purchase side, with its lines and the notes raised from it.