在OmniPay中设置送货信息

时间:2013-08-28 18:40:59

标签: paypal omnipay

我正在尝试使用OmniPay为 PayPal Express 设置送货信息(姓名,地址,电子邮件等)。 我已尝试在purchase($options)对象中的选项数组中添加送货信息:

$options = array(
// required fields (username, pass, etc) 
// .....
'shippingAddress1' => 'Elm Street'
'shippingCity' => 'Elm', 
'shippingPostcode' => '1000'
// etc. 
);

我也尝试将此信息传递给CreditCard对象:

$card = new Omnipay\Common\CreditCard($card_options); 没有任何成功。代码:

$gateway = GatewayFactory::create('PayPal_Express');
        $gateway->setUsername(USERNAME);
        $gateway->setPassword(PASS);
        $gateway->setSignature(SIGNATURE);
        $gateway->setTestMode(true);

        $card_options = array(
         'shippingAddress1' => 'Elm Street',
         'shippingCity' => 'Elm',
         'shippingPostcode' => '10000',
         'shippingState' => '',
         'shippingCountry' => 'NEverland',
         'shippingPhone' => '123465789',
         'company' => '',
         'email' => 'shipping@test.com'
         );
        $card = new Omnipay\Common\CreditCard($card_options);

        $response = $gateway->purchase(
            array(
                'cancelUrl'=>'http://localhost/laravel_paypal/',
                'returnUrl'=>'http://localhost/laravel_paypal/public/paypalexpress_confirm',
                'amount' =>  '0.99',
                'currency' => 'USD',
                'card' => $card

            )
        )->send();

如何使用OmniPay向 PayPal Express 添加送货信息?

BTW,我正在使用 Laravel PayPal Sandbox

1 个答案:

答案 0 :(得分:4)

此问题最近已修复(https://github.com/adrianmacneil/omnipay/pull/140),因此现在应该可以正确设置送货信息。