I asked this question back in 2020: How do I programmatically "place" an order? and provided my own answer there:
Provide an event subscriber:
public static function getSubscribedEvents() {
$events['commerce_order.order.paid'][] = ['placeOrder'];
return $events;
}
which then applies a transition to the Order:
public function placeOrder($event) {
$order = $event->getOrder();
$order->getState()->applyTransitionById('place');
return;
}
This has worked well for the past 2 years but client now wants to split payment authorize and capture. This requires a later step after accepting payment to "capture" the payment. Although the payment capture seems to work and changes payment state to completed; the order balance is not reduced to $0. Removing my code to fix the Order being placed (on admin authorize and capture payments) allows capture to work correctly.
I can likely trigger my transition by something which distinguishes between the 2 types of payments; but suspect I am likely doing something wrong in how I am placing the Order.
EDIT
Changed title to better clarify the requirement.