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 the used payment method in order as offline or online.

Offline Payment methods are Cash on delivery, Check/Money order, Bank transfer, Purchase Order, and Payment on account.

Online Payment methods are Paypal,, Cybersource, Braintree, Adyen, Klarna, and many more online payments available that contain the credit card form.

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

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

I have given a demo for Observer. The event name used sales_order_place_after,

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

    $isOffline = $order->getPayment()
    if ($isOffline){
        echo __('Payment method is offline');
    } else {
        echo __('Payment method is online');