processReturn
Requires permission sales:credit_note:create.
Processes a PENDING return. With action PROCESS (or APPROVE, which means the same here) the return becomes PROCESSED: for each restockable line with an accepted quantity, stock moves through the inventory ledger (stock comes back for a sales return and leaves for a purchase return), and a credit note (sales return) or debit note (purchase return) is created when you send its details. For each line, accepted plus rejected cannot exceed the quantity returned. A note amount above the value of the accepted lines is refused unless you hold the override-note-amount permission. With action REJECT the return is closed without touching stock or money. Only a PENDING return can be processed, and only once.
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 ProcessReturn($input: ProcessReturnInput!) {
processReturn(input: $input) {
creditNoteId
debitNoteId
message
updatedReturn {
id
returnNumber
status
type
createdAt
baseTotalAmount
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ProcessReturn($input: ProcessReturnInput!) {\n processReturn(input: $input) {\n creditNoteId\n debitNoteId\n message\n updatedReturn {\n id\n returnNumber\n status\n type\n createdAt\n baseTotalAmount\n }\n }\n}",
"variables": {
"input": {
"action": "APPROVE",
"processedItems": [
{
"acceptedQuantity": 0,
"itemId": "string",
"rejectedQuantity": 0,
"restockable": true
}
],
"returnId": "string"
}
}
}
EOF
Variables:
{
"input": {
"action": "APPROVE",
"processedItems": [
{
"acceptedQuantity": 0,
"itemId": "string",
"rejectedQuantity": 0,
"restockable": true
}
],
"returnId": "string"
}
}
Response:
{
"data": {
"processReturn": {
"creditNoteId": "string",
"debitNoteId": "string",
"message": "string",
"updatedReturn": {
"id": "id",
"returnNumber": "string",
"status": "APPROVED",
"type": "DEFECTIVE_RETURN",
"createdAt": "2025-01-15T00:00:00Z",
"baseTotalAmount": 0
}
}
}
}
processReturn(
input: ProcessReturnInput!
): ProcessReturnResponse!
Arguments
processReturn.input ● ProcessReturnInput! non-null input
The details of the process return request.
Type
ProcessReturnResponse object
The result of processing a return.