#muhammad-hamza-siddiqui_subscription-schedules

1 messages ยท Page 1 of 1 (latest)

dapper plankBOT
#

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

potent raven
maiden nest
#

means i have to change my whole code?

#

isn't there any parameter in existing one to make it start from sptember 1

potent raven
#

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.

maiden nest
#

means in stripe subscription schedule the user would be charged immedit

#

immediately but subscription would start later

#

when i would want

potent raven
#

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.

  1. Create and process the payment you want to process immediately
  2. 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)
maiden nest
#

didn't understand it can you explain in easy words?

potent raven
#

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.

maiden nest
#

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

potent raven
#

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)

maiden nest
#

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

potent raven
#

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

Learn how to save the customer's payment method when you confirm a PaymentIntent.

Learn how to accept a payment and save your customer's payment details for future purchases.

Learn how to create and send an invoice with code.

maiden nest
#

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

potent raven
#

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).

maiden nest
#

i want it to be recurring

potent raven
#

Not the first payment, right? That's a one-off payment, the recurring doesn't start until later?

maiden nest
#

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
potent raven
maiden nest
#

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

potent raven
#

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?

maiden nest
#

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

potent raven
#

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.

maiden nest
#

whats the best approach in your perspective?

potent raven
#

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.

maiden nest
#

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

potent raven
#

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).

maiden nest
#

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?

potent raven
#

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.

maiden nest
#

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
potent raven
#

Gotcha, and you aren't relying on the existence of a Subscription object for any of your flows?

maiden nest
#

nopes i just would check if user has bought the subscription or not

potent raven
#

If so, my suggestion is to:

  1. Create a one-time payment, using one of the approaches in the previously provided guides. This will be your $300 up front payment.
  2. 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.
maiden nest
#

can you send me the approaches again for one time?

#

by one time you mean normal checkout session?

potent raven
potent raven
# maiden nest by one time you mean normal checkout session?

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.

maiden nest
#

but i have one flow also

#

that subscription should end in the month of december

#

automatically

#

so how will it be done

potent raven
#

ah, more context about your needs

maiden nest
#

yess yess

potent raven
#

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?

dapper plankBOT
maiden nest
#

is this possible to set the end date?

signal yarrow
#

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.

maiden nest
#

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/

#

?

signal yarrow
#

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

maiden nest
#

nopes not grasping

#

can you explain in easy words

signal yarrow
#

I recommed you build this in test mode

maiden nest
#

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

signal yarrow
#

Yes. And if you have end_behavior set to cancel, when the last phase ends so will the Subscription

maiden nest
#

okay some few questions only

#

end_behavior is set for each phase?

signal yarrow
#

No

#

The whole Schedule

maiden nest
#

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

maiden nest
maiden nest
signal yarrow
#

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.

maiden nest
#

and what does iterations means in phases in stripe subscription schedule

signal yarrow
#

The number of times that phase repeats.

dapper plankBOT