Get post data, in Checkout success observer
protected $_request;
public function __construct(
\Magento\Framework\App\RequestInterface $request,
\Psr\Log\LoggerInterface $logger,
\Magento\Sales\Model\Order\Status\HistoryFactory $historyFactory,
\Magento\Sales\Model\OrderFactory $orderFactory
) {
$this->_request = $request;
$this->_logger = $logger;
$this->_historyFactory = $historyFactory;
$this->_orderFactory = $orderFactory;
}
Inside function get post data as below way:
$this->_request->getPost();
Don't forget to clear var/generation folder.
I'm pretty sure you need to replace:
$this->getRequest()->getPost()
With:
$observer->getRequest()->getPost()
But it may depend on the event you're observing IIRC.