Failed to refund via REST API

Topic summary

A developer is encountering an error when attempting to process a refund through Shopify’s REST API. The API returns “cannot refund more than refundable quantity” despite the order being fulfilled and marked as returned.

Key Details:

  • Using Shopify Admin REST API version 2023-10
  • Refund parameters appear correct: quantity (1), line_item_id, and amount are within refundable limits
  • Request includes refund_line_items with detailed pricing breakdown and a transaction object
  • The error persists even though the developer has cross-checked that the line_item ID and quantity match the order

Current Status:
The issue remains unresolved with no responses or solutions provided yet. The developer has shared complete request/response logs showing the API call structure and error message.

Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Getting the following response during refund REST API. The order is fulfilled and the marked as returned on the shopify. The quantity and amount are within the refundable parameters. The line_item id and quantity are correct as corss checked. Below are the attached logs:

REQUEST:

URL: https://***/admin/api/2023-10/orders/***/refunds.json

Method: POST

Body: {
    "refund": {
        "currency": "INR",
        "notify": true,
        "note": "",
        "shipping": {
            "amount": 0
        },
        "refund_line_items": [
            {
                "quantity": 1,
                "line_item_id": ***,
                "location_id": null,
                "restock_type": "no_restock",
                "price": "1421.00",
                "subtotal": "1271.19",
                "total_tax": "136.20",
                "discounted_price": "1421.00",
                "discounted_total_price": "1421.00",
                "total_cart_discount_amount": "149.81"
            }
        ],
        "transactions": [
            {
                "order_id": ***,
                "kind": "refund",
                "gateway": "***",
                "parent_id": ***,
                "amount": "1271.19",
                "currency": "INR",
                "maximum_refundable": "5363.89"
            }
        ]
    }
}

RESPONSE: 

{
    "errors": {
        "refund_line_items": [
            "cannot refund more than refundable quantity"
        ]
    }
}