unicodeveloper / laravel-paystack

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

The paystack token has expired. Please refresh the page and try again. #158

Open Iconbanderas opened 2 years ago

Iconbanderas commented 2 years ago

This keeps happening on laravel 8 and PHP 7.3, Is there a permanent fix? How do we fix the paystack token always getting expired? Or does this not work for test keys?

iNerdStack commented 2 years ago

Some required parameters to initiate the payment might be missing from your $request, you can try output the error under the catch block to see more details on what went wrong.

You can try this

            try {
                   return Paystack::getAuthorizationUrl()->redirectNow();
             } catch (\Exception $e) {
                   return $e->getMessage();  //Output the error here
                   echo "The paystack token has expired. Please refresh the page and try again.";
        }