Managed to resolve this myself in the end.
I get the order data I need for refunding using this...
Query:
query ($id: ID!) {
node(id:$id) {
id
...on Order {
name
email
id
lineItems(first: 100) {
edges {
node {
id
refundableQuantity
}
}
}
transactions(first: 5) {
id
kind
gateway
parentTransaction {
id
}
amountSet {
shopMoney {
amount
currencyCode
}
}
}
}
}
}
Variables:
{
"id": "gid://shopify/Order/40461712*****"
}
Then run the refund...
Query:
mutation refundCreate($input: RefundInput!) {
refundCreate(input: $input) {
order {
id
}
refund {
id
}
userErrors {
field
message
}
}
}
Variables:
{
"input":{
"orderId": "gid://shopify/Order/40461712****",
"note": "Agechecked.com - Unable to verify age",
"notify": true,
"refundLineItems": {
"lineItemId": "gid://shopify/LineItem/103967428****",
"quantity": 1
},
"shipping": {
"fullRefund": true
},
"transactions": {
"amount": "6.99",
"gateway": "bogus",
"kind": "REFUND",
"parentId": "gid://shopify/OrderTransaction/48704215****",
"orderId": "gid://shopify/Order/40461712****"
}
}
}
Hope it helps someone else.