#saintlike_webhooks

1 messages ¡ Page 1 of 1 (latest)

timber muskBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1404986698567254056

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

carmine frost
#

Hey, here's some code for context of how I am handling the webhook and whats happening:

const permittedEvents = ['payment_intent.succeeded']

    if (permittedEvents.includes(event.type)) {
        let data
    
        try {
          switch (event.type) {
            case 'payment_intent.succeeded':
        ...
try {
                  console.log('==============================================reached try for product submission creation')
                  const productSubmission = {
                    _type: 'productSubmission',
                    title: data.metadata.productTitle,
                    customerName: customer.name,
                    customerEmail: customer.email,
                    description: data.metadata.productDescription,
                    price: data.metadata.productPrice,
                    productUrl: data.metadata.productUrl,
                    purchasedTier: data.metadata.purchasedProductTitle,
                    amountCharged: data.metadata.amountCharged,
                  }
                  await createSanity(productSubmission)
                } catch (err) {
                  console.error('Failed to create a product submission:', err)
                  throw new Error('Failed to create a product submission', err)
                }
            ...
#

this is what happens in the console, what is weird to me is that the block for creating an object console.logs only once while two objects are created from this same webhook and from the same block of code

last fractal
#

Hi there, can you share with me the ID of the webhook event?

carmine frost
#

evt_3RvSn0QlxuTOhr2i0Gm1ZWA0

last fractal
#

Ok, looks like there were two local webhook enpoints receiving the same event. Did you run stripe listen twice in two separate Terminal windows?

carmine frost
#

i didnt. im currently listening to only one endpoint. I renamed the endpoint from stripe-webhook to stripe-webhooks and rerun the listen command to ensure i am not listening to multiple

#

here's the overview from stripe of all endpoints that are currently open

last fractal
#

Ok, can you restart your laptop and try again? Just want to make sure that there's only one instance of stripe listen running in your machine.