Skip to main content
added 465 characters in body
Source Link
Rakesh Jesadiya
  • 42.4k
  • 19
  • 132
  • 184

You can try with below method for payment encryption method to get value,

You have to replace \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, with below class path, \Magento\Payment\Gateway\ConfigInterface This is works fine,

   <?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Vendor\Package\Block;Vendor\Module\Gateway\Http;

use Magento\Payment\Gateway\Http\TransferBuilder;
use Magento\Payment\Gateway\Http\TransferFactoryInterface;
use Magento\Payment\Gateway\Http\TransferInterface;
use Magento\Payment\Gateway\ConfigInterface;

class TestTransferFactory implements TransferFactoryInterface
{
    protectedprivate $config;

    private $transferBuilder;

    public function __construct(
        ..ConfigInterface $config,
        \Magento\Payment\Gateway\ConfigInterfaceTransferBuilder $config$transferBuilder
    ) {
   ..
    ) {$this->config = $config;
        $this->config>transferBuilder = $config;$transferBuilder;
    } 

   
    public function getPaymentKey()
    {
        $key=echo $this->config->getValue('payment/webpay/keyid');
        echo $key;
    }
 
}

You can try with below method for payment encryption method to get value,

You have to replace \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, with below class path, \Magento\Payment\Gateway\ConfigInterface This is works fine,

<?php

namespace Vendor\Package\Block;

class Test
{
    protected $config;

    public function __construct(
        ..
        \Magento\Payment\Gateway\ConfigInterface $config
        ..
    ) {
        $this->config = $config;
    }

    public function getPaymentKey()
    {
        $key= $this->config->getValue('payment/webpay/keyid');
        echo $key;
    }
 
}

You can try with below method for payment encryption method to get value,

You have to replace \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, with below class path, \Magento\Payment\Gateway\ConfigInterface This is works fine,

   <?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Vendor\Module\Gateway\Http;

use Magento\Payment\Gateway\Http\TransferBuilder;
use Magento\Payment\Gateway\Http\TransferFactoryInterface;
use Magento\Payment\Gateway\Http\TransferInterface;
use Magento\Payment\Gateway\ConfigInterface;

class TransferFactory implements TransferFactoryInterface
{
    private $config;

    private $transferBuilder;

    public function __construct(
        ConfigInterface $config,
        TransferBuilder $transferBuilder
    ) {
        $this->config = $config;
        $this->transferBuilder = $transferBuilder;
    } 

   
    public function getPaymentKey()
    {
        echo $this->config->getValue('payment/webpay/keyid')
    }
}
Source Link
Rakesh Jesadiya
  • 42.4k
  • 19
  • 132
  • 184

You can try with below method for payment encryption method to get value,

You have to replace \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, with below class path, \Magento\Payment\Gateway\ConfigInterface This is works fine,

<?php

namespace Vendor\Package\Block;

class Test
{
    protected $config;

    public function __construct(
        ..
        \Magento\Payment\Gateway\ConfigInterface $config
        ..
    ) {
        $this->config = $config;
    }

    public function getPaymentKey()
    {
        $key= $this->config->getValue('payment/webpay/keyid');
        echo $key;
    }

}