What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

refund the line_item in fulfillment process not the unfulfilled one

refund the line_item in fulfillment process not the unfulfilled one

lisiming
New Member
11 0 0

Hi, Shopify devs,

I ordered 4 products and created the fulfillment of three of them, then I created a refund of the last one of line_items. But In the end, the unfulfilled line_item wasn't removed and one of the line_item in process was refunded. How can I refund the unfulfilled one not the one in fulfillment process?

Here is my request.

{
    "refund":{
        "currency":"EUR",
        "note":"",
        "notify":true,
        "refund_line_items":[
            {
                "line_item_id":"10189000736955",
                "quantity":1,
                "restock_type":"no_restock"
            }
        ],
        "shipping":{
            "amount":0,
            "full_refund":false
        },
        "transactions":[
            {
                "amount":13.2,
                "currency":"EUR",
                "gateway":"bogus",
                "kind":"refund",
                "order_id":"3951865364667",
                "parent_id":"4906332881083"
            }
        ]
    }
}

 

Replies 3 (3)

garyrgilbert
Shopify Partner
431 41 187

 

Can you share the original orders line_item section of the json object?

The only way that the refund didn't work as expected, that I can think of, is if you gave the wrong line_item id in your refund object. To make sure you select the right line_item id from the order double check the fulfillment_status of the order line_items and make sure you refund the one thats not "fulfilled"

If you did all that then the problem "might" not be on your side 😉

 

Cheers

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
lisiming
New Member
11 0 0

There is the order object.

