#bugkiller.
1 messages · Page 1 of 1 (latest)
It depends - we'd always attach the payment method to the customer if the session is in subscription or setup mode. If it's in payment mode then you'd have to make sure to set payment_intent_data.setup_future_usage (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage) to indicate that the payment method should be saved
if user has few cards, how to know which one is default
You could check the default by retrieving the customer and checking invoice_settings.default_payment_method
once user created subscription with stripe subscription checkout session
then can we change subscription in the backend to the differnt pricing (of courese, when user clicks the button in frontend to change, then we need to change it somehow in the backend)
I'm asking if we can operate that kind of action ( we have permission? )
Yeah once a subscription is created you're welcome to update it however you want - but if the change triggers an immediate payment (like if you were to immeidately reset the billing cycle anchor) then it's always possible that future off-session charge fails and you'd need to bring your customer back on-session for them to complete payment
how to create that session for subscription update?
Checkout Sessions are ONLY for subscription creation - for subscription updates you'd either have to build your own flow, or rely on something else like customer portal to allow customers to update their subscriptions themselves
hmm,
but I have my own user interface for it
is it possible to use my own ui?
like select the plan (to update)
because we need to provide same ui to customers (who use paypal, who use stripe for both)
Yeah it's definitely possible to use your own UI - you'd make the request to update the subscription from your backend (we have a bunch of examples of that here https://stripe.com/docs/billing/subscriptions/upgrade-downgrade) and if a new invoice is generated/payment is required you can send the underlying client_secret back to your frontend and call confirmPayment (example here https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#complete-payment)
but you said it could be failed. and what if user wanted to use different coupon
""Checkout Sessions are ONLY for subscription creation - for subscription updates you'd either have to build your own flow, or rely on something else like customer portal to allow customers to update their subscriptions themselves""
so want to manage the subscription upgrade/downgrade somehow
Yeah that's what the second link I sent you is for - you'd use stripe elements to allow your users to confirm their payments client-side so that you can trigger extra actions like authentication/3ds
and it will bring user to the checkout page maybe
which link?
can you give me link again for stripe elements
This one - https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#complete-payment
It's making a call to confirmPayment which is a client-side call that you'd make to confirm a payment intent
Really I'd recommend reading that whole page if you can - it walks through how to build an integration with PaymentElement and subscriptions
used checkout popup old api for all the time
but now we need to update it because it's not supported 3ds, so some users failed to pay
Yeah that's why you need the call to confirmPayment - that's what triggers 3ds if it's needed
we can even create subscription with this stripe elements? (instead of creating subscription checkout session and redirect user to it)
Yup!
hmm, interesting, but this is not popup
right?
so do you think I can integrate my this ui with stripe elements?
Nope, it wouldn't be a popup - we walk through the whole flow here if you're curious https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
and yeah, all you'd have to do at the bottom of the page is add the payment element where they can provide their payment details and compelte payment
I have few plans as you can see
then should I make
this for each plan?
I have few plans, but wanted to have 1 button for stripe
user select the plan, and click the stripe button
You'd only need to do it once - and if your user selects a different plan you can update the amount https://stripe.com/docs/js/elements_object/update#elements_update-options-amount
Which button? The one to update the amount?
submit button
I believe you'd want it wihtin your form