#supreeth_20471

1 messages ยท Page 1 of 1 (latest)

kind slateBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

feral mirage
#

Reading your scenario, I think the most straightforward way would be to cancel the subscription, note that the user owes you for 28 days on your side, and when they re-subscribe you can add a one time invoice item for that amount when creating the new subscription

marble crypt
#

so lets say i cancel the subscription, will stripe still track the unpaid invoice or would it void it

#

i mean to ask if a invoice is attached to customer or a subscription

feral mirage
#

Depends on your subscription settings from the dashboard. I think you can have it automatically voided

marble crypt
#

is there anyway i can get on a quick call with a stripe dev? this is bit of an involved use case which i feel needs a verbal chat.

feral mirage
#

Unfortunately we don't offer calls on this server, I am happy to talk through it further here if you would like. Or you can write in an email with a full writeup if you think a longform format would be bettter

marble crypt
#

in that case let me try my best to word it out here

#

so here's how our subscription is setup

  • we have a volume tiered pricing model. we offer a monthly plan ($22/unit/month) and a yearly plan ($16/unit/month).
  • lets say i do cancel the subscription like you suggested. the customer still owes us the amount for 28 days based on the plan they are on and the volume they have.
  • here are the things that would need to happen
  1. void the initial bill that was raised (stripe does this as soon as subscription is cancelled)
  2. prorate the bill for 28 day charge based on plan and volume -> maintain this number in my db maybe?
  3. in case customer reactivates, i need to create a new subscription. link the new subscription id to the customer on my db, create a one time charge in addition to the subscription amount. accept payment.

i think this might work but its just too many operations. what i mean by this is -> im calculating the prorations on my server,

(we have very strict BE design rule not to calculate anything related to billing on the server because of data inconsistencies with stripe )

i think this is will get very messey when we scale. so just wondering what a better cleaner approach would be

#

@feral mirage let me know if this isnt clear. will be happy to help you out with more details ๐Ÿ™‚

feral mirage
#

That is clear but makes me realize that I may not understand the situation fully. Is there a reason you don't want to use the amount that was on the original invoice that was voided? Are you only looking to charge for specific invoice items on that invoice or something like that?

marble crypt
#

so the reason i cant do that is, technically the customers are pre paying right?

lets take a use case with 5 units yearly customer who's subscription renews on 1st of jan

An invoice for $960 (i.e $16 * 5 units * 12 months) is raised on the 1st of Jan. their payment fails.

after 28 days they do not change their payment method.

i need to void the $960 bill (stripe auto does this when me cancel it)

but i need to calculate the charge for 28 days and not the entire year because the cant use the app after 28 days. so i can not use the original invoice. let say they sign up from feb 12th or something ->

the invoice should be

28 days prorated amount (from jan 1st to jan 28th) + $960 (1 year subscription from feb 12 2024 to feb 12 2025)

#

does this answer your question?

feral mirage
#

Ah gotcha, yes apologies I missed the yearly vs 28 day difference there. One way to make Stripe do these calculations may be to use our upcoming invoice endpoint. The idea would eb to pretend you are making a subscription for that price that ends after 28 days, but I am unsur if that endpoint allows the parameters for that to be passed in simultaneously https://stripe.com/docs/api/invoices/upcoming_invoice_lines

#

Oh and I'm not sure if it is possible to pass in usage in that call as well

marble crypt
#

in all honesty if there was anyway to pause the subscription (like the one when trial ends and payment method is not attached) not pause collection it would work perfectly

#

yea we did try to use the upcoming invoice but like you said we cant set the 28 days usage in that

feral mirage
#

Is the 12 month price always the same or always one of a select few prices? If so, you could pre-calculate a price for the 28 day proration and then pass that in to our upcoming invoice API along with the usage info

#

Wait, not seeing a way to pass in usage.

#

I will ask my colleagues if there is a clean way to do this and get back to you with what we can find.

marble crypt
#

was i not supposed to share that lol

feral mirage
#

Good for now, also deleted that as this is a public channel that bots scrape sometimes

#

No worries, I got the email address

marble crypt
#

awesome ๐Ÿ™‚

feral mirage
#

It is fine, just like I said bots sometimes scrape channels and spam email addresses that they find on them

marble crypt
#

@feral mirage just wondering if i should be active here or should i expect an email ? no rush though

feral mirage
#

Colleague just got back to me, before you cancel the subscription you should be able to run the upcoming invoice endpoint and pass in the start date + 28 days as the subscription_cancel_at parameter as well as turning prorations on. That should calculate the prorated amount + usage. Can you test that in test mode to confirm if that calculates what you are expecting?

marble crypt
#

so i have to maintain the 28 day amount on my db?

feral mirage
#

Yes

marble crypt
#

ohh ๐Ÿ˜ฆ are you sure there's no other way?

feral mirage
#

If you create prorations while cancelling the subscription, that may also give you the mount you need. But I think those are all the main options here

marble crypt
#

alright got it. also any idea why the pause subscription endpoint is not public?

#

like why cant a subscription enter a paused stated?

feral mirage
#

Apologies I thought you said that the pause functionality does not work for your usecase

kind slateBOT
marble crypt
wary void
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

I'm not sure I understand the question. What are you asking?