0

I've recently copy pasted code from a tutorial on paypal adaptive payments, found here:

http://proggblo.blogspot.ca/2013/04/paypal-adaptive-payments-parallel.html

However, I've run across some apparent syntax errors. Perhaps deprecated due to newer versions of PHP? (currently using 7.0.5)

The first issue is this piece of code:

  $sum;

  foreach ($itemsArr as $key=>$value) {

    $sum+=$value["price"];

  }

if I leave this as is, I get the error

Undefined variable: sum

Alright. So change that to

sum = 1;

hoping the original code wanted an integer and not a string. But then I get a new error:

Illegal string offset 'price'

which is coming from

$sum+=$value["price"];

I'm not entirely sure what to replace this with.

Next up is

$payKey = $response['payKey'];

which is giving me the error:

Undefined index: payKey

Help?

Felix Maxime
  • 2,218
  • 5
  • 31
  • 64

0 Answers0