Cancel an order
1 min
code examples curl request post \\ \ url https //api archbee com/v2/orders/{orderid}/cancel \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "reason" "", "refundpreference" { "method" "original payment" } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "reason" "", "refundpreference" { "method" "original payment" } }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //api archbee com/v2/orders/{orderid}/cancel", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //api archbee com/v2/orders/{orderid}/cancel") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "reason" "", "refundpreference" { "method" "original payment" } }) response = https request(request) puts response read body import requests import json url = "https //api archbee com/v2/orders/{orderid}/cancel" payload = json dumps({ "reason" "", "refundpreference" { "method" "original payment" } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // order cancelled { "id" "880e8400 e29b 41d4 a716 446655440003", "status" "pending", "items" \[ {} ], "subtotal" 159 98, "tax" 12 8, "total" 172 78, "shippingaddress" { "street" "123 main st", "street2" "apt 4b", "city" "springfield", "state" "il", "zipcode" "62701", "country" "us" }, "metadata" "", "tracking" { "carrier" "fedex", "trackingnumber" 794644790132, "estimateddelivery" "2025 07 15", "events" \[ { "timestamp" "", "location" "", "description" "" } ] }, "createdat" "", "updatedat" "" }// order cannot be cancelled (already shipped/delivered) { "code" "validation error", "message" "the request body contains invalid fields", "details" \[ { "field" "email", "message" "must be a valid email address", "code" "invalid format" } ], "requestid" "" }// not found — the requested resource does not exist { "code" "validation error", "message" "the request body contains invalid fields", "details" \[ { "field" "email", "message" "must be a valid email address", "code" "invalid format" } ], "requestid" "" }