{
    "order": {
        "id": 3951865364667,
        "admin_graphql_api_id": "gid://shopify/Order/3951865364667",
        "app_id": 580111,
        "browser_ip": "148.153.60.102",
        "buyer_accepts_marketing": false,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": "95151d1768ffd3eee18f03ded6d4f5b8",
        "checkout_id": 21670251233467,
        "checkout_token": "d94791f1a43568d20c28da7e5087c0bc",
        "client_details": {
            "accept_language": "zh-CN,zh;q=0.9",
            "browser_height": 798,
            "browser_ip": "148.153.60.102",
            "browser_width": 1440,
            "session_hash": null,
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
        },
        "closed_at": null,
        "confirmed": true,
        "contact_email": "simingli@clubfactory.com",
        "created_at": "2021-08-02T08:04:18-04:00",
        "currency": "EUR",
        "current_subtotal_price": "33.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "33.00",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "33.00",
                "currency_code": "EUR"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "EUR"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "41.16",
        "current_total_price_set": {
            "shop_money": {
                "amount": "41.16",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "41.16",
                "currency_code": "EUR"
            }
        },
        "current_total_tax": "6.86",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "6.86",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "6.86",
                "currency_code": "EUR"
            }
        },
        "customer_locale": "zh-TW",
        "device_id": null,
        "discount_codes": [],
        "email": "simingli@clubfactory.com",
        "financial_status": "partially_refunded",
        "fulfillment_status": null,
        "gateway": "bogus",
        "landing_site": "/",
        "landing_site_ref": null,
        "location_id": null,
        "name": "#1566",
        "note": "",
        "note_attributes": [],
        "number": 566,
        "order_number": 1566,
        "order_status_url": "https://307test.myshopify.com/43203068056/orders/61a417d976348b38a4023f5b13c44838/authenticate?key=a82df7004716e4a5d674da1879a459e4",
        "original_total_duties_set": null,
        "payment_gateway_names": [
            "bogus"
        ],
        "phone": null,
        "presentment_currency": "EUR",
        "processed_at": "2021-08-02T08:04:17-04:00",
        "processing_method": "direct",
        "reference": null,
        "referring_site": "",
        "source_identifier": null,
        "source_name": "web",
        "source_url": null,
        "subtotal_price": "44.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "44.00",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "44.00",
                "currency_code": "EUR"
            }
        },
        "tags": "",
        "tax_lines": [
            {
                "price": "9.06",
                "rate": 0.2,
                "title": "GB VAT",
                "price_set": {
                    "shop_money": {
                        "amount": "9.06",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "9.06",
                        "currency_code": "EUR"
                    }
                }
            }
        ],
        "taxes_included": false,
        "test": true,
        "token": "61a417d976348b38a4023f5b13c44838",
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "EUR"
            }
        },
        "total_line_items_price": "44.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "44.00",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "44.00",
                "currency_code": "EUR"
            }
        },
        "total_outstanding": "0.00",
        "total_price": "54.36",
        "total_price_set": {
            "shop_money": {
                "amount": "54.36",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "54.36",
                "currency_code": "EUR"
            }
        },
        "total_price_usd": "64.50",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "1.30",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "1.30",
                "currency_code": "EUR"
            }
        },
        "total_tax": "9.06",
        "total_tax_set": {
            "shop_money": {
                "amount": "9.06",
                "currency_code": "EUR"
            },
            "presentment_money": {
                "amount": "9.06",
                "currency_code": "EUR"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 0,
        "updated_at": "2021-08-02T08:06:05-04:00",
        "user_id": null,
        "billing_address": {
            "first_name": "kj",
            "address1": "kjhkh",
            "phone": null,
            "city": "Menlo Park",
            "zip": "NE63 8DW",
            "province": "England",
            "country": "United Kingdom",
            "last_name": "jjh",
            "address2": "111",
            "company": null,
            "latitude": 55.1775563,
            "longitude": -1.5762752,
            "name": "kj jjh",
            "country_code": "GB",
            "province_code": "ENG"
        },
        "customer": {
            "id": 4681828761787,
            "email": "simingli@clubfactory.com",
            "accepts_marketing": false,
            "created_at": "2021-02-19T01:18:12-05:00",
            "updated_at": "2021-08-02T08:13:45-04:00",
            "first_name": "kj",
            "last_name": "jjh",
            "orders_count": 2,
            "state": "disabled",
            "total_spent": "14.76",
            "last_order_id": 3951328067771,
            "note": null,
            "verified_email": true,
            "multipass_identifier": null,
            "tax_exempt": false,
            "phone": null,
            "tags": "",
            "last_order_name": "#1551",
            "currency": "EUR",
            "accepts_marketing_updated_at": "2021-02-19T01:18:12-05:00",
            "marketing_opt_in_level": null,
            "tax_exemptions": [],
            "admin_graphql_api_id": "gid://shopify/Customer/4681828761787",
            "default_address": {
                "id": 6319527788731,
                "customer_id": 4681828761787,
                "first_name": "kj",
                "last_name": "jjh",
                "company": null,
                "address1": "kjhkh",
                "address2": "111",
                "city": "Menlo Park",
                "province": "England",
                "country": "United Kingdom",
                "zip": "NE63 8DW",
                "phone": null,
                "name": "kj jjh",
                "province_code": "ENG",
                "country_code": "GB",
                "country_name": "United Kingdom",
                "default": true
            }
        },
        "discount_applications": [],
        "fulfillments": [
            {
                "id": 3477561639099,
                "admin_graphql_api_id": "gid://shopify/Fulfillment/3477561639099",
                "created_at": "2021-08-02T08:05:50-04:00",
                "location_id": 60196389051,
                "name": "#1566.1",
                "order_id": 3951865364667,
                "receipt": {},
                "service": "amoeba",
                "shipment_status": null,
                "status": "pending",
                "tracking_company": null,
                "tracking_number": null,
                "tracking_numbers": [],
                "tracking_url": null,
                "tracking_urls": [],
                "updated_at": "2021-08-02T08:05:50-04:00",
                "line_items": [
                    {
                        "id": 10189000736955,
                        "admin_graphql_api_id": "gid://shopify/LineItem/10189000736955",
                        "fulfillable_quantity": 1,
                        "fulfillment_service": "amoeba",
                        "fulfillment_status": null,
                        "gift_card": false,
                        "grams": 0,
                        "name": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile - Green",
                        "origin_location": {
                            "id": 2223540469912,
                            "country_code": "HK",
                            "province_code": "KL",
                            "name": "307test1",
                            "address1": "test",
                            "address2": "",
                            "city": "test",
                            "zip": "322222"
                        },
                        "price": "11.00",
                        "price_set": {
                            "shop_money": {
                                "amount": "11.00",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "11.00",
                                "currency_code": "EUR"
                            }
                        },
                        "product_exists": true,
                        "product_id": 6273866694843,
                        "properties": [],
                        "quantity": 3,
                        "requires_shipping": true,
                        "sku": "1000000391",
                        "taxable": true,
                        "title": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile",
                        "total_discount": "0.00",
                        "total_discount_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "EUR"
                            }
                        },
                        "variant_id": 38286122582203,
                        "variant_inventory_management": "shopify",
                        "variant_title": "Green",
                        "vendor": "amoeba",
                        "tax_lines": [
                            {
                                "price": "8.80",
                                "price_set": {
                                    "shop_money": {
                                        "amount": "8.80",
                                        "currency_code": "EUR"
                                    },
                                    "presentment_money": {
                                        "amount": "8.80",
                                        "currency_code": "EUR"
                                    }
                                },
                                "rate": 0.2,
                                "title": "GB VAT"
                            }
                        ],
                        "duties": [],
                        "discount_allocations": []
                    }
                ]
            }
        ],
        "line_items": [
            {
                "id": 10189000736955,
                "admin_graphql_api_id": "gid://shopify/LineItem/10189000736955",
                "fulfillable_quantity": 1,
                "fulfillment_service": "amoeba",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile - Green",
                "origin_location": {
                    "id": 2223540469912,
                    "country_code": "HK",
                    "province_code": "KL",
                    "name": "307test1",
                    "address1": "test",
                    "address2": "",
                    "city": "test",
                    "zip": "322222"
                },
                "price": "11.00",
                "price_set": {
                    "shop_money": {
                        "amount": "11.00",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "11.00",
                        "currency_code": "EUR"
                    }
                },
                "product_exists": true,
                "product_id": 6273866694843,
                "properties": [],
                "quantity": 4,
                "requires_shipping": true,
                "sku": "1000000391",
                "taxable": true,
                "title": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "EUR"
                    }
                },
                "variant_id": 38286122582203,
                "variant_inventory_management": "shopify",
                "variant_title": "Green",
                "vendor": "amoeba",
                "tax_lines": [
                    {
                        "price": "8.80",
                        "price_set": {
                            "shop_money": {
                                "amount": "8.80",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "8.80",
                                "currency_code": "EUR"
                            }
                        },
                        "rate": 0.2,
                        "title": "GB VAT"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_details": {
            "credit_card_bin": "1",
            "avs_result_code": null,
            "cvv_result_code": null,
            "credit_card_number": "•••• •••• •••• 1",
            "credit_card_company": "Bogus"
        },
        "refunds": [
            {
                "id": 811835949243,
                "admin_graphql_api_id": "gid://shopify/Refund/811835949243",
                "created_at": "2021-08-02T08:06:05-04:00",
                "note": "{\"reason\":\"Items unavailable\",\"type\":\"unfulfilled\"}",
                "order_id": 3951865364667,
                "processed_at": "2021-08-02T08:06:05-04:00",
                "restock": false,
                "total_duties_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "EUR"
                    }
                },
                "user_id": null,
                "order_adjustments": [],
                "transactions": [
                    {
                        "id": 4906335666363,
                        "admin_graphql_api_id": "gid://shopify/OrderTransaction/4906335666363",
                        "amount": "13.20",
                        "authorization": null,
                        "created_at": "2021-08-02T08:06:04-04:00",
                        "currency": "EUR",
                        "device_id": null,
                        "error_code": null,
                        "gateway": "bogus",
                        "kind": "refund",
                        "location_id": null,
                        "message": "Bogus Gateway: Forced success",
                        "order_id": 3951865364667,
                        "parent_id": 4906332881083,
                        "processed_at": "2021-08-02T08:06:04-04:00",
                        "receipt": {
                            "paid_amount": "13.20"
                        },
                        "source_name": "4833631",
                        "status": "success",
                        "test": true,
                        "user_id": null
                    }
                ],
                "refund_line_items": [
                    {
                        "id": 303633399995,
                        "line_item_id": 10189000736955,
                        "location_id": null,
                        "quantity": 1,
                        "restock_type": "no_restock",
                        "subtotal": 11.0,
                        "subtotal_set": {
                            "shop_money": {
                                "amount": "11.00",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "11.00",
                                "currency_code": "EUR"
                            }
                        },
                        "total_tax": 2.2,
                        "total_tax_set": {
                            "shop_money": {
                                "amount": "2.20",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "2.20",
                                "currency_code": "EUR"
                            }
                        },
                        "line_item": {
                            "id": 10189000736955,
                            "admin_graphql_api_id": "gid://shopify/LineItem/10189000736955",
                            "fulfillable_quantity": 1,
                            "fulfillment_service": "amoeba",
                            "fulfillment_status": null,
                            "gift_card": false,
                            "grams": 0,
                            "name": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile - Green",
                            "origin_location": {
                                "id": 2223540469912,
                                "country_code": "HK",
                                "province_code": "KL",
                                "name": "307test1",
                                "address1": "test",
                                "address2": "",
                                "city": "test",
                                "zip": "322222"
                            },
                            "price": "11.00",
                            "price_set": {
                                "shop_money": {
                                    "amount": "11.00",
                                    "currency_code": "EUR"
                                },
                                "presentment_money": {
                                    "amount": "11.00",
                                    "currency_code": "EUR"
                                }
                            },
                            "product_exists": true,
                            "product_id": 6273866694843,
                            "properties": [],
                            "quantity": 4,
                            "requires_shipping": true,
                            "sku": "1000000391",
                            "taxable": true,
                            "title": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile",
                            "total_discount": "0.00",
                            "total_discount_set": {
                                "shop_money": {
                                    "amount": "0.00",
                                    "currency_code": "EUR"
                                },
                                "presentment_money": {
                                    "amount": "0.00",
                                    "currency_code": "EUR"
                                }
                            },
                            "variant_id": 38286122582203,
                            "variant_inventory_management": "shopify",
                            "variant_title": "Green",
                            "vendor": "amoeba",
                            "tax_lines": [
                                {
                                    "price": "8.80",
                                    "price_set": {
                                        "shop_money": {
                                            "amount": "8.80",
                                            "currency_code": "EUR"
                                        },
                                        "presentment_money": {
                                            "amount": "8.80",
                                            "currency_code": "EUR"
                                        }
                                    },
                                    "rate": 0.2,
                                    "title": "GB VAT"
                                }
                            ],
                            "duties": [],
                            "discount_allocations": []
                        }
                    }
                ],
                "duties": []
            }
        ],
        "shipping_address": {
            "first_name": "kj",
            "address1": "kjhkh",
            "phone": null,
            "city": "Menlo Park",
            "zip": "NE63 8DW",
            "province": "England",
            "country": "United Kingdom",
            "last_name": "jjh",
            "address2": "111",
            "company": null,
            "latitude": 55.1775563,
            "longitude": -1.5762752,
            "name": "kj jjh",
            "country_code": "GB",
            "province_code": "ENG"
        },
        "shipping_lines": [
            {
                "id": 3320979620027,
                "carrier_identifier": null,
                "code": "Standard",
                "delivery_category": null,
                "discounted_price": "1.30",
                "discounted_price_set": {
                    "shop_money": {
                        "amount": "1.30",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "1.30",
                        "currency_code": "EUR"
                    }
                },
                "phone": null,
                "price": "1.30",
                "price_set": {
                    "shop_money": {
                        "amount": "1.30",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "1.30",
                        "currency_code": "EUR"
                    }
                },
                "requested_fulfillment_service_id": null,
                "source": "shopify",
                "title": "Standard",
                "tax_lines": [
                    {
                        "price": "0.26",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.26",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "0.26",
                                "currency_code": "EUR"
                            }
                        },
                        "rate": 0.2,
                        "title": "GB VAT"
                    }
                ],
                "discount_allocations": []
            }
        ]
    }
}

 

 

