# Refund Allocation This article explains how to correctly allocate refunds when delivering orders in multiple shipments. ## The Challenge When customers return goods from a partially delivered order, the refund should be allocated to the invoice corresponding to the returned shipment. However, this isn't always the case, leading to customer confusion. ## The Solution Kustom can correctly allocate refunds based on the order lines in the capture and refund requests. To ensure accurate allocation: 1. **Identify the Capture:** Determine the specific capture corresponding to the returned goods. Example: If a customer returns a pair of sneakers from a two-part delivery (Capture A for T-shirt/jeans, and Capture B for sneakers), you need to focus on Capture B. 2. **Consistent Order Lines:** Ensure the order lines in your refund request have the same `reference` attributes as the order lines in the corresponding capture request. This is critical for correct allocation. 3. **Request a Refund:** Use the Order management API to send a refund request, including order lines matching the specific capture. ## Conditions Correct refund allocation depends on these conditions: - No previous failed refund allocations for the order. - The total amount of refunded order lines matches the refund amount. - The refunded amount must be less than or equal to the `captured_amount` in the specific capture being refunded. ```json { "captured_amount": 10000, "description": "Capture A, shipping part of the order", "order_lines": [ { "reference": "A12345", "name": "T-shirt", "type": "physical", "quantity": 1, "total_amount": 3000, "unit_price": 3000 }, { "reference": "A98765", "name": "Jeans", "type": "physical", "quantity": 1, "total_amount": 7000, "unit_price": 7000 } ] } ``` ```json { "refunded_amount": 10000, "description": "Returning the sneakers", "order_lines": [ { "reference": "B24680", "name": "Sneakers", "type": "physical", "quantity": 1, "total_amount": 10000, "unit_price": 10000 } ] } ``` For more details on API calls, refer to the related documentation on [refunding an order](/contents/order-management/manage-orders-with-the-api/refund-and-extend-orders).