The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
reset paymentFailedAt in charge.succeeded
Steven Teyf2141f35a025
diff --git a/apps/web/app/(ee)/api/stripe/webhook/charge-succeeded.ts b/apps/web/app/(ee)/api/stripe/webhook/charge-succeeded.tsindex 3b3ff1a4a2..7095154769 100644--- a/apps/web/app/(ee)/api/stripe/webhook/charge-succeeded.ts+++ b/apps/web/app/(ee)/api/stripe/webhook/charge-succeeded.ts@@ -14,7 +14,29 @@ export async function chargeSucceeded(event: Stripe.Event) {const { transfer_group: invoiceId } = charge;if (!invoiceId) {- console.log("No transfer group found, skipping...");+ // check if the customer's workspace has paymentFailedAt, if so, reset it to null+ const stripeId = charge.customer as string;+ if (stripeId) {+ const workspace = await prisma.project.findUnique({+ where: {+ stripeId,+ },+ });+ if (workspace?.paymentFailedAt) {+ console.log("Workspace has paymentFailedAt, resetting it to null...");+ await prisma.project.update({+ where: {+ id: workspace.id,+ },+ data: {+ paymentFailedAt: null,+ },+ });+ }+ }+ console.log(+ "No transfer_group (invoiceId) found, skipping invoice update flow...",+ );return;}