Php omnipay产品系列

Php omnipay产品系列,php,laravel,paypal,omnipay,Php,Laravel,Paypal,Omnipay,大家好,我在拉拉维尔与omnipay合作,我想知道如何更改代码以在paypal receip中显示每个项目的总数和描述 $response=$gateway->purchase( array( 'cancelURL' => $keys->getCancelUrl(), 'returnURL' => $keys->getReturnUrl(), 'descrip

大家好,我在拉拉维尔与omnipay合作,我想知道如何更改代码以在paypal receip中显示每个项目的总数和描述

$response=$gateway->purchase(
        array(
            'cancelURL'     =>  $keys->getCancelUrl(),
            'returnURL'     =>  $keys->getReturnUrl(),
            'description'   =>  Cart::content(),
            'amount'        =>  '200.00',
            'currency'      =>  $keys->getCurrency()
            )
    )->send();</i>
$response=$gateway->purchase(
排列(
'cancelURL'=>$keys->getCancelUrl(),
'returnURL'=>$keys->getReturnUrl(),
'description'=>Cart::content(),
“金额”=>“200.00”,
“货币”=>$keys->getCurrency()
)
)->send();

我从未使用过OmniPay,顺便说一句,我在谷歌搜索了一下,在GitHub上的一个类中找到了我认为您需要的东西

$purchase = $gateway->purchase(array(
    'currency' => 'GBP',
    'transactionReference' => 'referenceID1',
    'clientIp' => '95.87.212.88',
    'items' => array(
        array(
            'name' => 10,
            'price' => '5.00',
            'description' => 'Product 1 Desc',
            'quantity' => 2
        ),
        array(
            'name' => 12,
            'price' => '5.00',
            'description' => 'Shipping for Product 1',
            'quantity' => 1
        ),
        array(
            'name' => 12,
            'price' => '0.00',
            'description' => 'Promotion',
            'quantity' => 1
        ),
    ),
    'card' => array(
        'firstName' => 'Example',
        'lastName' => 'User',
        'number' => '4111111111111111',
        'expiryMonth' => 7,
        'expiryYear' => 2013,
        'cvv' => 123,
        'address1' => '123 Shipping St',
        'address2' => 'Shipsville',
        'city' => 'Shipstown',
        'postcode' => '54321',
        'state' => 'NY',
        'country' => 'US',
        'phone' => '(555) 987-6543',
        'email' => 'john@example.com',
    )
));
我建议您尝试在脚本中实现items数组并测试结果


PS:也许你错过了,但是有一个composer包实现了;)

我从来没有使用过OmniPay,顺便说一句,我在谷歌搜索了一下,在GitHub上的一个类中找到了我认为你想要的东西

$purchase = $gateway->purchase(array(
    'currency' => 'GBP',
    'transactionReference' => 'referenceID1',
    'clientIp' => '95.87.212.88',
    'items' => array(
        array(
            'name' => 10,
            'price' => '5.00',
            'description' => 'Product 1 Desc',
            'quantity' => 2
        ),
        array(
            'name' => 12,
            'price' => '5.00',
            'description' => 'Shipping for Product 1',
            'quantity' => 1
        ),
        array(
            'name' => 12,
            'price' => '0.00',
            'description' => 'Promotion',
            'quantity' => 1
        ),
    ),
    'card' => array(
        'firstName' => 'Example',
        'lastName' => 'User',
        'number' => '4111111111111111',
        'expiryMonth' => 7,
        'expiryYear' => 2013,
        'cvv' => 123,
        'address1' => '123 Shipping St',
        'address2' => 'Shipsville',
        'city' => 'Shipstown',
        'postcode' => '54321',
        'state' => 'NY',
        'country' => 'US',
        'phone' => '(555) 987-6543',
        'email' => 'john@example.com',
    )
));
我建议您尝试在脚本中实现items数组并测试结果

PS:也许你错过了,但是有一个composer包实现了;)

谢谢,伙计,太好了。 我要和paypal分享一些东西,有一个方法可以添加数组,它是setItems($array) 而且很酷

foreach (Cart::content() as $content)
{
    $items->add(array(
        'name' => $content->name,
        'quantity' => $content->qty,
        'price' => $content->price,
    ));
}

$items->add(array(
    'name' => 'IVA',
    'quantity' => '1',
    'price' => $iva,
));

$response = $gateway->purchase(
    array(
        'cancelURL' => $keys->getCancelUrl(),
        'returnURL' => $keys->getReturnUrl(),
        'description' => 'Venta',
        'amount' => $total,
        'currency' => $keys->getCurrency()
    )
)->setItems($items)->send();
我唯一找不到的是如何加税,所以我加了一个项目

谢谢,伙计,这很好。 我要和paypal分享一些东西,有一个方法可以添加数组,它是setItems($array) 而且很酷

foreach (Cart::content() as $content)
{
    $items->add(array(
        'name' => $content->name,
        'quantity' => $content->qty,
        'price' => $content->price,
    ));
}

$items->add(array(
    'name' => 'IVA',
    'quantity' => '1',
    'price' => $iva,
));

$response = $gateway->purchase(
    array(
        'cancelURL' => $keys->getCancelUrl(),
        'returnURL' => $keys->getReturnUrl(),
        'description' => 'Venta',
        'amount' => $total,
        'currency' => $keys->getCurrency()
    )
)->setItems($items)->send();

我唯一找不到的是如何加税,所以我添加了一个类似于项目的内容

什么是
$items
的实例?在哪里实例化该变量?@MartinBean$item是Omnipay\Common\item的实例,$items是Omnipay\Common的实例\ItemBag@ddjikic我猜它应该是
Omnipay\Common\ItemBag
的一个实例,它是一个项目集合。什么是
$items
的一个实例?在哪里实例化该变量?@MartinBean$item是Omnipay\Common\item的实例,$items是Omnipay\Common的实例\ItemBag@ddjikic我猜它应该是
Omnipay\Common\ItemBag
的一个实例,它是一个项目集合。