Skip to main content
PUT
/
orders
/
{id}
Update Order
curl --request PUT \
  --url https://api.loopreturns.com/api/v1/orders/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: <api-key>' \
  --data '
{
  "sales_channel": "<string>",
  "source": {
    "name": "<string>"
  },
  "external_id": "<string>",
  "name": "<string>",
  "secondary_identifier": "<string>",
  "customer": {
    "id": 123,
    "external_id": "<string>"
  },
  "taxes_included": true,
  "total_price_presentment": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "total_discounts": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "total_discounts_presentment": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "total_taxes": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "total_taxes_presentment": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "shipping_lines": [
    [
      {
        "title": "<string>",
        "discounts": {
          "external_id": "<string>",
          "name": "<string>",
          "code": "<string>",
          "reason": "<string>",
          "rate": 123
        },
        "tax_lines": [
          {
            "title": "<string>",
            "rate": 123
          }
        ]
      }
    ]
  ],
  "refunds": [
    [
      {
        "amount": {
          "amount": 123,
          "currency_code": "USD"
        },
        "external_id": "<string>",
        "line_item": {
          "id": 123,
          "quantity": 123,
          "restock": true
        },
        "created_at": "2023-04-25T13:25:00-05:00",
        "updated_at": "2023-04-25T13:25:00-05:00"
      }
    ]
  ],
  "line_items": [
    {
      "external_id": "<string>",
      "product_variant": {
        "id": 123
      },
      "quantity": 123,
      "unit_price_presentment": {
        "amount": 50000,
        "currency_code": "USD"
      },
      "unit_discounts": {
        "amount": 50000,
        "currency_code": "USD"
      },
      "unit_discounts_presentment": {
        "amount": 50000,
        "currency_code": "USD"
      },
      "taxable": true,
      "tax_lines": [
        {
          "title": "<string>",
          "rate": 123
        }
      ],
      "refunds": [
        {
          "amount": {
            "amount": 123,
            "currency_code": "USD"
          },
          "external_id": "<string>",
          "line_item": {
            "id": 123,
            "quantity": 123,
            "restock": true
          },
          "created_at": "2023-04-25T13:25:00-05:00",
          "updated_at": "2023-04-25T13:25:00-05:00"
        }
      ],
      "discounts": [
        {
          "external_id": "<string>",
          "name": "<string>",
          "code": "<string>",
          "reason": "<string>",
          "rate": 123
        }
      ],
      "duties": [
        {
          "hs_code": "<string>",
          "country_of_origin": "<string>",
          "tax_lines": [
            {
              "title": "<string>",
              "rate": 123
            }
          ]
        }
      ]
    }
  ],
  "fulfillments": [
    {
      "external_id": "<string>",
      "fulfilled_at": "2023-11-07T05:31:56Z",
      "shipping_carrier": "<string>",
      "location": {
        "id": 123
      },
      "fulfillment_line_items": [
        {
          "external_id": "<string>",
          "order_line_item_external_id": "<string>",
          "quantity": 123
        }
      ],
      "tracking_numbers": [
        "<string>"
      ]
    }
  ],
  "tags": [
    "<string>"
  ],
  "created_at": "2023-04-25T13:25:00-05:00",
  "updated_at": "2023-04-25T13:25:00-05:00",
  "cancelled_at": "2023-04-25T13:25:00-05:00",
  "processed_at": "2023-04-25T13:25:00-05:00",
  "browser_ip": "127.0.0.1",
  "client_details_user_agent": "<string>",
  "total_tip_received": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "metadata": [
    {
      "key": "<string>",
      "value": "<unknown>"
    }
  ]
}
'
import requests

url = "https://api.loopreturns.com/api/v1/orders/{id}"

