#kun_setupintents-savedpms-defaultpm
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/1277698447767507017
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- kun_webhooks, 5 days ago, 28 messages
- kun_webhooks, 5 days ago, 27 messages
- kun_webhooks, 6 days ago, 18 messages
This is another topic
Can you try to explain the issue a bit more clearly? What steps are you doing right now? What is going wrong?
ok let me clear it
I am trying to create stripe subscription
1 first I create customer and get the customer Id
2 2nd I create subscription passing the ciustomerId and then get the client secret
3 on frontend I pass the client secrte along side with card elements and use confirmCardSetup
And hence I create the whole flow of stripe subscription
what if in future if my customer change its card details what I need to do?
get its paymentid and atatch to the customer thats it?>
any idea?
Hello, once you have the payment method saved you can set it as the subscription's default payment method or the customer's default payment method depending on whether your customers can have multiple subscriptions that charge different payment methods or not
https://docs.stripe.com/api/subscriptions/update#update_subscription-default_payment_method
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
A easy way to collect a new payment method would be to collect a new payment method for the customer using a SetupIntent.
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
my customer will have one subscription at a time
so with which I should updated my payment method?
customer or subscripton
whats you expert opinion
You can do either in that case. I probably should have explained how this works: we first check whether the subscription itself has a default payment method, if that is not set we use the Customer's default payment method. So if you have customers with just one subscription then setting either would have the same result
ohhhh got it
a quick question
on frontend which method I should use
to get new payment method of new card and attach ot t customer
In the doc that I linked confirmSetup is the specific call where a payment method will be created if it succeeds
but what about client secret ?
and is the client secret remains the same forever? of subscription
The client secret unique for each intent. The steps would be:
- Create a SetupIntent for this customer, pass its client secret to the frontend
- Confirm the SetupIntent on the frontend using the client secret
- Set the newly created payment method as the default for the customer or subscription
But I want the user subscription remains the same if in future he needs to updated the card details
in that case I think I can resue the same client secret
Intents can only be used one time. Once one succeeds (or is cancelled) you need to use a new one which means using the new intent's client secret
To be clear, you can make multiple charge attempts on one intent. The thing that is limited is that thay can only be used until they succeed, at which point any attempt to re-use the client secret will fail because the intent is in a final state.
Let me clear my point
suppose the subscription is active and not canceled. after 6 months user want to just change its card details and keeping its subscription the same old activated.
I that case I think i should use the client secret of the this old activated subscription
??
That is not how intents work unfortunately. If the intent was successfully confirmed, its client secret is not usable anymore.
ohh now that is my point
for new card deatils to update it
i dont want to create a new subscription I want to attach this payment method to my old activated subsctiption
and confirmCardSetup need client secret
how then I can handle it
any suggestions?
By creating a SetupIntent directly, you do not need to create a new subscription
I would recommend trying to implement the flow in the doc that I linked to on a quick test page. I think that may clarify how that flow works
I went through the links but tbh they are no0t related to my question
I dont want to have future setup future payment intent
what I simply wanted is
once customer updated its card details the activated subscription he has will start using its new card details for the recurring payments
But the links you have provided are ambiguous not related to my question
If you want I can re ask my question
If you are already saving these new payment methods properly then those first two fields that I linked to are the only thing that you need to set
https://docs.stripe.com/api/subscriptions/update#update_subscription-default_payment_method
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
I thought that link was relevant because it sounded like you weren't sure how to save new payment methods to attach to the subscription
The point still remains there
on frontend confirmCardSetup needs a client secret for the time I want to use new payment method
and the client_secret is coming from the creation of subscription
which I dont want
The doc that I sent you shows how to create a SetupIntent and use its client secret
furthermore
customer or subscription will update once
i have new payment method from confirmCardSetup
I am sorry I don't know how but we just keep talking past each other
But I dont want SetupIntent
My system using subscriptions
I think we are trying to find the solution
You need to use a SetupIntent here. There is no other alternative.
SetupIntents are a suppliment here, they don't replace or in any way negatively impact the subscriptions that you otherwise have
How SetupIntent will work with my subscription
both are totally different
SetupIntents are what you use when you want to save a PaymentMethod when you aren't also taking a payment
You can use a setup intent to create a payment method and can then set that payment method as the default for the subscription
That is the purpose of setup intents. To save payment methods to be used for other things
Now I got it and its much clear
can I re confirm it?
Once I need to update the card details .
step 1: create setup intent so i can get client secret
step 2: use this client secret with confirmCardSetup to get new payment method
step3 : update the customer with this new payment method so that my activated subscription start using the new card details
am I right?
and Please provide me the url for creating setup intent so I can update my card details
Yep that is the correct process. Happy we are on the same page. This is the specific step in the doc that shows creating the setup intent
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements#create-intent
And here is the API ref page on creating setup intents
https://docs.stripe.com/api/setup_intents/create
hahahah yes brother because a a seniro developer I never code unless I understood the whole flow
now the flow is clear
What i learnt today
if I want new payment method
setupintent is for it
a quick question
on frontend I should use confirmCardSetup right?
and will setupintent send client secret key?
You will want to send your setup intent client secret to the front end before calling confirmCardSetup. The confirmCardSetup call requires a client secret
got it and the flow is clear
thansk for the help really appraciate it
Of course, glad I could help!
Have a nice day