#obxd
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- obxd-checkout-subscription, 33 minutes ago, 24 messages
Hello! No, that doesn't sound like something I'd reccommend. Can you tell me what you're trying to accomplish at a high level?
simple saas. I want to implement premium subscription, I store users in my own db
Can you tell me more about what "if I make checkout (not Subscription) with subscription mode" means exactly?
in subscription example in docs I haven't found how to determine from which user webhook came
checkout_session = stripe.checkout.Session.create(
line_items=[
{
'price': price_id,
'quantity': 1,
},
],
mode='subscription',
success_url='http://localhost:3000',
metadata={'email': user.email}
)```
The checkout.session.completed Event will have a customer property that indicates the Customer.
but what if the user type another email in checkout form
should I use Subscription api for that simple project?
Usually we recommend specifying the existing Customer if they already exist.
When you create the Checkout Session I mean.
That way even if they type in a new email or something they'll still be associated with the same Customer in Stripe.
so I create a customer with user's email and attach it to checkout
I got it
thanks
Yep!
are checkouts with mode=subscription and recurring price work like normal subscriptions and charge user automatically?
Yes.
great, thank you a lot
Happy to help!
am I right that I should process payment_intent.succeeded webhook?
and just adding 30 days to the db is a common practice
That depends on what your ultimate goal is. Are you trying to keep track of the Subscription status on your end?
I want to have ability to check if user currently has a subscription
If you're doing monthly Subscriptions the number of days will be variable, for example, so you would probably want to listen for Events like customer.subscription.updated and look at the current period start and end values. You should review the list of Subscription-related Events here: https://stripe.com/docs/billing/subscriptions/overview#subscription-events
thanks
so there is no need to handle remaining days and in a simple implementation I can just listen to created and deleted
Probably, but it really depends on your specific needs. I recommend testing in test mode to make sure everything works as expected.