Q:

How can I access the Gateways services?

I have been trying to access craft\commerce\services\Gateways; from a plugin but I can't figure out how I need to access it. I've used the following:
$gateways = Commerce::getInstance()->commerce->getAllGateways();

$gateways = craft\commerce\services\Gateways::getAllGateways();

The first one says Getting unknown property: craft\commerce\Plugin::commerce and the second one tells me 
Non-static method craft\commerce\services\Gateways::getAllGateways() should not be called statically
Can anyone tell me the proper way of doing this? Thanks!

A:

Figured it out:
use craft\commerce\Plugin as Commerce;

$gatewayService = Commerce::getInstance()->getGateways();
$variables = [
    'gateways' => $gatewayService->getAllGateways(),
];

