#miroslav-grozdanovski_best-practices

1 messages ¡ Page 1 of 1 (latest)

frigid zodiacBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1283777967977267266

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

cunning stratus
#

Hello

#

Generally the easiest way to do this is you use a trial period

rocky venture
#

Hm, how would that work? Can I add trial period in the middle of a paying subscription? Also, how would I prolong it for multiple months if they refer more users?

#

What are the advantages of that approach in comparison to using the Customer Balance?

cunning stratus
#

Yep you can set a trial whenever you want

#

It is basically an arbitrary way to extend the billing cycle and reset the billing anchor for an already-created Subscription

#

And it will always cover the entire cost of the Price, which is why it is better than Customer Balance

rocky venture
#

Thanks. Would it mess with the user's ability to upgrade the subscription plan in any way?

cunning stratus
#

Not if you are handling the update -- you would just update the Price but maintain a trial period

rocky venture
#

not sure what you mean by me handling the update, but members are upgrading through Stripe's Customer Portal

cunning stratus
#

Gotcha then no you aren't handling the update

#

So then no this wouldn't really work I don't think

#

Let me check

#

Yeah that won't work

#

Because you can't update and maintain a trial using Customer Portal

rocky venture
#

Is there a simpler way through using invoice items? If I'm storing the info on how many referrals are processed already on our side, can I somehow mark invoices as paid (or add a negative invoice item) or something similar?

#

or maybe manually apply coupons on those invoices before payment is attempted on them?

#

I feel like there should be an easier way then managing trials, but I haven't looked into Stripe docs in details in some time

cunning stratus
#

Hmm yeah if you want to go that route that works to add a discount to an Invoice when it is created

#

You could listen for invoice.created, the Invoice will be in draft for 1 hour before it charges, then you can update it wit ha discount to make it $0, or you can add a negative Invoice Item.

#

Either way works so that it finalizes as $0

rocky venture
#

Yeah, great. Would I be able to differentiate between regular monthly invoices and an invoice generated for a plan upgrade? I guess so, as I'll need to do that.

cunning stratus
#

Yeah you can use customer.subscription.updated in this case as your Webhook instead of invoice.created

#

That will include a previous_attributes which will indicate whether the Subscription Price was updated

#

And the Webhook contains the Subscription object which has latest_invoice which will be the new Invoice ID

rocky venture
#

Thanks for the suggestion. As I remember, the previous_attributes was a dynamic thing, not easy to handle in strong type languages like C#, but I'll check it out. Maybe there's some alternative way to differentiate between the invoices...

cunning stratus
#

You can test and check, but I think that is the best way.

rocky venture
#

final question, is the referral thing possible with me assigning coupons on the Customer or Subscription level? I've looked into coupons and I can see that they can be configured as one-time, forever, or few-months.

#

that would be by far the easiest way, as I only need to update one thing in Stripe after a new referral is made and that's all

cunning stratus
#

Yeah you could do that and just use a 100% off coupon

#

That would be another route

#

If you are only going to have a 1-1 Customer/Subscription relationship

rocky venture
#

but what would be the duration of the 100% off coupon that I'm applying? Can I stack more 100%-once coupons on the customer, expecting that they would be applied on the next N invoices?

#

if they only make one referral a month, I can just assign them a one-time coupon that'll be used on the next invoice. But what if they make more referrals?

cunning stratus
#

No you can't stack duration: once coupons

#

You wold just align your duration_in_months to the amount of renewals

#

So if they make more renewals you would update the Coupon that is being applied to have the relevant duration

rocky venture
#

should I keep track of that, or Stripe will? I mean, if I initially apply that coupon with duration_in_months equal to 1, and they make an additional referral, am I just updating that coupon to 2? Would I have different logic depending on whether that coupon was already applied? What if it was partially applied (like 2 out of 3 months were used and a 4th referral is made)?

cunning stratus
#

You would have to track this

rocky venture
#

another question (thanks a lot for the help so far!). If I apply a coupon on the Subscription (say a one-time 100% coupon), will that coupon only apply on regular monthly payments, or it will mess up with an in-between prorated invoice if the user upgrades in the middle of the month?

#

or will they pay the difference as regular and the coupon would only apply on the next monthly invoice?

cunning stratus
rocky venture
#

I'm not sure what "first charge from a subscription" means here. Are upgrades considered as "charges from a subscription"?

cunning stratus
#

First charge related to a Subscription from the point in time the Coupon is applied

#

So the next Charge

rocky venture
#

Do you consider the upgrade a charge as well or not?

cunning stratus
#

Yes, a Charge is a Charge -- it doesn't take into account what created it.

rocky venture
#

Got it. So it wouldn't work in my case.

#

Thanks a lot, I'll try a few of these options. The one where I listed on draft invoices sounds most compelling to be honest, as it gives me most freedom and control.

cunning stratus
#

Yeah I think that makes sense as a good path forward

#

But yep testing is the right next step here!

#

Let us know if we can help any further