Skip to content

Area: Developers

POST

Report refunds

Path
/refunds
Auth
Secret key · server only
POST
/refunds
curl --request POST \
--url https://releva.ai/api/v0/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "refunds": [ { "orderId": "DEMO-ORDER-1001", "refundId": "DEMO-REFUND-1001", "products": [ { "id": "DEMO-1002", "quantity": 1 } ] } ] }'

Nets refunded money out of the revenue of an order previously sent to POST /carts. Send only what was refunded (products, or an amount in value) and against which orderId; the customer, date, prices, currency and attribution come from the stored order, so those fields are rejected. The refund is recorded on the original order’s date and subtracted from the channel that earned the sale. Loyalty points the order earned are reversed in proportion. A refundId is processed once. Refunds for orders older than 30 days, or for orders Releva never received, are accepted and skipped. Asynchronous.

Media typeapplication/json
object
refunds
required
Array<object>
>= 1 items

Send products or value. With both, value is ignored. With neither, nothing is netted.

object
orderId
required

The refunded order, exactly as sent to POST /carts.

string
refundId
required

Your unique id for this refund. Processed at most once.

string
products
Array<object>
object
id
required

Product id as sent on the order.

string
variantId

Refunded variant, when the order carried one.

string
quantity

Units refunded. Omit (or send 0) to refund the whole line. Capped at the ordered quantity.

number
value

Refunded amount in the order’s currency, spread over the order’s lines by value and capped at the order’s product total.

number

Examples

Refund line items

{
"refunds": [
{
"orderId": "DEMO-ORDER-1001",
"refundId": "DEMO-REFUND-1001",
"products": [
{
"id": "DEMO-1002",
"quantity": 1
}
]
}
]
}

Accepted for asynchronous processing.

Media typeapplication/json
object
0

Example

{}

Authentication or validation error.

Media typeapplication/json
object
message
required

Human-readable error. Several validation errors are joined with a space.

string

Examples

{
"message": "The 'refunds' field must contain at least 1 items."
}

The domain is disabled.

Media typeapplication/json
object
message
required

Human-readable error. Several validation errors are joined with a space.

string

Example

{
"message": "Domain is disabled. Please reach out to support@releva.ai to enable it."
}

Request body larger than 800 KB.

Media typeapplication/json
object
message
required

Human-readable error. Several validation errors are joined with a space.

string

Example

{
"message": "request entity too large"
}

Unexpected server error.

Media typeapplication/json
object
message
required

Human-readable error. Several validation errors are joined with a space.

string

Example

{
"message": "An internal error occurred."
}