【问题标题】:Show billing and shipping information in Paypal Express using Omnipay使用 Omnipay 在 Paypal Express 中显示账单和运输信息
【发布时间】:2014-09-28 13:58:25
【问题描述】:

我将 Laravel 与 Omnipay 一起用于我们的电子商务应用程序。我们将客户引导至 Paypal 进行购买。我们需要在下订单之前提供运输和账单信息,我们希望这些信息继续提供给 Paypal,以便他们更轻松地使用。但是,只有名字和姓氏才能正确转换到 Paypal。我们也可以毫无问题地使用电子邮件。

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

    }

根据文档https://github.com/omnipay/omnipay,它应该可以正常工作。转储会话会显示正确的计费和运输参数。

【问题讨论】:

    标签: php paypal omnipay


    【解决方案1】:

    它只是需要刷新缓存。

    【讨论】:

      猜你喜欢
      • 2010-12-26
      • 2012-10-28
      • 2014-03-29
      • 2016-06-29
      • 2014-11-01
      • 2014-10-11
      • 2017-05-26
      • 2017-03-25
      • 2016-09-17
      相关资源
      最近更新 更多