#nadia_sub-schedules

1 messages ยท Page 1 of 1 (latest)

paper elmBOT
#

๐Ÿ‘‹ 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.

fossil sonnetBOT
timid perch
#

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 :

compact igloo
#

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"?

timid perch
#
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

compact igloo
#

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?

timid perch
#

ohhhh

#

that's why ?

#

yes

#

i didnt notice

compact igloo
# timid perch that's why ?

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.

timid perch
#

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

compact igloo
#

Do you have the specific details of what you provided in that request, or can you share the request ID (req_)?

timid perch
#

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

compact igloo
timid perch
#

sorry

compact igloo
#

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.

timid perch
#

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 ?
compact igloo
#

You add logic to your end to filter out the duplicates.

timid perch
#

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 ?

compact igloo
compact igloo
timid perch
timid perch
#

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

compact igloo
compact igloo
timid perch
#

& then remove the duplicated

#

because the schedule field is set to null after a subscription is released (subscription schedule)

compact igloo
#

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.

fossil sonnetBOT
compact igloo
#

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)
timid perch
#

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

compact igloo
#

Okay, I don't understand the concern if you aren't talking about seeing the same Subscription in two different list requests then.

timid perch
#
const endDateTimestamp = 1712008799;

const stripeSubscriptions = await stripe.listSubscriptions({
            created: {
                gte: startDateTimestamp,
                lte: endDateTimestamp
            }
        });

const stripeSubscriptionsSchedules = await stripe.listSubscriptionsSchedules({
            created: {
                gte: startDateTimestamp,
                lte: endDateTimestamp
            }
        });```
compact igloo
#

Can you take the time to put together a message fully articulating your concern complete with references to example objects from your testing?

timid perch
#

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)
fossil citrus
#

๐Ÿ‘‹ I'm hopping in here to take a look - give me a few minutes to catch up

timid perch
#

welcome @fossil citrus

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?

timid perch
#

trying to retrieve the subscriptions created on may 2nd

#

but i'll have the subscription issued form a schedule created on april 2nd

fossil citrus
#

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

timid perch
#

no unfortunately it's set to null

#

that's what i said to your colleague

#

i have schedule:null

fossil citrus
#

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