How to update payment status inside an order? I am trying to update order status and payment status depending upon the value we get in a variable called $payment_status.  I am able to update order status but I am unable to update payment status inside that order. I am getting an error "The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\commerce_order\Payment\Payment' not found" The code I used is as follows:-

//update order status based on payment status
  $order = \Drupal\commerce_order\Entity\Order::load($order_id);
  // dpm($order);
  if($payment_status === 'payment.captured' ){
    $order-&gt;set('state', 'completed' );
    $order-&gt;save();
    $payments = \Drupal\commerce_order\Payment\Payment::loadByProperties(['order_id' =&gt; $order_id]);
      foreach ($payments as $payment)
      {
        $payment-&gt;setState('completed')-&gt;save();
      }
  }
  else{
    $order-&gt;set('state', 'pending' );
    $order-&gt;save();
  }


How to solve this?
Please change the code from 

 \Drupal\commerce_order\Payment\Payment::loadByProperties(['order_id' =&gt; $order_id]);    
        TO        
 \Drupal::entityTypeManager() -&gt;getStorage('commerce_payment') -&gt;loadByProperties([ 'order_id' =&gt; [$orderid], ]);