#xu_api
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/1301553707074322442
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
From an existing subscription, I want to create a new subscription, with billing_cycle_anchor set to the next renewal.
Can you describe your usecase for this?
Curious why you need to create a new sub
In agreement with a few partners, we need to create "shadow/anonymous" accounts for their users. However, when their users deanonymize their accounts, we might discover they are already using our service outside of these partnerships and want to move the subscriptions they get through the partners to their main account
Since we can't just move a subscription over, we are trying our best to make a "clone"
AH ok
It seems like next natural billing date was decided to be now + 30 days, while the period of sub_1QFlSeIXLR0o4zHDHAaURTFE is actually 31 days
Sorry I'm not that familiar with plans. They're the legacy version of products/prices. Not sure why you're getting this error for creating a brand new sub
Let me see if a colleague knows
Thx ๐
Ok so the issue here is that this a new Subscription. The timestamp at which you tried to create it was 2024-10-31 06:31:37 UTC. billing_cycle_anchor has to be <= exactly 1month from this timestamp since it's a monthly price. The anchor you passed is 17 hours beyond this
If the entire goal is to just start a subscription on 1733009880, then you probably want to be using a Subscription schedule instead: https://docs.stripe.com/billing/subscriptions/subscription-schedules
Yes. The goal is to have a subscription that will be active, but not billed/charged until the renewal date of the original subscription
But I find it inconsistent that I can't set billing_cycle_anhcor > 1 month from now, when an existing monthly subscription has it's next renewal > 1 month
It has nothing to do with existing sub
It's a new sub
Since the price is a monthly price, the billing cycle anchor you set must be <= 1 month from the timestamp you try to create it
Yes but how come the existing sub has a period that is greater than 1 month
it is also a monthly price
Ah I see your confusion. The existing sub's current period start is 2024-10-30 23:38:00 +0000 and end is 2024-11-30 23:38:00 +0000. That is 1 month exactly. The issue is that today is the 31st of Oct. There is no 31st of Nov
Nov ends on the 30th, so the period end has to be the 30th
This is discussed in this doc: https://docs.stripe.com/billing/subscriptions/billing-cycle
Ah okay so this is a pretty rare edge case. So in this case, the newer sub will actually be renewed before the existing one?
existing sub
start: 2024-10-30 23:38:00 +0000
end:2024-11-30 23:38:00 +0000
potential new sub created 31st
start: 2024-10-31 07:38:00 +0000
end:2024-11-30 07:38:00 +0000
Alright, thx ๐
No problem