Paypal request permission services : We're sorry, your transaction has timed out. Please retry your transaction

155 Views Asked by At

I am using paypal request permission services to grant refund permission for my sandbox app. Here is the code of that

$url = "https://svcs.sandbox.paypal.com/Permissions/RequestPermissions";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_VERBOSE, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_HTTPHEADER,  array(
    "X-PAYPAL-SECURITY-USERID: username",
    "X-PAYPAL-SECURITY-PASSWORD: password",
    "X-PAYPAL-SECURITY-SIGNATURE: signature",
    "X-PAYPAL-REQUEST-DATA-FORMAT: NV",
    "X-PAYPAL-RESPONSE-DATA-FORMAT: NV",
    "X-PAYPAL-APPLICATION-ID: APP-ID"
));

$detailLevel = urlencode("ReturnAll");

$errorLanguage = urlencode("en_US");
    
$scope = "REFUND";

$callback = "http://www.example.com/permission.php";

$nvpreq =  "requestEnvelope.errorLanguage='en_US'&scope=$scope&callback=$callback";

$nvpreq .= "detailLevel=$detailLevel";

curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

$result = curl_exec($ch);

curl_close($ch);

echo $result;

Using this code i am getting this message

responseEnvelope.timestamp=2016-06-24T05%3A30%3A37.350-07%3A00 responseEnvelope.ack=Success responseEnvelope.correlationId=06cb98ac28931/ responseEnvelope.build=2210301 token=AAAAAAAi3Sw3MkHlV5t2

But when i am placing token in this url Redirect the account holder's browser to PayPal and include the request token in the request_token parameter

I am getting this error

Oops! We're sorry, your transaction has timed out. Please retry your transaction

So why is this happening ? Where am i wrong ? I am using this url without login to my paypal account. Will this process grant the required permission from all admin and other seller too ?

0

There are 0 best solutions below