Inquiry on how to use transactions during returnRefund

Topic summary

Issue: A user is attempting to implement the returnRefund mutation but is unsure how to obtain the required parentId for the orderTransactions field.

Code Context:

  • The mutation requires parentId as a mandatory parameter within orderTransactions
  • The refund input includes return line items, shipping refund details, and transaction amounts in KRW currency

Solution Provided:

  • The parentId must be retrieved by first fetching transaction details from the order being refunded
  • Use the Shopify Admin API’s Order query to access this information
  • Look specifically for transactions with a kind of CAPTURE or SALE associated with the order

Status: Partial solution provided; implementation details for the Order query may require further clarification.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

It says to put parentId in orderTransactions as mandatory. I don’t know how to get parentId.

mutation returnRefund($returnRefundInput: ReturnRefundInput!) {
  returnRefund(returnRefundInput: $returnRefundInput) {
    refund {
      id
    }
    userErrors {
      field
      message
    }
  }
}
{
  "returnRefundInput": {
    "notifyCustomer": true,
    "orderTransactions": [
      {
        "parentId": "?????????????????????",
        "transactionAmount": {
          "amount": "6600",
          "currencyCode": "KRW"
        }
      }
    ],
    "refundShipping": {
      "fullRefund": true,
      "shippingRefundAmount": {
        "amount": "26000",
        "currencyCode": "KRW"
      }
    },
    "returnId": "gid://shopify/Return/5151096890",
    "returnRefundLineItems": [
      {
        "quantity": 1,
        "returnLineItemId": "gid://shopify/LineItem/12962798272570"
      }
    ]
  }
}

To get the parentId, you first need to fetch the transaction details of the order you are refunding. This can be done using the Order query of the Shopify Admin API. You should look for transactions associated with the order that have a kind of CAPTURE or SALE.