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:
isaacclad
2026-07-21 21:32:36 +00:00
parent 86d2dcbf0b
commit a50b5c6a44
8 changed files with 275 additions and 249 deletions
@@ -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