mirror of
https://github.com/lawrencehook/remove-youtube-suggestions.git
synced 2026-07-25 06:54:31 +00:00
Fix license cache not updating after checkout
The checkout.session.completed webhook only sent a welcome email but did not update the subscription cache, so users kept getting cached free status after paying. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,13 +35,14 @@ router.post('/stripe', async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const email = session.customer_email || await getCustomerEmail(session.customer);
|
const email = session.customer_email || await getCustomerEmail(session.customer);
|
||||||
if (email) {
|
if (email) {
|
||||||
|
storage.setSubscriptionStatus(email, true, session.customer);
|
||||||
await sendWelcomeEmail(email);
|
await sendWelcomeEmail(email);
|
||||||
console.log(`[webhook] Checkout completed: ${email} (welcome email sent)`);
|
console.log(`[webhook] Checkout completed: ${email} (cache updated, welcome email sent)`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`[webhook] Checkout completed: ${session.customer} (no email found)`);
|
console.log(`[webhook] Checkout completed: ${session.customer} (no email found)`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`[webhook] Checkout completed but welcome email failed:`, err.message);
|
console.error(`[webhook] Checkout completed but failed:`, err.message);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user