2
I’m using the PHP API for Secure Paging to perform a transparent checkout. I am having problems when I change from test environment (sandbox) to production.
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 Pagseguro api) the 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 class PagSeguroData.class.php
production data are thus: (This is called the production data, not the sandbox data. The email and token are correct. The token was generated again in the Secure Page 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 the 403