Skip to main content

createSalesReturn

Requires the permissions sales:credit_note:approve and sales:credit_note:create.

Starts a return request (RMA) for a customer against a sales invoice. The invoice must exist, every product returned must be on it, and the invoice must be no more than 30 days old unless the request is marked as a customer request. This is the invoice-based flow; the order-based flow is createReturn, and a return created in one flow cannot be advanced by the other. The return is approved as it is created, so it needs the credit notes create and approve permissions, and the customer must be one you may see.

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 CreateSalesReturn($input: CreateSalesReturnInput!) {
createSalesReturn(input: $input) {
id
returnNumber
rmaNumber
status
}
}

Variables:

{
"input": {
"customerId": "string",
"invoiceId": "string",
"items": [
{
"condition": "string",
"productId": "string",
"quantity": 0,
"variantId": "string"
}
],
"reason": "string",
"refundMethod": "BANK_TRANSFER",
"warehouseId": "string"
}
}

Response:

{
"data": {
"createSalesReturn": {
"id": "string",
"returnNumber": "string",
"rmaNumber": "string",
"status": "string"
}
}
}

Create a sales return refunded as a credit note:

mutation CreateSalesReturn($input: CreateSalesReturnInput!) {
createSalesReturn(input: $input) {
id
returnNumber
status
}
}

Variables:

{
"input": {
"customerId": "CUSTOMER_ID",
"invoiceId": "INVOICE_ID",
"warehouseId": "WAREHOUSE_ID",
"reason": "Item returned",
"refundMethod": "CREDIT_NOTE",
"items": [
{
"productId": "PRODUCT_ID",
"variantId": "VARIANT_ID",
"quantity": 1,
"condition": "GOOD"
}
]
}
}

Response:

{
"data": {
"createSalesReturn": {
"id": "RETURN_ID",
"returnNumber": "RETURN_NUMBER",
"status": "PENDING"
}
}
}
createSalesReturn(
input: CreateSalesReturnInput!
): ReturnResponse!

Arguments​

createSalesReturn.input ● CreateSalesReturnInput! non-null input​

The details of the sales return to create.

Type​

ReturnResponse object​

A return created through the RMA flow.