#miroslav-grozdanovski_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ 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.
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?
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
I'd recommend you test it out (you can use test clocks to do so: https://docs.stripe.com/billing/testing/test-clocks)
Thanks. Would it mess with the user's ability to upgrade the subscription plan in any way?
Not if you are handling the update -- you would just update the Price but maintain a trial period
not sure what you mean by me handling the update, but members are upgrading through Stripe's Customer Portal
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
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
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
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.
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
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...
You can test and check, but I think that is the best way.
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
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
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?
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
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)?
You would have to track this
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?
It would apply to the next Invoice, see: https://docs.stripe.com/api/coupons/create#create_coupon-duration
Applies to the first charge from a subscription with this coupon applied.
I'm not sure what "first charge from a subscription" means here. Are upgrades considered as "charges from a subscription"?
First charge related to a Subscription from the point in time the Coupon is applied
So the next Charge
Do you consider the upgrade a charge as well or not?
Yes, a Charge is a Charge -- it doesn't take into account what created it.