[{"data":1,"prerenderedAt":464,"buildId":465},["ShallowReactive",2],{"\u002Fdocs\u002Fpayments":3,"\u002Fdocs\u002Fpayments-docs-surround":229,"contentNavigation":240,"docsNavigation":410},{"id":4,"title":5,"body":6,"description":218,"extension":219,"links":220,"meta":221,"navigation":222,"path":223,"seo":224,"sitemap":225,"stem":227,"__hash__":228},"docs\u002Fdocs\u002F06.payments\u002F1.index.md","Payments in Nuxt with Polar and better-auth",{"type":7,"value":8,"toc":209},"minimark",[9,21,26,35,43,86,90,93,96,99,102,119,129,133,145,172,187,191,194,205],[10,11,12,13,20],"p",{},"Nuxt Starter Kit uses ",[14,15,19],"a",{"href":16,"rel":17},"https:\u002F\u002Fpolar.sh\u002F",[18],"nofollow","Polar"," to accept payments. Polar is a Merchant of Record: it is the legal seller and handles taxes for you. It provides an API for creating and managing subscriptions, invoices and payments.",[22,23,25],"h2",{"id":24},"getting-started","Getting Started",[10,27,28,29,34],{},"To get started with Polar, you need to create an account and an access token. You can do this by following the instructions in the ",[14,30,33],{"href":31,"rel":32},"https:\u002F\u002Fpolar.sh\u002Fdocs\u002Fgetting-started",[18],"Polar documentation",".",[10,36,37,38,42],{},"Set the following environment variables in ",[39,40,41],"code",{},"apps\u002Fweb\u002F.env",":",[44,45,50],"pre",{"className":46,"code":47,"language":48,"meta":49,"style":49},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","NUXT_PRIVATE_POLAR_ACCESS_TOKEN=\nNUXT_PRIVATE_POLAR_ORGANIZATION_ID=\nNUXT_PRIVATE_POLAR_SERVER=sandbox\n","bash","",[39,51,52,65,73],{"__ignoreMap":49},[53,54,57,61],"span",{"class":55,"line":56},"line",1,[53,58,60],{"class":59},"sTEyZ","NUXT_PRIVATE_POLAR_ACCESS_TOKEN",[53,62,64],{"class":63},"sMK4o","=\n",[53,66,68,71],{"class":55,"line":67},2,[53,69,70],{"class":59},"NUXT_PRIVATE_POLAR_ORGANIZATION_ID",[53,72,64],{"class":63},[53,74,76,79,82],{"class":55,"line":75},3,[53,77,78],{"class":59},"NUXT_PRIVATE_POLAR_SERVER",[53,80,81],{"class":63},"=",[53,83,85],{"class":84},"sfazB","sandbox\n",[87,88,60],"h3",{"id":89},"nuxt_private_polar_access_token",[10,91,92],{},"Required. This is your Polar access token. You can generate one in your Polar account settings. This token is used to authenticate your requests to the Polar API.",[87,94,70],{"id":95},"nuxt_private_polar_organization_id",[10,97,98],{},"This is the ID of your Polar organization. You can find this in your Polar account settings. This ID is used to identify your organization when making requests to the Polar API.",[87,100,78],{"id":101},"nuxt_private_polar_server",[10,103,104,105,108,109,114,115,118],{},"The Polar server you want to use: ",[39,106,107],{},"sandbox"," (default) for testing with your ",[14,110,113],{"href":111,"rel":112},"https:\u002F\u002Fdocs.polar.sh\u002Fintegrate\u002Fsandbox",[18],"Sandbox",", or ",[39,116,117],{},"production"," for production.",[120,121,122],"warning",{},[10,123,124,125,128],{},"The ",[39,126,127],{},"\u002Fpricing"," page loads the Polar products at build time. Production builds need the Polar values, otherwise the page prerenders without products.",[22,130,132],{"id":131},"how-it-works","How It Works",[10,134,135,136,141,142,42],{},"The kit uses the ",[14,137,140],{"href":138,"rel":139},"https:\u002F\u002Fpolar.sh\u002Fdocs\u002Fintegrate\u002Fsdk\u002Fadapters\u002Fbetter-auth",[18],"Polar plugin for better-auth",", configured in ",[39,143,144],{},"apps\u002Fweb\u002Flayers\u002Fauth\u002Fserver\u002Futils\u002Fpolar.ts",[146,147,148,156,166],"ul",{},[149,150,151,155],"li",{},[152,153,154],"strong",{},"Customer on sign-up:"," every new user gets a Polar customer with the user ID as external ID.",[149,157,158,161,162,165],{},[152,159,160],{},"Checkout:"," signed-in users start a Polar checkout and return to ",[39,163,164],{},"\u002Fdashboard"," afterwards.",[149,167,168,171],{},[152,169,170],{},"Customer portal:"," users manage their subscription, payment method and invoices in Polar's customer portal.",[10,173,174,175,178,179,182,183,186],{},"On the client, ",[39,176,177],{},"useAuth()"," exposes the Polar customer state (",[39,180,181],{},"polarState",") and the user's ",[39,184,185],{},"activeSubscription",". The billing page in the dashboard uses them.",[22,188,190],{"id":189},"subscriptions-lifetime-deals","Subscriptions & Lifetime Deals",[10,192,193],{},"The starter kit is designed to support subscriptions (free & Pro) and a lifetime deal.",[10,195,196,197,200,201,204],{},"Products and pricing live in the ",[39,198,199],{},"apps\u002Fweb\u002Flayers\u002Fpayment"," layer. The billing pages are in the ",[39,202,203],{},"dashboard"," layer.",[206,207,208],"style",{},"html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":49,"searchDepth":67,"depth":67,"links":210},[211,216,217],{"id":24,"depth":67,"text":25,"children":212},[213,214,215],{"id":89,"depth":75,"text":60},{"id":95,"depth":75,"text":70},{"id":101,"depth":75,"text":78},{"id":131,"depth":67,"text":132},{"id":189,"depth":67,"text":190},"Accept payments with Polar through the better-auth plugin: a Polar customer on sign-up, checkout for signed-in users and the customer portal.","md",null,{},{"title":19},"\u002Fdocs\u002Fpayments",{"title":5,"description":218},{"loc":223,"lastmod":226},"2026-12-02","docs\u002F06.payments\u002F1.index","cbcs8KPbmjLUtqnqx2JbK5z9scHdMZMENluxp3i2s_8",[230,235],{"title":231,"path":232,"stem":233,"description":234,"children":-1},"Overview","\u002Fdocs\u002Fauthentication","docs\u002F05.authentication\u002F1.index","Email and password, Google and GitHub login and passkeys with better-auth in Nuxt 4: sessions stored in PostgreSQL, environment variables and setup.",{"title":236,"path":237,"stem":238,"description":239,"children":-1},"Features","\u002Fdocs\u002Fadmin","docs\u002F07.admin\u002F1.index","Manage users, testimonials, the waitlist and banners in the Nuxt Starter Kit admin dashboard, built on better-auth's admin plugin with role-based access.",[241,271],{"title":242,"path":243,"stem":244,"children":245,"page":270},"Blog","\u002Fblog","blog",[246,250,254,258,262,266],{"title":247,"path":248,"stem":249},"How to Build a SaaS with Nuxt 4, better-auth, and Polar","\u002Fblog\u002Fbuild-saas-with-nuxt-4-better-auth-polar","blog\u002Fbuild-saas-with-nuxt-4-better-auth-polar",{"title":251,"path":252,"stem":253},"DIY vs Nuxt Starter Kit - The Real Cost of Auth and Payments","\u002Fblog\u002Fdiy-vs-nuxt-starter-kit-cost","blog\u002Fdiy-vs-nuxt-starter-kit-cost",{"title":255,"path":256,"stem":257},"Nuxt Boilerplate for Solo Founders - Ship Without Rebuilding Foundations","\u002Fblog\u002Fnuxt-boilerplate-for-solo-founders","blog\u002Fnuxt-boilerplate-for-solo-founders",{"title":259,"path":260,"stem":261},"Best Nuxt SaaS Boilerplate in 2026 - What Actually Matters","\u002Fblog\u002Fnuxt-saas-boilerplate-comparison","blog\u002Fnuxt-saas-boilerplate-comparison",{"title":263,"path":264,"stem":265},"Nuxt Starter Kit v3: Delete the Features You Don't Need","\u002Fblog\u002Fnuxt-starter-kit-v3-layer-architecture","blog\u002Fnuxt-starter-kit-v3-layer-architecture",{"title":267,"path":268,"stem":269},"Polar Checkout and Customer Portal in Nuxt with the better-auth Plugin","\u002Fblog\u002Fpolar-checkout-customer-portal-better-auth-nuxt","blog\u002Fpolar-checkout-customer-portal-better-auth-nuxt",false,{"title":272,"path":273,"stem":274,"children":275,"page":270},"Documentation","\u002Fdocs","docs",[276,307,319,327,334,339,344,349,356,363,370,378,385,392,404],{"title":25,"path":277,"stem":278,"children":279,"icon":306},"\u002Fdocs\u002Fgetting-started","docs\u002F01.getting-started\u002F1.index",[280,282,286,290,294,298,302],{"title":281,"path":277,"stem":278},"Introduction",{"title":283,"path":284,"stem":285},"Installation","\u002Fdocs\u002Fgetting-started\u002Finstallation","docs\u002F01.getting-started\u002F2.installation",{"title":287,"path":288,"stem":289},"Setup","\u002Fdocs\u002Fgetting-started\u002Fsetup","docs\u002F01.getting-started\u002F3.setup",{"title":291,"path":292,"stem":293},"Pull Updates","\u002Fdocs\u002Fgetting-started\u002Fpull-updates","docs\u002F01.getting-started\u002F4.pull-updates",{"title":295,"path":296,"stem":297},"Upgrade to the Layer Architecture","\u002Fdocs\u002Fgetting-started\u002Fupgrade-to-layer-architecture","docs\u002F01.getting-started\u002F5.upgrade-to-layer-architecture",{"title":299,"path":300,"stem":301},"Deployment","\u002Fdocs\u002Fgetting-started\u002Fdeployment","docs\u002F01.getting-started\u002F6.deployment",{"title":303,"path":304,"stem":305},"Going to production","\u002Fdocs\u002Fgetting-started\u002Fgoing-to-production","docs\u002F01.getting-started\u002F7.going-to-production","i-lucide-square-play",{"title":308,"path":309,"stem":310,"children":311,"icon":318},"Architecture","\u002Fdocs\u002Farchitecture","docs\u002F02.architecture\u002F1.index",[312,314],{"title":313,"path":309,"stem":310},"Tech Stack",{"title":315,"path":316,"stem":317},"Layers","\u002Fdocs\u002Farchitecture\u002Flayers","docs\u002F02.architecture\u002F2.layers","i-lucide-layers",{"title":320,"path":321,"stem":322,"children":323,"icon":326},"Database","\u002Fdocs\u002Fdatabase","docs\u002F03.database\u002F1.index",[324],{"title":325,"path":321,"stem":322},"PostgreSQL","i-lucide-database",{"title":328,"path":329,"stem":330,"children":331,"icon":333},"Emails","\u002Fdocs\u002Femails","docs\u002F04.emails\u002F1.index",[332],{"title":231,"path":329,"stem":330},"i-lucide-mail",{"title":335,"path":232,"stem":233,"children":336,"icon":338},"Authentication",[337],{"title":231,"path":232,"stem":233},"i-lucide-lock-keyhole",{"title":340,"path":223,"stem":227,"children":341,"icon":343},"Payments",[342],{"title":19,"path":223,"stem":227},"i-lucide-circle-dollar-sign",{"title":345,"path":237,"stem":238,"children":346,"icon":348},"Admin",[347],{"title":236,"path":237,"stem":238},"i-lucide-user-cog",{"title":350,"path":351,"stem":352,"children":353,"icon":355},"Images","\u002Fdocs\u002Fimages","docs\u002F08.images\u002F1.index",[354],{"title":231,"path":351,"stem":352},"i-lucide-image",{"title":357,"path":358,"stem":359,"children":360,"icon":362},"i18n","\u002Fdocs\u002Fi18n","docs\u002F09.i18n\u002F1.index",[361],{"title":231,"path":358,"stem":359},"i-lucide-languages",{"title":364,"path":365,"stem":366,"children":367,"icon":369},"SEO","\u002Fdocs\u002Fseo","docs\u002F10.seo\u002F1.index",[368],{"title":231,"path":365,"stem":366},"i-lucide-globe",{"title":371,"path":372,"stem":373,"children":374,"icon":377},"Analytics","\u002Fdocs\u002Fanalytics","docs\u002F11.analytics\u002F1.index",[375],{"title":376,"path":372,"stem":373},"Umami","i-lucide-chart-line",{"title":379,"path":380,"stem":381,"children":382,"icon":384},"Security","\u002Fdocs\u002Fsecurity","docs\u002F12.security\u002F1.index",[383],{"title":231,"path":380,"stem":381},"i-lucide-file-lock",{"title":386,"path":387,"stem":388,"children":389,"icon":391},"Testing","\u002Fdocs\u002Ftesting","docs\u002F13.testing\u002F1.index",[390],{"title":386,"path":387,"stem":388},"i-lucide-test-tube",{"title":393,"path":394,"stem":395,"children":396,"icon":403},"Support","\u002Fdocs\u002Fsupport","docs\u002F14.support\u002F1.index",[397,399],{"title":398,"path":394,"stem":395},"Help",{"title":400,"path":401,"stem":402},"Troubleshooting","\u002Fdocs\u002Fsupport\u002Ftroubleshooting","docs\u002F14.support\u002F2.troubleshooting","i-lucide-message-circle-question",{"title":405,"path":406,"stem":407,"children":408},"LLMs","\u002Fdocs\u002Fllms","docs\u002F15.llms\u002F1.index",[409],{"title":405,"path":406,"stem":407},[411,420,424,427,430,433,436,439,442,445,448,451,454,457,461],{"title":25,"path":277,"stem":278,"children":412,"icon":306},[413,414,415,416,417,418,419],{"title":281,"path":277,"stem":278},{"title":283,"path":284,"stem":285},{"title":287,"path":288,"stem":289},{"title":291,"path":292,"stem":293},{"title":295,"path":296,"stem":297},{"title":299,"path":300,"stem":301},{"title":303,"path":304,"stem":305},{"title":308,"path":309,"stem":310,"children":421,"icon":318},[422,423],{"title":313,"path":309,"stem":310},{"title":315,"path":316,"stem":317},{"title":320,"path":321,"stem":322,"children":425,"icon":326},[426],{"title":325,"path":321,"stem":322},{"title":328,"path":329,"stem":330,"children":428,"icon":333},[429],{"title":231,"path":329,"stem":330},{"title":335,"path":232,"stem":233,"children":431,"icon":338},[432],{"title":231,"path":232,"stem":233},{"title":340,"path":223,"stem":227,"children":434,"icon":343},[435],{"title":19,"path":223,"stem":227},{"title":345,"path":237,"stem":238,"children":437,"icon":348},[438],{"title":236,"path":237,"stem":238},{"title":350,"path":351,"stem":352,"children":440,"icon":355},[441],{"title":231,"path":351,"stem":352},{"title":357,"path":358,"stem":359,"children":443,"icon":362},[444],{"title":231,"path":358,"stem":359},{"title":364,"path":365,"stem":366,"children":446,"icon":369},[447],{"title":231,"path":365,"stem":366},{"title":371,"path":372,"stem":373,"children":449,"icon":377},[450],{"title":376,"path":372,"stem":373},{"title":379,"path":380,"stem":381,"children":452,"icon":384},[453],{"title":231,"path":380,"stem":381},{"title":386,"path":387,"stem":388,"children":455,"icon":391},[456],{"title":386,"path":387,"stem":388},{"title":393,"path":394,"stem":395,"children":458,"icon":403},[459,460],{"title":398,"path":394,"stem":395},{"title":400,"path":401,"stem":402},{"title":405,"path":406,"stem":407,"children":462},[463],{"title":405,"path":406,"stem":407},1796282654039,"e90768e1-1006-4f68-a0b7-e7c6553b660f"]