I am looking for a way to update order status with rest api (php) based on order ID.

I tried several things from the doc (well at least, I have found below code Without success)

    $data = array(
        "entity" => array(

$retour = $this->api->put("orders",$data );

How can I accomplish this.

  • 1
    'entity_id'=>'000000159' it's not entity_id but real_order_id – Adrian Szulc Oct 9 '17 at 16:09
$entity_id = 955;
$data_json = [
    "entity"=> [
        "entity_id" => $entity_id,
        "state" => "processing",
        "status" => "Processing"
$data_string = json_encode($data_json);
$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer '.json_decode($token),
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
$response = curl_exec($ch);
$response =  json_decode($response);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.