payload = {
    "sales_channel": "<string>",
    "source": { "name": "<string>" },
    "external_id": "<string>",
    "name": "<string>",
    "secondary_identifier": "<string>",
    "customer": {
        "id": 123,
        "external_id": "<string>"
    },
    "taxes_included": True,
    "total_price_presentment": {
        "amount": 50000,
        "currency_code": "USD"
    },
    "total_discounts": {
        "amount": 50000,
        "currency_code": "USD"
    },
    "total_discounts_presentment": {
        "amount": 50000,
        "currency_code": "USD"
    },
    "total_taxes": {
        "amount": 50000,
        "currency_code": "USD"
    },
    "total_taxes_presentment": {
        "amount": 50000,
        "currency_code": "USD"
    },
    "shipping_lines": [[
            {
                "title": "<string>",
                "discounts": {
                    "external_id": "<string>",
                    "name": "<string>",
                    "code": "<string>",
                    "reason": "<string>",
                    "rate": 123
                },
                "tax_lines": [
                    {
                        "title": "<string>",
                        "rate": 123
                    }
                ]
            }
        ]],
    "refunds": [[
            {
                "amount": {
                    "amount": 123,
                    "currency_code": "USD"
                },
                "external_id": "<string>",
                "line_item": {
                    "id": 123,
                    "quantity": 123,
                    "restock": True
                },
                "created_at": "2023-04-25T13:25:00-05:00",
                "updated_at": "2023-04-25T13:25:00-05:00"
            }
        ]],
    "line_items": [
        {
            "external_id": "<string>",
            "product_variant": { "id": 123 },
            "quantity": 123,
            "unit_price_presentment": {
                "amount": 50000,
                "currency_code": "USD"
            },
            "unit_discounts": {
                "amount": 50000,
                "currency_code": "USD"
            },
            "unit_discounts_presentment": {
                "amount": 50000,
                "currency_code": "USD"
            },
            "taxable": True,
            "tax_lines": [
                {
                    "title": "<string>",
                    "rate": 123
                }
            ],
            "refunds": [
                {
                    "amount": {
                        "amount": 123,
                        "currency_code": "USD"
                    },
                    "external_id": "<string>",
                    "line_item": {
                        "id": 123,
                        "quantity": 123,
                        "restock": True
                    },
                    "created_at": "2023-04-25T13:25:00-05:00",
                    "updated_at": "2023-04-25T13:25:00-05:00"
                }
            ],
            "discounts": [
                {
                    "external_id": "<string>",
                    "name": "<string>",
                    "code": "<string>",
                    "reason": "<string>",
                    "rate": 123
                }
            ],
            "duties": [
                {
                    "hs_code": "<string>",
                    "country_of_origin": "<string>",
                    "tax_lines": [
                        {
                            "title": "<string>",
                            "rate": 123
                        }
                    ]
                }
            ]
        }
    ],
    "fulfillments": [
        {
            "external_id": "<string>",
            "fulfilled_at": "2023-11-07T05:31:56Z",
            "shipping_carrier": "<string>",
            "location": { "id": 123 },
            "fulfillment_line_items": [
                {
                    "external_id": "<string>",
                    "order_line_item_external_id": "<string>",
                    "quantity": 123
                }
            ],
            "tracking_numbers": ["<string>"]
        }
    ],
    "tags": ["<string>"],
    "created_at": "2023-04-25T13:25:00-05:00",
    "updated_at": "2023-04-25T13:25:00-05:00",
    "cancelled_at": "2023-04-25T13:25:00-05:00",
    "processed_at": "2023-04-25T13:25:00-05:00",
    "browser_ip": "127.0.0.1",
    "client_details_user_agent": "<string>",
    "total_tip_received": {
        "amount": 50000,
        "currency_code": "USD"
    },
    "metadata": [
        {
            "key": "<string>",
            "value": "<unknown>"
        }
    ]
}
headers = {
    "X-Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {'X-Authorization': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    sales_channel: '<string>',
    source: {name: '<string>'},
    external_id: '<string>',
    name: '<string>',
    secondary_identifier: '<string>',
    customer: {id: 123, external_id: '<string>'},
    taxes_included: true,
    total_price_presentment: {amount: 50000, currency_code: 'USD'},
    total_discounts: {amount: 50000, currency_code: 'USD'},
    total_discounts_presentment: {amount: 50000, currency_code: 'USD'},
    total_taxes: {amount: 50000, currency_code: 'USD'},
    total_taxes_presentment: {amount: 50000, currency_code: 'USD'},
    shipping_lines: [
      [
        {
          title: '<string>',
          discounts: {
            external_id: '<string>',
            name: '<string>',
            code: '<string>',
            reason: '<string>',
            rate: 123
          },
          tax_lines: [{title: '<string>', rate: 123}]
        }
      ]
    ],
    refunds: [
      [
        {
          amount: {amount: 123, currency_code: 'USD'},
          external_id: '<string>',
          line_item: {id: 123, quantity: 123, restock: true},
          created_at: '2023-04-25T13:25:00-05:00',
          updated_at: '2023-04-25T13:25:00-05:00'
        }
      ]
    ],
    line_items: [
      {
        external_id: '<string>',
        product_variant: {id: 123},
        quantity: 123,
        unit_price_presentment: {amount: 50000, currency_code: 'USD'},
        unit_discounts: {amount: 50000, currency_code: 'USD'},
        unit_discounts_presentment: {amount: 50000, currency_code: 'USD'},
        taxable: true,
        tax_lines: [{title: '<string>', rate: 123}],
        refunds: [
          {
            amount: {amount: 123, currency_code: 'USD'},
            external_id: '<string>',
            line_item: {id: 123, quantity: 123, restock: true},
            created_at: '2023-04-25T13:25:00-05:00',
            updated_at: '2023-04-25T13:25:00-05:00'
          }
        ],
        discounts: [
          {
            external_id: '<string>',
            name: '<string>',
            code: '<string>',
            reason: '<string>',
            rate: 123
          }
        ],
        duties: [
          {
            hs_code: '<string>',
            country_of_origin: '<string>',
            tax_lines: [{title: '<string>', rate: 123}]
          }
        ]
      }
    ],
    fulfillments: [
      {
        external_id: '<string>',
        fulfilled_at: '2023-11-07T05:31:56Z',
        shipping_carrier: '<string>',
        location: {id: 123},
        fulfillment_line_items: [
          {
            external_id: '<string>',
            order_line_item_external_id: '<string>',
            quantity: 123
          }
        ],
        tracking_numbers: ['<string>']
      }
    ],
    tags: ['<string>'],
    created_at: '2023-04-25T13:25:00-05:00',
    updated_at: '2023-04-25T13:25:00-05:00',
    cancelled_at: '2023-04-25T13:25:00-05:00',
    processed_at: '2023-04-25T13:25:00-05:00',
    browser_ip: '127.0.0.1',
    client_details_user_agent: '<string>',
    total_tip_received: {amount: 50000, currency_code: 'USD'},
    metadata: [{key: '<string>', value: '<unknown>'}]
  })
};

