php - PayPal Chained payment using dynamic variables
I've got the PayPal chained payment working so that it works by inputting the receivers email addresses and the amount in quote marks in the code, but I cannot get this working dynamically using variables that have stored data from the query string.
I am using: https://github.com/braintreedev/paypal-adaptive-payments-wrapper-php as the framework behind the code below:
$price = $_GET['price'];
$projectid =$_GET['projid'];
$developeremail = $_GET['devemail'];
$devprice = $price * 0.9;
$paypal = new PayPal($config);
$result = $paypal->call(
array(
'actionType' => 'PAY',
'currencyCode' => 'GBP',
'feesPayer' => 'EACHRECEIVER',
'memo' => 'Payment for project',
'cancelUrl' => 'cancel.php',
'returnUrl' => 'success.php',
'receiverList' => array(
'receiver' => array(
array(
'amount' => '100',
'email' => '[email protected]',
'primary' => 'true',
),
array(
'amount' => '90',
'email' => '[email protected]',
),
),
),
),
'Pay'
);
The code above is working but I want to swap the "[email protected]" email to the $developeremail variable and the amount to $devprice and the amount for "[email protected]" to be the value of $price but it doesn't process.
After doing some research it is because it is an associative array and the PHP engine cannot read variables, Do you guys know of any ways around this? I can't be the first person with this problem, right?
Answer
Solution:
What happens when you do this?
Answer
Solution:
To find out what the problem is var_dump the $result, in my case the problem was that for a chained payment you need more than one secondary receiver, so i switched to parallel payment instead, thanks for all your help guys