HomeGuidesReference↗ Forage Dashboard
Log In
Reference

Create a refund for an entire Order

Refunding Entire Orders Must Be Server-Side

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}/.

Retrieving Refund Receipt Info

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 the refunds field until the status of each is succeeded. Then, confirm that the receipt.balance.updated timestamp is no longer changing and retrieve the latest balance.

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.

Path Params
string
required

A unique reference hash for the Forage Order object, returned when the order’s parent Session was created.

Body Params

Forage attaches the below parameters to every OrderRefund created as part of refunding the entire order.

string
required

A string that describes why the order is to be refunded.

metadata
object
required

A required object containing merchant-defined key-value pairs to provide additional context for the payment.

Merchants should use this field to store reference information relevant to the transaction (for example, order details, system identifiers, or tracking data). This helps link the payment to records within their system.

Pass an empty object ({}) if no additional information is available.

Personally Identifiable Information

Do not include personally identifiable information (PII) such as names, emails, or payment details.

string
length ≤ 64

A unique identifier for the order as created by the merchant or platform (not Forage).

When a merchant or platform passes this order ID to Forage, it persists in each Forage transaction related to the Order. This field enables merchants to map order IDs in their system to corresponding Forage Order IDs.

You must build with Forage Version 2023-05-15 or later to use external_order_id. Either pass 2023-05-15 as the API-Version header on a per request basis, or set the version for all requests in the Forage dashboard.

Headers
string
required

An OAuth 2.0 authentication token that validates the request. Send a POST to the /o/token/ endpoint to generate an authentication token. Pass the token in this header after the word Bearer and a whitespace, for example Bearer sandbox_sZawPSUSm9eetx8LrfBbJlzUZS3zWD.

string
required

A unique merchant ID that Forage provides during onboarding, as in 123ab45c67. The Merchant ID can be found in the Forage sandbox or production dashboard.

string
required

An alphanumeric key that clients can use to identify repeated requests that are dropped in transit. Generate a distinct key for every unique request and only re-use keys for retries.

string

The Forage version, represented as a string with the format of a YYYY-MM-DD date.

If not specified in the request header, then the version defaults to the value set in the Forage dashboard.

Responses

Language
Credentials
OAuth2
URL
Request
Response
Choose an example:
application/json