I'm trying to add a second Item to a created payment via a PatchRequest but can't seem to figure it out.
Here is my code:
$patch = new \PayPal\Api\Patch();
$patch->setOp('add');
$patch->setPath('/transactions/0/item_list/items/1');
$json = '
{
"description":"Testartikel",
"price":"50.00",
"currency":"EUR",
"quantity":1
}';
$data = json_decode($json);
$patch->setValue($data);
$patches[] = $patch;
$patchRequest = new \PayPal\Api\PatchRequest();
$patchRequest->setPatches($patches);
$payment->update($patchRequest, $apiContext);
So the request looks like this:
[{"op":"add","path":"/transactions/0/item_list/items/1","value":{"description":"Testartikel","price":"50.00","currency":"EUR","quantity":1}}]
I get this error:
{"name":"MALFORMED_REQUEST","message":"MALFORMED_REQUEST","information_link":"https://developer.paypal.com/docs/api/#MALFORMED_REQUEST","debug_id":"682441321797"}
I guess the path /transactions/0/item_list/items/1
might be wrong but i couldn't figure out what would be the correct one. I already tried /transactions/0/item_list
and /transactions/0/item_list/items
with the same result.
Any help would be very much appreciated.