lisiming
New Member
11 0 0

order_id is 3951865364667.

There was only one origin line_item. The origin quantity is 4. The pending_fulfilled quantity is 3 and the unfulfilled quantity is 1. But when I created a refund which the quantity of line_item is 1, the unfulfilled quantity is still 1.

"line_items": [
            {
                "id": 10189000736955,
                "admin_graphql_api_id": "gid://shopify/LineItem/10189000736955",
                "fulfillable_quantity": 1,
                "fulfillment_service": "amoeba",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile - Green",
                "origin_location": {
                    "id": 2223540469912,
                    "country_code": "HK",
                    "province_code": "KL",
                    "name": "307test1",
                    "address1": "test",
                    "address2": "",
                    "city": "test",
                    "zip": "322222"
                },
                "price": "11.00",
                "price_set": {
                    "shop_money": {
                        "amount": "11.00",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "11.00",
                        "currency_code": "EUR"
                    }
                },
                "product_exists": true,
                "product_id": 6273866694843,
                "properties": [],
                "quantity": 4,
                "requires_shipping": true,
                "sku": "1000000391",
                "taxable": true,
                "title": "Plush Corn Spell Linen Sound Toy Pet Toy Cartoon Crocodile",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "EUR"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "EUR"
                    }
                },
                "variant_id": 38286122582203,
                "variant_inventory_management": "shopify",
                "variant_title": "Green",
                "vendor": "amoeba",
                "tax_lines": [
                    {
                        "price": "8.80",
                        "price_set": {
                            "shop_money": {
                                "amount": "8.80",
                                "currency_code": "EUR"
                            },
                            "presentment_money": {
                                "amount": "8.80",
                                "currency_code": "EUR"
                            }
                        },
                        "rate": 0.2,
                        "title": "GB VAT"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ]