'Assign array to be equal to another array
Currently I am building Paypal Payment with REST API, and I want to assign array value to another one
//Data for Options
$data = [
'payer' => [
"address" => [
"address_line_1" => "Test",
"admin_area_2" => "Test",
"postal_code" => "111",
"admin_area_1" => "Test",
"country_code" => "GB"
]
],
'amountObject' => [
"currency_code" => "EUR",
"value" => $this->orderPrice
],
'purchase_units' => [
"object" => [
//Equals to amountObject array
"amount" => "amountObject"
],
"shipping" => [
//Equals to payer['address']
"address" => "payer['address']"
]
],
'intent' => 'CAPTURE'
];
So what I want to archive is that Purchase Units -> object -> amount is equal to amountObject array, and shipping-> address is equal to payer['address']
Thanks for help
Solution 1:[1]
The second issue might be solved by this:
$data['purchase_units']['shipping']['address'] = $data['payer']['address']
I think that is probably what ChristianM was thinking of in the comment.
The first issue would probably be similar although I am not quite sure what the $this is all about.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user3425506 |
