Update an Order
PUThttps://useast.api.elasticpath.com/v2/orders/:orderID
You can only update custom data, shipping
, shipping_address
, and status of orders. All other settings in the order object are immutable.
This endpoint allows you to:
- Update an order number and external reference: You can update an existing order that does not have an
order_number
andexternal_ref
, modify theorder_number
andexternal_ref
values, or remove them by passing an empty value in theorder_number
andexternal_ref
fields. - Cancel an order: You can cancel an order only if it has not been fulfilled.
- Fulfill an order: You can fulfill a paid order only.
caution
You can update shipping
, shipping_address
, and status of an order only if the order is not fulfilled. You can use the refund API to refund an order only if the payment status is paid
. Canceling an order does not automatically refund a payment. You must refund the orders manually.
note
- This request is only accessible to client credentials token users with Seller Admin role.
- Non client credentials token users cannot access this endpoint. See Permissions.
- The
order_number
will appear as the invoice number in Authorize.net transactions.
Request
Responses
- 200
- 401
OK
Unauthorized
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://useast.api.elasticpath.com/v2/orders/:orderID");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"order_number\": \"string\",\n \"external_ref\": \"string\",\n \"shipping_address\": {\n \"first_name\": \"string\",\n \"last_name\": \"string\",\n \"phone_number\": \"string\",\n \"company_name\": \"string\",\n \"line_1\": \"string\",\n \"line_2\": \"string\",\n \"city\": \"string\",\n \"county\": \"string\",\n \"region\": \"string\",\n \"postcode\": \"string\",\n \"country\": \"string\",\n \"instructions\": \"string\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear