#soumya
1 messages · Page 1 of 1 (latest)
Are you asking how to collect a payment method so that you can use it in a subscription ?
yes card details
later on need to add option to add multiple cards
how is this equalent to add cards flow we had earlier can u little brief out
this is related to checkout right?
What add card flow do you refer to? do you have the link?
yes let me share
we used this to create card token - https://stripe.com/docs/api/tokens/create_card
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and the token was passed to this api to create card - https://stripe.com/docs/api/cards/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
now as this gives error like u cannot send carddetails as a pci complainces
The tokens API is not recommended, you should use SetupIntent API to collect a paymentMethod instead.
can u share the link to payment methods api which is equalent to this
The details are explained in https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
we need to setup intent everytime to add cards ?
because if user wants to add one more card and wants to make it as defualt card do the next renewal payment can be deducted from the same how can this be done?
You use SetupIntent to collect a new card, and this card can be used for recurring payments of a subscription. There's no need to collect a new card for the same subscription unless your customer want to change the payment method for the subsription.
yes if customer wants to change the payment method shd we setup intent again?
Yes you are right
so the previous card which we added will be removed from defualt and the new one whcih we add will become the defualt payment method ?
No. You still need to set the newly collected payment method as the default payment for customer or/and subscription,.
how do we do thta?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Let me confirm the flow again backend will ccall setup intent and will send client secret to frontend and in return we will get a card token?
this card token will be used to create a subscription or update subscription?
Not card token, it's a payment method.
As I mentioned earlier, Tokens API is deprecated and you should use PaymentMethod instead.
the paymenthos shd be used here to create subscription - https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
should we hande this in stripe webhooks ?
how to use the collected payment method to create a susbcription is entirely up to you.
do we get any event in strip when a payment menthod is added?
You mean when payment method is attached to a customer? https://stripe.com/docs/api/events/types#event_types-payment_method.attached
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
when i setup intent and send client secret to frontend and card details are added - it means that payment menthos is created and attached to the customer right ?
after this do we get ant event in webhook so that i can call subscription api
If the SetupIntent is succeeded, then yes the payment method will be created and attached to a customer (if provided), and you'll receive a payment_method.attached event
Okay so after we create subscription with the payment menthis we have to pay the invoice right?
If the subscription's collection_method is charge_automatically and the invoice's auto_advance is true, Stripe will automatiacally pay the invoice with the default_payment_method.
okay so once invoice is paid successfully we will get event invoice.paid right?
Yes you are right
Also when customer wants to add one more payement menthod will the old payment menthod details showed over the UI?
will the new payment menthod get attached as defualt source to customer ? do we need to call update customer/update subscription apis ?
1/ No the old payment method won't be shown in the payment method
2/ I have already answered this quesiton.
No the old payment method won't be shown in the payment method - is their a option to show this?
I have already answered this quesiton. - yes i understand because in docs it says like the whenever we add a new payment menthod it wll taken as customers defualt payment menthos removing the older method want to confirm this once again
No, the purpose of payment element is to collect a new payment method, not to display an existingo one.
2/ it's just to attach the newly payment method to a customer, it doesn't set or override the customer's invoice_settings.default_payment_method.
okay tht means it is mandatory to call update subscription and update customer api right?
For completeness, you can attach multiple payment methods to the same customer.
For completeness, you can attach multiple payment methods to the same customer. - am asking for the same here does it means one wil be marked as defualt?
I don't see the point of repeating answers to the same questions.
When a setupIntent is succedded, it won't set the newly collected payment method as the customer's invoice_settings.default_payment_method
here is it confusing
you mentioned to update customer and subscription now again invoice?
This is the confusion we have
I don't understand you latest question
We have been contacting support multiple times and we get different approach each time
Or can you tell me what you expect vs what you actually experience?
My query is - if we add multiple payment methods to a customer will the last added one will be marked automatically as defualt source for customer and sunscriptions or do we need to call update customer/update subscription to mark as defualt source?
When a setupIntent is succeeded, it won't set the newly collected payment method as the customer's invoice_settings.default_payment_method. You need to call the update API if you want to set it as invoice_settings.default_payment_method
Is it clear now?
update customer api right?
I'd suggest you to try it out yourself. If you find anything different from what I desribed just now, send me the request ID and I'd continue to help you.