#stan_api
1 messages · Page 1 of 1 (latest)
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.
- stan_api, 4 hours ago, 13 messages
👋 Welcome to your new thread!
⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!
🔗 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/1212401393659416576
📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.
⏲️ 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. Thank you for your patience!
hey @faint maple Not able to message anywhere in the channel
@lost ledge please read the message in the announcements channel
#🔊announcements message
It explains how to initiate a new thread using the buttons in the #help channel
Sorry about that @chilly heath
Quick question, is there a specific reason you're creating a subscription schedule here?
You could just straight up use the subscriptions API for this, no?
Can you share an example request or a subscription schedule ID?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
yeah I need to create a subscription with 14 free trial days and always have payment on 1st each month.
now is 28 I need to start free trial and have payment on 13 of march for the rest of the month and then a payment for the full price on 1st of may
the support here told me to use scheduleSubscription
Gotcha. Have you tried setting the proration behavior on the phase between March 13 - April 1?
https://docs.stripe.com/api/subscription_schedules/object#subscription_schedule_object-phases-proration_behavior
yup, create_prorations is what you likely need
yeah it is by default
but the price in dashboard is the full one
and the date for the phace is not 13-30 march but 13.03-13.04
which is strange
Can you share an example?
{"customer":"cus_Pe5tte3P6dfd1I","start_date":"now","end_behavior":"release","phases":[{"items":[{"price":"price_1OoSX7GogiQBpoccWvlC9PUu","quantity":100}],"trial_end":1710340149,"end_date":1714521600},{"items":[{"price":"price_1OoSX7GogiQBpoccWvlC9PUu","quantity":100}],"iterations":100}]}
this is how I create the subscriptioSchedule
this is how it looks like in the dashboard
I have tried also with 3 items
{"customer":"cus_Pe5tte3P6dfd1I","start_date":"now","end_behavior":"release","phases":[{"items":[{"price":"price_1OoSX7GogiQBpoccWvlC9PUu","quantity":100}],"trial":true,"end_date":1710340367},{"items":[{"price":"price_1OoSX7GogiQBpoccWvlC9PUu","quantity":100}],"end_date":1711929599},{"items":[{"price":"price_1OoSX7GogiQBpoccWvlC9PUu","quantity":100}],"iterations":100}]}
but again
Can you share the subscription schedule ID?
sub_sched_xxx
I don't get what I need
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
is it this one from the dashboard or I should log it ?
sub_sched_1OooEJGogiQBpoccqmPaxAIh
I have created new one
Thanks, looking..
ok
what happens if you set billing_cycle_anchor to phase_start in the third phase?
https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#resetting-anchor
let me try
sub_sched_1OooP3GogiQBpoccJB0cRsQ2
not what I expect
also the second item end_date: 1711929600 (which is Mon Apr 01 2024 00:00:00 GMT+0000) but it ends on 31 march
Hmm, let me think..
ok
The reason you're seeing the full amount invoice in phase 2 is due to billing_cycle_anchor is still likely anchored to April 13 for a full month.
I'm checking with a colleague about how you can change that..
ok
also any idea why on the second item I set end_date: 1711929600 (which is equal to: GMT Mon Apr 01 2024 00:00:00 GMT+0000), but in the dashboard it is 31 of march. I want my normal cycle to start on 1st of the month
any thoughts what I can try ?
Still talking to our colleague about how you can achieve this, I will get back to you with what we can find
ok, great
Apologies, still working. Basically it looks like the second phase will always try to charge for the full amount, so we are discussing various ways to mitigate that. Discounts, calculating the phase 2 amount yourself, etc
no problem i am available, also have a look at the end date that is not correct, why is it going to 31 march instead of 1st of april
Can you send me the ID of the subscription that you are seeing that on?
Also my colleauges are saying the best two ways to do this would be:
- Calculate the price yourself and add it as a one time invoice item at the end of the trial
why i am gettint this error Parameter 'company' cannot be used in conjunction with an account token. To set this field create a token with the desired changes. Pass the token with 'account_token' in a request without setting 'company'.
sub_1OooBgGogiQBpoccQUiwqT3j
Can you send me the ID of the request where you got that error?
you can check this one
(req_1234)
Sounds good, also for completeness solution #2 is "Add a coupon equal to the amount of the recurring price, to take that off that same end-of-trial Invoice". Which is probably not as good of a solution but is worth mentioning. They provided sample code to demonstrate this
'customer'=> $customer->id,
"start_date"=>"now",
'phases' => [
[
"trial"=>true,
"end_date" => "1710288000", // March 13
'items' => [
[
'price' => $gold->id,
'quantity' => 1,
],
],
],
[
'add_invoice_items' => [
[
'price_data' => [
'unit_amount' => 56250, // manually calculated proration
'currency' => 'usd',
'product' => $product->id
]
]
],
'coupon'=>$co->id, // coupon with amount_off == Price amount
'items' => [
[
'price' => $gold->id,
'quantity' => 1,
],
],
"end_date"=> "1711929600", // Apr 1
],
[
'billing_cycle_anchor'=>"phase_start",
'items' => [
[
'price' => $gold->id,
'quantity' => 1,
],
],
],
],
"end_behavior" => "release"
]);```
really i need to calculate my self
Unfortunately that is where our API currently is
i can't msg in dev-help
Also our server is very busy, will be back in a few minutes to check that subscription and that error (please provide the specific request ID if you can)
That is intentional with our new flow. Please fill out our form in the #help
can you really think about a normal solution not workaround
because in some cases i can do normal subscription creat with trial days and start of subscription 1 month
this is supported if the trial days don’t go to the next month
We extensively tried thinking of "normal solutions". Unfortunately our API does not support your usecase at the moment so a workaround is necessary
so why do i need an coupon can i just add invoice item with price calculated by me
Yeah, that was likely the better solution of the 2. I meant to stress that more
Also it looks like the anchor is the 31st becauce the timestamp that you sent us 1711929599 is on the 31st https://dashboard.stripe.com/test/logs/req_gxXHPLadV5jPSn
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
do i need schedule then can i just create normal subscription
I think you need a schedule because your second phase is of variable length, rather than the full month
yes, the second phase how to lower the price there can i set it manually
because i have created prices and i used them
there i need 13-30, it should be lower price
Right, but the variable length of time is something you can't do with a regular subscription.
ok can you give me example schedule creation
with 3 items
free trial for 14 days starting now
then 13-30 march
for lower price
and then 1 of april full price recurring each month after this
Which part of that specifically are you trying to understand?
Making that full request would take some time with how busy the server is, but if we focus on what you are trying to figure out we can likely solve much faster
it would be very helpful if you can give me sample json for what i describe above
like schedule creation json example
If you don't understand the entire thing, I think we should cover the concepts before I send a giant block of code for them
i do understand it
what i get, i need to creat dynamically coupon with calculated value by me and apply it to the second item
then it will work?
but if you send me sample i will understand it
Apologies but the server keeps getting busier. If applying that discount is the sticking point, then you can try passing in the coupon to the coupon parameter on the second phase when creatig the schedule. The coupon will apply as a coupon normally would for that period. So if you give 25% off of your price, the invoice for that period will be for 75% of the normal price https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-phases-coupon
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok i will try with coupon
last thing, when creating a schedule how do i confirm the payment intent for the subscription?
Same way with normal subscriptions, if you have the payment behavior set to charge_automatically we will try to charge the user ourselves though you can also call the invoice API's /pay endpoint to try outside of that. If you have it set to send_invoice , you need to manually enter payment details on the payment page
in the frontend i need to confirm the payment after entering card numbers, i tried to get the subscription from the schedule but the payment intent is null
If this is during the trialing period, there won't be a payment intent, the subscription will have a pending_setup_intent property
If this is during a paid period, you actually need to get the payment intent off of the latest_invoice on the subscription
yeah i always start with free trial
so i need to retrieve the subscription and get it from pending_setup_intent
could it be that it is missing from there when it is created via schedule?
because i had it as null before
Hello! I'm taking over and catching up...
You had what as null before? The pending_setup_intent?
Ah, and you want to collect payment details before the Subscription itself is created?
Meaning you create the Subscription Schedule first, which is set to create the Subscription later, then later when the Subscription is created it has a 14 day trial?
schedule start date is now
Ah, in that case the Subscription should be created immediately and it should have a pending_setup_intent.
which creates the subscription but i need to verify the payment
Note that property is on the Subscription, not the Subscription Schedule.