Product Refunds Must Be Server-Side
To keep your app secure, requests to refund specific products should only be generated on the server-side.
A POST
request to /orders/{order_ref}/refund_by_product/
creates refunds for specific products in an Order
. It tells Forage's servers to create OrderRefund
objects for the specified products and refund the appropriate amounts to their original payment methods. This request has immediate financial side effects.
On success, the API responds with an array of refund objects that represent the transactions and a 201
HTTP status code.
HTTP STATUS 201
This endpoint always returns a 201
, even if some refund attempts fail, because Forage always creates refund objects to preserve a record of the attempted transactions. To make sure that the refunds were successful, check that the status
of each refund is succeeded
. Send periodic GET
requests to /orders/{order_ref}/refunds/{refund_ref}/
to retrieve the updated objects. If the status is failed
, then inspect the last_processing_error
field of the response object for information about the error.
Webhooks For Refund Status Updates
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.