#shoonjohn_webhooks

1 messages ยท Page 1 of 1 (latest)

woven vortexBOT
long quiverBOT
#

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.

woven vortexBOT
#

๐Ÿ‘‹ 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/1265995925092958249

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

next temple
karmic galleon
#

Can you share the webhook code?

next temple
karmic galleon
#

Does the code inside the switch statement run?

if (isset($checkout_session->line_items->data)) {
            foreach ($checkout_session->line_items->data as $line_item) {
                $productId = intval($line_item->description); // Ensure you're using the correct product identifier
                $quantity = $line_item->quantity;

                // Log the values for debugging
                error_log("Product ID: $productId, Quantity: $quantity");

                if ($productId) {
                    updateProductQuantity($productId, $quantity, $conn);
                } else {
                    error_log("Invalid Product ID retrieved from line item description.");
                }
            }
        } else {
            error_log("Line items data not available in checkout session.");
        }```
next temple
#

Yes

#

I am not receiving any errors...yet the db is not being updated

karmic galleon
#

Then you probably need to debug the code in your updateProductQuantity function

next temple
#

i used to get some errors

karmic galleon
#

The 2xx response is not dependent on the success of that function overall so it seems expected that you'd get a success message event if that logic doesn't run

karmic galleon
next temple
#

my datebase is really simple... is there any way I can implent a easier logic. This is my first project working with a database and backend in general...

mental wigeon
#

hi! I'm taking over this thread.

#

if you have specific questions about Stripe, I'd be happy to help.

next temple
#

Hey, I am trying to set up a webhook, that automaticly updates the stock in my databse... I am not receiving any errors , yet the stock wont update in my DB

mental wigeon
#

I can't really help with database since this is unrelated to Stripe. but make sure to add some logs in your backend code to make sure that:

  • the code is actually executed
  • and see if there are any errors
next temple
#

I have logs in my Code and fixed some errors that were shown here...
I don't receive any errors now but the stock wont update.

mental wigeon
#

like mentioned before, add some logs to your code to understand why the stock won't update. maybe that code is never executed, or maybe you have a error in your dabase query, or something else.