0

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

1 回答 1

0

以这种方式设置网关:

$gateway = Omnipay::gateway('Paypal_Pro');
于 2015-01-18T14:19:50.387 回答