/** * Show payment page * @return \Magento\Framework\View\Result\PageFactory */ public function execute() { $result = $this->payment->createPaymentRequest(); $resultPage = $this->resultPageFactory->create(); $code = $result->getCode(); $resultPage->getLayout()->getBlock('pagseguro.payment.checkout')->setCode($code); $resultPage->getLayout()->getBlock('pagseguro.payment.checkout')->setPaymentJs($this->getPagSeguroPaymentJs()); $resultPage->getLayout()->getBlock('pagseguro.payment.checkout')->setPaymentUrl($this->payment->checkoutUrl($code, 'paymentService')); return $resultPage; }