1

I am using Laravel with Omnipay for our ecommerce application. We direct the customers to Paypal to make their purchase. We require shipping and billing information prior to placing an order and we would like that information to continue to Paypal to make it easier for them. However, only the first name and last name are crossing over to Paypal correctly. We can also use email with no issues.

        public function postPayment() {

       //var_dump(Session::get('shipping_info')); die;

        $info = Session::get('shipping_info');

        $gateway = Omnipay::gateway('paypal');

        //sandbox

        $gateway->setUsername('xxxx');
        $gateway->setPassword('xxxx');
        $gateway->setSignature('xxx');

        $gateway->setTestMode('true');

        //production
//        $gateway->setUsername('xxxx');
//        $gateway->setPassword('xxxx');
//        $gateway->setSignature('xxxx');

        $cardInput = array(
            'firstName' => $info['first_name_bill'],
            'lastName'  => $info['last_name_bill'],
            'billingAddress1' => $info['street_address_1_bill'],
            'billingAddress2' => $info['street_address_2_bill'],
            'billingPhone'  =>  $info['phone_bill'],
            'billingCity'   =>  $info['city_bill'],
            'billingState'  =>  $info['state_bill'],
            'billingPostCode'   => $info['zip_bill'],
            'shippingAddress1' => $info['street_address_1_ship'],
            'shippingAddress2' => $info['street_address_2_ship'],
            'shippingPhone'  =>  $info['phone_ship'],
            'shippingCity'   =>  $info['city_ship'],
            'shippingState'  =>  $info['state_ship'],
            'shippingPostCode'   => $info['zip_ship'],
        );

        $card = Omnipay::creditCard($cardInput);

       // var_dump($card); die;
        $response = Omnipay::purchase(
            array(
                'cancelUrl' => 'http://localhost/public/',
                'returnUrl' => 'http://localhost/public/',
                'amount' => Input::get('total'),
                'currency' => 'USD',
                'card' => $card,
                'description' => 'Stuff'
            )
        )->send();

        $response->redirect();

    }

According to the docs https://github.com/omnipay/omnipay it should work with no issues. dumping the sessions reveals the correct billing and shipping parameters.

Lynx
  • 1,462
  • 5
  • 32
  • 59

1 Answers1

0

It was just needing a cache refresh.

Lynx
  • 1,462
  • 5
  • 32
  • 59