ignited/laravel-omnipay

call_user_func_array() expects parameter 1 to be a valid callback, class 'Omnipay\Common\GatewayFactory' does not have a method 'purchase'

Closed this issue · 2 comments

Hello,
Thank you for this great package. But when i am trying to do check out i get this error

call_user_func_array() expects parameter 1 to be a valid callback, class 'Omnipay\Common\GatewayFactory' does not have a method 'purchase'

I followed the installed step as given in the documentation. And my code is something like this

use Omnipay\Omnipay;  //When i impoted Omnipay it imported this.. I am not sure if it should be this one or something with ignited/...

class CartController extends Controller
{
 public function processPayment(Request $request)
    {
      ...................
      ...................
         $response = Omnipay::purchase([
                   'amount'    => '100.00',
                    'returnUrl' => $redirectUrl,
                    'cancelUrl' => $canceledUrl,
                    'currency'=>'USD'
                ])->send();

                echo '<pre>';

                print_r($response->getMessage());
                //print_r($response);
                die();
    }
}

My config/app.php is like this

'providers'=>[
   ......
 Ignited\LaravelOmnipay\LaravelOmnipayServiceProvider::class
]

'aliases'=>[
'Omnipay' => Ignited\LaravelOmnipay\Facades\OmnipayFacade::class
]

Laravel version : 5.7
"omnipay/paypal": "^3.0",
"ignited/laravel-omnipay": "3.*",

Can you please tell me how can i resolve this issue.
Thank you.

sadiss commented

how you solved it?

@sadiss when importing it needs to be

use Ignited\LaravelOmnipay\Facades\OmnipayFacade as Omnipay;