Keep Mini QR Paystack checkout fully in-app.
Stop form POSTs from 307ing to ladl.link or redirecting away to checkout.paystack.com, open Paystack Inline with access_code, and use the single-chrome sheet so payment stays on the Mini page.
This commit is contained in:
@@ -41,7 +41,7 @@ class PaymentController extends Controller
|
||||
return back()->withInput()->with('error', $e->getMessage());
|
||||
}
|
||||
|
||||
if ($request->expectsJson()) {
|
||||
if ($request->expectsJson() || $request->ajax()) {
|
||||
return response()->json([
|
||||
'checkout_url' => $result['checkout_url'],
|
||||
'access_code' => $result['access_code'] ?? null,
|
||||
@@ -52,7 +52,24 @@ class PaymentController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->away($result['checkout_url']);
|
||||
// Never send the browser to checkout.paystack.com — reopen the landing
|
||||
// with checkout payload so Paystack Inline can run in-page.
|
||||
$provider = (string) ($result['provider'] ?? '');
|
||||
if ($provider === 'mtn_momo') {
|
||||
$waiting = (string) ($result['checkout_url'] ?? '');
|
||||
if ($waiting !== '' && str_starts_with($waiting, url('/'))) {
|
||||
return redirect()->to($waiting);
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->to(url('/q/'.$shortCode))
|
||||
->with('checkout_url', $result['checkout_url'] ?? null)
|
||||
->with('access_code', $result['access_code'] ?? null)
|
||||
->with('public_key', $result['public_key'] ?? null)
|
||||
->with('callback_url', $result['callback_url'] ?? null)
|
||||
->with('provider', $provider !== '' ? $provider : 'paystack')
|
||||
->with('amount', $validated['amount']);
|
||||
}
|
||||
|
||||
public function callback(Request $request, string $shortCode): View
|
||||
|
||||
Reference in New Issue
Block a user