From e5135caa3ab9f56ce3d9ffde7c440d689c76d609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Gr=C3=BCneberg?= Date: Mon, 29 May 2023 15:59:36 +0200 Subject: [PATCH] feat: handle remaining subscription events (#80) --- README.md | 4 ++++ src/routes/webhooks.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index d5e7688..209cf41 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ This server synchronizes your Stripe account to a Postgres database. It can be a - [ ] `customer.source.updated` - [x] `customer.subscription.created` 🟢 - [x] `customer.subscription.deleted` 🟢 +- [x] `customer.subscription.paused` 🟢 +- [x] `customer.subscription.pending_update_applied` 🟢 +- [x] `customer.subscription.pending_update_expired` 🟢 +- [x] `customer.subscription.resumed` 🟢 - [x] `customer.subscription.updated` 🟢 - [x] `customer.updated` 🟢 - [x] `invoice.created` 🟢 diff --git a/src/routes/webhooks.ts b/src/routes/webhooks.ts index 9a2ddc0..adbf6b6 100644 --- a/src/routes/webhooks.ts +++ b/src/routes/webhooks.ts @@ -50,6 +50,10 @@ export default async function routes(fastify: FastifyInstance) { } case 'customer.subscription.created': case 'customer.subscription.deleted': // Soft delete using `status = canceled` + case 'customer.subscription.paused': + case 'customer.subscription.pending_update_applied': + case 'customer.subscription.pending_update_expired': + case 'customer.subscription.resumed': case 'customer.subscription.updated': { const subscription = event.data.object as Stripe.Subscription await upsertSubscriptions([subscription])