#hc-card-subscriptions

1 messages ยท Page 1 of 1 (latest)

viral cometBOT
#

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.

#

hc-card-subscriptions

urban creek
#

What do you mean?

plush walrus
#

user makes subscription via stripe checkout session

#

then we will have card info for stripe customer

#

but it's not 'preferred'

#

want to make it as preferred one automatically

urban creek
#

What does preferred mean

#

Not sure what you're referring to

plush walrus
#

card.preferred

#

ah, sorry ๐Ÿ™‚

#

I mean, want to make it as default payment method

#

never mind for this question..

#

Instead of that, Can I ask another question?

urban creek
#

Sure

plush walrus
#

thanks

#

I want to calculate the prorated amount

#

before subscription update

#

I made $27 subscription

#

and trying proration amount to update to $49

#

I'm doing that calculation based on this link

#

I made subscription $27 today and trying proration calculation to the $49

#

what I got is

#

amount_due: 7085

#

how it can be?

urban creek
#

I don't understand

#

Can you share request id's

plush walrus
#

ok, sorry.

#

what I want to do is

#

if you have already subscription and wanted to upgrade/downgrade to the another plan

#

then you will not pay full amount due to proration right?

#

So, I want to display how much user should be billed at the moment due to subscription chagne

urban creek
#

Yep that's correct

#

I understand

plush walrus
#

how can I do that?

#

I tried to get that amount based on above link

#

I tested for it and what I got is not understandable for me.

#

subscription purchase for $27/month

#

and then once user tries to upgrade it to the $49 / month plan in same day

#

what about is 7085

urban creek
#

Can you share the request id

plush walrus
#

where can I get it

#

proration_date = int(time.time())

#

I hope this makes sense.

#

if you want, I'll share the subscripton id , and new plan's id

urban creek
plush walrus
#

ok, thanks.

#

why stripe always giving me incorrect password when try login every time these days

urban creek
#

๐Ÿคทโ€โ™‚๏ธ

viral cometBOT
plush walrus
#

Can you please stay here

#

I'd like to give you request id after resolving the stripe login

gloomy meadow
#

Hi ๐Ÿ‘‹

I'm stepping in as my colleague needs to go soon. I will be happy to investigate the API request once you can provide the ID

plush walrus
#

Thanks. don't close the chat

#

hi

#

I think no any request id

#

what I'm calling is stripe.Invoice.upcoming

#

it's not logged as I guess

gloomy meadow
#

That would be logged as a GET request. Our logs default to only showing POST and DELETE requests

#

In the Method filter

plush walrus
#

I can't see response for 'GET' request?

gloomy meadow
#

We don't log responses to GET requests

plush walrus
#

then what should I do?

#

what you want me to share?

#

you understood what I'm doing right?

gloomy meadow
#
  1. What is your current question? There's a lot of back and forth in this thread and I don't have time to read it all
  2. What are you trying to do?
plush walrus
#

My qusetion is I want to display the prorated amount once user upgrades/downgrades to another plan for the subscriptoin

#

understand?

gloomy meadow
#

Before they update or after?

plush walrus
#

before

#

before update we have confirmation modal in our app,

#

need to display amount to be paid at the moment

#

that's why I tried to use this

#

so my test is made subscription for $27/month

#

and tehn trying prorated amount due for upgrading $49/month

#

amount_due I got from invoice object is 7084

#

and I don't understand what it is

#

how it's bigger than $49 (full payment )

gloomy meadow
#

The way the prorations work is, the next invoice will include the full amoun $49 + the prorated amount for the change partway through the billing cycle

plush walrus
#

what I'd like to get is how much money user will pay at the point subscription upgrade

gloomy meadow
#

