12
I’m having some difficulty to integrate a system with pagseguro using codeigniter.
I’ve already downloaded the official pagseguro library. https://pagseguro.uol.com.br/v2/guia-de-integracao/tutorial-da-biblioteca-pagseguro-em-php.html
I’ve already created a controller with all the data (in case for a test);
function pagseguro(){
// $data['dados_pessoa'] = $this->cadastro_model->listar($this->session->userdata('uid'));
// $data['dados_pedido'] = $this->cadastro_model->listarpedidos($this->session->userdata('uid'));
require_once "PagSeguroLibrary/PagSeguroLibrary.php";
$paymentRequest = new PagSeguroPaymentRequest();
$paymentRequest->addItem('12345', 'Software', 1, 50.00);
$sedexCode = PagSeguroShippingType::getCodeByType('SEDEX');
$paymentRequest->setShippingType($sedexCode);
$paymentRequest->setShippingAddress(
'01452002',
'Av. x',
'1384',
'apto. x',
'Jardim x',
'São Paulo',
'SP',
'BRA'
);
$paymentRequest->setCurrency("BRL");
$paymentRequest->setReference('12345');
$paymentRequest->setRedirectUrl("http://meusite.com.br/pedidos");
$paymentRequest->addParameter('notificationURL', 'http://www.meusite.com.br/minhapagina');
try {
$credentials = PagseguroConfig::getAccountCredentials();
$checkoutUrl = $paymentRequest->register($credentials);
}
catch (PagseguroServiceException $e) {
die($e->getMessage());
}
}
It is the first time that I deal with framework pagseguro and do not understand very well. The controller loads normally and no error appears! I would like to know how I do the post to send the data to the pagseguro!
It would be good for you to post the full controller here. Another point, have you tried debugging line by line? The controller can even load normally, but that doesn’t mean there’s no error.Try adding more information and if you have an xdebugger try to debug and make sure everything is really working as it should..
– Ricardo Silva