#manny_manny_2023
1 messages · Page 1 of 1 (latest)
Can you share an example of the subscription you're working with?
So, the 1 hour delay is coming from the invoice finalization.
https://stripe.com/docs/billing/invoices/subscription#manage-invoices
The subscription and the schedule both were created at 2023-08-04 13:37:06
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
Hi taking over here
ok
Not sure I understand the question. Can you explain more?
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'
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
we are using pst and sending pst only
Yeah our api doesn't support that. Our api only accepts utc time
so we cannot send pst time, we can only send utc time?
Can you share your code snippet for this? Want to check something
my backend code?
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
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
Yeah that won't work. Also just confirmed with a colleague. setStartDate expects the timestamp to be passed in utc
so it should be utc unix time right?
yeah
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
Can you share that subscription id?
sub_1NbPDsJgNsQxYgSckZ06MvKk
no problem
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
billing clock means account time zone?
That customer you're using is tied to a test clock. ie: https://stripe.com/docs/billing/testing/test-clocks
You can see here:
Test clocks allow you to set the time
ok if i remove test clock it should work fine in theory?
ok thankyou so much
No problem
if you could give me 2 mins will test without test clock and let you know
same issue without test clock
sub_1NbPhVJgNsQxYgScWVe87UVa
You're setting the start_date in the past
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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