config = $config; $this->adapterFactory = $adapterFactory; $this->quoteSession = $quoteSession; } /** * @inheritdoc */ public function execute() { $params = []; $response = $this->resultFactory->create(ResultFactory::TYPE_JSON); $storeId = $this->quoteSession->getStoreId(); $merchantAccountId = $this->config->getMerchantAccountId($storeId); if (!empty($merchantAccountId)) { $params[PaymentDataBuilder::MERCHANT_ACCOUNT_ID] = $merchantAccountId; } $clientToken = $this->adapterFactory->create($storeId) ->generate($params); $response->setData(['clientToken' => $clientToken]); return $response; } }