# Supabase stripe webhook listening to events that are not triggered from the app

**URL:** <https://community.weweb.io/t/supabase-stripe-webhook-listening-to-events-that-are-not-triggered-from-the-app/9723>\
**Category:** How do I?\
**Tags:** supabase\
**Created:** [July 15, 2024, 9:39am UTC](https://community.weweb.io/t/supabase-stripe-webhook-listening-to-events-that-are-not-triggered-from-the-app/9723 "2024-07-15T09:39:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![springbloom](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/springbloom/32/7345_2.png) [@springbloom](https://community.weweb.io/u/springbloom)\
**Post date:** [July 15, 2024, 9:39am UTC](https://community.weweb.io/t/supabase-stripe-webhook-listening-to-events-that-are-not-triggered-from-the-app/9723/1 "2024-07-15T09:39:42Z")

</div>

Hi,  
We have a stripe webhook setup that is used for our Stripe Connect Customers. This webhook is triggered when a payment is made from the weweb that is listening to this Stripe Webhook.  
Not what is happening is there are auto-subscriptions setup on our stripe account for non weweb customers and this webhook is also getting triggered on payment\_intent.succeeded for these users. How can I stop the webhook getting triggered for all the payment\_intent.succeeded? I want it to only listen to this event, when it is triggered from the weweb app.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [July 15, 2024, 10:43am UTC](https://community.weweb.io/t/supabase-stripe-webhook-listening-to-events-that-are-not-triggered-from-the-app/9723/2 "2024-07-15T10:43:46Z")

</div>

I think you need to add meta-data to your `payment_intent.succeeded` then in the Supabase webhook, you filter for example for `metadata.source = weweb-payment`. I used this for my NodeJS project, this is how I handled this. It’s not the exact same thing, but it’s pretty similar.

```auto
 try {
        event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);
    }
    catch (err) {
        return res.status(400).send(`Webhook Error: ${err.message}`);
    }

    if ( event.type === 'checkout.session.completed' ) {

        const { metadata, customer_details } = event.data.object;

        if (metadata.type === 'digital-goods') {
            const digitalGoodsPath = path.join(rootDir, 'content', 'goodies');

            if (metadata.product === 'rbac-script') {
                   // Your logic for the (in my case) product that has 'rbac-script' metadata
            }

        } else return res.status(400).send(`Object is not defined.`);

    }

```

By the way, you can use [Stripe Wrapper | Works With Supabase](https://supabase.com/partners/integrations/supabase_wrapper_stripe) to avoid this entirely maybe?

This is how my (in this case payment link) works, with metadata and all.

 ![Screenshot 2024-07-15 at 12.44.48](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/9/92965f9c3a44615717cb0f006eb76de5a5852c9f.png)

---

<div class="post-metadata">

**Author:** ![springbloom](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/springbloom/32/7345_2.png) [@springbloom](https://community.weweb.io/u/springbloom)\
**Post date:** [July 16, 2024, 2:35pm UTC](https://community.weweb.io/t/supabase-stripe-webhook-listening-to-events-that-are-not-triggered-from-the-app/9723/3 "2024-07-16T14:35:56Z")

</div>

@Broberto thank you sharing this. I’ll give it a try!
