createRefundRequest
Create a refund request for an order. 🔐 This method requires authorization.
Description
Creates a refund request for the order with the given id. Resolves to true on success.
In body.products, list the products to refund as a map of product id to { quantity }; note is optional.
The order must belong to the user and be fully paid, and it can have only one pending refund request at a time. To change a pending request, cancel it with cancelRefundRequest() and create a new one.
.createRefundRequest(
,
);
Parameters schema
Schema
id(required): number
Order ID.
example: 1
body(required): ICreateRefundRequest
Refund request data.
body.products(required): Record<string, IRefundProduct>
Refund details keyed by product ID.
example:
{ "146": { "quantity": 1 } }
body.note: string
Note attached to the refund request. Required by the API (the SDK types it optional to stay backward-compatible — pass it to avoid a 400).
example: "test"
Examples
Minimal example
const response = await Orders.createRefundRequest(476, {
products: { '2957': { quantity: 1 } },
note: 'Damaged on delivery',
});
Example response
true