Okay that should be present in the line items for the upcoming invoice. Can you make the request and copy/paste the output here between three ` marks?

plush walrus
gloomy meadow
#

Okay you see the line with the description Remaining time on PageOptimizer Pro after 15 Dec 2023?

plush walrus
#

yes

#

so how can I know how much user will pay for now?

#

due to subscription change

gloomy meadow
#

What do you mean "pay for now"?

plush walrus
#

so if you upgrade the subscription from $27 plan to $49 plan

#

then you will not pay any money now?

gloomy meadow
#

No

plush walrus
#

it will be only for the next cycle?

gloomy meadow
#

Not unless you configure the change to invoice immediately

plush walrus
#
stripe.Subscription.modify(subscription.id,                             trial_from_plan=False,
           trial_end='now',
           cancel_at_period_end=False,                                  proration_behavior='create_prorations',
           billing_cycle_anchor='now',
           coupon=coupon_code,                                          items=subscription_items)
#

I'm doing this

gloomy meadow
#

Right, so that will create the prorations and add them to the next invoices, which were those line items I mentioned

plush walrus
#

so?

#

what do you mean?

#

user will not pay any money at the moment?

#

for $27 to $49 plan change?

gloomy meadow
#

Correct, the way you make the change

plush walrus
#

then what if user cancel before the next cycle?

gloomy meadow
plush walrus
#

how then prevent the fraud

#

I'm so noob for the proration so not sure how to handle

gloomy meadow
#

The doc will cover this. You can bill immediately if that makes sense for you business

plush walrus
#

how to bill immediately ?

#

can you give me python example for it?

gloomy meadow
#

I STRONGLY suggest you read the whole doc carefully but here's the bit you need for this change

To bill a customer immediately for a change to a subscription on the same billing cycle, set proration_behavior to always_invoice.

plush walrus
#

and If I change it as immediate billl, my question is how much will be billed immediately

gloomy meadow
#

You can test this out with the Upcoming Invoice API

plush walrus
#

yes, that was main point of my question

#

which field shold I consider to get immediate bill amont for the subscription change

gloomy meadow
#

You need to test this out yourself and get a better understanding of what the API response will look like and how you should handle it

plush walrus
#

sorry for the dummy question

#

so you can't explain me which field should I consider?

#

to get the amount of immediate bill for the subscription change?

#

how can I get that amount before making it happen

#

because we need to display it in our app for the confirmation modal before user proceed

gloomy meadow
#

I'm saying you should test this yourself. I cannot answer every single question for you. What you need to display will change depending on what parameters you pass to the Upcoming Invoices API

plush walrus
#

ok, so can you please give me an example for only getting immediate bill amount?

#

I'll change proration_behavior to always_invoice. so I want to get immediate bill amount before proceed

#

how can I get it with stripe.invoice.upcoming

#

what parameter should I pass

#

thanks

gloomy meadow
#

I am not just going to give you code snippets. You need to read the document and test out different options to make sure you understand what you are doing

plush walrus
#

hmm, I really need it though

#

ok

#

for my current code

#

proration_behavior='create_prorations'

#

but even though

#

once I upgrade I can see payment

gloomy meadow
#

Read the document to understand how to handle upgrades/downgrades

plush walrus
#

but you said, user will not billed and then it will be added in the next invoice

#

if proration_behavior='create_prorations'

#

but as you can see, I can see $22.24 is paid

#

(test env)

gloomy meadow
#

Please read the document

plush walrus
#

I was going to undersatnd what's going on

#

cuz in my test,

#

$27 plan to the $49 plan update

#

it paid $22.24 asap

#

then what will be added in the next invoice for proration

viral cometBOT
plush walrus
#

as I guess, next bill will just full $49 not additional payment

near pecan
#

๐Ÿ‘‹ Hopping in here since snufkin has to headout - did you change your code to use always_invoice? If you want the proration immediately, that's what you'll need

plush walrus
#

hi

#

no, I didn't change it

#

proation_behavior='create_prorations'

#

my proation_behavior is 'creaet_prorations'

#

but when I upgrade, I can see some money paid soon

#

so not sure what will be added in the next invoice.

#

what I can see is proration calculated amount is paid asap

#

even

#

with proation_behavior='create_prorations'

near pecan
#

Ah, are you saying you're seeing behavior where the proration is calcaulted immediatley and you're confused about why that's happenign with create_prorations?

plush walrus
#

yes

#

and also

#

the point is that if user paid money at the moment, what should be added in the next invoice

#

in my understand, next invoice willl be simply full amount for the new price

near pecan
#

Yes, if the invoice is paid for immediately the next invoice will just be full price

plush walrus
#

$27 plan purchase after the update subscription to the $49

near pecan
#

If you share that specific invoice/payment ID I can see why it was being charged for immediately

plush walrus
#

then piad $22.24 immediately

#

pm_1ONZCTBTGnRwDyDiP81fSbxg

near pecan
#

It's being charged for immediately becuase in your update request you passed in billing_cycle_anchor: now, which immediately reset the billing cycle anchor.

plush walrus
#

yes, I always pass it

near pecan
#

If you always pass it then you'll always get charged immediately for the prorations

plush walrus
#

ok, then

#

for the next invoice, we will not have any additional item

#

right?

near pecan
#

Correct

plush walrus
#

good. that's what I wanted.

#

then now how can I calculate the amount to be paid now with

#

billing_cycle_anchor: now

#

can I estimate it before proceed?

near pecan
plush walrus
#

yes, I used it already

#

but not sure what parameter I need to add and also which field I need to use to get

#

what I wanted

near pecan
#

Have you taken a look at the list of parameters in the link I sent? If you look, it has params like subscription_proration_behavior , subscription_billing_cycle_anchor and subscription_items which match the params you pass in for your subscription update

plush walrus
#

wait a moment, I'll call with that options and tehn will share result ok?

#

calling like this

#

subscription_proration_behavior='create_prorations',
subscription_billing_cycle_anchor='now',

#

and then I can use 'amount_due' field from invoice object ?

near pecan
#

Yup

plush walrus
#

๐Ÿ˜„

#

before without that parameters, amout_due was bigger than full amount of new plan

#

so I was very confused

near pecan
#

Yeah, it's really important to use the equivalent params for upcoming invoice and subscription update, otherwise you can endup with weird results

plush walrus
#

you're the best

#

let me test more in this way

near pecan
#

๐Ÿ‘

plush walrus
#

If I use the billing_cycle_anchor='now'

#

then even if proration_behavior='create_prorations', it will charge asap right?

near pecan
#

Correct

plush walrus
#

thanks this is really important one to me

#

what will happen of another case like

#

$49 plan to $27 plan

#

then money be less than 0 ?

near pecan
#

You can try this out in test mode and see for yourself

plush walrus
#

amout_due field should be 0?

#

in my check it's not 0

#

just full $27

#

just upcoming function check

near pecan
#

Do you have a request ID I can take a look at?

#

Also one small tweak to what I said earlier - it would be $0 if the credit from ending the $49 plan was enough to balance out the $27. If you were downgrading to the $27 plan towrads the end of the cycle then not very much credit would be generated and you'd still pay a positive amount

plush walrus
#

yes, all was today so it should be enough

#

it's get request for the

#

stripe.invoice.upcoming

#

how to get request id?

near pecan
plush walrus
#

sorry it was 0

#

my bad

#

๐Ÿ™‚

near pecan
#

๐Ÿ‘

plush walrus
#

if it was enough like

#

remaing is $40 ($49 plan but due to some time used) and new plan is $27

#

then amount_due will be $0

#

then what about remaining?

near pecan
#

It'll go to the customer credit balance like I mentioned earlier

plush walrus
#

can I get that number also?

#

how much will go back to the customer's balance

near pecan
#

I need to head out, but if you have more questions a teammate is around and can help

plush walrus
#

but you're best in help ๐Ÿ˜„