Report refunds
- Path
/refunds- Auth
- Secret key · server only
const url = 'https://releva.ai/api/v0/refunds';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"refunds":[{"orderId":"DEMO-ORDER-1001","refundId":"DEMO-REFUND-1001","products":[{"id":"DEMO-1002","quantity":1}]}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Send products or value. With both, value is ignored. With neither, nothing is netted.
object
The refunded order, exactly as sent to POST /carts.
Your unique id for this refund. Processed at most once.
object
Product id as sent on the order.
Refunded variant, when the order carried one.
Units refunded. Omit (or send 0) to refund the whole line. Capped at the ordered quantity.
Refunded amount in the order’s currency, spread over the order’s lines by value and capped at the order’s product total.
Examples
Refund line items
{ "refunds": [ { "orderId": "DEMO-ORDER-1001", "refundId": "DEMO-REFUND-1001", "products": [ { "id": "DEMO-1002", "quantity": 1 } ] } ]}Refund an amount
{ "refunds": [ { "orderId": "DEMO-ORDER-1001", "refundId": "DEMO-REFUND-1002", "value": 12.5 } ]}Responses
Section titled “Responses”Accepted for asynchronous processing.
object
Example
{}Authentication or validation error.
object
Human-readable error. Several validation errors are joined with a space.
Examples
{ "message": "The 'refunds' field must contain at least 1 items."}{ "message": "The 'refunds[0].refundId' field is required."}{ "message": "The object 'refunds[0]' contains forbidden keys: 'email'."}{ "message": "The object 'refunds[0].products[0]' contains forbidden keys: 'price'."}{ "message": "The 'refunds[0].value' field must be a number."}{ "message": "The '' field is required."}The domain is disabled.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "Domain is disabled. Please reach out to support@releva.ai to enable it."}Request body larger than 800 KB.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "request entity too large"}Unexpected server error.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "An internal error occurred."}