Timeout for Refund Payment API

We have developed a VTEX module in order to offer Pix as a payment method. However, we don’t know the best way to implement refunding.

Since Pix refunding can be asynchronous, what do we should to do considering that VTEX expects a synchronous response, as described on this link: Payment Provider Protocol

In my side, after receive VTEX request, I will send the request to PSP, and it can delays some minutes in order to answer if refunding was successfully.

Hi there!

Just to make sure I got it right.

Both the refund and the authorization can be asynchronous.
The authorization can be asynchronous using the callback. So, the PSP can return the undefined status and later callback VTEX to inform that the transaction has been paid (and approved).
The refund can happen any time after the settle, so it´s asynchronous too.

Hi! Thanks for your answer!!!

In my point of view, authorization can be asynchronous, because we can response the “undefined” status. If VTEX receives an “undefined”, it will wait for my callback, becoming this a asynchronous process.

However, on Refund service, there isn’t the option to response an “undefined” status.
I can response 200 (“Successfully refunded”), 500 (“Refund has failed due to an internal error”) and 501 (“This payment needs to be manually refunded”).

Considering only these 3 options, I cannot see how to implement an asynchronous refunding…

Ahhhh I got it wrong.

Maybe you can try to return a 501 status code with something different from code: “refund-manually” to force VTEX to retry the operation later. Then return the correct information or return “refund-manually” after 2 or 3 tries.

It might be a good idea!
I just have two questions…

  1. Are you sure that VTEX retries the operation if I return 501?
  2. Do you know if I can return anything on “code”, instead of “refund-manually”? I can return “refund-in-process”, for example…

Sorry again.

You should try the status code 500.

Actually, I got the idea from this mockup.

The VTEX APIs usually retries after sometime, but I am not 100% sure that will happen with the refund. Maybe you can open a ticket with VTEX and ask them.

Another solution is process asynchronously, but respond synchronous…
When VTEX requests a refunding, I can hold it and only responds when PSP has finished all refunding process… but it could last until 1 minute…
Do you know how long is VTEX timeout?

Sorry, don´t know!

Thanks anyway!!! :bowing_man: