HomeGuidesReference↗ Forage Dashboard
Log In
Reference

Create a refund for part of an Order

Partial Refunds Must Be Server-Side

To keep your app secure, requests to refund part of an Order should only be generated on the server-side.

API Version Requirements

You must use Forage version 2024-01-08 or higher for this endpoint to return populated receipt data. Earlier versions return the receipt value as null, so to retrieve the data you need to send GET requests to /orders/{order_ref}/refunds/{refund_ref}/ until the status of the refund is succeeded.

A POST request to /orders/{order_ref}/refunds/ refunds part of an Order. It tells Forage’s servers to refund a specific amount of a single OrderPayment associated with the Order. This request has immediate financial side effects.

On success, the API responds with an OrderRefund that represents the transaction and a 201 HTTP status code.

HTTP STATUS 201

This endpoint always returns a 201, even if the refund attempt fails, because Forage always creates an OrderRefund to preserve a record of the attempted transaction. To make sure that the refund was successful, check that the status is succeeded. Send periodic GET requests to /orders/{order_ref}/refunds/{refund_ref}/ to retrieve the updated object. If the status is failed, then inspect the last_processing_error field of the response object for information about the error.

Path Params
string
required

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

Body Params

Pass the below parameters to create an OrderRefund.

string
required

A unique reference hash for the Forage OrderPayment to be refunded, returned when the OrderPayment was created.

number
required

The amount to be refunded in USD. Does not need to equal the amount field of the OrderPayment, if a partial refund. Precision is supported to the penny.

The minimum amount that can be refunded is 0.01.

string
required

A string that describes why the refund is happening.

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.

number

The fixed amount in USD that should be restored to the merchant from EBT Cash payments prior to splitting by the platform_fee. Precision is supported to the penny.

number

The fixed amount in USD that should be restored to the platform from EBT Cash payments prior to splitting by the platform_fee. Precision is supported to the penny.

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