Files
2026-02-10 01:14:19 +00:00

1 line
2.4 KiB
JavaScript

"use strict";(()=>{var e={};e.id=8491,e.ids=[8491],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},30108:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>_,requestAsyncStorage:()=>d,routeModule:()=>p,serverHooks:()=>h,staticGenerationAsyncStorage:()=>l});var n={};r.r(n),r.d(n,{POST:()=>c});var o=r(49303),s=r(88716),a=r(60670),u=r(87070),i=r(73141);async function c(e){try{let t=await e.json(),r=t.accountId,n=t.name,o=t.description,s=Number(t.unitAmount),a=t.currency||"usd",c=Number(t.quantity)||1;if(!r||!n||!Number.isFinite(s))return u.NextResponse.json({error:"accountId, name, and unitAmount are required."},{status:400});let p="https://www.ShiftedOffRoad.ca";if(!p)return u.NextResponse.json({error:"Missing NEXT_PUBLIC_BASE_URL. Set it so we can build success/cancel URLs."},{status:500});let d=await i.G.checkout.sessions.create({line_items:[{price_data:{currency:a,product_data:{name:n,description:o},unit_amount:s},quantity:c}],payment_intent_data:{application_fee_amount:Math.max(50,Math.floor(.1*s))},mode:"payment",success_url:`${p}/success?session_id={CHECKOUT_SESSION_ID}`,cancel_url:`${p}/cancel`},{stripeAccount:r});return u.NextResponse.json({url:d.url})}catch(e){return u.NextResponse.json({error:e?.message||"Failed to create checkout session."},{status:500})}}let p=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/connect/checkout/route",pathname:"/api/connect/checkout",filename:"route",bundlePath:"app/api/connect/checkout/route"},resolvedPagePath:"/root/ShiftedOffRoad/app/api/connect/checkout/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:d,staticGenerationAsyncStorage:l,serverHooks:h}=p,m="/api/connect/checkout/route";function _(){return(0,a.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:l})}},73141:(e,t,r)=>{r.d(t,{G:()=>s});var n=r(89777);let o=process.env.STRIPE_SECRET_KEY,s=o?new n.Z(o,{}):new Proxy({},{get(){throw Error("Missing STRIPE_SECRET_KEY. Add it to your environment before starting the server.")}})}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[9276,5972,9777],()=>r(30108));module.exports=n})();