Secure Pag Transparent Checkout - Unauthorized

Asked

Viewed 1,603 times

3

I’m having trouble finalizing the transparent checkout of the secure pag, follow the code of what I’m leaking

$url = "https://ws.sandbox.pagseguro.uol.com.br/v2/transactions";
$dados = '[email protected]&token=6128AD81C3E1487CA564B23D28D91577&paymentMode=default&paymentMethod=boleto&currency=BRL&notificationURL=http://pjdesign.zapto.org/newalternativa/notify&reference=ABCD123&senderName=Paulo José&senderCPF=11111111111&senderAreaCode=11&senderPhone=11&[email protected]&senderHash=36f5be1b09a8f3af3a8489cf9ae1d3539884e2012a266f1c303176b6baf381ff&shippingAddressStreet=Rua Getúlio Vargas&shippingAddressNumber=11&shippingAddressComplement=&shippingAddressDistrict=Alto da Boa Vista&shippingAddressPostalCode=75523170&shippingAddressCity=Itumbiara&shippingAddressState=GO&shippingAddressCountry=BRA&shippingType=3&shippingCost=160.00&itemId1=1748&itemDescription1=Shape Adesivado E Pintura Verniz Automotivo&itemAmount1=63.25&itemQuantity1=1';

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, Array('Content-Type: application/xml; charset=ISO-8859-1'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $dados);
$xml = curl_exec($curl);
curl_close($curl);

if($xml == 'Unauthorized'){
        echo 'O servidor encontra se temporariamente indisponível';
        printvetor($xml);
        exit;
}

Definitely, I followed all the documentation instructions and always log in to Unauthorized, someone who has already done this integration can help me?

  • 2

    "Unauthorized" means either the email or the token is wrong. Another thing that may be is that the environment is switched: sandbox or production. Remember that each environment has a different token.

  • Verify that the email is the one you used to register your account in pagseguro and your token is actually the token used in sandbox. You can check here -> https://sandbox.pagseguro.uol.com.br/ log in with your account, Integration profiles, Seller.

  • In my case, it was running normal in the production environment and started giving "Unauthorized" out of nowhere. Then I had to log in and generate a new token, so it worked. I guess the old token expired.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.