Refund api error

Simon62
Shopify Partner
9 1 3

Hi

I'm going round in circles trying to get the refund api working.

I can get a result from the calculate refund api, but when I try issue a refund, I get the following error

refund=Required parameter missing or invalid

From comparing my json against the example one, it's identical. 

These are not live transactions. We're still integrating in the test environment. I don't know if that makes a difference.

 

This is my json sent to

POST https://flyflot.myshopify.com/admin/orders/3355105991/refunds.json ;

{
    "refund": {
        "restock": false,
        "note": "Refund issued from cancel",
        "shipping": {
            "full_refund": true
        },
        "refund_line_items": [{
            "line_item_id": 5878395911,
            "quantity": 1
        }],
        "transactions": [{
            "parent_id": 3591917895,
            "amount": 30.98,
            "kind": "refund",
            "gateway": "shopify_payments"
        }]
    }
}

 

this is the shopify example from https://help.shopify.com/api/reference/refund#create

{
    "refund": {
        "restock": true,
        "note": "wrong size",
        "shipping": {
            "full_refund": true
        },
        "refund_line_items": [{
            "line_item_id": 518995019,
            "quantity": 1
        }],
        "transactions": [{
            "parent_id": 801038806,
            "amount": 199.65,
            "kind": "refund",
            "gateway": "bogus"
        }]
    }
}

Replies 3 (3)
Ben106
Tourist
36 0 3

I am having problems with the refund API also, and my json looks just like yours. I keep getting a BadRequest status code from the HTTP response.

gonor_alex
Shopify Partner
1 0 0

Has anyone solved this problem? I have the same issue

KarlOffenberger
Shopify Partner
1873 184 886

@gonor_alex wrote:

Has anyone solved this problem? I have the same issue


From the documentation

 


Apps are required to specify a restock_type and a location_id on the refund_line_item.


 

Liked this post? You might also like our fantastic upsell apps Candy Rack, Last Upsell post-purchase and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie