Magento 2 Identify Payment method is offline or online after place order.

Magento 2 you can identify Payment method was offline or online for a placed order. Sometimes you need to identify Used payment method in Order was offline or online.

Offline Payment methods are Cash on delivery, Check/Money order, Bank transfer.

Online Payment methods are Paypal, Authorize.net, Cybersource, Braintree and many more online payments available.

You can check payment method is offline or online using programmatically by

$order->getPayment()->getMethodInstance()->isOffline() result will be 1 for offline payment method.

I have given demo for Observer. Event name is sales_order_place_after,

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $order = $observer->getOrder();
    $isOffline = $order->getPayment()->getMethodInstance()->isOffline();

    if ($isOffline) {
    	echo __('Payment method is offline');
	} else {
    	echo __('Payment method is online');
	}
}