0

I have a shopping cart that currently is redirecting users to paypal directly to make their payment. I am wanting to allow customers to input their credit card on the site and paypal to process it. I have Paypal Pro account but I am having trouble using it. I am not sure how I can use the Paypal Pro package via Omnipay. In my vendors folder I have a ExpressGateway.php and a Progateway.php but not sure how to call the Progateway.php page. The only way I can see to set it is by using Omnipay::getway('paypal') which I currently do for express. What is the process i need to use in order to use 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();`

1 Answer 1

0

Set the gateway this way:

$gateway = Omnipay::gateway('Paypal_Pro');
4
  • If i do that I get this error. Gateway [Paypal_Pro] is not defined.
    – Lynx
    Jan 20, 2015 at 19:41
  • I was able to figure it out. i had to edit the config.php file
    – Lynx
    Jan 20, 2015 at 20:05
  • @Muhammad sumon molla senim, I am unable to configure it? Jan 24, 2019 at 9:54
  • Can you please share package link which support paypal pro using laravel ? Jan 24, 2019 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.