{"id":2598,"date":"2024-12-31T20:23:15","date_gmt":"2024-12-31T20:23:15","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-credit-memo\/"},"modified":"2025-03-17T09:03:03","modified_gmt":"2025-03-17T09:03:03","slug":"magento-2-api-create-credit-memo","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-credit-memo\/","title":{"rendered":"Magento 2 API &#8211; Create Credit Memo"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello, Magento peeps!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019m back with another blog post on the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API<\/a>&nbsp;series. Earlier, I posted about&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-create-a-shipment\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API to create a shipment<\/a>. In this blog post, I will show you how to&nbsp;<em><strong>create credit memo in Magento 2 using REST API<\/strong><\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Product returns are common for eCommerce businesses. Customers return the products for a variety of reasons \u2014 size mismatch, an order placed by mistake, and wrong product received are a few to name. If you are a Magento developer creating a custom admin panel, you can use the&nbsp;<em><strong>REST API to create a credit memo and issue a refund in Magento 2<\/strong><\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Create a Credit Memo Using Magento 2 REST API?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2, being one of the most flexible eCommerce platforms, allows businesses to create and manage eCommerce stores as per the business requirements through APIs. The&nbsp;<em><strong>Magento 2 API to create a credit memo<\/strong><\/em>&nbsp;requires an admin-level access, and therefore the client needs to submit an authorization token along with the request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to&nbsp;<em><strong>create a memo and issue a refund using Magento 2 REST API<\/strong><\/em>, the client needs to make a POST request to the&nbsp;<em>order\/&lt;order_id&gt;\/refund&nbsp;<\/em>endpoint. It can be better understood by the following:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Method:&nbsp;<\/strong>POST<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>URL:&nbsp;<\/strong><em>store_url\/V1\/order\/&lt;order_id&gt;\/refund<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Headers:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Content-Type:&nbsp;<\/strong>application\/json<\/li>\n\n\n\n<li><strong>Authorization:&nbsp;<\/strong>Bearer &lt;admin token&gt;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Body:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"items\": [\n    {\n      \"order_item_id\": 5,\n      \"qty\": 2\n    }\n  ],\n  \"notify\": false,\n  \"arguments\": {\n    \"shipping_amount\": 0,\n    \"adjustment_positive\": 0,\n    \"adjustment_negative\": 0,\n    \"extension_attributes\": {\n      \"return_to_stock_items\": [\n        8\n      ]\n    }\n  }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Response:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On successful authorization of the API request, Magento will return the credit memo id.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can use the about solution to issue refund in Magento 2 API by creating a credit memo. The admin can also tweak the payload and adjust the request as per the requirements. I hope you will find this blog helpful to&nbsp;<em><strong>create a credit memo and issue a refund in Magento 2 through API<\/strong><\/em>. In case you still have any queries or doubts regarding the solution, feel free to comment. I will be happy to help!  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share this Magento 2 API tutorial with your developer friends.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading.  <\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-fe48e5de wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-create-a-shipment\/\">Magento 2 API \u2013 Create a Shipment<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello, Magento peeps! I\u2019m back with another blog post on the&nbsp;Magento 2 API&nbsp;series. Earlier, I posted about&nbsp;Magento 2 API to create a shipment. In this&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2598","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2598"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2598\/revisions"}],"predecessor-version":[{"id":9499,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2598\/revisions\/9499"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}