#anoush_72862
1 messages · Page 1 of 1 (latest)
Hi there!
- No, just add a free trial to your subscription
- Probably simpler to update the existing subscription to remove the trial
- in that case, which price to use if a user has not chosen any price yet, he/she just registers in my app
oh got it. then yes you could try a $0 price in this case
in that case, after creating a trial, when the user wants to upgrade to the paid plan, should I cancel the free trial and create a new subscription? or update the existing subscription?
up to you, but I think updating the existing Subscription is simpler.
ok, thanks
another question regarding the payment element,
On the front end, the payment element requires a client secret for initialization. So whenever a user clicks on a subscribe button, I create a subscription from the backend to get the client secret from the payment intent, and send it to the front end and after that, the payment element appears. There could be a scenario when the user clicks on a subscribe button many times. In my current implementation, I delete all incomplete subscriptions when the user clicks on the subscribe button. My question: is there a more accurate method to handle this? I mean create payment element without creating subscription to get client secret?
what you are doing is fine. but if you perefere there's the new deferred flow, to create the Subscription later: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
seems that the link you provided does not use price_id to create payment method, and how it uses customer_id here?
you use the price ID and customer when creating the Subscriptions
const options = {
mode: 'subscription',
amount: 1099,
currency: 'usd',
// Fully customizable with appearance API.
appearance: {/.../},
};
// Set up Stripe.js and Elements to use in checkout form
const elements = stripe.elements(options);
how do I pass subscription-related info here?
you don't. you will create the Subscription later, that's the whole point of this flow
you create the Subscription at Step 6.
ok, thank you