#erin_api

1 messages · Page 1 of 1 (latest)

next rivetBOT
#

👋 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/1285329168485187746

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

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.

burnt gyro
#

Hello again 👋 happy to help

full widget
#

the future invoice is good, except in the following use case. This feature is for referrals, everytime someone you refer signs up, you get 2 free months. Imagine this, you refer 2 people, the first person signs up right away, so you get 2 free months (as a credit balance)

#

then then next person signs up a few weeks later. If I look at "upcoming invoice" the value will be $0 because they already have a credit to apply.

#

how can I get the actual "normal" monthly amount they pay?

#

and you can't really use another 100% off coupon because you can't stack those

#

not to mention you'd want the "next" 2 months free to start after the current one

#

which is why I was going to do the credit balance, except I can't get the "usual" monthly amount

burnt gyro
#

Good question. Trying to think about your options here.
One more thing I will throw out while thinking on previewing the normal price is that you could define a subscription schedule that moves your subscriptions to and from a $0/month price. There is a parameter called iterations that determines how many cycles a particular phase lasts, so the subscription schedule solution would basically be to increment iterations on the $0 phase by two every time the user gets a new referral.
If you haven't worked with subscription schedules before, it can be a steep learning curve to get them up and running. Doing things like updating a subscription can get more complicated because with schedules you need to update the schedule rather than the subscription directly, which means you may need logic to check if a subscription has a schedule in the first place before modifying an existing subscription.

full widget
#

ya I've used those before

#

checking for existence doesn't sound hard, I presume there's an api call to retrieve or something I can use

#

question for that though

#

let's say the person is mid-cycle...

#

if I move them to $0 for 2 iterations, do they get a refund on the 1/2 month they're in? And only billed a 1/2 month at the other end? cuz that's not what I want

burnt gyro
#

checking for existence doesn't sound hard, I presume there's an api call to retrieve or something I can use
Yep, subscriptions have a schedule property that you can check
https://docs.stripe.com/api/subscriptions/object#subscription_object-schedule
if I move them to $0 for 2 iterations, do they get a refund on the 1/2 month they're in? And only billed a 1/2 month at the other end? cuz that's not what I want
For this, I believe you can set proration_behavior: 'none' for the phase with a $0 price. That should tell us to not create prorations if that $0 phase starts in the middle of another cycle. Or if you want the current month to finish out, you can set iterations: 1 on your first phase that still has a >$0 price. That way the current cycle should end before going to the next one
https://docs.stripe.com/api/subscription_schedules/object#subscription_schedule_object-phases-proration_behavior

#

I am going to ask my colleagues if they can think of an easy way to get the normal price. I feel like if there is that would be way easier to manage than a subscription schedule

full widget
#

@karmic moon take a look at this

full widget
#

then this is trivial:

  1. get proper amount
  2. apply credit balance *2 of that amount.
  3. party like it's 1999
#

all my subscriptions AT THE MOMENT, are consistent with only one discount max, so calculating isn't horrble but it is error prone and not future proof

burnt gyro
#

Turns out there is a parameter exactly for this! https://docs.stripe.com/api/invoices/create_preview#create_create_preview-preview_mode

Will calculate an invoice that is an estimate of the subscription’s long-term recurring bill. The invoice lines will only include recurring subscription items, taxes, and coupons with duration=repeating or duration=forever.
To calculate a recurring estimate, you must provide at least one of subscription or subscription_details.items. Prorations, subscription cancellations, and trials are not supported with recurring estimates.

full widget
#

checking, but it sounds great

#

and it IGNORES credit balances?

#

ok, I'll give this a try, thanks for finding this

burnt gyro
#

I have not tested it myself, but the description does make it sound like it would ignore credit balances. Can you let me know what you see from your test?

full widget
#

ya, it' won't be now, I have other things to do, but seems promising. If you leave this open I can report back later tonight

next rivetBOT