This is the code that I'm using to get the value from a specific field saved via the admin panel.
protected $_paymentData;
protected $_scopeConfig;
protected $logger;
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
\Magento\Payment\Helper\Data $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Module\ModuleListInterface $moduleList,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Directory\Model\CountryFactory $countryFactory,
\Stripe\Stripe $stripe,
\Inchoo\Stripe\Model\StripeFactory $stripeFactory,
array $data = array()
) {
parent::__construct(
$context,
$registry,
$extensionFactory,
$customAttributeFactory,
$paymentData,
$scopeConfig,
$logger,
$moduleList,
$localeDate,
null,
null,
$data
);
$this->_scopeConfig = $scopeConfig;
$this->logger = $logger;
$this->initializeData($data);
}
public function getPaymentKey(){
$key= $this->_scopeConfig->getValue('payment/webpay/keyid');
echo $key;
exit;
}
Echo Result: idfrk3-45pfnrkhwneirgplbmisniepssnie:hirtw45
True Key: p92GBhcQl7TklHOsWcxBk4eOmL6wpQWBG9nT2Qcf