#usamarashad_testing-subscription-schedules

1 messages ยท Page 1 of 1 (latest)

mint hullBOT
tropic ploverBOT
#

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.

mint hullBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1251175729392128101

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

nova cargo
mint hullBOT
#

usamarashad_testing-subscription-schedules

pale bay
#

noted. After i change the time using the clock I am assuming the following can be done : 1) The invoices for the next months will be charged immediately, 2) If I retrieve the phases from the subscription, their individual "endDates" would have correspondingly been set to the months end date when they expired.

deep plume
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needs to step away soon. Yup, as far as I know those should all occur, but please let me know if that's not what you see.

pale bay
#

Can I use the test clock directly from the dashboard or must I create functions in code ?

#

Thanks for jumping in Toby

deep plume
#

Take a look in the guide that my teammate linked, there are tabs that let you indicate whether you want to see API or Dashboard based instructions.

pale bay
#

ok. Small concern here. I followed the instructions to use the dashboard to advance the time. To get the subscription schedules , have used "await stripe.subscriptionSchedules.list" with a day before and after the instant I applied the test clock. There are no subscriptions found. **The list function returns empty. ** And for some reason after finishing the simulation the subscription is also canceled. (I'm assuming this is the intended behavior)

deep plume
#

What is the ID of the Subscription Schedule you expected to find? What are the exact criteria you provided in your list request, can you share the ID of that request?

pale bay
#

ok wait . I will create the sub again and send you the id.

deep plume
#

Just to be clear, are you creating a Subscription or Subscription Schedule? They are distinct object types.

pale bay
#

I am creating a sub shcedule

#

I have applied the test clock on the subscription "enclosed" inside the subscription schedule

#

sub_sched_1PRbLGDVf1B7CjYu8KQ7Pnq9

#

Thats the shcedule ID

#

its active but the stripe "stripe.subscriptionSchedules.list" function does not return this

deep plume
#

Can you share what parameters you used in your list request, or what the ID of that request was?

pale bay
#

start and end date are the unix timestamps

#

on the first run of this function "starting_after" is null

deep plume
pale bay
#

start date : 1718218800 , end date : 1718564399

deep plume
#

Thank you taking a closer look.

pale bay
#

Appreciate it !!

deep plume
#

Based on what I'm seeing, it does look like the Sub Sched's creation timestamp is within that range, 1718376182. But I do also see your list requests aren't returning any results.

#

If you make a list request without any filter parameters, do you see the new Subscription Schedule then? I'd expect it to be near the top of the list of results if so.

pale bay
#

let me try.

deep plume
#

Okay, I think I know what you need to do, and if it works I'll need to file feedback with my teams because we don't make this apparent in our documentation.

Can you try making your list request again, feel free to use your time filters, but include the ID of the Customer in the customer field as well:
https://docs.stripe.com/api/subscription_schedules/list#list_subscription_schedules-customer

It seems listing Subscription Schedules doesn't return ones that are inside of Test Clocks, unless you provide the ID of the Customer that is in the Test Clock that it's attached to. This is how our Subscription listing works, and we explain that, but it looks like we don't provide that same advice for listing Subscription Schedules.

Let me know if that doesn't do the trick though!

pale bay
#

ok i just tried it

#

this is what i call

#

it shows a list of shcedules

#

The one at index 0 is the schedule which does not have the simulation clock running on it

deep plume
#

Sorry, should have let you know that I was testing the same and already confirmed that approach won't work.

pale bay
#

Hmmm ok

deep plume
pale bay
#

i double checked it then. lol

#

ok I will try it with the customer ID of the only one schedule I need to test it with

pale bay
#

ok when I input the customer ID to the subscription schedule list function I do get the schedule. Phew !!

#

Another question

#

Now I need to get the phases which have been assigned to the schedule to get the amounts. I use this function " let sub = await stripe.subscriptionSchedules.retrieve(subScheduleID);
" and then "return sub.phases;"

#

however it looks like the first phase is not being returned

#

I get only 3 out of 4 phases.

#

How can I get the first phase as well which has passed ?

deep plume
#

You can't as far as I'm aware. Once the phases are completed they're removed from the Subscription Schedule. If you're going to need to look at the historical state of the Subscription Schedule, you will need to log those previous states on your end so you can review them.

pale bay
#

So you are saying that once the phase is passed, Stripe is effectively deleting that phases' data and there is no way I can know what amount was charged that month? Because the amount is what I'm after.

deep plume
#

The Invoice that was created for that billing period's charges will contain information about the amount that was paid, but no, it won't continue residing in the Subscription Schedule.

pale bay
#

This complicates things a bit. So lets say I have a schedule whose 2 out 4 phases have passed, how do I get the relevant 2 phases if they are deleted and there is no connection to them any more ? And even more , how do I know if a phase has been deleted and needs to be fetch indirectly via the invoice?

deep plume
#

You created those phases, so if you need to know more about them you can log how you created them on your side and look that up later. Subscription Schedules are designed for controlling future updates for a Subscription, once a phase has been completed it no longer serves a purpose in the Subscription Schedule so it's removed.

Why are you looking at the past Subscription Schedule phases here? They may not take into account things like whether a Customer had a Coupon applied to them that adjusted how much they were invoiced for.

pale bay
#

ok lets revise my approach. What If I get the subscription from the subscription schedule? Will it have the amounts of the passed phases ?

mint hullBOT
onyx marten
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

Give me a few minutes to get caught up.

pale bay
#

sure

deep plume
pale bay
#

So i need to handle two cases: 1) If the subscription phase has not passed then the "let sub = await stripe.subscriptionSchedules.retrieve(subScheduleID)" followed by "return sub.phases" , 2) In cases where a phase could have passed I need to list invoices with the subscriptionID.

#

Correct?

deep plume
#

Depends on what you're looking for. If you want to see what the customer paid previously, then the Subscription Schedule object won't provide you with any insight or context about that.

pale bay
#

I need simply the amounts which were or will be charged for each phase. Is that the shortest possible pathway?

#

Because there are some subscriptions which were miscalculated and I need to find those. I can only do that if I can find the amounts for all 4 out 4 phases (passed and new ones included)