Fix checkout route price ID env var names
This commit is contained in:
parent
8ac25ae633
commit
b24262513a
|
|
@ -5,10 +5,10 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
|
||||||
|
|
||||||
// Map price IDs to human-readable tier names
|
// Map price IDs to human-readable tier names
|
||||||
const TIER_NAMES: Record<string, string> = {
|
const TIER_NAMES: Record<string, string> = {
|
||||||
[process.env.STRIPE_PRICE_WEEKLY!]: "Weekly",
|
[process.env.NEXT_PUBLIC_STRIPE_PRICE_WEEKLY!]: "Weekly",
|
||||||
[process.env.STRIPE_PRICE_MONTHLY!]: "Monthly",
|
[process.env.NEXT_PUBLIC_STRIPE_PRICE_MONTHLY!]: "Monthly",
|
||||||
[process.env.STRIPE_PRICE_ANNUAL!]: "Annual",
|
[process.env.NEXT_PUBLIC_STRIPE_PRICE_ANNUAL!]: "Annual",
|
||||||
[process.env.STRIPE_PRICE_LIFETIME!]: "Lifetime",
|
[process.env.NEXT_PUBLIC_STRIPE_PRICE_LIFETIME!]: "Lifetime",
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function POST(req: NextRequest) {
|
export async function POST(req: NextRequest) {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ const pricingTiers = [
|
||||||
|
|
||||||
export default function UIT() {
|
export default function UIT() {
|
||||||
const handleBuy = async (priceId: string) => {
|
const handleBuy = async (priceId: string) => {
|
||||||
if (priceId.startsWith("STRIPE_PRICE_ID")) {
|
if (!priceId || priceId.startsWith("STRIPE_PRICE_ID") || priceId.startsWith("price_PLACEHOLDER")) {
|
||||||
alert("Purchase flow coming soon. Check back shortly.");
|
alert("Purchase flow coming soon. Check back shortly.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,11 @@ export default function UIT() {
|
||||||
body: JSON.stringify({ priceId }),
|
body: JSON.stringify({ priceId }),
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (data.url) window.location.href = data.url;
|
if (data.url) {
|
||||||
|
window.location.href = data.url;
|
||||||
|
} else {
|
||||||
|
alert("Something went wrong. Please try again or contact support@verimundsolutions.com.");
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
alert("Something went wrong. Please try again or contact support@verimundsolutions.com.");
|
alert("Something went wrong. Please try again or contact support@verimundsolutions.com.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue