createPurchaseReturn
Requires permission purchase:debit_note:create.
Starts a return of goods to a supplier, against a goods receipt (GRN) or a purchase order. The supplier must exist with the supplier role, the document and products must exist, and a unit cost must be resolvable for each line. Needs the purchase returns feature on your plan and the debit notes create permission; a return that does not wait for approval (requiresApproval false) is approved as it is created and also needs the debit notes approve permission.
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 CreatePurchaseReturn($input: CreatePurchaseReturnInput!) {
createPurchaseReturn(input: $input) {
id
returnNumber
rmaNumber
status
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreatePurchaseReturn($input: CreatePurchaseReturnInput!) {\n createPurchaseReturn(input: $input) {\n id\n returnNumber\n rmaNumber\n status\n }\n}",
"variables": {
"input": {
"items": [
{
"condition": "string",
"productId": "string",
"quantity": 0,
"variantId": "string"
}
],
"reason": "string",
"supplierId": "string",
"warehouseId": "string"
}
}
}
EOF
Variables:
{
"input": {
"items": [
{
"condition": "string",
"productId": "string",
"quantity": 0,
"variantId": "string"
}
],
"reason": "string",
"supplierId": "string",
"warehouseId": "string"
}
}
Response:
{
"data": {
"createPurchaseReturn": {
"id": "string",
"returnNumber": "string",
"rmaNumber": "string",
"status": "string"
}
}
}
createPurchaseReturn(
input: CreatePurchaseReturnInput!
): ReturnResponse!
Arguments
createPurchaseReturn.input ● CreatePurchaseReturnInput! non-null input
The details of the purchase return to create.
Type
ReturnResponse object
A return created through the RMA flow.