🐛 Ignore completed checkout sessions for one-time payments (#878)

This commit is contained in:
Luke Vella 2023-09-19 19:37:51 +01:00 committed by GitHub
parent 946e1828f4
commit f7d28d86a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,6 +52,12 @@ export default async function handler(
switch (event.type) {
case "checkout.session.completed":
const checkoutSession = event.data.object as Stripe.Checkout.Session;
if (checkoutSession.subscription === null) {
// This is a one-time payment (probably for Rallly Self-Hosted)
break;
}
const { userId } = metadataSchema.parse(checkoutSession.metadata);
if (!userId) {