#takahiro_api

1 messages ยท Page 1 of 1 (latest)

rugged sailBOT
#

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

spice lark
#

Hello
Are you following any docs/guides for this?

hexed matrix
#

yes I have read it already...

#

I did follow this example pretty much

spice lark
#

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?

hexed matrix
#

yes exactly!!

spice lark
#

What happens if you remove the billing cycle anchor?

hexed matrix
#

let me try

#

req_rt5VlHPMIstBfq

#

it seems the same behavior ๐Ÿ˜ข

rugged sailBOT
spice lark
#

Also, to be honest I don't know if we allow creating backdated invoices. @lapis laurel is taking a look..

hexed matrix
#

thank you so much for both~~ ๐Ÿ™

lapis laurel
#

Ooh, I think it's because of the test clock

hexed matrix
#

ok I can try with actual test env

lapis laurel
#

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)

hexed matrix
#

req_cisyEcxN8iPxUm and subscription is: sub_1PVgMdCyPLIPWcnNWK04IHtF ๐Ÿ˜ญ

lapis laurel
lapis laurel
#

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?

hexed matrix
#

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. ๐Ÿฅ…

lapis laurel
#

Okay

#

Okay, I think I got it. I take it your primary reason for using Schedules was to assist with the backdating?

hexed matrix
#

Yess

lapis laurel
#

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

hexed matrix
#

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