#gagan.suie

1 messages · Page 1 of 1 (latest)

lusty kernelBOT
worthy star
graceful rampart
#

Hi! Let me help you with this.

#

Are you using Subscription Schedules or just Subscriptions?

worthy star
#

i dont know what that means. im using a pricingtable

#

with monthly and yearly products

graceful rampart
#

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?

worthy star
#

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}) }

graceful rampart
#
  1. 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
  2. I recommend listening to customer.subscription.updated, and checking for status: 'active' and the Price selected: https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated
  3. subscription_schedule.aborted is the wrong event, it works with Subscription Schedules, which is an advanced feature.
worthy star
#

can we keep this chat open. id like to follow up on some of these cases tomorrow morning

graceful rampart
#

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.

worthy star
#

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

graceful rampart
#

My colleagues will be here until like 1 am UTC, but I will have to close the chat until then.