Skip to content

Commit

Permalink
fix(stripe): check stripe initialization before use in webhook handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ousszizou committed Mar 18, 2024
1 parent cb88f0e commit 2b5c836
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/stripe/src/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { stripe } from ".";
import { stripePriceToSubscriptionPlan } from "./plans";

export async function handleEvent(event: Stripe.Event) {

if (!stripe) {
console.error("Stripe is not initialized. Please check the USE_STRIPE environment variable.");
return;
}

switch (event.type) {
case "checkout.session.completed": {
const session = event.data.object;
Expand Down

0 comments on commit 2b5c836

Please sign in to comment.