php - Laravel/Omnipay paypal, pass custom shipping amount -
i'm trying pass custom shipping cost paypal express checkout.
i'm using omnipay , laravel 4.
i gather possible referenced in paypal express docs cant work omnipay ive tried following:
/*set api details*/ $request = $gateway->purchase([ 'amount'=> $cart['total'], 'currency' => 'gbp', 'xxx' => 100 'transactionid' => $order->reference, 'returnurl' => $returnurl . '/checkout/success', 'cancelurl' => $returnurl . '/checkout/cancel' ])->setitems($cart['items'])->send(); /*handleresponse*/
where xxx shipping, shippingamt, shipping_amount, i've tried adding shipping value each item in cart. i've tried modifying abstractrequest.php
class add together on shipping value manually so:
protected function getitemdata() { $data = array(); $items = $this->getitems(); if ($items) { foreach ($items $n => $item) { $data["l_paymentrequest_0_name$n"] = $item->getname(); $data["l_paymentrequest_0_desc$n"] = $item->getdescription(); $data["l_paymentrequest_0_qty$n"] = $item->getquantity(); $data["l_paymentrequest_0_amt$n"] = $this->formatcurrency($item->getprice()); } } $data["l_paymentrequest_0_shippingamt"] = "3.00"; homecoming $data; }
i found answer here
i using older version of package, needed run composer update , utilize function setshippingamount();
php paypal omnipay paypal-express
No comments:
Post a Comment