I'm using the PagSeguro PHP API to perform a transparent checkout. I'm having problems when I switch from sandbox to production environment.
Below the code snippet
jQuery
jQuery.ajax({
url: "url/GetSessionId",
type:"GET",
cache: false,
success: function(response) {
PagSeguroDirectPayment.setSessionId(response);
PHP
public function getsessionid(){
$checkout = new Checkout(false); // Se for false, esta no ambiente de produção
$checkout->printSessionId();
}
In the Checkout class (from the PayPal account) method printSessionId()
public function printSessionId() {
// Creating a http connection (CURL abstraction)
$httpConnection = new HttpConnection();
// Request to PagSeguro Session API using Credentials
$httpConnection->post($this->pagSeguroData->getSessionURL(), $this->pagSeguroData->getCredentials());
// Request OK getting the result
if ($httpConnection->getStatus() === 200) {
$data = $httpConnection->getResponse();
$sessionId = $this->parseSessionIdFromXml($data);
echo $sessionId;
} else {
throw new Exception("API Request Error: ".$httpConnection->getStatus());
}
}
And in the PagSeguroData.class.php
class the production data is as follows: (The production data is being called, not the sandbox data.) The email and token are correct The token was regenerated in PagSeguro and updated )
'credentials' => array(
"email" => "[email protected]",
"token" => "00000000011111111112222222222"
),
'sessionURL' => "https://ws.pagseguro.uol.com.br/v2/sessions",
'transactionsURL' => "https://ws.pagseguro.uol.com.br/v2/transactions",
'javascriptURL' => "https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"
The error that occurs is 403