How to correct a POST request for refund calculation?

How to correct a POST request for refund calculation?

david_lybe
Shopify Partner
1 0 0

Hello, I'm trying to make a POST request to calculate a refund like this:

 

const refund = new Refund({session});
refund.order_id = req.body.orderId;
await refund.calculate({
body: {"refund": {"shipping": {"full_refund": true}, "refund_line_items": [{"line_item_id": 12037678563511, "quantity": 1, "restock_type": "no_restock"}]}},
});

 But the API instead of returning an object with an object as we have on the documentation, I'm receiving this object with just the session:

 

 

{
    "session": {
        "id": "offline_testdavidlybe.myshopify.com",
        "shop": "testdavidlybe.myshopify.com",
        "state": "offline_589238188760222",
        "isOnline": false,
        "scope": "write_products,read_discounts,write_orders,read_product_listings",
        "accessToken": "shpua_3d6d676e0affe20f66bcedb22a06c5d8"
    },
    "order_id": 4592998645943
}

 

 

How to fix it ?

Documentation: https://shopify.dev/api/admin-rest/2022-04/resources/refund#post-orders-order-id-refunds-calculate

Replies 0 (0)