作者:非常名花有主 | 来源:互联网 | 2024-10-20 09:14
I'm working on passing line item details to PayPal (and other gateways which support this - see #32) and looking for feedback on the API.
It currently looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| $request->setItems(array(
array('name' => 'Food', 'quantity' => 1, 'price' => '40.00'),
array('name' => 'Drinks', 'quantity' => 2, 'price' => '6.00'),
));
// or
$items = new ItemBag;
$items->add(array('name' => 'Food', 'quantity' => 1, 'price' => '10.00'));
$request->setItems($items);
// or
$items = new ItemBag;
$item = new Item;
$item->setName('Cheese');
$item->setQuantity(1);
$item->setPrice(99.00);
$items->add($item);
$request->setItems($items); |
Similar to the CreditCard object, you can either pass an array and have the ItemBag object instantiated for you, or you can pass the actual item and it will be used.
Feedback welcome.
该提问来源于开源项目:thephpleague/omnipay
How do I view these items on PayPal history?