我正在尝试使用 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 ?
顺便说一句,我将Laravel与PayPal Sandbox一起使用。