src/Checkout/Checkout.php
public function setPaymentMethod($paymentmethod)
    {
        $methods = GatewayInfo::getSupportedGateways();
        if (!isset($methods[$paymentmethod])) {
            ShopTools::getSession()
                ->set('Checkout.PaymentMethod', null)
                ->clear('Checkout.PaymentMethod');
            return $this->error(_t(__CLASS__ . '.NoPaymentMethod', 'Payment method does not exist'));
        }
        ShopTools::getSession()->set('Checkout.PaymentMethod', $paymentmethod);
        return true;
    }
public function setPaymentMethod($paymentmethod)
    {
        $methods = GatewayInfo::getSupportedGateways();
        if (!isset($methods[$paymentmethod])) {
            ShopTools::getSession()
                ->set('Checkout.PaymentMethod', null)
                ->clear('Checkout.PaymentMethod');
            return $this->error(_t(__CLASS__ . '.NoPaymentMethod', 'Payment method does not exist'));
        }
        ShopTools::getSession()->set('Checkout.PaymentMethod', $paymentmethod);
        return true;
    }
Set payment method

@throws \SilverStripe\Omnipay\Exception\InvalidConfigurationException