MultiSafepay / magento2

MultiSafepay plugin for Magento 2
Open Software License 3.0
19 stars 8 forks source link

Question: Online-Refund when doing a refund in magento via api #49

Closed nebula2 closed 1 year ago

nebula2 commented 1 year ago

Hey :)

I have a question. When doing a refund through magento order via rest/default/V1/order/{orderId}/refund it seems like it does not create a refund for MultiSavepay.

image

If a refund is created through API, I want to automatically send a refund to MultiSavepay. Is that a configuration thing? The docs do not specifically tell how this is handled (or I am just misunderstanding) https://docs.multisafepay.com/docs/magento-2#refunds

Thank you for your time

vinodsowdagar commented 1 year ago

Hi @nebula2 ,

We'll check this one and come back to you a bit later. Once we have more information about how this is currently working, we will let you know.

vinodsowdagar commented 1 year ago

Hi @nebula2 ,

We've double checked this and it seems that this feature has not been implemented. Refunding through the REST API will at the moment not result in a refund at MultiSafepay.

I've created a task for the backlog to add support for this. We will keep you informed about the status of this task.

If there are any questions or comments in the meantime, please let us know.

nebula2 commented 1 year ago

@Vinod-MultiSafepay thank you!

vinodsowdagar commented 1 year ago

Hi @nebula2 ,

During implementation we noticed that this feature is actually already working, but there are some more steps to be taken.

First of all, I would like to point out that in order to do an online refund, you would have to refund the invoice, and not the order.

The correct API request url would be: /V1/invoice/:invoiceId/refund

In the JSON of the request body there is a flag which needs to be set to true, which will create the online refund: "is_online": true

Looking at the Magento docs, i couldn't find anything about this flag, so it was unclear that this exists.

Please resort to the following pages for how to create an online refund through the invoice and add JSON information to the request body:

https://devdocs.magento.com/guides/v2.3/rest/modules/sales/refunds.html https://developer.adobe.com/commerce/webapi/rest/tutorials/orders/order-issue-refund/

Moreover, i have created a task for the backlog of our own docs, to clarify that this flag is needed when doing a REST API refund request.

I hope this clears it out, I am closing this issue for now.