You can also have a look at this module:
http://r-martins.github.io/PagSeguro-Magento-Transparente/download.html
According to the module description:
This extensions allows your store to acept payments using credit cards with PagSeguro without needing to redirect customer to Pagseguro's website. To use PagSeguro Transparente you should require authorization of PagSeguro UOL. You can find more details at official website.