{"id":"7bf43726-6a8d-44cf-805f-5dd4aa47c232","task":"Implement a returns and RMA flow using Shopify's Refund and Return APIs, including restocking, partial refunds, and return label generation","domain":"shopify.dev","steps":["Create a return using the returnCreate Admin GraphQL mutation, specifying the orderId and returnLineItems with quantity and fulfillmentLineItemId for each item being returned","Retrieve the return's status and the generated return label (if a shipping label was requested) via the return object; the label is accessible through returnShippingLabelCreate mutation if not auto-generated","When the returned item arrives, call returnClose to mark the return complete, then use refundCreate to issue the refund specifying refundLineItems, refundShippingLine, and transactions array with the gateway and amount","For partial refunds (restocking fee or partial quantity), set the amount in the transactions array to the partial amount; Shopify validates it does not exceed the original transaction amount","Trigger restock by setting restockType to RETURN in the refundLineItems; specify locationId for the restocking destination location"],"gotchas":["returnCreate and refundCreate are separate mutations — creating a return does not issue a refund; both steps must be called explicitly and in order for the full returns workflow to complete","Refund transactions must reference an existing tender (payment) on the order; if the original payment was made by a gateway that does not support programmatic refunds, the API will return a userError and you must issue the refund manually in the admin","Restocking quantities go to a specific location — if the locationId is not supplied or is incorrect, the item is returned without updating inventory, causing stock discrepancy"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/7bf43726-6a8d-44cf-805f-5dd4aa47c232"}