export const handleStripeEvent = async ( type: string, data: Stripe.Event.Data, id: string ) => { try { const isTestEvent = id === 'evt_00000000000000'; if (isTestEvent) { return; } switch (type) { case 'checkout.session.completed': await handleCheckoutSessionCompleted(data.object); break; case 'customer.subscription.updated': await handleCustomerSubscriptionUpdated(data.object); break; case 'invoice.paid': await handleInvoicePaid(data.object); break; case 'invoice.payment_failed': await handleInvoicePaymentFailed(data.object); break; case 'customer.subscription.deleted': await handleCustomerSubscriptionDeleted(data.object); break; } return true; } catch (e) { console.log({ message: e }); } };