#muhammad-hamza-siddiqui_subscription-schedules
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/1374008091485667421
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there ๐ that is expected behavior when creating a Subscription. It sounds like you'll want to explore using Subscription Schedules instead:
https://docs.stripe.com/billing/subscriptions/subscription-schedules
There are several cases where they're better to use than Subscriptions, including scheduling a subscription to be created and started in the future:
https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#start-subscription-future
means i have to change my whole code?
isn't there any parameter in existing one to make it start from sptember 1
Yes, you will need to adjust your integration to use Subscription Schedules instead of creating Subscriptions. No, there isn't a parameter that can be provided when creating a Subscription that delays its start, that functionality is provided by Subscription Schedules instead.
means in stripe subscription schedule the user would be charged immedit
immediately but subscription would start later
when i would want
No, that is not how they behave.
When using a Subscription Schedule to schedule the creation of a Subscription in the future, the Subscription is not immediately created. Since the Subscription object isn't immediately created, it doesn't create its first Invoice immediately, and so the first payment of the Subscription can't be processed immediately.
If you want to charge a customer immediately, and then create a Subscription later in the future, you'll need to handle those as two separate things.
- Create and process the payment you want to process immediately
- Create a Subscription Schedule to create a Subscription in the future (if you don't want the Subscription to also charge the customer for the first billing period, if that's what you're charging them for, then you'll need to include adjustements to your code to discount the cost of the first billing period for that Subscription)
didn't understand it can you explain in easy words?
Didn't understand which part? If you can help me understand which part isn't clear I can point you to the relevant guide.
And do you have more details on what the exact flow you want is, as there are lots of different possibilities here and depending on the specifics of what you want my recommendations may change.
my exact flow is that i have an app where users would buy be onboarded via buying the subscription for suppose alex comes on my platform in the month of may and buy the subscription but i do not want his subscription to start in may instead i would charge him in the month of may but i want the subscription to start in the month of september
Do you need an Invoice for that first payment?
(since you're using Stripe Billing for the recurring payments, but it's unclear whether that's just for the recurring payment behavior or because that also creates invoices)
let me confirm from my fellow developer
one minute
i am using just for recurring payments
can you help me as i am confused how it will be done
The first payment will need to be a one-off payment. Since it's not clear whether you need to have an invoice created for that payment, I'll give you links to our guide for accepting a payment without creating an invoice and our guide that does create an invoice.
No invoice, using Stripe Elements: https://docs.stripe.com/payments/save-during-payment
No invoice, using Checkout: https://docs.stripe.com/payments/checkout/save-during-payment
Creating an invoice: https://docs.stripe.com/invoicing/integration
i have no use case for onvoice
invoice
means for the first time i have to create a normal checkout session?
but if i accept a one off payment for the first time
it would not be created as a subscription
Not sure what you mean by "normal", you should create the Checkout Session the way shown in the guide I linked (since you intend to use the created payment method for Subscriptions in the future, I linked you to the guides that set up the payment method the customer uses for future usage, so you can reuse that in your Subscription integration later).
i want it to be recurring
Not the first payment, right? That's a one-off payment, the recurring doesn't start until later?
yes the flow is
- user comes
- user opens the checkout session and pays
- the subscription won't be started instead it will start from september and it will be then recurring
Yup, so step one is to process a one-off payment using the flow shown in the provided guides, then step 2 is to create a Subscription Schedule that will create a new Subscription in the future:
https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#start-subscription-future
for that second part, you don't want the customer to be charged anything when that Subscription starts?
yes for first month i do not want to charge as the user would have already paid off
then from second month i want to charge the user
Do you have a sense of how you want to handle that? Do you want to:
- create the Subscription to start a month later? (or are you planning to use the Subscription object to drive downstream processes and need it to exist sooner)
- create the Subscription so it starts with a trial period?
- apply a Coupon to reduce the price of the first Invoice?
- use a $0 price to avoid your customer needing to pay for the first month?
Are there buseinss requirements that you're trying to satisfy, or are there more details about your technical requirements, that may change which of those are viable solutions for you?
i do not have any trail period just simple as that i want to onboard user and charge them before but as classes would start in december at my platform so i want the subscription to start in september 2025
I get that, but you need to settle on how you want to discount the first month's Invoice for the Subscription, or decide to postpone the start of the Subscription one more month.
I don't have enough context on your requirements to recommend a specific approach at this point, which is why instead I'm outlining the options available to you to see if any of them resonate with your needs.
whats the best approach in your perspective?
Depends on your needs
And how you plan to rely on Stripe objects
Like if you're planning on using the existence of a Subscription object, and fields on it like status, to grant access to resources you provide then the advice would be different from if you just want to use the Stripe Subscription for processing recurring payments.
as for subscription when its made one time the rest i am handling from my backend
so what would be the approach then
like this
Sorry, I don't know what that means.
Kind of sounds like you're saying you're just using the Subscription to create and handle recurring payments (but honestly, I'm not confident I'm understanding what you're trying to convey correctly), in which case I'd suggest scheduling the Subscription to start when you actually need the next payment to happen (not when your class starts).
ohh so you mean that i charge the customer for first time via normal checkout session
and schedule the subscription to start from next month?
Hang on, can you lay a hypothetical flow with dates for an example of what you're trying to build an integration to handle? I think it'll be easier if I can put my suggestions against particular parts of your flow.
let me create an hypothetical flow
suppose
- I promoted my website and suggested to a friend named "Alex" in the month of june on date 1st
- Alex wants to onboard on my website so it is necessary to buy subscription of my website which is 300 dollar so alex pays it on 10th june but his subscription won't start
- when 1st september starts his subscription would start but he won't be charged in this month
- when 1st october will come he would be charged to the same product
Gotcha, and you aren't relying on the existence of a Subscription object for any of your flows?
nopes i just would check if user has bought the subscription or not
If so, my suggestion is to:
- Create a one-time payment, using one of the approaches in the previously provided guides. This will be your $300 up front payment.
- Immediately create a Subscription Schedule that will create a Subscription on Oct 1st. On Oct 1st the Subscription Schedule will create a Subscription, which will create an Invoice, will will process the payment for October.
can you send me the approaches again for one time?
by one time you mean normal checkout session?
They're in this message still
Not necessarily, I mean a non-Subscription flow. Whether you do that with Checkout Sessions or by embedding the Payment Element on your page is up to you, I don't have a specific recommendation about which of those you use, that depends on what kind of customer-facing experience you want to provide.
but i have one flow also
that subscription should end in the month of december
automatically
so how will it be done
ah, more context about your needs
yess yess
In that case you'll want to create the Subscription Schedule in such a way that it cancels the associated Subscription at the end of its lifecycle:
https://docs.stripe.com/billing/subscriptions/subscription-schedules#completing-schedule
so you'll want to set end_behavior to cancel when creating the Subscription Schedule.
You'll also want to be explicit about when the phases in your Subscription Schedule end then. Is there anything else you need the Subscription Schedule to do, or is create and cancel the Subscription it?
is this possible to set the end date?
Hi ๐
My colleague had to go so I've stepped in. You define the end date of the Subscription Schedule by the end date of the last phase. I strongly recommend you review the documentation my colleague has already shared.
let me go through it
wait
end_behaviour accepts an enum
cancel and release
so means i have to add a cron job to delete on 30th december of each year/
?
As my colleague already explained, you use end_behavior t o determine if you want the Subscription to cancel at the end of the Schedule or just continue with the last phase.
It seems like you are not grasping how this works at all
I recommed you build this in test mode
i am building this in test mode but unable to understand like is the phases pre defined?
okay understood little bit
phases.end_date i would set it
Yes. And if you have end_behavior set to cancel, when the last phase ends so will the Subscription
and in scheduled subscription it simple means that you have to charge the user for suppose on 20th may but subscription is scheduled on 1st april
okay understood
can you please help me in it also
Sorry but that makes no sense at all
Subscriptions do not have any direct impact on the specific date when you charge
That is entirely up to you
It is not clear to me how you expect your subscriptions to behave. I think using Subscription Schedules will allow you to achieve the behavior you are expecting but you will need to experiment with different options to see how the settings you choose affect the behavior.
I recommend testing with Test clocks so you can simulate multiple billing cylces quickly.
and what does iterations means in phases in stripe subscription schedule
The number of times that phase repeats.