#ebellotpu6_api

1 messages ยท Page 1 of 1 (latest)

wide sierraBOT
#

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

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

rocky dagger
#

What's the sub_xxx ID?

#

cus_QnjnlS07yaYp4B has a few subscriptions, so want to make sure I'm checking the right one

torpid harbor
#

the subscription is sub_1PyCD1Dbw9778AEfr8m6kbhT and the invoice subscription created on 31th is in_1QFjwsDbw9778AEfzlKbJ5VZ

#

sorry, it was created on 30th at 23:01

rocky dagger
#

To confirm, you set billing_cycle_anchor: '1727733600' (2024-09-30 22:00:00) on creation and you're confused why the invoice for the next period was created an hour later?

#

FWIW, the timestamps in our API are all UTC which isn;'t subject to daylight savings. Hopefully obviously whatever part of the world you're in may be subject to DST so the local time you receive the event may differ throughout the year, yes

torpid harbor
#

but in my code I have specified that I wanted to use UTC:
int year = subscription.StartDate.Year;
int month = (subscription.StartDate.Month + 1) % 12;
if (month == 1) year = year + 1;
if (month == 0) month = 12;
var startMonth = new DateTime(year, month, 1, 0, 0, 0, DateTimeKind.Utc);

rocky dagger
#

Not sure where you're seeing 23:01 โ€“ the Dashboard?

torpid harbor
#

sorry, maybe because I am in Ireland?

rocky dagger
#

That doesn't answer my question? Where do you see 23:01 as the time the invoice was created

wide sierraBOT
torpid harbor
upbeat rampart
#

hi! I'm taking over this thread.

#

the time you see in your dashboard is not using the UTC tiemzone.

torpid harbor
#

how can I change it?

upbeat rampart
#

I don't think you ca change it, it's set automatically based on you account's country.

torpid harbor
#

So, the problem is not that. The problem is that I have configured the subscription to create the invoice on the 1st day of the month, and I don't know why, this invoice has been created on 30th Oct

upbeat rampart
#

having a look

#

when you created the Subscription, you set billing_cycle_anchor: "1727733600", which is exactly at midnight. so when the time changes, the Invoice is created one day earlier.
to avoid this, make set the billing_cycle_anchor at 4 or 5am.

torpid harbor
#

okey

#

Can you confirm me that this should resolve any future problem?

#

But for this reason, every subscription should have created the invoice on 30th and not in 1st no?

fast frost
#

not sure, depends really since different places and surfaces might show the dates differently

torpid harbor
#

I have to give my customer a reason why it happened...

fast frost
#

likely something to do with timestamps and timezones, I'm sorry I don't have a deeper answer at the moment

torpid harbor
#

Could you forward my question to someone who can answer it?

fast frost
#

sorry I'm just taking over from @upbeat rampart as it's too busy in other threads , and it's also busy for me on other workstreams so we just don't have the bandwidth right now to answer. Not your fault or anything