This feature allows merchants to report return fees in Shopify using metafields. The refund fees deducted for refunds in yayloh will be stored in the order metafields, helping retailers' ERP systems read and process refund fee details for accurate bookkeeping. This integration ensures that all financial records remain accurate and up to date.
Note:
ERP Integration: The ERP system should be configured to read the return_fee metafield from orders.
yayloh Metafield Structure
The return fee details will be stored in an order metafield with the following structure:
{
"id": "gid://shopify/Metafield/37791328633111",
"namespace": "yayloh",
"key": "return_fee",
"value": {
"amount": "10.00",
"currency_code": "SEK"
},
"type": "money"
}
How to fetch Return Fees via GraphQL? (For your ERP)
ERP systems can retrieve the return fee data from Shopify using the following GraphQL query:
query {
order(id: "gid://shopify/Order/6344849424663") {
id
name
metafields(first: 10) {
edges {
node {
id
namespace
key
value
type
}
}
}
}
}
Example Response
{
"data": {
"order": {
"id": "gid://shopify/Order/6344849424663",
"name": "DEV51286",
"metafields": {
"edges": [
{
"node": {
"id": "gid://shopify/Metafield/37791328633111",
"namespace": "yayloh",
"key": "return_fee",
"value": "{\"amount\":\"10.00\",\"currency_code\":\"SEK\"}",
"type": "money"
}
}
]
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 7,
"actualQueryCost
Good to Know
Formula:
return_feeis calculated asShopify Suggested Refund Amount - Actual Refunded Amount.Positive Value (
+X): Indicates a return fee was charged and deducted from the customer's refund (e.g., standard restocking or return shipping fee).Zero Value (
0): Indicates no return fee was deducted (the actual amount refunded matches Shopify's suggested product value).Negative Value (
-X): Occurs when the merchant refunds more than Shopify's suggested product value—most commonly when the merchant chooses to reimburse the original outbound delivery/shipping fee alongside the returned items.
