You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation Update: Invalid URL Error in Next.js Guide for Checkout
Current Status
The current code in the Next.js integration guide uses a relative URL for the successUrl:
// src/app/checkout/route.tsimport{Checkout}from'@polar-sh/nextjs'exportconstGET=Checkout({accessToken: process.env.POLAR_ACCESS_TOKEN!,successUrl: '/confirmation',server: 'sandbox',// Use this option if you're using the sandbox environment - else use 'production' or omit the parameter});
The successUrl should accept a valid, absolute URL string — not a relative one.
Recommended Fix
Update the successUrl to use a full absolute URL instead of a relative path. The updated example should look like this:
// src/app/checkout/route.tsimport{Checkout}from'@polar-sh/nextjs'exportconstGET=Checkout({accessToken: process.env.POLAR_ACCESS_TOKEN!,successUrl: 'https://your-domain.com/confirmation',// Use localhost in development, swap with your production URL in productionserver: 'sandbox',// Use this option if you're using the sandbox environment - else use 'production' or omit the parameter});
This resolves the Invalid URL error.
The text was updated successfully, but these errors were encountered:
Documentation Update:
Invalid URL
Error in Next.js Guide for CheckoutCurrent Status
The current code in the Next.js integration guide uses a relative URL for the
successUrl
:This throws the following error:
Expected Behavior
The
successUrl
should accept a valid, absolute URL string — not a relative one.Recommended Fix
Update the
successUrl
to use a full absolute URL instead of a relative path. The updated example should look like this:This resolves the
Invalid URL
error.The text was updated successfully, but these errors were encountered: