fix: use hardcoded base URL for Stripe redirect URLs
The request.nextUrl.origin returns internal Docker address (0.0.0.0:3000) when behind reverse proxy, causing invalid redirect after payment.
This commit is contained in:
parent
13bddc06ef
commit
f2736fc3d3
|
|
@ -8,6 +8,9 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
|
||||||
// Dynamic pricing configuration (in EUR cents)
|
// Dynamic pricing configuration (in EUR cents)
|
||||||
const TICKET_PRICE_CENTS = 8000 // €80 early bird
|
const TICKET_PRICE_CENTS = 8000 // €80 early bird
|
||||||
|
|
||||||
|
// Public base URL (needed because request.nextUrl.origin returns internal Docker address)
|
||||||
|
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || "https://cryptocommonsgather.ing"
|
||||||
|
|
||||||
export async function POST(request: NextRequest) {
|
export async function POST(request: NextRequest) {
|
||||||
try {
|
try {
|
||||||
const formData = await request.formData()
|
const formData = await request.formData()
|
||||||
|
|
@ -43,8 +46,8 @@ export async function POST(request: NextRequest) {
|
||||||
payment_method_types: paymentMethodTypes,
|
payment_method_types: paymentMethodTypes,
|
||||||
line_items: lineItems,
|
line_items: lineItems,
|
||||||
mode: "payment",
|
mode: "payment",
|
||||||
success_url: `${request.nextUrl.origin}/success?session_id={CHECKOUT_SESSION_ID}`,
|
success_url: `${BASE_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
|
||||||
cancel_url: `${request.nextUrl.origin}/register`,
|
cancel_url: `${BASE_URL}/register`,
|
||||||
metadata: registrationData
|
metadata: registrationData
|
||||||
? {
|
? {
|
||||||
name: registrationData.name,
|
name: registrationData.name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue