#gagan.suie
1 messages · Page 1 of 1 (latest)
is this what im looking for?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hi! Let me help you with this.
Are you using Subscription Schedules or just Subscriptions?
i dont know what that means. im using a pricingtable
with monthly and yearly products
No worries.
So, there's many ways to design this. Do you want the Subscription to stay active until the end of this billing cycle, if the Customer cancels it (changes to free plan)? Or do you want to stop it immediately and refund the difference?
the first option
also how do i know they subscribed to the paid plan in payment_intent.succeeded?
switch (event.type) { case 'payment_intent.succeeded': paymentIntent = event.data.object clientReferenceId = paymentIntent.client_reference_id const planTier = '<how do i know its a paidPlan?>' await createPlanHelper(request, db, clientReferenceId, planTier ? 0 : 1) break case 'subscription_schedule.aborted': paymentIntent = event.data.object clientReferenceId = paymentIntent.client_reference_id await createPlanHelper(request, db, clientReferenceId, 0) break default: console.log(Unhandled event type ${event.type}) }
- If so, you can set
cancel_at_period_end: true, when the Customer wants to cancel the subcription, so it will stay active until the end of the month (this billing period): https://stripe.com/docs/api/subscriptions/object#subscription_object-cancel_at_period_end - I recommend listening to
customer.subscription.updated, and checking forstatus: 'active'and the Price selected: https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated subscription_schedule.abortedis the wrong event, it works with Subscription Schedules, which is an advanced feature.
can we keep this chat open. id like to follow up on some of these cases tomorrow morning
I will have to close it, as I won't be here. We are not working on the weekend, also. But you can start the chat with one of my colleagues next week and they will help you.
sorry i meant later today, in like 7 hours.
so basically i want to confirm how to handle all cases.
paid subscription became active --> set planTier to 1.
user canceled or doesn't pay --> set planTier to 0 after end of billing period.
not sure where to set:
cancel_at_period_end: true
while im using pricingTable
My colleagues will be here until like 1 am UTC, but I will have to close the chat until then.
You can update the Subscription: https://stripe.com/docs/api/subscriptions/update