#sheisty6_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/1225440414946033686
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Hi!
So your goal here is to clean up Customers that attempt to start a Subscription through Stripe Checkout but the initial payment fails?
Ideally, I would keep the customer existing, but I would not that their subscription is past due in my internal storage so that I can direct them to update their payment on my site.
But I can't update my internal storage without associating the customer with my internal id
Hmm in this case though the Subscription won't be past_due
It will be incomplete
In which case there is only a 23 hour window for it to move to active otherwise it moves to incomplete_expired
But if you want to track this then you can listen for the customer.subscription.updated Webhook for when a Subscription's status is incomplete
Ah actually sorry that Webhook wouldn't fire
It would only be customer.subscription.created
As that is the initial status here
That Webhook would contain the Customer ID that you are looking for
For any webhook, though, I update my internal state by looking up my internal customer object via the stripe_customer_id. However, without checkout.session.completed, I cannot tie my internal id to the created stripe customer id
session_params = {
"line_items": [
{
"price": price_id,
"quantity": 1,
}
],
"mode": "subscription",
"success_url": "https://doinksports.com?subscribed=true",
"cancel_url": "https://doinksports.com?canceled=true",
"automatic_tax": {"enabled": True},
"phone_number_collection": {"enabled": True},
"metadata": {"user_id": request.user["uid"]},
}
^^ my checkout session params. I use this metadata field
The best matchup analysis platform. Research offense and defense trends to find winning player props, team props, spreads, and OUs for NFL, NBA, MLB, NHL, NCAAB
The best matchup analysis platform. Research offense and defense trends to find winning player props, team props, spreads, and OUs for NFL, NBA, MLB, NHL, NCAAB
Your other option in that case is to create the Customer ID before redirecting to Checkout
And then pass that Customer ID to the customer parameter for the Checkout Session
Then you have the Customer ID up front and can store it in your database
Ohh ok. Makes sense. Thank you!