fetch('https://api.loopreturns.com/api/v1/orders/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.loopreturns.com/api/v1/orders/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'sales_channel' => '<string>',
    'source' => [
        'name' => '<string>'
    ],
    'external_id' => '<string>',
    'name' => '<string>',
    'secondary_identifier' => '<string>',
    'customer' => [
        'id' => 123,
        'external_id' => '<string>'
    ],
    'taxes_included' => true,
    'total_price_presentment' => [
        'amount' => 50000,
        'currency_code' => 'USD'
    ],
    'total_discounts' => [
        'amount' => 50000,
        'currency_code' => 'USD'
    ],
    'total_discounts_presentment' => [
        'amount' => 50000,
        'currency_code' => 'USD'
    ],
    'total_taxes' => [
        'amount' => 50000,
        'currency_code' => 'USD'
    ],
    'total_taxes_presentment' => [
        'amount' => 50000,
        'currency_code' => 'USD'
    ],
    'shipping_lines' => [
        [
                [
                                'title' => '<string>',
                                'discounts' => [
                                                                'external_id' => '<string>',
                                                                'name' => '<string>',
                                                                'code' => '<string>',
                                                                'reason' => '<string>',
                                                                'rate' => 123
                                ],
                                'tax_lines' => [
                                                                [
                                                                                                                                'title' => '<string>',
                                                                                                                                'rate' => 123
                                                                ]
                                ]
                ]
        ]
    ],
    'refunds' => [
        [
                [
                                'amount' => [
                                                                'amount' => 123,
                                                                'currency_code' => 'USD'
                                ],
                                'external_id' => '<string>',
                                'line_item' => [
                                                                'id' => 123,
                                                                'quantity' => 123,
                                                                'restock' => true
                                ],
                                'created_at' => '2023-04-25T13:25:00-05:00',
                                'updated_at' => '2023-04-25T13:25:00-05:00'
                ]
        ]
    ],
    'line_items' => [
        [
                'external_id' => '<string>',
                'product_variant' => [
                                'id' => 123
                ],
                'quantity' => 123,
                'unit_price_presentment' => [
                                'amount' => 50000,
                                'currency_code' => 'USD'
                ],
                'unit_discounts' => [
                                'amount' => 50000,
                                'currency_code' => 'USD'
                ],
                'unit_discounts_presentment' => [
                                'amount' => 50000,
                                'currency_code' => 'USD'
                ],
                'taxable' => true,
                'tax_lines' => [
                                [
                                                                'title' => '<string>',
                                                                'rate' => 123
                                ]
                ],
                'refunds' => [
                                [
                                                                'amount' => [
                                                                                                                                'amount' => 123,
                                                                                                                                'currency_code' => 'USD'
                                                                ],
                                                                'external_id' => '<string>',
                                                                'line_item' => [
                                                                                                                                'id' => 123,
                                                                                                                                'quantity' => 123,
                                                                                                                                'restock' => true
                                                                ],
                                                                'created_at' => '2023-04-25T13:25:00-05:00',
                                                                'updated_at' => '2023-04-25T13:25:00-05:00'
                                ]
                ],
                'discounts' => [
                                [
                                                                'external_id' => '<string>',
                                                                'name' => '<string>',
                                                                'code' => '<string>',
                                                                'reason' => '<string>',
                                                                'rate' => 123
                                ]
                ],
                'duties' => [
                                [
                                                                'hs_code' => '<string>',
                                                                'country_of_origin' => '<string>',
                                                                'tax_lines' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                'title' => '<string>',
                                                                                                                                                                                                                                                                'rate' => 123
                                                                                                                                ]
                                                                ]
                                ]
                ]
        ]
    ],
    'fulfillments' => [
        [
                'external_id' => '<string>',
                'fulfilled_at' => '2023-11-07T05:31:56Z',
                'shipping_carrier' => '<string>',
                'location' => [
                                'id' => 123
                ],
                'fulfillment_line_items' => [
                                [
                                                                'external_id' => '<string>',
                                                                'order_line_item_external_id' => '<string>',
                                                                'quantity' => 123
                                ]
                ],
                'tracking_numbers' => [
                                '<string>'
                ]
        ]
    ],
    'tags' => [
        '<string>'
    ],
    'created_at' => '2023-04-25T13:25:00-05:00',
    'updated_at' => '2023-04-25T13:25:00-05:00',
    'cancelled_at' => '2023-04-25T13:25:00-05:00',
    'processed_at' => '2023-04-25T13:25:00-05:00',
    'browser_ip' => '127.0.0.1',
    'client_details_user_agent' => '<string>',
    'total_tip_received' => [
        'amount' => 50000,
        'currency_code' => 'USD'
    ],
    'metadata' => [
        [
                'key' => '<string>',
                'value' => '<unknown>'
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Authorization: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.loopreturns.com/api/v1/orders/{id}"

	payload := strings.NewReader("{\n  \"sales_channel\": \"<string>\",\n  \"source\": {\n    \"name\": \"<string>\"\n  },\n  \"external_id\": \"<string>\",\n  \"name\": \"<string>\",\n  \"secondary_identifier\": \"<string>\",\n  \"customer\": {\n    \"id\": 123,\n    \"external_id\": \"<string>\"\n  },\n  \"taxes_included\": true,\n  \"total_price_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_discounts\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_discounts_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_taxes\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_taxes_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"shipping_lines\": [\n    [\n      {\n        \"title\": \"<string>\",\n        \"discounts\": {\n          \"external_id\": \"<string>\",\n          \"name\": \"<string>\",\n          \"code\": \"<string>\",\n          \"reason\": \"<string>\",\n          \"rate\": 123\n        },\n        \"tax_lines\": [\n          {\n            \"title\": \"<string>\",\n            \"rate\": 123\n          }\n        ]\n      }\n    ]\n  ],\n  \"refunds\": [\n    [\n      {\n        \"amount\": {\n          \"amount\": 123,\n          \"currency_code\": \"USD\"\n        },\n        \"external_id\": \"<string>\",\n        \"line_item\": {\n          \"id\": 123,\n          \"quantity\": 123,\n          \"restock\": true\n        },\n        \"created_at\": \"2023-04-25T13:25:00-05:00\",\n        \"updated_at\": \"2023-04-25T13:25:00-05:00\"\n      }\n    ]\n  ],\n  \"line_items\": [\n    {\n      \"external_id\": \"<string>\",\n      \"product_variant\": {\n        \"id\": 123\n      },\n      \"quantity\": 123,\n      \"unit_price_presentment\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"unit_discounts\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"unit_discounts_presentment\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"taxable\": true,\n      \"tax_lines\": [\n        {\n          \"title\": \"<string>\",\n          \"rate\": 123\n        }\n      ],\n      \"refunds\": [\n        {\n          \"amount\": {\n            \"amount\": 123,\n            \"currency_code\": \"USD\"\n          },\n          \"external_id\": \"<string>\",\n          \"line_item\": {\n            \"id\": 123,\n            \"quantity\": 123,\n            \"restock\": true\n          },\n          \"created_at\": \"2023-04-25T13:25:00-05:00\",\n          \"updated_at\": \"2023-04-25T13:25:00-05:00\"\n        }\n      ],\n      \"discounts\": [\n        {\n          \"external_id\": \"<string>\",\n          \"name\": \"<string>\",\n          \"code\": \"<string>\",\n          \"reason\": \"<string>\",\n          \"rate\": 123\n        }\n      ],\n      \"duties\": [\n        {\n          \"hs_code\": \"<string>\",\n          \"country_of_origin\": \"<string>\",\n          \"tax_lines\": [\n            {\n              \"title\": \"<string>\",\n              \"rate\": 123\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fulfillments\": [\n    {\n      \"external_id\": \"<string>\",\n      \"fulfilled_at\": \"2023-11-07T05:31:56Z\",\n      \"shipping_carrier\": \"<string>\",\n      \"location\": {\n        \"id\": 123\n      },\n      \"fulfillment_line_items\": [\n        {\n          \"external_id\": \"<string>\",\n          \"order_line_item_external_id\": \"<string>\",\n          \"quantity\": 123\n        }\n      ],\n      \"tracking_numbers\": [\n        \"<string>\"\n      ]\n    }\n  ],\n  \"tags\": [\n    \"<string>\"\n  ],\n  \"created_at\": \"2023-04-25T13:25:00-05:00\",\n  \"updated_at\": \"2023-04-25T13:25:00-05:00\",\n  \"cancelled_at\": \"2023-04-25T13:25:00-05:00\",\n  \"processed_at\": \"2023-04-25T13:25:00-05:00\",\n  \"browser_ip\": \"127.0.0.1\",\n  \"client_details_user_agent\": \"<string>\",\n  \"total_tip_received\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"metadata\": [\n    {\n      \"key\": \"<string>\",\n      \"value\": \"<unknown>\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Authorization", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.loopreturns.com/api/v1/orders/{id}")
  .header("X-Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"sales_channel\": \"<string>\",\n  \"source\": {\n    \"name\": \"<string>\"\n  },\n  \"external_id\": \"<string>\",\n  \"name\": \"<string>\",\n  \"secondary_identifier\": \"<string>\",\n  \"customer\": {\n    \"id\": 123,\n    \"external_id\": \"<string>\"\n  },\n  \"taxes_included\": true,\n  \"total_price_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_discounts\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_discounts_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_taxes\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_taxes_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"shipping_lines\": [\n    [\n      {\n        \"title\": \"<string>\",\n        \"discounts\": {\n          \"external_id\": \"<string>\",\n          \"name\": \"<string>\",\n          \"code\": \"<string>\",\n          \"reason\": \"<string>\",\n          \"rate\": 123\n        },\n        \"tax_lines\": [\n          {\n            \"title\": \"<string>\",\n            \"rate\": 123\n          }\n        ]\n      }\n    ]\n  ],\n  \"refunds\": [\n    [\n      {\n        \"amount\": {\n          \"amount\": 123,\n          \"currency_code\": \"USD\"\n        },\n        \"external_id\": \"<string>\",\n        \"line_item\": {\n          \"id\": 123,\n          \"quantity\": 123,\n          \"restock\": true\n        },\n        \"created_at\": \"2023-04-25T13:25:00-05:00\",\n        \"updated_at\": \"2023-04-25T13:25:00-05:00\"\n      }\n    ]\n  ],\n  \"line_items\": [\n    {\n      \"external_id\": \"<string>\",\n      \"product_variant\": {\n        \"id\": 123\n      },\n      \"quantity\": 123,\n      \"unit_price_presentment\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"unit_discounts\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"unit_discounts_presentment\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"taxable\": true,\n      \"tax_lines\": [\n        {\n          \"title\": \"<string>\",\n          \"rate\": 123\n        }\n      ],\n      \"refunds\": [\n        {\n          \"amount\": {\n            \"amount\": 123,\n            \"currency_code\": \"USD\"\n          },\n          \"external_id\": \"<string>\",\n          \"line_item\": {\n            \"id\": 123,\n            \"quantity\": 123,\n            \"restock\": true\n          },\n          \"created_at\": \"2023-04-25T13:25:00-05:00\",\n          \"updated_at\": \"2023-04-25T13:25:00-05:00\"\n        }\n      ],\n      \"discounts\": [\n        {\n          \"external_id\": \"<string>\",\n          \"name\": \"<string>\",\n          \"code\": \"<string>\",\n          \"reason\": \"<string>\",\n          \"rate\": 123\n        }\n      ],\n      \"duties\": [\n        {\n          \"hs_code\": \"<string>\",\n          \"country_of_origin\": \"<string>\",\n          \"tax_lines\": [\n            {\n              \"title\": \"<string>\",\n              \"rate\": 123\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fulfillments\": [\n    {\n      \"external_id\": \"<string>\",\n      \"fulfilled_at\": \"2023-11-07T05:31:56Z\",\n      \"shipping_carrier\": \"<string>\",\n      \"location\": {\n        \"id\": 123\n      },\n      \"fulfillment_line_items\": [\n        {\n          \"external_id\": \"<string>\",\n          \"order_line_item_external_id\": \"<string>\",\n          \"quantity\": 123\n        }\n      ],\n      \"tracking_numbers\": [\n        \"<string>\"\n      ]\n    }\n  ],\n  \"tags\": [\n    \"<string>\"\n  ],\n  \"created_at\": \"2023-04-25T13:25:00-05:00\",\n  \"updated_at\": \"2023-04-25T13:25:00-05:00\",\n  \"cancelled_at\": \"2023-04-25T13:25:00-05:00\",\n  \"processed_at\": \"2023-04-25T13:25:00-05:00\",\n  \"browser_ip\": \"127.0.0.1\",\n  \"client_details_user_agent\": \"<string>\",\n  \"total_tip_received\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"metadata\": [\n    {\n      \"key\": \"<string>\",\n      \"value\": \"<unknown>\"\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.loopreturns.com/api/v1/orders/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"sales_channel\": \"<string>\",\n  \"source\": {\n    \"name\": \"<string>\"\n  },\n  \"external_id\": \"<string>\",\n  \"name\": \"<string>\",\n  \"secondary_identifier\": \"<string>\",\n  \"customer\": {\n    \"id\": 123,\n    \"external_id\": \"<string>\"\n  },\n  \"taxes_included\": true,\n  \"total_price_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_discounts\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_discounts_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_taxes\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"total_taxes_presentment\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"shipping_lines\": [\n    [\n      {\n        \"title\": \"<string>\",\n        \"discounts\": {\n          \"external_id\": \"<string>\",\n          \"name\": \"<string>\",\n          \"code\": \"<string>\",\n          \"reason\": \"<string>\",\n          \"rate\": 123\n        },\n        \"tax_lines\": [\n          {\n            \"title\": \"<string>\",\n            \"rate\": 123\n          }\n        ]\n      }\n    ]\n  ],\n  \"refunds\": [\n    [\n      {\n        \"amount\": {\n          \"amount\": 123,\n          \"currency_code\": \"USD\"\n        },\n        \"external_id\": \"<string>\",\n        \"line_item\": {\n          \"id\": 123,\n          \"quantity\": 123,\n          \"restock\": true\n        },\n        \"created_at\": \"2023-04-25T13:25:00-05:00\",\n        \"updated_at\": \"2023-04-25T13:25:00-05:00\"\n      }\n    ]\n  ],\n  \"line_items\": [\n    {\n      \"external_id\": \"<string>\",\n      \"product_variant\": {\n        \"id\": 123\n      },\n      \"quantity\": 123,\n      \"unit_price_presentment\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"unit_discounts\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"unit_discounts_presentment\": {\n        \"amount\": 50000,\n        \"currency_code\": \"USD\"\n      },\n      \"taxable\": true,\n      \"tax_lines\": [\n        {\n          \"title\": \"<string>\",\n          \"rate\": 123\n        }\n      ],\n      \"refunds\": [\n        {\n          \"amount\": {\n            \"amount\": 123,\n            \"currency_code\": \"USD\"\n          },\n          \"external_id\": \"<string>\",\n          \"line_item\": {\n            \"id\": 123,\n            \"quantity\": 123,\n            \"restock\": true\n          },\n          \"created_at\": \"2023-04-25T13:25:00-05:00\",\n          \"updated_at\": \"2023-04-25T13:25:00-05:00\"\n        }\n      ],\n      \"discounts\": [\n        {\n          \"external_id\": \"<string>\",\n          \"name\": \"<string>\",\n          \"code\": \"<string>\",\n          \"reason\": \"<string>\",\n          \"rate\": 123\n        }\n      ],\n      \"duties\": [\n        {\n          \"hs_code\": \"<string>\",\n          \"country_of_origin\": \"<string>\",\n          \"tax_lines\": [\n            {\n              \"title\": \"<string>\",\n              \"rate\": 123\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"fulfillments\": [\n    {\n      \"external_id\": \"<string>\",\n      \"fulfilled_at\": \"2023-11-07T05:31:56Z\",\n      \"shipping_carrier\": \"<string>\",\n      \"location\": {\n        \"id\": 123\n      },\n      \"fulfillment_line_items\": [\n        {\n          \"external_id\": \"<string>\",\n          \"order_line_item_external_id\": \"<string>\",\n          \"quantity\": 123\n        }\n      ],\n      \"tracking_numbers\": [\n        \"<string>\"\n      ]\n    }\n  ],\n  \"tags\": [\n    \"<string>\"\n  ],\n  \"created_at\": \"2023-04-25T13:25:00-05:00\",\n  \"updated_at\": \"2023-04-25T13:25:00-05:00\",\n  \"cancelled_at\": \"2023-04-25T13:25:00-05:00\",\n  \"processed_at\": \"2023-04-25T13:25:00-05:00\",\n  \"browser_ip\": \"127.0.0.1\",\n  \"client_details_user_agent\": \"<string>\",\n  \"total_tip_received\": {\n    \"amount\": 50000,\n    \"currency_code\": \"USD\"\n  },\n  \"metadata\": [\n    {\n      \"key\": \"<string>\",\n      \"value\": \"<unknown>\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "order": {
    "id": 2,
    "external_id": "<string>",
    "name": "<string>",
    "secondary_identifier": "<string>",
    "source": "<string>",
    "sales_channel": "<string>",
    "customer": {
      "id": 123,
      "external_id": "<string>",
      "sales_channel": "<string>",
      "first_name": "<string>",
      "last_name": "<string>",
      "email": "<string>",
      "phone": "<string>"
    },
    "shipping_address": {
      "address1": "<string>",
      "city": "<string>",
      "country_code": "<string>",
      "name": "<string>",
      "company": "<string>",
      "address2": "<string>",
      "region": "<string>",
      "postal_code": "<string>"
    },
    "billing_address": {
      "address1": "<string>",
      "city": "<string>",
      "country_code": "<string>",
      "name": "<string>",
      "company": "<string>",
      "address2": "<string>",
      "region": "<string>",
      "postal_code": "<string>"
    },
    "taxes_included": true,
    "total_price": {
      "amount": 123,
      "currency_code": "USD"
    },
    "total_price_presentment": {
      "amount": 123,
      "currency_code": "USD"
    },
    "total_discounts": {
      "amount": 123,
      "currency_code": "USD"
    },
    "total_discounts_presentment": {
      "amount": 123,
      "currency_code": "USD"
    },
    "shipping_lines": [
      {
        "title": "<string>",
        "price": {
          "amount": 123,
          "currency_code": "USD"
        },
        "discounts": {
          "external_id": "<string>",
          "name": "<string>",
          "code": "<string>",
          "reason": "<string>",
          "rate": 123,
          "net_adjustment_money": {
            "amount": 123,
            "currency_code": "USD"
          },
          "tax_adjustment_money": {
            "amount": 123,
            "currency_code": "USD"
          }
        },
        "tax_lines": [
          {
            "title": "<string>",
            "rate": 123,
            "price": {
              "amount": 123,
              "currency_code": "USD"
            }
          }
        ]
      }
    ],
    "order_discounts": [
      {
        "external_id": "<string>",
        "name": "<string>",
        "code": "<string>",
        "reason": "<string>",
        "rate": 123,
        "tax_adjustment_money": {
          "amount": 123,
          "currency_code": "USD"
        },
        "net_adjustment_money": {
          "amount": 123,
          "currency_code": "USD"
        }
      }
    ],
    "total_taxes": {
      "amount": 123,
      "currency_code": "USD"
    },
    "total_taxes_presentment": {
      "amount": 123,
      "currency_code": "USD"
    },
    "tags": [
      "<string>"
    ],
    "refunds": [
      [
        [
          {
            "amount": {
              "amount": 123,
              "currency_code": "USD"
            },
            "external_id": "<string>",
            "line_item": {
              "id": 123,
              "quantity": 123,
              "restock": true
            },
            "created_at": "2023-04-25T13:25:00-05:00",
            "updated_at": "2023-04-25T13:25:00-05:00"
          }
        ]
      ]
    ],
    "line_items": [
      {
        "id": 2,
        "external_id": "<string>",
        "product": {
          "id": 123
        },
        "product_variant": {
          "id": 123
        },
        "quantity": 123,
        "unit_price": {
          "amount": 123,
          "currency_code": "USD"
        },
        "unit_price_presentment": {
          "amount": 50000,
          "currency_code": "USD"
        },
        "unit_discounts": {
          "amount": 50000,
          "currency_code": "USD"
        },
        "unit_discounts_presentment": {
          "amount": 50000,
          "currency_code": "USD"
        },
        "taxable": true,
        "tax_lines": [
          {
            "title": "<string>",
            "rate": 123,
            "price": {
              "amount": 123,
              "currency_code": "USD"
            }
          }
        ],
        "refunds": [
          {
            "amount": {
              "amount": 123,
              "currency_code": "USD"
            },
            "external_id": "<string>",
            "line_item": {
              "id": 123,
              "quantity": 123,
              "restock": true
            },
            "created_at": "2023-04-25T13:25:00-05:00",
            "updated_at": "2023-04-25T13:25:00-05:00"
          }
        ],
        "discounts": [
          {
            "external_id": "<string>",
            "name": "<string>",
            "code": "<string>",
            "reason": "<string>",
            "rate": 123,
            "tax_adjustment_money": {
              "amount": 123,
              "currency_code": "USD"
            },
            "net_adjustment_money": {
              "amount": 123,
              "currency_code": "USD"
            }
          }
        ],
        "duties": [
          {
            "hs_code": "<string>",
            "country_of_origin": "<string>",
            "price": {
              "amount": 123,
              "currency_code": "USD"
            },
            "tax_lines": [
              {
                "title": "<string>",
                "rate": 123,
                "price": {
                  "amount": 123,
                  "currency_code": "USD"
                }
              }
            ]
          }
        ]
      }
    ],
    "fulfillments": [
      {
        "external_id": "<string>",
        "fulfilled_at": "2023-11-07T05:31:56Z",
        "shipping_carrier": "<string>",
        "location": {
          "id": 123
        },
        "fulfillment_line_items": [
          {
            "external_id": "<string>",
            "order_line_item_external_id": "<string>",
            "quantity": 123
          }
        ],
        "tracking_numbers": [
          "<string>"
        ]
      }
    ],
    "created_at": "2023-04-25T13:25:00-05:00",
    "updated_at": "2023-04-25T13:25:00-05:00",
    "processed_at": "2023-04-25T13:25:00-05:00",
    "browser_ip": "127.0.0.1",
    "client_details_user_agent": "<string>",
    "total_tip_received": {
      "amount": 50000,
      "currency_code": "USD"
    },
    "warnings": [
      {
        "code": "<string>",
        "message": "<string>"
      }
    ]
  }
}
{
  "errors": "<string>"
}
{
  "message": "<string>"
}

Authorizations

X-Authorization
string
header
required

API Scope: "Order (write)"

Path Parameters

id
integer
required

Identifier of the order.

Body

application/json
sales_channel
string
required

If a channel with this name is not already associated with the shop, it will be used to create a new channel.

Maximum string length: 255
Example:

"shopify"

source
object
required

The source system that created the order.

external_id
string | null
Maximum string length: 64
Example:

"564400c7-7a6b-4f29-b6a5-7bb580b2992c"

name
string
Maximum string length: 100
secondary_identifier
string | null

An optional secondary identifier for the order, enabling customer lookup by an alternate reference. Use this for any supplementary order ID your system tracks — for example a fulfillment system ID (e.g. NetSuite), a marketplace order number, or a confirmation number. Customers can look up their return using either name or secondary_identifier.

Maximum string length: 100
customer
object | null
status
enum<string>

Status of the Order.

Available options:
active,
archived,
cancelled,
unknown
shipping_address
object
Example:
{
  "name": "John Smith",
  "company": "Acme, Co",
  "address1": "123 Example St",
  "address2": "Box 123",
  "city": "Columbus",
  "region": "OH",
  "postal_code": 12345,
  "country_code": "US"
}
billing_address
object
Example:
{
  "name": "John Smith",
  "company": "Acme, Co",
  "address1": "123 Example St",
  "address2": "Box 123",
  "city": "Columbus",
  "region": "OH",
  "postal_code": 12345,
  "country_code": "US"
}
taxes_included
boolean | null
total_price
object

The price of the order in minor units, such as cents, with its corresponding currency.

Examples:
{ "amount": 50000, "currency_code": "USD" }
{ "amount": 25000 }
{ "amount": 1500, "currency_code": "EUR" }
total_price_presentment
object | null

The price of the order in minor units, such as cents. This is included if the price was shown to the customer in an alternate currency.

Example:
{ "amount": 50000, "currency_code": "USD" }
total_discounts
object | null

The deduction from the original order price as a way to promote sales, special offers, or customer loyalty rewards.

Example:
{ "amount": 50000, "currency_code": "USD" }
total_discounts_presentment
object | null

The deduction from the original order price as a way to promote sales, special offers, or customer loyalty rewards. This price is discounted from the original price according to the customer's local currency.

Example:
{ "amount": 50000, "currency_code": "USD" }
total_taxes
object | null

The tax amount for the order.

Example:
{ "amount": 50000, "currency_code": "USD" }
total_taxes_presentment
object | null

The tax amount for the order according to the customer's local currency.

Example:
{ "amount": 50000, "currency_code": "USD" }
shipping_lines
ShippingLine · object[][]

List of shipping line items associated with the order.

refunds
RefundItems · object[][]

List of refunds associated with the order.

line_items
object[]

List of order line items associated with the order.

fulfillments
object[] | null

Fulfillment information for the order.

tags
string[] | null

A tag used to classify and group orders.

created_at
string<date-time> | null

The date and time the order was created in the source system. Required in the unstable API version; will become required in a future stable version.

Example:

"2023-04-25T13:25:00-05:00"

updated_at
string<date-time> | null
Example:

"2023-04-25T13:25:00-05:00"

cancelled_at
string<date-time> | null

Timestamp when the order was cancelled. Required when status is cancelled — include both fields together so Loop can reverse Checkout+ protection coverage.

Example:

"2023-04-25T13:25:00-05:00"

financial_status
enum<string> | null

The financial status of the order.

Available options:
pending,
authorized,
partially_paid,
paid,
partially_refunded,
refunded,
voided,
null
Maximum string length: 30
cancel_reason
enum<string> | null

The reason the order was cancelled, if applicable.

Available options:
customer,
declined,
fraud,
inventory,
other,
staff,
null
Maximum string length: 30
processed_at
string<date-time> | null

The date and time when the order was processed in the source system.

Example:

"2023-04-25T13:25:00-05:00"

browser_ip

The IP address of the browser used to place the order.

Maximum string length: 45
client_details_user_agent
string | null

The user agent string of the browser used to place the order.

Maximum string length: 1000
total_tip_received
object | null

The total tip amount received for the order.

Example:
{ "amount": 50000, "currency_code": "USD" }
metadata
object[] | null

Key/value metadata to attach to the order. A return_id key must reference a return that exists for the shop.

Response

OK

order
OrderResponse · object