refactor(odeme): update environment variable usage and documentation
All checks were successful
Deploy / deploy (push) Successful in 8m39s

Replaced `NEXT_PUBLIC_APP_URL` with `APP_URL` in the payment processing logic to ensure proper runtime access. Updated related documentation to clarify the distinction between build-time and runtime environment variables, emphasizing the importance of using `APP_URL` for callback and webhook URLs. Adjusted references in the codebase to reflect this change, enhancing clarity and functionality in the payment flow.
This commit is contained in:
bilalgursen
2026-08-11 11:42:47 +03:00
parent d03ba91bf0
commit 951caa3c93
6 changed files with 47 additions and 9 deletions

View File

@@ -4,6 +4,7 @@ import { eq } from "drizzle-orm";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
import { verifySession } from "@/lib/session";
import { appUrl as siteKok } from "@/lib/app-url";
import { appDb, schema } from "@/lib/appdb";
import { URUNLER } from "@/lib/credits";
import { initializeCheckoutForm, initImzaDurumu } from "@/lib/iyzico";
@@ -47,7 +48,7 @@ export async function baslatOdeme(
const h = await headers();
const buyerIp =
h.get("x-forwarded-for")?.split(",")[0]?.trim() ?? "85.34.78.112";
const appUrl = process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000";
const appUrl = siteKok();
const [ad, soyad] = adSoyadAyir(session.user.name ?? "");
let init;