unicodeveloper / laravel-paystack

:credit_card: :package: :moneybag: Laravel 6, 7, 8, 9, 10 and 11 Package for Paystack
https://paystack.co
MIT License
593 stars 309 forks source link

Using $this when not in object context #152

Open adetech2017 opened 2 years ago

adetech2017 commented 2 years ago

I'm getting error in line 210 of the package saying "Error Using $this when not in object context". Please how do i solve this. public function getAuthorizationUrl() { $this->makePaymentRequest();

    $this->url = $this->getResponse()['data']['authorization_url'];
    return $this;

}
mishiray commented 2 years ago

This has been solved here https://github.com/unicodeveloper/laravel-paystack/issues/16#issuecomment-431568603

MShoaibAkram commented 2 years ago

Can you please update. is this issue resolved I am also facing this issue

mishiray commented 2 years ago

This is what worked for me

/**

MShoaibAkram commented 2 years ago

I have fixed this solution by using using package of Paystack instead of Unicodedeveloper/Paystack.. below here is my payment controller code for reference `use Paystack; class PaymentController extends Controller{

public function redirectToGateway(Request $request){
  ......
  ......
  .....
   return Paystack::getAuthorizationUrl()->redirectNow();

} }`