#ajay vibeosys-Subscription
1 messages · Page 1 of 1 (latest)
You can use subscription_data.trial_period_days
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
sorry my bad
I already saw that but saw just another parameters and it says Deprecated
so I thought no use
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
items is deprecated but trial_period_days should be usable
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?
Hi @royal rivet I'll take over this thread, give me a sec to catch up.
can you send me the subscription ID?
OK, can you also give me the request ID?
And also can you let me know the problem that you try to solve?
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
I see, so you want to update your database with the total amount of the line_items, am I right?
yes
old subscription total cost was $22 monthly
and updated subscription cost is $25 monthly
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.
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
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.
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?
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
oh now clear all
proration_behavior=create_prorations
is it default or I need add this when update api?
Yes, create_prorations is the default value for proration_behavior
thank you for all help