-1

I'm trying to send the price someone paid for an item in my App over to my redirect URL after the Paypal payment is complete.

//Redirect
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl(SITE_URL . '/paypal/pay.php?sucess=true&paid={$price}')
    ->setCancelUrl(SITE_URL . '/paypal/pay.php?sucess=false');

The variable &paid={$price} should send over the price of the item to the URL but I'm getting a 400 error:

exception 'PayPal\Exception\PayPalConnectionException' with message 'Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment.' in /home1//public_html/Clients/rust/paypal/vendor/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php:174 Stack trace: #0 /home1//public_html/Clients/rust/paypal/vendor/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php(74): PayPal\Core\PayPalHttpConnection->execute('{"intent":"sale...') #1 /home1//public_html/Clients/rust/paypal/vendor/paypal/rest-api-sdk-php/lib/PayPal/Common/PayPalResourceModel.php(102): PayPal\Transport\PayPalRestCall->execute(Array, '/v1/payments/pa...', 'POST', '{"intent":"sale...', NULL) #2 /home1//public_html/Clients/rust/paypal/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/Payment.php(579): PayPal\Common\PayPalResourceModel::executeCall('/v1/payments/pa...', 'POST', '{"intent":"sale...', NULL, Object(PayPal\Rest\ApiContext), NULL) #3 /home1/*/public_html/Clients/rust/paypal/checkout.php(69): PayPal\Api\Payment->create(Object(PayPal\Rest\ApiContext)) #4 {main}

Everything works correctly if I remove the variable from the redirect.
Any ideas why this isn't working?

thanksd
  • 54,176
  • 22
  • 157
  • 150
wUmpage
  • 165
  • 2
  • 17
  • Someone needs to go learn some PHP basics … http://php.net/manual/en/language.types.string.php#language.types.string.parsing – CBroe Apr 07 '16 at 17:26

1 Answers1

-1

Remove the curly braces and use double quotes ("):

//Redirect
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl(SITE_URL . "/paypal/pay.php?success=true&paid=$price")
->setCancelUrl(SITE_URL . '/paypal/pay.php?success=false');

*success has two 'c's.