Backend API
Create a new return.
Arguments
List of line items describing the products returned.
ID of the order item returned.
ID of the order bundle item returned, if applicable.
Options from the order item returned, if applicable.
Unique identifier for the object.
Name of the product option.
Name value of the product option.
Quantity of the item returned. Defaults to 1.
Quantity of the item received in a return shipment.
Quantity of the item restocked to product inventory.
ID of the item variant, if applicable.
Unique identifier for the return item.
Expandable link to the item product.
Quantity of the item that can still be received in a return shipment.
Quantity of the item that can still be restocked to product inventory.
Expandable link to the item variant, if applicable.
ID of the order this return was created for.
Internal admin notes, not visible to the customer.
Indicates the return was canceled.
ID of a 3rd party carrier offering the service, if applicable.
Name of a 3rd party carrier offering the service, if applicable.
Three-letter ISO currency code in uppercase. Defaults to the store's base currency.
Date the expected return shipment is meant to arrive at a warehouse, if applicable.
The intended return destination.
ID of the intended return destination, if applicable.
Arbitrary amount to apply to the order as compensation for their inconvenience.
The customer's location of origin for the return shipment.
Origin address line 1: street address/PO box/company name.
Origin address line 2: apartment/suite/unit/building.
Origin city/district/suburb/town/village.
Two-letter ISO country code.
Origin customer name.
Origin phone number.
Origin state/county/province/region.
Origin zip/postal code.
Code indicating the reason for the return.
Amount to charge the customer for re-stocking the returned items.
ID of a shipping service as configured in shipment settings.
Name of the return shipping service.
Amount to apply to the order as a credit as compensation for the original shipping price.
Tracking code used to identify the return shipment, if applicable.
Total amount of taxes credited to the order for the returned items.
Total amount of additional credit applied to the order.
Total quantity of line items that can still be received in a return shipment.
Total quantity of line items that have been received in a return shipment.
Total quantity of line items that can still be restocked to product inventory.
Total quantity of line items that have been restocked to product inventory.
Expandable list of notifications sent on behalf of the products returned.
Unique incremental return number, assigned automatically.
Expandable link to the order.
Indicates that all items have been received in a return shipment.
Amount to apply to the order as a credit as compensation for the original shipping tax.
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.post('/returns', {
order_id: '5a9ea7ba3f95740a914267f1',
items: [
{
order_item_id: '5a9ea7ba3f95740a914267f2',
product_id: '5cad15bc9b14d1990724663a',
quantity: 2,
}
],
notes: 'Damaged in transit',
});
Response
{
"id": "5cad15bc9b14d1990724663a",
"number": "R10001",
"order_id": "5a9ea7ba3f95740a914267f1",
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"order_item_id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"quantity_received": 0,
"quantity_receivable": 2,
"quantity_restocked": 0,
"quantity_restockable": 2,
...
}
],
"item_quantity_received": 0,
"item_quantity_receivable": 2,
"item_quantity_restocked": 0,
"item_quantity_restockable": 2,
"shipment_total": 0,
"shipment_tax": 0,
"extra_credit": 10,
"restock_fee": 0,
"credit_total": 10,
"credit_tax": 0,
"notes": "Damaged in transit",
...
}