fix email trigger
This commit is contained in:
@@ -20,7 +20,7 @@ import { createHmac, timingSafeEqual } from "node:crypto";
|
||||
interface StripeSessionCompleted {
|
||||
id: string;
|
||||
type: string;
|
||||
customer_details?: { email?: string };
|
||||
data?: { object?: { id?: string; customer_details?: { email?: string } } };
|
||||
}
|
||||
|
||||
function verifyStripeSignature(rawBody: string, signatureHeader: string): boolean {
|
||||
@@ -94,8 +94,8 @@ export async function POST(event: APIEvent) {
|
||||
return json({ received: true });
|
||||
}
|
||||
|
||||
const sessionId = body.id;
|
||||
const email = body.customer_details?.email;
|
||||
const sessionId = body.data?.object?.id;
|
||||
const email = body.data?.object?.customer_details?.email;
|
||||
if (!sessionId || !email) {
|
||||
console.error("checkout.session.completed missing id or email:", rawBody);
|
||||
return json({ received: true });
|
||||
|
||||
@@ -66,18 +66,27 @@ export default function NookCheckout() {
|
||||
<>
|
||||
<PageHead
|
||||
title="Checkout"
|
||||
description="Buy a The Nook license — $10 one-time for up to 3 devices."
|
||||
description="Buy a The Nook license — $10 beta price (33% off) for up to 3 devices."
|
||||
/>
|
||||
<SubdomainHeader />
|
||||
|
||||
<div class="bg-base mx-auto max-w-lg px-4 py-16">
|
||||
<div class="border-overlay0 bg-surface0 rounded-xl border p-8 shadow-2xl">
|
||||
<h1 class="text-text mb-1 text-3xl font-bold">The Nook</h1>
|
||||
<p class="text-subtext0 mb-6">Lifetime License — 3 devices</p>
|
||||
|
||||
<div class="text-text mb-6 text-4xl font-extrabold">
|
||||
$10<span class="text-subtext0 text-base font-normal"> one-time</span>
|
||||
<div class="mb-2 flex items-end gap-3">
|
||||
<div class="text-text text-4xl font-extrabold">
|
||||
$10<span class="text-subtext0 text-base font-normal"> one-time</span>
|
||||
</div>
|
||||
<div class="text-subtext0 mb-1 text-2xl font-medium line-through">
|
||||
$15
|
||||
</div>
|
||||
</div>
|
||||
<p class="mb-6 text-sm font-medium">
|
||||
<span
|
||||
class="border-overlay0 bg-surface0 text-subtext0 inline-block rounded-full border px-3 py-1 text-xs font-semibold tracking-wide"
|
||||
>
|
||||
Beta pricing — 33% off
|
||||
</span>
|
||||
</p>
|
||||
<ul class="text-subtext0 mb-6 space-y-2 text-sm">
|
||||
<li>• Activate on up to 3 of your own Macs</li>
|
||||
<li>• No subscription, ever</li>
|
||||
|
||||
@@ -102,9 +102,16 @@ export default function NookLanding() {
|
||||
Buy
|
||||
</Button>
|
||||
</div>
|
||||
<p class="text-subtext1 mt-3 text-xs">
|
||||
$10 one-time · 3 devices · 14-day free trial
|
||||
</p>
|
||||
<div class="mt-3 flex flex-col items-center gap-1.5">
|
||||
<span class="border-overlay0 bg-surface0 text-subtext0 rounded-full border px-2.5 py-0.5 text-[11px] font-semibold tracking-wide">
|
||||
Beta pricing · 33% off
|
||||
</span>
|
||||
<p class="text-subtext1 text-xs">
|
||||
<span class="text-subtext0 line-through">$15</span>{" "}
|
||||
<span class="text-text font-bold">$10</span> one-time · 3 devices ·
|
||||
14-day free trial
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -152,11 +159,12 @@ export default function NookLanding() {
|
||||
class="text-subtext1 my-auto text-sm underline decoration-dotted hover:opacity-80"
|
||||
href="/checkout"
|
||||
>
|
||||
Buy a license → $10
|
||||
Buy a license → $10 <span class="text-subtext0 line-through">$15</span>
|
||||
</a>
|
||||
</div>
|
||||
<p class="text-subtext1 mt-6 text-xs">
|
||||
One license covers up to 3 of your own Macs.
|
||||
Beta pricing — full price will be $15. One license covers up to 3 of
|
||||
your own Macs.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user