#asif
1 messages ยท Page 1 of 1 (latest)
Hi ๐ that is expected, as a Subscription Schedule created to start a Subscription in the future will not generate a client secret until the Subscription is started and it's first Invoice is generated.
I would suggest using a Payment Intent to process the one-time payment, use setup_future_usage: off_session while doing so to prepare the collected Payment Method for future usage, and then once you're notified that payment is successful create the Subscription Schedule to start the associated Subscription in the future.
or should i create a subscription with free trial. and also create a payment intent for one time as well
If you're going to create a Subscription with a trial period, then you could include the one-time payment in add_invoice_items when creating the Subscription to process the one-time payment and create the Subscription simultaneously.
will that charge one time payment instantly?
It will create an Invoice that will contain the one-time payment amount, it won't be payed automatically if there isn't a payment method already set up and provided though.
i am also creating subscription before payment intent
i will be doing confirmPayment from frontend as well with the amount
Are you creating a Subscription and then also creating a Payment Intent? If a Subscription's first Invoice requires a payment, then that Invoice will automatically generate a Payment Intent to be used.
i dont know which route to take
Can you elaborate? Client-side confirmation doesn't support providing an amount, nor would you want to use that approach as anyone with JS knowledge could alter the amount your script is providing.
my use case is
i want to charge $1 for the first month and then 9.99 after
to mount payment element on our page, we need to pass an amount
Oh, are you looking at using our flow that lets you render the Payment Element without first creating a Payment Intent?
Is there a reason you're not interested in pursuing my original suggestion, is there something specific about your use-case that I don't seem to be taking into account?
Yes. I am rendering payment element to capture user's credit card info before creating payment intent.
In the backend we create the customer->create subscription
Frontend then does confirmSetup or confirmPayment with client_secret
retrieved from subscription api
it is working if i have free trial or no free trial
now i am trying to add different amount in the subscription process
are you referencing to this
Sorry, I'm not sure I'm grasping what you're trying to accomplish that is giving you trouble currently. If you already have a flow for creating a Subscription, then creating those for different amounts/products/prices would involve adjusting your code that creates the Subscription to do so referencing different Price and Product objects.
Let's try taking a step back. What do you have currently, and what about that flow are you interested in changing?
currently i have
We create a product/price id in dashboard
User can subscribe to the product/price id with or without free trial
Interested in :
User subscribes to the product/price id with reduced pricing for the first billing cycle, and then regular pricing in the future
Easiest path for that would likely be to include a one-time coupon when creating the Subscription, which will discount the first Invoice only.
https://stripe.com/docs/billing/subscriptions/coupons
Yup, there are code snippets showing how to do that included in the Apply coupons to subscriptions section in the doc I linked to.
Any time!
quick question. can you add multiple coupons to the subscription or just one
Only one