Paypal PHP SDK payment status and no shipping please

New Community Member

I am using paypal php sdk. I have the following code:

ini_set('display_errors', 1);

require __DIR__  . '/vendor/PayPal-PHP-SDK/autoload.php';

$dev_ClientID = 'xxxxxxxxxx';
$dev_ClientSecret = 'xxxxxxxxxx';

$apiContext = new \PayPal\Rest\ApiContext(
        new \PayPal\Auth\OAuthTokenCredential(

$payer = new \PayPal\Api\Payer();

$amount = new \PayPal\Api\Amount();
$transaction = new \PayPal\Api\Transaction();

$redirectUrls = new \PayPal\Api\RedirectUrls();

// Create the WebProfile
$presentation = new \PayPal\Api\Presentation();
    ->setBrandName("YeowZa! Paypal")

$inputfields = new \PayPal\Api\InputFields();
$inputfields ->getNoShipping(1);

$webProfile = new \PayPal\Api\WebProfile();
   ->setName('somename' . uniqid())

$webProfileId = $webProfile->create($apiContext)->getId();

$payment = new \PayPal\Api\Payment();


try {
    echo "\n\nRedirect user to approval_url: " . $payment->getApprovalLink() . "\n";
catch (\PayPal\Exception\PayPalConnectionException $ex) {
    // This will print the detailed information on the exception.
    echo $ex->getData();

I get the payment link but i still see the shipping info.

I have defined getNoShipping to true, maybe hooked web profile wrong. So thats one thing. The second thing I am not sure about is this.

I passed a payment and got redirected back to paypal_success.php with paymentId, token and PayerID. How would I use these to receive info about the transaction. I wish to make sure it actually occured.

I tried the following:

$paymentId = $_GET["paymentId"];
$token = $_GET["token"];
$PayerID = $_GET["PayerID"];
echo "paymentId: " . $paymentId . "<br>";
echo "token: " .$token . "<br>";
echo "PayerID: " .$PayerID . "<br>";

$curl = curl_init("$paymentId");
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer ' . $token,
    'Accept: application/json',
    'Content-Type: application/json'
$response = curl_exec($curl);
$result = json_decode($response);


with the following result:

{ ["error"]=> string(13) "invalid_token" ["error_description"]=> string(35) "Token signature verification failed" }

Will appreciate any help rendered. Thanks

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.