#ajay vibeosys-Subscription

1 messages · Page 1 of 1 (latest)

trim whale
#

You can use subscription_data.trial_period_days

royal rivet
trim whale
#

items is deprecated but trial_period_days should be usable

royal rivet
#

yeah, understands, my bad

I am updating subscription using
$subscription = $stripe->subscriptions->update(

in its response I am not getting total amount
so I need use foreach and loop through
items->data->price->unit_amount
and add amount to total?

balmy solstice
#

Hi @royal rivet I'll take over this thread, give me a sec to catch up.

#

can you send me the subscription ID?

royal rivet
#

sub_1KU5fnGvql6L15SKN7DTEePX

#

its in test mode

balmy solstice
#

OK, can you also give me the request ID?

#

And also can you let me know the problem that you try to solve?

royal rivet
#

consider I have products
SMS $10/month
EMAIL $12/month
WHATSAPP $15/month

user choose SMS and EMAIL so total is $22 and subscription is created
I store $22 in my database

now user update subscription
SMS keep it
EMAIL remove
WHATSAPP add
so now total is $25

balmy solstice
#

I see, so you want to update your database with the total amount of the line_items, am I right?

royal rivet
#

yes
old subscription total cost was $22 monthly
and updated subscription cost is $25 monthly

balmy solstice
#

OK, the subscription object does not have property to reflect the total amount, but you can derive it by adding the amount of the line_items.

royal rivet
#

thats what I want to confirm
thank you

#

after subscription update user subscription period will be same?
like user created subscription on date 1-1-22
so his renewal is 1-2-22

but in between he updated subscription on date 15-1-22

so?

#

I have read about
prorate subscription changes

balmy solstice
#

If both prices have the same billing periods—combination of interval and interval_count, the subscription retains the same billing dates.

#

so in your case, since the billing period stays the same, the billing date will remains on the 1st day of the month.

royal rivet
#

sorry little bit confusion here

first time create subscription with product SMS ($10) and EMAIL ($12) on date 1-1-22

now consider 15-1-22 user update subscription with
keep SMS
remove EMAIL
add WHATSAPP

so for SMS date is 1-1-22 to 1-2-22
and for WHATSAPP date will be 15-1-22 to 15-2-22?

balmy solstice
#

No worries, let me explain here
Assuming you are passing proration_behavior=create_prorations when updating the subscription, and there is no trial period

  • On 1 Jan, your customer subscribes SMS + Email - you customer will be invoiced of $22 on the same day
  • On 15 Jan, your customer decides to change the items - SMS + WHATSAPP - you customer won't be invoiced at this time
  • On 1 Feb, you customer will be invoiced with $25 for the (SMS + WHATSAPP) Feb usage + the prorated (SMS + WHATSAPP) Jan usage - the unused (SMS + Email) Jan usage
royal rivet
#

oh now clear all

proration_behavior=create_prorations
is it default or I need add this when update api?

balmy solstice
#

Yes, create_prorations is the default value for proration_behavior

royal rivet
#

thank you for all help