$request = new GetAccessTokenRequest(); $request->requestEnvelope = $requestEnvelope; /* * (Required) The request token from the response to RequestPermissions. */ $request->token = $_REQUEST['Requesttoken']; /* * (Required) The verification code returned in the redirect from PayPal to the return URL. */ $request->verifier = $_REQUEST['Verifier']; /* * ## Creating service wrapper object Creating service wrapper object to make API call and loading Configuration::getAcctAndConfig() returns array that contains credential and config parameters */ $permissions = new PermissionsService(Configuration::getAcctAndConfig()); try { /* wrap API method calls on the service object with a try catch */ $response = $permissions->GetAccessToken($request); } catch (Exception $ex) { require_once '../error.php'; exit; } /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($response->responseEnvelope->ack); if ($ack != "SUCCESS") { $_SESSION['reshash'] = $response; $location = "APIError.php";
foreach ($_POST['chkScope'] as $value) { $scope[$i++] = $value; } } /* * (Required) Information common to each API operation, such as the language in which an error message is returned. */ $requestEnvelope = new RequestEnvelope("en_US"); $request = new RequestPermissionsRequest($scope, $returnURL); $request->requestEnvelope = $requestEnvelope; /* * ## Creating service wrapper object Creating service wrapper object to make API call and loading Configuration::getAcctAndConfig() returns array that contains credential and config parameters */ $service = new PermissionsService(Configuration::getAcctAndConfig()); try { /* wrap API method calls on the service object with a try catch */ $response = $service->RequestPermissions($request); } catch (Exception $ex) { require 'Error.php'; exit; } /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <body>
$request = new GetAccessTokenRequest(); $request->requestEnvelope = $requestEnvelope; /* * (Required) The request token from the response to RequestPermissions. */ $request->token = $_REQUEST['Requesttoken']; /* * (Required) The verification code returned in the redirect from PayPal to the return URL. */ $request->verifier = $_REQUEST['Verifier']; /* * ## Creating service wrapper object Creating service wrapper object to make API call and loading Configuration::getAcctAndConfig() returns array that contains credential and config parameters */ $service = new PermissionsService(Configuration::getAcctAndConfig()); try { /* wrap API method calls on the service object with a try catch */ $response = $service->GetAccessToken($request); } catch (Exception $ex) { require 'Error.php'; exit; } /* Display the API response back to the browser. */ $ack = strtoupper($response->responseEnvelope->ack); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>GetAccessToken - Response</title>
$i++; } } /* * (Required) Information common to each API operation, such as the language in which an error message is returned. */ $requestEnvelope = new RequestEnvelope(); $requestEnvelope->errorLanguage = "en_US"; $request = new RequestPermissionsRequest($scope, $returnURL); $request->requestEnvelope = $requestEnvelope; /* * ## Creating service wrapper object Creating service wrapper object to make API call and loading Configuration::getAcctAndConfig() returns array that contains credential and config parameters */ $permissions = new PermissionsService(Configuration::getAcctAndConfig()); try { $response = $permissions->RequestPermissions($request); } catch (Exception $ex) { require_once '../error.php'; exit; } /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($response->responseEnvelope->ack); session_start(); if ($ack != "SUCCESS") { $_SESSION['reshash'] = $response; $location = "APIError.php";