#nadia_sub-schedules
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ 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.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1224732583515131974
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
i used the stripe export to compare my script result & ive noticed 1 difference
the client cus_PMCBBpGmzi5YBJ is returned on the stripe report
but not on mine
my requests are :
Hi there ๐ alright, it sounds like there are now three different questions being surfaced here.
Which one would you like to start with?
We can start here?
if a subscription is created through a subscription schedule will i have a post /subscription at the end of the subscription schedule last phase ?
What are you referring to when you're asking if you're have a "post /subscription"?
const startDateTimestamp = 1711922400;
const endDateTimestamp = 1712008799;
const stripeSubscriptions = await stripe.listSubscriptions({
created: {
gte: startDateTimestamp,
lte: endDateTimestamp
}
});
const stripeSubscriptionsSchedules = await stripe.listSubscriptionsSchedules({
created: {
gte: startDateTimestamp,
lte: endDateTimestamp
}
});
it returns all the created subscriptions + subscriptions schedules on april 1st
but when i used stripe dashboard to retrieve the subscriptions created on april 1st I have 1 extra entry & i cant find why
My team doesn't know much about the dashboard exports, we spend most of our time helping with the API instead. I'll need substantially more context in order to try to provide context about what you're seeing in the dashboard.
The startDateTimestamp value you provided does not align with 0:00 April 1st UTC. Are you expecting to not have these aligned with UTC timestamps?
I don't know if "that's why" I still don't have a ton of context on what your concern is, just that some object is missing from one of the ways you're retrieving data.
i still have a pb
as you can see for this request req_2OaXk4GxTTm6s1
the sub schedule was created on march, starting on april
but when i call this code for april 1st
created: {
gte: startDateTimestamp,
lte: endDateTimestamp
}
});```
the subscription is returned
Do you have the specific details of what you provided in that request, or can you share the request ID (req_)?
how can i prevent this situation of having subscriptions issued from schedules
i thought that the created info was set on the creation
here is the id req_2OaXk4GxTTm6s1
my report will return subscriptions created for a next date 2 times instead of 1
because it'll have the created date of the schedule
& the created date of the sub
Sorry, I'm not sure I understand what you're asking here. Are you asking how to avoid have a Subscription Schedule create a Subscription (I don't think so, but I'm not sure I'm grasping the question otherwise).
sorry
This is the request to create the Subscription Schedule. Apologies for not being clear, I was looking for details of what you provided in the GET request to list Subscriptions.
Oh, I think I get it now.
The start_date you provided in the request to create the Subscription Schedule was set to April 1st. So the Subscription should be returned in a request to list all Subscriptions created after on-or-after April 1st.
I want to create a script that returns subscriptions that were created yesterday (whether they start on the same day or in the future). So, I called the two web services that allow me to retrieve:
- Subscriptions with the 'created' parameter specifying yesterday's date (GET /subscriptions).
- Scheduled subscriptions with the 'created' parameter specifying yesterday's date (GET /subscription_schedules).
This way, I retrieve all subscriptions created yesterday. The problem is that when a subscription is scheduled, for example, one month earlier and its start date is April 1st 2024, I retrieve it in the response of both the GET /subscriptions and GET /subscription_schedules web services one month earlier.
how can i prevent this situation please ?
You add logic to your end to filter out the duplicates.
but how can i know it's from a schedule when the schedule element is set to null when the last phase ended
?
which element is used on the dasboard to know when the post subscription call is made please ?
Didn't you say you saw the Subscription referenced within the list of Subscription Schedules that you're receiving?
I don't know what this means. Can you try clarifying?
no i said that it's on both list
the subscriptions schedules list of the previous month
& the subscription list of yesterday
yes
on stripe there is this view : https://dashboard.stripe.com/subscriptions
we can add filters such as created at
what element on the subscription is used to know its created on april 1st ? and not months ago
if i can know that subscription is from a schedule i can remove it from my result
but without the schedule element i cant
Yeah, so if you see it in both lists, you add logic to your end to filter out the duplicates. Sorry, I feel like I'm not answering what you're asking, and if you feel the same, can you provide a lot more context on what you're trying to accomplish and the concern you're encountering. I still don't feel like I'm grasping the issue here.
The created field on the Subscription object contains the timestamp of when the Subscription object was created:
https://docs.stripe.com/api/subscriptions/object#subscription_object-created
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes i used this filter
i cant find the element to retrieve the subscription issued from schedules
& then remove the duplicated
because the schedule field is set to null after a subscription is released (subscription schedule)
It is expected for the schedule field to be set to null once the Subscription is released from the Subscription Schedule. At that point there is no way to tell the Subscription was created from a Subscription Schedule unless you already tracked that somehow.
My understanding, is that you're making two requests:
- one to list Subscriptions
- one to list Subscription Schedules
and are worried about what to do when you see the same Subscription in both of those results. What I'm trying to propose is that once you get the results from those requests, you look to see if there is the same Subscription repeated in the two requests. If so, only display one (however you're choosing to display these results)
yes but it wont appear on the subscription schedules because i'm making the two requests with the same date
so, the subscription repeated will be on the previous month report if it was created on 1nd march for example
Okay, I don't understand the concern if you aren't talking about seeing the same Subscription in two different list requests then.
const endDateTimestamp = 1712008799;
const stripeSubscriptions = await stripe.listSubscriptions({
created: {
gte: startDateTimestamp,
lte: endDateTimestamp
}
});
const stripeSubscriptionsSchedules = await stripe.listSubscriptionsSchedules({
created: {
gte: startDateTimestamp,
lte: endDateTimestamp
}
});```
Can you take the time to put together a message fully articulating your concern complete with references to example objects from your testing?
here is an example :
let's say i have 2 customers who subscribed to my product today (2 april 2024)
- customer A subscription (sub_A) starts today (2 april 2024) => subscription
- customer B subscription (sub_B) starts on 2nd may 2024 => subscription schedule
if i run my script to retrieve today's created subscriptions i'll have 2 subscriptions :
- sub_A (subscription list)
- sub_B (schedule list)
if i run my script on may 2nd i will have the created subscriptions on may 2nd, lets say :
- sub_X
- sub_Y
but also sub_B (from the schedule, but subscription.created === today)
๐ I'm hopping in here to take a look - give me a few minutes to catch up
welcome @fossil citrus
In the most recent message you sent - what are you trying to accomplish on May 2nd? ARe you trying to differentiate between the subs that were created through a schedule and the ones that were not?
trying to retrieve the subscriptions created on may 2nd
but i'll have the subscription issued form a schedule created on april 2nd
You should be able to differentiate between the two by expand schedule on the Subscription and seeing when the created date of the subscription schedule is
no unfortunately it's set to null
that's what i said to your colleague
i have schedule:null
That means it isn't tied to a schedule, right? So that would reflect a subscription that was created through the API on may 2nd