#sethu_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/1506646239029231677
๐ 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.
- sethu_best-practices, 1 day ago, 14 messages
Hi Jazz,
Hello! Let me look for a better solution for you ๐
Sure
It looks like Stripe sets active: false on the Payment Link when it reaches it's limit after a completed Checkout Session which is why you're receiving both webhook events. Therefore, checking that restrictions.completed_sessions.count = restrictions.completed_sessions.limit is actually the best way to know this happened after a payment versus from a dashboard deactivation (where count < limit or limit is null).
Are you running into any issues using this approach?
I didn't face any issue with this approach.
Currently. if the count and limt is equal. then I'm skiping the webhook.
Java code:
if (paymentLink.getRestrictions() == null
|| paymentLink.getRestrictions().getCompletedSessions() == null) {
return false;
}
var completedSessions = paymentLink.getRestrictions().getCompletedSessions();
return completedSessions.getCount().equals(completedSessions.getLimit());
but I'm thinking, tomorrow if we remove the payment link one time use configuration. Then we will recevie restrictions = null in the webhook.
In this scnario, we can't predict wheather the webhook is triggered after the payment or payment link deactivation.
I'm thinking about this negative scenario.
is there any other ways to differentiate the payment_link.updated webhook. (i.e,., after payment completion or after payment link deactivation from dashboard. )
Pls help ๐
If you remove the one-time use configuration, restrictions.completed_sessions.limit will be null on the Payment Link so there is no limit to be reached after a completed Checkout Session and thus it will only fire the checkout.session.completed event not the payment_link.updated event ๐ does that help?
Thanks. got it.