Question

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. 
);

I also tried passing this info to CreditCard object:

$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();

How to add shipping info to PayPal Express using OmniPay?

BTW, I'm using Laravel with PayPal Sandbox.

Was it helpful?

Solution

This problem has recently been fixed (https://github.com/adrianmacneil/omnipay/pull/140) so it should now be possible to set shipping info properly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top