You can only update custom data, shipping, shipping_address, and status on orders. All other settings in the order object are immutable.
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. Cancelling an order does not automatically refund a payment. You must refund the orders manually.
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.
Represents the object being returned. It is always order.
external_ref
Optional
string
Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.
constMoltinGateway=require("@moltin/sdk").gateway;constMoltin=MoltinGateway({client_id:"X",client_secret:"X",});const id ="XXXX";const order ={shipping_address:{first_name:"John",},};Moltin.Orders.Update(id, order).then((order)=>{// Do something});
{"data":{"type":"order","id":"369ad4a4-ee67-48b0-x347-t50a6e61d83d","status":"incomplete","payment":"unpaid","shipping":"unfulfilled","customer":{"name":"Mr John Doe","email":"johndoe@example.com"},"external_ref":"external_order_123","shipping_address":{"first_name":"James","last_name":"Doe","phone_number":"","company_name":"","line_1":"1234 Disney Drive","line_2":"Disney Resort","city":"Anaheim","county":"Orange","region":"CA","postcode":"92802","country":"US","instructions":""},"billing_address":{"first_name":"John","last_name":"Doe","company_name":"","line_1":"1234 Disney Drive","line_2":"Disney Resort","city":"Anaheim","county":"Orange","region":"CA","postcode":"92802","country":"US"},"links":{},"meta":{"display_price":{"with_tax":{"amount":237500,"currency":"USD","formatted":"$2175.00"},"without_tax":{"amount":237500,"currency":"USD","formatted":"$2175.00"}},"timestamps":{"created_at":"2018-04-16T10:11:59.715Z","updated_at":"2018-04-16T10:11:59.715Z"}},"relationships":{"items":{"data":[{"type":"item","id":"de9fddf5-011b-4485-abf8-ebb8f53c39ff"}]}}}}
{"data":{"type":"order","id":"50ca1ec7-cb04-45f0-b7a9-3613ef7c23d3","status":"cancelled","payment":"authorized","shipping":"unfulfilled","anonymized":false,"customer":{"name":"Andy","email":"andy@example.com"},"shipping_address":{"first_name":"Andy","last_name":"Dwyer","phone_number":"123-456-1111","company_name":"Elasticpath","line_1":"1234 Disney Drive","line_2":"Disney Resort","city":"Anaheim","county":"Orange","region":"CA","postcode":"92802","country":"US","instructions":""},"billing_address":{"first_name":"Andy","last_name":"Dwyer","company_name":"Elasticpath","line_1":"1234 Disney Drive","line_2":"Disney Resort","city":"Anaheim","county":"Orange","region":"CA","postcode":"92802","country":"US"},"links":{},"meta":{"display_price":{"with_tax":{"amount":10000,"currency":"USD","formatted":"$100.00"},"without_tax":{"amount":10000,"currency":"USD","formatted":"$100.00"},"tax":{"amount":0,"currency":"USD","formatted":"$0.00"},"discount":{"amount":0,"currency":"USD","formatted":"$0.00"}},"timestamps":{"created_at":"2022-02-16T00:30:24Z","updated_at":"2022-02-16T00:32:25Z"}},"relationships":{"items":{"data":[{"type":"item","id":"df6f9b0c-b4b6-4fbe-b94c-c36bab71f121"}]}}}}
You cannot cancel a payment using manual gateway. You can only cancel an order. The following error response is returned when you can cancel a payment using manual gateway:
"errors":[{"status":422,"title":"Unsupported gateway operation","detail":"Cancellation is not supported for Manual payment gateway"}]}
{"data":{"type":"order","id":"369ad4a4-ee67-48b0-x347-t50a6e61d83d","status":"complete","payment":"paid","shipping":"fulfilled","customer":{"name":"Mr John Doe","email":"johndoe@example.com"},"shipping_address":{"first_name":"James","last_name":"Doe","phone_number":"","company_name":"","line_1":"1234 Disney Drive","line_2":"Disney Resort","city":"Anaheim","county":"Orange","region":"CA","postcode":"92802","country":"US","instructions":""},"billing_address":{"first_name":"John","last_name":"Doe","company_name":"","line_1":"1234 Disney Drive","line_2":"Disney Resort","city":"Anaheim","county":"Orange","region":"CA","postcode":"92802","country":"US"},"links":{},"meta":{"display_price":{"with_tax":{"amount":237500,"currency":"USD","formatted":"$2175.00"},"without_tax":{"amount":237500,"currency":"USD","formatted":"$2175.00"}},"timestamps":{"created_at":"2018-04-16T10:11:59.715Z","updated_at":"2018-04-16T10:11:59.715Z"}},"relationships":{"items":{"data":[{"type":"item","id":"de9fddf5-011b-4485-abf8-ebb8f53c39ff"}]}}}}