form submission is not redirecting to paystack payment page
Adamcy-lvts opened this issue · comments
This package seems like a difficult or tricky to work with or maybe is just me, after following all the steps every time I submitted the form it redirected back to the form page not paystack payment page. I need help working with this package seems to be the most popular paystack laravel package. I am working with laravel 7.0.
I didn't add anything to the form hidden input fields just submitting it with the default values I hope that's not what's stopping it from redirecting correctly
This is PaymentController
`class PaymentController extends Controller
{
/**
* Redirect the User to Paystack Payment Page
* @return Url
*/
public function redirectToGateway()
{
try{
return Paystack::getAuthorizationUrl()->redirectNow();
}catch(\Exception $e) {
return Redirect::back()->withMessage(['msg'=>'The paystack token has expired. Please refresh the page and try again.', 'type'=>'error']);
}
}
/**
* Obtain Paystack payment information
* @return void
*/
public function handleGatewayCallback()
{
$paymentDetails = Paystack::getPaymentData();
dd($paymentDetails);
// Now you have the payment details,
// you can store the authorization_code in your db to allow for recurrent subscriptions
// you can then redirect or do whatever you want
// return view('pay')->with($paymentDetails);
}
}`
PaymentPageController
`class PaymentPageController extends Controller
{
public function show_payment_page(Request $request){
return view('paystack-form');
}
}`
My .env file
PAYSTACK_PUBLIC_KEY=pk_test_d40154a3e63219d632fc2564ed02124e64b7fa6c
PAYSTACK_SECRET=sk_test_**************************************ccfc
PAYSTACK_PAYMENT_URL=https://api.paystack.co
MERCHANT_EMAIL=lv4mj1@gmail.com
Any help would be appreciated
problem solved.
i am also facing the same issue how did you solved it?