在OmniPay中设置送货信息 [英] Setting shipping info in OmniPay
问题描述
我正在尝试使用OmniPay为 PayPal Express 设置运输信息(名称,地址,电子邮件等).
我尝试在purchase($options)
对象的选项数组中添加运送信息:
I'm trying to set a shipping info (name,address, email, etc) using OmniPay for PayPal Express.
I've tried adding shipping info in options array in purchase($options)
object:
$options = array(
// required fields (username, pass, etc)
// .....
'shippingAddress1' => 'Elm Street'
'shippingCity' => 'Elm',
'shippingPostcode' => '1000'
// etc.
);
我还尝试将此信息传递给CreditCard
对象:
I also tried passing this info to CreditCard
object:
$card = new Omnipay\Common\CreditCard($card_options);
没有任何成功.代码:
$card = new Omnipay\Common\CreditCard($card_options);
without any success. The code:
$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 ?
How to add shipping info to PayPal Express using OmniPay?
顺便说一句,我在 PayPal沙箱中使用了 Laravel .
BTW, I'm using Laravel with PayPal Sandbox.
推荐答案
该问题最近已得到解决( https://github.com/adrianmacneil/omnipay/pull/140 ),因此现在应该可以正确设置运输信息了.
This problem has recently been fixed (https://github.com/adrianmacneil/omnipay/pull/140) so it should now be possible to set shipping info properly.
这篇关于在OmniPay中设置送货信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!