【问题标题】:Use Paypal Pro instead of Paypal Express - Omnipay for Laravel使用 Paypal Pro 代替 Paypal Express - Laravel 的 Omnipay
【发布时间】:2015-02-13 22:14:02
【问题描述】:

我有一个购物车,目前正在将用户直接重定向到贝宝以进行付款。我希望允许客户在网站上输入他们的信用卡并使用贝宝进行处理。我有 Paypal Pro 帐户,但我无法使用它。我不确定如何通过 Omnipay 使用 Paypal Pro 包。在我的vendors 文件夹中,我有一个ExpressGateway.php 和一个Progateway.php,但不知道如何调用Progateway.php 页面。我能看到设置它的唯一方法是使用我目前为 express 做的Omnipay::getway('paypal')。为了使用 Paypal Pro,我需要使用什么流程?

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

        if(Auth::user() != NULL && Auth::user()->super_user == 1) {

            //sandbox

            $gateway->setUsername('#######');
            $gateway->setPassword('#######');
            $gateway->setSignature('#######');

            $gateway->setTestMode('true');
        } else {

            //production

            $gateway->setUsername('#######');
            $gateway->setPassword('#######');
            $gateway->setSignature('######');
        }

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

        $response = Omnipay::purchase(
            array(
                'cancelUrl' => URL::to('cart'),
                'returnUrl' => URL::action('CartController@getSuccessPayment', array('id' =>$invoice->id)),
                'amount' => Input::get('total'),
                'currency' => 'USD',
                'card' => $card,
                'description' => '#####'
            )
        )->send();`

【问题讨论】:

    标签: php laravel paypal omnipay


    【解决方案1】:

    这样设置网关:

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

    【讨论】:

    • 如果我这样做,我会收到此错误。 Gateway [Paypal_Pro] is not defined.
    • 我能弄明白。我不得不编辑 config.php 文件
    • @Muhammad sumon molla senim,我无法配置它?
    • 你能分享一下支持使用 laravel 的 paypal pro 的包链接吗?
    猜你喜欢
    • 2017-03-25
    • 2014-11-01
    • 2015-03-28
    • 2019-01-04
    • 2015-04-01
    • 2021-09-01
    • 2014-12-22
    • 2014-03-29
    • 2017-07-03
    相关资源
    最近更新 更多