我尝试将自定义运费通过PayPal快速结账。
我使用的是omnipay和laravel 4.
我认为这可以在paypal express docs中引用,但无法与omnipay一起使用我已尝试过以下方法:
/*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*/
XXX正在发货,shippingAmt,shipping_amount,我已经尝试为购物车中的每件商品添加运费。我已尝试修改abstractrequest.php
类以手动添加运费值,如下所示:
protected function getItemData()
{
$data = array();
$items = $this->getItems();
if ($items) {
foreach ($items as $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";
return $data;
}