#worming-subscriptions

1 messages · Page 1 of 1 (latest)

split bear
#

Starting up a new thread for you since it's been a while since the last thread - can you give me the gist of where your last thread left off?

pliant dove
#

Hey karbi, yes give me a minute and im gonig to send you what i need help with

#

i need some help to figure out how to handle some "special" subscriptions.
When a subscription is paid, and we get the invoice.paid webhook event notification, we are releasing some credits in our app for that customer. But now we have some customers that are going to pay 30 days after the subscription started...
i was wondering how can we handle this type of subscriptions... I know we can achieve that using the "Start billing cycle" date to 30 days after the Subscription creation date, but since our app is based on credits, and we need to release those credits to the customer in order to let them use it, i was wondering what is the Stripe event that is going to be sent monthly but at the start subscription date cycle basis not at the billing cycle date basis.

split bear
#

Hmmm... so basically you have Subscriptions that start on the 1st of the month (at which point you want to release the credits), but the customer doesn't pay for that month until the end of the cycle/the start of the next cycle?

pliant dove
#

right

#

the billing cycle is different than the subscription cycle

#

the billing could be 30 days after the subscription creation date, 60 days or 90 days

#

currently we are using the invoice.paid event to know that something happened with that subscription, we check the invoice field billing_reason and if the reason is subscription_cycle we know that the invoice was charged because the subscription was recently created and charged or it is a renewal

#

so at that moment we register the payment in our app and release the credits

#

but this new type of subscription that we want to manage, its going to have a different flow, since the invoice.paid event is not going to be triggered until 30/60/90 days after the subscription is created/renewed

#

so maybe what we can do is add some metadata to the subscription when we create it, and then use the subscription.created webhook event to release the credits... that is ok for the first month (or year depending on the cycle)... but how can we handle the renewals?

split bear
#

So there's a couple of different ways to go about this - give me a bit to start typing

pliant dove
#

ok cool, thx

split bear
#

So the simplest way (in my opinion) to do this, would be to create a separate price that's set up like this:

  • have it be metered (recurring.usage_type: metered)
  • Give it a single tier with tiers[0][up_to]: inf, tiers[0][flat_amount]: the monthly amount you want to charge
    Since it's metered, it'll automatically bill at the end of the month (instead of the start), and you'll still be able to create the subscription when you normally would. It'll just start off with a $0 invoice, instead of the full amount like your normal subscriptions
#

This is why snufkin mentioned usage based subscriptions before (which use metered billing)

pliant dove
#

ok.. so i can create a different price for the same products like this:
Product A
Prices:

  • $100 (standard pricing) ID: price_standard
  • $100 (graduated pricing) ID: price_metered
#

but that is not going to work if the start billing date was set to 60 or 90 days after subscription creation date right?

split bear
#

Correct - you'd need to workaround that, and it'll depend on what you want to happen with those 60/90 day ones.

#

At the 60 days, do you want to charge them for 200 dollars? Or do you still want to charge them $100

pliant dove
#

what i need is the subscription to have 2 cycles:

  1. Subscription cycle
  2. Billing cycle
    and we need to get notification from Stripe on both cycles
#

a notification when the subscription is renewed and a notification when the invoice is paid

split bear
#

I need to head out by @ancient hound is going to take over and help - my earlier question is more, after the 60 days is over do you only want to charge them for the 30 day price? Or do you consider that two cycles and now you want to charge them $200?

pliant dove
#

just $100

#

because we should charge in a 60 days billing cycle

#

the first 2 month is not going to pay anything, and after 60 days, start to pay 100 each month

#

Jan - $0
Feb - $0
Mar- $100 (corresponding to Jan)

split bear
#

Yeah, so then you could probably work around it by giving them a free trial for the first 30 days

#

So for 60 day delay you'd create the subscription with the metered price + a 30 day trial, for the 90 day you'd create the subscription w/ the metered price + 60 day trial

#

I'm heading out now - but if you have any other questions my teammate can help you out 👍

pliant dove
#

ok and Stripe is going to generate an charge a $0 invoice for the first month?

split bear
#

yup, it should

pliant dove
#

ok thx karbi im going to test it

#

I tried and it doesn't work as expected

ancient hound
#

Hi there. What didn't work as expected?

pliant dove
#

what i can do is to use a 100% discount coupon (duration once) for a Net30 subscription, a 100% discount coupon (duration multiple month = 2) for a Net60 subscription, and so on

pliant dove
ancient hound
#

Can you share the request ID?

pliant dove
#

do you mean the subscriptionId?

#

sub_1LdfNMLN0iJa18Zeh6xq4pwC

ancient hound
#

That also works

pliant dove
#

in_1LdfNMLN0iJa18Zeawso4icb

ancient hound
#

You didn't create it with a trial

pliant dove
#

maybe the issue is that i have to disable the prorate

#

i dont have to create the subscription with the trial

#

i use the "start billing cycle on" setting the date to 30 days after the subscription create date

#

nope, even with the prorate disabled is generating a proration invoice

ancient hound
#

Create it with a 30 day trial like karbi suggested. Also don't set collection_method, days_until_due, and billing_cycle_anchor

pliant dove
#

to test it, im creating the subscription using the dashboard.. so im not setting those properties

#

sub_1LdfhHLN0iJa18ZewHRJT7Jl
right, if i use the standard pricing and set 30 days trial, Stripe is generating a $0 invoice for the first cycle

#

but let say the customer is going to use the subscription for 3 cycles (in a monthly sub):
1st Month: $0 invoice
2nd Month: $100 invoice (full price)
3rd Month: $100 invoice (full price)
and then the customer cancel the subscription
we still need to charge the $100 first month before the cancellation occurs

ancient hound
#

You could just generate a 1-off invoice for that

pliant dove
#

right but that implies a manual process

#

and we want to avoid manual operations, becuase we could have a lot of customer running the same type of subscription on different dates

ancient hound
#

It wouldn't be manual. You could listen for the subscription cancel event and then generate an invoice programatically

pliant dove
#

right, thats true

ancient hound
#

You would just have to keep track whether they started 30, 60, or 90 days

pliant dove
#

we should set a metadata to the subscription to identify when we have to generate an invoice at cancellation

ancient hound
#

You could do that

pliant dove
#

what i dont like of this approach is that the customer is going to receive an email for the first month with the $0 invoice saying free trial

#

and we are not doing that

#

i mean the customer is not getting any free trial really

ancient hound
#

Yeah I get why that's not ideal. And sending the customer an email is a requirement for you?

pliant dove
#

yes... some customer pays using credit cards and we dont need to send the invoice for those customers, but some others are configured to send the invoice

#

and we are listing the Stripe invoices in our app, so they are going to see that invoice anyways

#

ok, but at least we have a way to handle this type of subscriptions, we can let the customer knows about how its working

#

to summarize:

  1. we need to create the subscriptions with a 30/60/90 free trial
  2. we need to add subscription metadata to let us identify the subscription type in order to charge the pending charges at cancellation event
  3. we need to listen to the subscription.deleted webhook event notifications to charge the pending charges if the customer cancel the subscription.
#

so far, i think doing just that, we are good

#

im going to test it now and if i have further question i'll reach out to you