Drupal commerce how to add/change billing programmatically

Unlike shipments, each order has one billing profile, to change it programmatically we can first check it existence and then we can do the changes, it goes like this:

      $profile = $order->getBillingProfile();

      if (empty($profile)) {
        $profile = Profile::create([
          'type' => 'customer',
          'uid' => $current_user,
        ]);
        $profile->save();
      }

      $profile->address->given_name = $given_name;
      $profile->address->family_name = $family_name;
      $profile->address->country_code = $values["data"]["result"]["token"]["card"]["country"];
      $profile->address->locality = $values["data"]["result"]["token"]["card"]["address_city"];
      $profile->address->administrative_area = $values["data"]["result"]["token"]["card"]["address_state"];
      $profile->address->postal_code = $values["data"]["result"]["token"]["card"]["address_zip"];
      $profile->address->address_line1 = $values["data"]["result"]["token"]["card"]["address_line1"];
      $profile->address->address_line2 = $values["data"]["result"]["token"]["card"]["address_line2"];
      $profile->save();

      $order->setBillingProfile($profile);
      $order->save();