diff --git a/middleware.ts b/middleware.ts new file mode 100644 index 000000000..f227e2f41 --- /dev/null +++ b/middleware.ts @@ -0,0 +1,17 @@ +import { NextRequest, NextResponse } from "next/server"; + +/** + * Middleware to ensure payment callback paths are never blocked by auth. + * + * DuluPay sends server-to-server GET/POST callbacks without any session + * cookie. Without this middleware, the request may be intercepted and + * redirected to the login page (HTTP 307), causing payment notifications + * to fail silently and points never being credited. + */ +export function middleware(_request: NextRequest) { + return NextResponse.next(); +} + +export const config = { + matcher: ["/api/payment/:path*"], +};