#zeke_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ 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/1344424745071935629
đ 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.
- zeke_unexpected, 1 day ago, 9 messages
- zeke_error, 1 day ago, 6 messages
- zeke_best-practices, 2 days ago, 11 messages
- zeke_best-practices, 2 days ago, 18 messages
Hello there
Hi!
I belive this to be the problem.
Make sure your webhook endpoint is set to: https://your-domain.com/api/stripe/webhook
I cant do such because it wont take a localhost....
If you are just testing using the CLI then you don't actually need to set up an endpoint yet.
What CLI command are you using?
Yep and are you using --forward-to?
Like shown here: https://docs.stripe.com/webhooks#local-listener
no!
Gotcha well that would be the issue!
Hi there. Taking over for my colleague here, who needs to step away
Sounds great!
I just ran the webhook and got a error lets see.
2025-02-26 14:48:00 <-- [500] POST http://localhost:3000/api/stripe/webhook [evt_1QwsSSIYhOvByvWrGzBMo6yf]
Okay, what steps exactly from the guide that my colleague shared did you take?
stripe listen --forward-to localhost:3000/api/stripe/webhook
And is your webhook endpoint code handling that event type? I would expect not from the 500 error
What I am trying to accomplish is the corralation/connection between when my authenticated user on my application purchases a subscription through stripe. when I get redirected after a succesful purchase the authenticated accound does not have the new subscription attached.
I would recommend starting with our webhook builder and trying to get that code working: https://docs.stripe.com/webhooks/quickstart
What does "when I get redirected after a succesful purchase the authenticated accound does not have the new subscription attached" mean? Do you mean that you're trying to understand what webhook event to find the Subscription id on?
Great question! When the authenticated account on my website for example my gmail gets sent to the checkout page and completes the purchase it gets re-directed back to my application, correct. I have made some code that shows the subscriptions and when I finishs the purcahse it re-directs me to that code and it never changes, even after the purcahses it says saying "Free subscription" when it should display whichever subscription I just made.
This tells me that there is no correlation/connection from when my user is completing the checkout process and the authenticated accounts on my page .
Does this make sense?
So I guess my question is "what does the code that shows the Subscriptions" do? My understanding is that your problem is that you aren't displaying the information about the Subscription that you want to be
Also, what products are you using? I am assuming you mean Checkout
yes checkout.
here is the code showcasing the subscription.
<div className="space-y-1">
<p className="text-sm font-medium leading-none">
{user?.fullName}
</p>
<p className="text-xs text-muted-foreground">
{user?.emailAddresses[0].emailAddress}
</p>
<span
className={ inline-flex items-center px-2.5 py-0.5 mt-1 rounded-full text-xs font-medium ${subscription?.tier === 'PRO' ? 'bg-gradient-to-r from-indigo-500 to-purple-500 text-white' : subscription?.tier === 'STARTER' ? 'bg-blue-100 text-blue-800' : 'bg-gray-100 text-gray-800'} }
>
{subscription ? subscription.tier : "FREE"} Plan
</span>
</div>
The problem is not with this code though.
How so? I'm not sure if I understand yet where you're getting the Subscription information that you're displaying
Correct me if I'm wrong but my understanding of your problem is "After paying for a Subscription, when Stripe Checkout redirects back to my application, I am displaying Subscription information, but it is not the information of the Subscription that I just paid for"
Okay! Now, how are you getting that Subscription?
Sorry! I dont think I understand the question. Could you explain it in another way?
Sure. Your code displays some information about the Subscription - I assume that you are taking that information from a Stripe Subscription. How do you get that Subscription information? Do you, for example, retrieve the Subscription from the API?
If you described what you're doing to me and asked me how to build it, I would tell you that a common approach would be to listen for a checkout.session_completed webhook event, take the Subscription id, and retrieve that Subscription from the API and pass it to the client
Interesting. Like this ID?
si_RqaCtjGqegyjy5
No, that's a Subscription item
a Subscription is sub_abc123
here's the example event you gave me: https://dashboard.stripe.com/test/events/evt_1QwsSSIYhOvByvWrGzBMo6yf
Yep. So in the event I just linked, the Subscription is sub_1QwsSPIYhOvByvWrxjcEWxTJ
Interesting so would I make and endpoint that would listen for the checkout.session_completed and then take the Subscription id from the API?
Yep! Here is a guide that explains this approach: https://docs.stripe.com/billing/quickstart
amazing ill check it out
Yeah, I highly recommend our integration guides. They are generally really useful