On order complete, system call the commerce_order.place.post_transition. so You need to create an Event on Checkout complete.
Reacting to Transitions
Example - reacting to the order 'place' transition.
// mymodule/src/EventSubscriber/MyModuleEventSubscriber.php
namespace Drupal\my_module\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\state_machine\Event\WorkflowTransitionEvent;
class MyModuleEventSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
// The format for adding a state machine event to subscribe to is:
// {group}.{transition key}.pre_transition or {group}.{transition key}.post_transition
// depending on when you want to react.
$events = ['commerce_order.place.post_transition' => 'onOrderPlace'];
return $events;
}
public function onOrderPlace(WorkflowTransitionEvent $event) {
// @todo Write code that will run when the subscribed event fires.
}
}
Telling Drupal About Your Event Subscriber
Your event subscriber should be added to {module}.services.yml in the base directory of your module.
The following would register the event subscriber in the previous section:
# mymodule.services.yml
services:
my_module_event_subscriber:
class: '\Drupal\my_module\EventSubscriber\MyModuleEventSubscriber'
tags:
- { name: 'event_subscriber' }
For more reference review the following URL:
https://docs.drupalcommerce.org/commerce2/developer-guide/orders/react-to-workflow-transitions#reacting-to-transitions