#coding-lover_code
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/1371399638539829281
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
You'd look at the current_period_end property
it is undefined not available on subscription object
if I do subscription.current_perion_end it is undefined
all others fields are available
but that field is not
Hmm, what's the sub_xxx ID where that is the case?
sub_1RIrusD0unIZlP8OiDhsZTSe
I have bunch of subscriptions in all it is not available
Ah, it's because of your API version. We deprecated the top-level current_period_* properties and moved them to the item-level to (eventually) support multi-interval subs: https://docs.stripe.com/changelog/basil/2025-03-31/deprecate-subscription-current-period-start-and-end
So you'll need to look at items[data][][current_period_end]
what are multi interval subs
e.g. you'll be able to have a single subscription with items of different intervals. 1 might be yearly, another monthly. Currently not supported but that API change will unlock that functionality
currently I have one product with two prices yearly and monthly
Yes, but I assume a single user will enver subscribe to both simulataneously. You'll only ever have subscriptions with one item, yes?
yes
Then this will work
items[data][0][current_period_end]
Just check the first (and only) index in items[data]
ok
does stripe have any way to send emails before 1 month to yearly subscription users?
You can send 'reminder' emails yes, but only 7 days before
I need to send reminder email before 30 days to yearly subscribers and before 7 days to monthly subscribers
No easy way to do that today I'm afraid
That's the only way to get the system you want yep
I need another help
Sure
I achieved it before but want to do with easy way
I want to create subscription yearly but it will expired after 1 month from today date
What do you mean by 'expired'?
yes It will expired after one month
I am doing this because I want to test my reminder email logic
Which I tell you before
Sorry for my poor grammar
I don't know what you mean by 'expired'? How does an annual subscription expire after a month? You mean the customer cancels?
no I want to change the expiration date for example I create yearly subscription but I want manually update its expiration date and set to after 1 month from today date so I test my reminder email logic
Stripe Ai suggest me put billing_cycle_anchor field while creating subscription so I put there date after 1 month in timestamp
Why not just use a test clock to 'fast forward' time to ~a month before the renewal?
That's the easiest way for you to test logic like this: https://docs.stripe.com/billing/testing/test-clocks
ok but how I comapared today date with it
i.e. start a yearly sub ~now, then you can advance the clock to April 2026 (1 month before the renewal) to test the logic
ok I got it I put manual date of future and then compare it with subscription date after doing advance clock
Yep, the guide here will help you step-by-step: https://docs.stripe.com/billing/testing/test-clocks/api-advanced-usage
ok thankyou so much