path(), '/'))) { return $next($request); } if (LadillLink::isInternalRequest($request)) { return $next($request); } // Same-origin pay from Mini-hosted pages (e.g. mini.ladill.com) must hit // local /q/{code}/pay — redirecting to ladl.link breaks CORS / form POSTs // and used to dump the browser onto checkout.paystack.com. if ($request->ajax() || $request->expectsJson() || $request->wantsJson()) { return $next($request); } // Form POST (and any method) to the Mini pay endpoint stays on Mini so // PaymentController can return JSON or flash payload for in-page Inline. $path = ltrim($request->path(), '/'); if (preg_match('#^q/[^/]+/pay(?:/callback)?$#i', $path) === 1) { return $next($request); } return LadillLink::legacyRedirect($request); } }