From 7bf05b35a63491666cf0bde206e93213ec128139 Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Tue, 16 Jul 2024 19:13:36 +0100 Subject: [PATCH] feat(#22): Add handling for customer.created event --- src/routes/api/webhook/stripe/+server.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routes/api/webhook/stripe/+server.ts b/src/routes/api/webhook/stripe/+server.ts index 7370213..47d1697 100644 --- a/src/routes/api/webhook/stripe/+server.ts +++ b/src/routes/api/webhook/stripe/+server.ts @@ -3,6 +3,7 @@ import stripe from 'stripe'; import { PUBLIC_STRIPE_SECRET_KEY } from '$env/static/public'; import { PUBLIC_STRIPE_ENDPOINT_SECRET } from '$env/static/public'; import { + createOrRetrieveCustomer, deletePriceRecord, deleteProductRecord, manageSubscriptionStatusChange, @@ -54,6 +55,9 @@ export const POST: RequestHandler = async ({ request }) => { case 'product.deleted': await deleteProductRecord(event.data.object as stripe.Product); break; + case 'customer.created': + await createOrRetrieveCustomer(event.data.object as stripe.Customer); + break; case 'customer.subscription.created': case 'customer.subscription.updated': case 'customer.subscription.deleted': {