To keep your app secure, requests to refund an entire Order should only be generated on the server-side.
A POST
request to /orders/{order_ref}/refund_all/
refunds an entire Order
. It tells Forage’s servers to create an OrderRefund
for every associated OrderPayment
, and to refund all charges to their original payment methods, net any already processed refunds. This request has immediate financial side effects.
On success, the API responds with the original Order
. The refunds
field details a list of reference hashes, refund_refs
, for all of the OrderRefunds
that Forage created as part of the refund process.
If there are any OrderRefunds
still processing when you send the POST
, then the API returns a 400
until those refunds have resolved.
To retrieve information about a particular OrderRefund
in the list, send a GET
to /orders/{order_ref}/refunds/{refund_ref}/
.
This endpoint does not return
receipt
information.To retrieve transaction information to display to a customer, send periodic
GET
requests to/orders/{order_ref}/refunds/{refund_ref}/
for everyOrderRefund
returned in therefunds
field until the status of each issucceeded
. Then, confirm that thereceipt.balance.updated
timestamp is no longer changing and retrieve the latest balance.
Set up webhooks for
OrderRefunds
.Forage sends a
REFUND_STATUS_UPDATED
webhook when the status of a refund changes. Check out the guide to Forage webhooks for instructions on how to listen for the event.