#icurrytheteam
1 messages · Page 1 of 1 (latest)
By the way, I ask this question because while I can list a customer's subscriptions using Stripe's api, I need a way to show which subscription "matches" with the right vendor. Like I can get the sub_id and prod_id but not who the user is subscribed to. Does this make sense?
Hi! Let me help you with this.
Yes this is a good place for this question, and yes it makes sense.
Both ways are valid, metadata or your own database. Depends on how much info do you need to store. The simplest solution is to store vendors on your database and add a vendor ID in Subscription metadata. You could also store vendors as Products maybe?
You could also store all the relations in your own database but you will need to makes sure it is in sync with Stripe data.
We have unique vendor id's, yes. May I ask something else?
Sure!
Ok, great. If a user wants to cancel a subscription immediately, there exists stripe.Subscription.delete('sub_id'). However, to cancel a sub effective end of billing cycle I'd have to use something like stripe.Subscription.modify('sub_id', cancel_at_period_end=True). That being said, what happens if I use the second command but then try reactivating the subscription halfway through the billing cycle. Would I use something like stripe.Subscription.modify(subscription.id, cancel_at_period_end=False, ..) or do I have to create a new subscription by running stripe.Subscription.create(...)?
You can do stripe.Subscription.modify(subscription.id, cancel_at_period_end=False, ..).
It is just an attribute on the Subscription object, which you can switch back and forth. At the end of the billing cycle, Stripe checks the attribute and cancels the subscription if it's True. At all other times you can update it freely.
https://stripe.com/docs/api/subscriptions/update#update_subscription-cancel_at_period_end
I see. So consider the following example: if a user subscribes to a vendor and after a couple months, they unsubscribe but subscribe again after another month. Would I have to check if theyve previously subscribed while they go through the subscription process because I am not creating a new subscription but rather updating one?
yep
sure
What happens if I reactivate the subscription for the user but the original payment method they used when they first bought the subscription no longer exists?
ultimately, the payment attempts on that subscription will fail, that's what would happen. Details depend on what exact APIs you're using and in which ways
just ask them please, don't ask to ask
I am creating a setupintent to collect payment information for future purchases. However, I want that newly created payment method to be the default method. How would I access the payment method id after the setupintent is succesful and the user enters their payment details? If i try to access the payment method from the setupintent then it would just return null (because the user has not yet entered their payment information).
you can access it after the SetupIntent succeeds, possibly as part of your webhook handler for setup_intent.succeeded, or by sending a message to your backend from the frontend when the confirmSetup Promise resolves
That makes sense, yes.