【问题标题】:Setting shipping info in OmniPay在 OmniPay 中设置送货信息
【发布时间】:2013-08-31 23:48:47
【问题描述】:

我正在尝试使用 OmniPay for 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

顺便说一句,我正在使用 LaravelPayPal Sandbox

【问题讨论】:

  • 找到了解决方法。 getData() 方法中的 ExpressAuthorizeRequest 类具有硬编码值,用于在 PayPal 付款时设置发货提示。 $data['NOSHIPPING'] = 1;
  • 如果您将值更改为2,那么当重定向到 PayPal Express 页面时,将有设置运输信息的选项(如有必要)。我希望这可以通过 purchase() 对象上的 getter/setter 来完成
  • 好点。我在这里为你提出了一个问题,将在未来的版本中解决这个问题。现在可能最简单的方法是直接分叉和编辑文件。 github.com/adrianmacneil/omnipay/issues/121
  • 如果您不需要运费(为服务付费),请使用 'noShipping' => true

标签: paypal omnipay


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-16
    • 2020-03-19
    • 2018-02-10
    • 2013-09-12
    • 1970-01-01
    • 2016-01-27
    • 2018-07-09
    • 2019-07-11
    相关资源
    最近更新 更多