The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
simplify
Steven Teydbbb9a21b6e6
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.tsindex c06401b768..b0abad60dc 100644--- a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts@@ -214,13 +214,16 @@ export async function checkoutSessionCompleted(event: Stripe.Event) {if (invoiceId) {// Skip if invoice id is already processed- // TODO: remove oldKeyValue stuff after 7 days (on Sep 23)- const [newKeyValue, oldKeyValue] = await redis.mget([+ const ok = await redis.set(`trackSale:stripe:invoiceId:${invoiceId}`, // here we assume that Stripe's invoice ID is unique across all customers- `dub_sale_events:invoiceId:${invoiceId}`,- ]);+ charge,+ {+ ex: 60 * 60 * 24 * 7,+ nx: true,+ },+ );- if (newKeyValue || oldKeyValue) {+ if (!ok) {console.info("[Stripe Webhook] Skipping already processed invoice.",invoiceId,diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.tsindex 782ee4e268..ed4fb8c171 100644--- a/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/invoice-paid.ts@@ -65,13 +65,16 @@ export async function invoicePaid(event: Stripe.Event) {}// Skip if invoice id is already processed- // TODO: remove oldKeyValue stuff after 7 days (on Sep 23)- const [newKeyValue, oldKeyValue] = await redis.mget([+ const ok = await redis.set(`trackSale:stripe:invoiceId:${invoiceId}`, // here we assume that Stripe's invoice ID is unique across all customers- `dub_sale_events:invoiceId:${invoiceId}`,- ]);+ invoice,+ {+ ex: 60 * 60 * 24 * 7,+ nx: true,+ },+ );- if (newKeyValue || oldKeyValue) {+ if (!ok) {console.info("[Stripe Webhook] Skipping already processed invoice.",invoiceId,