#takahiro_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1255252618935144550
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hello
Are you following any docs/guides for this?
We have the usecase outlined here: https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#backdating-subscription
Gotcha. Just to make sure I am on the same page,
You're trying to create a subscription schedule that began on 2024-05-31
start_date: 2024-05-31 15:00:00 UTC
end_date: 2025-05-31 15:00:00 UTC
The invoice it generated was for following interval
2024-06-25 07:27:00 UTC
2025-06-25 07:27:00 UTC
You want the invoice interval to be the same as schedule start - end dates?
yes exactly!!
What happens if you remove the billing cycle anchor?
Also, to be honest I don't know if we allow creating backdated invoices. @lapis laurel is taking a look..
thank you so much for both~~ ๐
Ooh, I think it's because of the test clock
ok I can try with actual test env
The customer you're creating the Subscription for is part of a clock where the current frozen time is 1719342509 (2024-06-25 19:08:29)
req_cisyEcxN8iPxUm and subscription is: sub_1PVgMdCyPLIPWcnNWK04IHtF ๐ญ
Ah, let me do a quick test but I think it's due to this: https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-default_settings-billing_cycle_anchor
Let me take a step back for a second
What's your ultimate goal here? Since you're backdating the Subscription by setting a start_date in the past, is your goal to charge the customer for the time between May 31 - now?
the goal is that the generated invoice has the period 2024-06-01 to 2025-06-01. and the next invoice should be issued on 2025-06-01 (subscription billing cycle anchor as current phase end) These are the ultimate goal. ๐ฅ
Okay
Okay, I think I got it. I take it your primary reason for using Schedules was to assist with the backdating?
Yess
If so, I recommend working with Subscriptions directly instead. You can create a Subscription for a customer with the yearly price, where backdate_start_date is 1717200000 (2024-06-01, 00:00:00 GMT) and billing_cycle_anchor is 1748736000 (2025-06-01, 00:00:00 GMT). You should also pass proration_behavior: 'create_prorations'. This will create an invoice for June 1 2024 - June 1 2025 and attempt to charge the customer automatically for this. The next invoice will be for the period June 1 2025 - June 1 2026
Thx!! I actually know that I can do with create subscription passing backdating yet it caused some issues when I create schedule with from_subscription. That's why I wanted to do it with schedule