3

I am trying to create credit memo and refund order and invoice via following api call:- '/V1/invoice/36/refund'

and my array is as below, which i am converting later to JSON

$postData = [
                            "items" => $invoice_item,
                            "notify" => true,
                             "isOnline"=> 0,
                                "arguments" => [
                                "shipping_amount" => $order->shipping_amount,
                                "adjustment_positive" => 0,
                                "adjustment_negative" => 0,
                                "extension_attributes" => [
                                    "return_to_stock_items" => $order_item_arr
                                    ]
                                ],
                            "appendComment" => true,
                            "comment" => [
                                "extension_attributes" => [],
                                "comment" => "string",
                                "is_visible_on_front" => 0
                            ],
                        ];

I am getting the following error "Creditmemo Document Validation Error(s): We can't create creditmemo for the invoice. The creditmemo contains product item that is not part of the original order. The "MT07-S-Gray" product is not part of the current creditmemo."

Though I have checked well the existence of product.

1
  • Did you find what the issue was? I am getting same Dec 4, 2019 at 10:52

1 Answer 1

0

I am not sure this will be the answer for you but I'been hitting my head on the wall for a while just find out that I wasn't passing the correct order if in the post url E.G: /rest/V1/order/{{OrderId}}/refund the body was correct but the OrderId was not the correct id after updating all test working I have only one issue order status not updating it closed.

UPDATED: By the way if you have multiple items then it gets trick. the field "order_item_id": value must be the configurable item_id for the child item and "return_to_stock_items":[] value(s) must have the child item_id otherwise you will get the same error:

May help someone!

1
  • can we Refund Orders to Payment Method ? Nov 5, 2020 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.