#manny_manny_2023

1 messages · Page 1 of 1 (latest)

strange jettyBOT
grim jasper
#

Can you share an example of the subscription you're working with?

potent raptor
#

yes

#

sub_1NbOBiJgNsQxYgScABVf1xSh

grim jasper
strange jettyBOT
potent raptor
#

i do get the 1 hour part its only happening for today created subscriptions if i create one for tomorrow its starting at 12 AM

strange ether
#

Hi taking over here

potent raptor
#

ok

strange ether
#

Not sure I understand the question. Can you explain more?

potent raptor
#

Hi, we are trying to create a subscription through subscription cycle, the subscription schedule is starting at 12AM but subscription is taking from user sys time, how to make subscription and subscription schedule both to start at 12 AM'

strange ether
#

Yes I saw the original question. Not sure I understand though. Our subscriptions use utc time, so they can't use whatever timezone the user is in

potent raptor
#

we are using pst and sending pst only

strange ether
#

Yeah our api doesn't support that. Our api only accepts utc time

potent raptor
#

so we cannot send pst time, we can only send utc time?

strange ether
#

Can you share your code snippet for this? Want to check something

potent raptor
#

my backend code?

strange ether
#

Yeah

#

So some of our libraries may convert localized timesamps. I'm not sure off the top of my head

#

But all our subscriptions rely on utc timestamps

potent raptor
#

public static Long getUnixPSTTime(String inputDate) {
DateFormat format = new SimpleDateFormat(Constants.DEFAULT_DATE_TIME_FORMAT);
Date d = null;
try {
format.setTimeZone(TimeZone.getTimeZone("PST"));
d = format.parse(inputDate);
} catch (ParseException e) {
e.printStackTrace();
}
Long unixTime = d != null ? d.getTime() / 1000 : 0L;
return unixTime;
}

#

SubscriptionScheduleCreateParams subscriptionScheduleCreateParams = SubscriptionScheduleCreateParams.builder()
.setCustomer(stripeCustomerId).setMetadata(metadata)
.setStartDate(AppUtil.getUnixPSTTime(resourceRequestResource.getCustomerExpectedStartDate()))
.setEndBehavior(EndBehavior.RELEASE)
.addPhase(SubscriptionScheduleCreateParams.Phase.builder()
.addItem(SubscriptionScheduleCreateParams.Phase.Item.builder()

#

we are converting the gmt time string into pst and putting it in Schedule start date

#

if its tomorrow its starting at 12 AM but if we put today date its taking current time not 12 AM

strange ether
#

Yeah that won't work. Also just confirmed with a colleague. setStartDate expects the timestamp to be passed in utc

potent raptor
#

so it should be utc unix time right?

strange ether
#

yeah

potent raptor
#

ok can you please keep this thread open for 5 mins will get back to you

#

tried the UTC string still not working

#

schedule created at 12AM only

#

but subscription is taking account timezone pst

strange ether
#

Can you share that subscription id?

potent raptor
#

sub_1NbPDsJgNsQxYgSckZ06MvKk

strange ether
#

Sorry for the delay

#

Looking now

potent raptor
#

no problem

strange ether
#

Oh issue is you're using billing clocks

#

So the billing clock time started on 2023-08-04 14:42:56 +0000 UTC but the start date of your subscription was set before that at 2023-08-04 00:00:00 UTC

#

Your billing clock needs to be before the start date of the sub if you want normal behavior

potent raptor
#

billing clock means account time zone?

strange ether
#

You can see here:

#

Test clocks allow you to set the time

potent raptor
#

ok if i remove test clock it should work fine in theory?

strange ether
#

Yep

#

The test clock is what's causing unexpected behavior here

potent raptor
#

ok thankyou so much

strange ether
#

No problem

potent raptor
#

if you could give me 2 mins will test without test clock and let you know

#

same issue without test clock

#

sub_1NbPhVJgNsQxYgScWVe87UVa

strange ether
#

You're setting the start_date in the past

#

You can see the subscription's start_date is set correctly to the past date

#

However the current period start is immediate

#

That's expected behavior since you set a past date

potent raptor
#

ok

#

thankyou so much for your help