#soumya

1 messages · Page 1 of 1 (latest)

zealous parrotBOT
spice flint
#

Are you asking how to collect a payment method so that you can use it in a subscription ?

strong ember
#

yes card details

spice flint
strong ember
#

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?

spice flint
#

What add card flow do you refer to? do you have the link?

strong ember
#

yes let me share

#

now as this gives error like u cannot send carddetails as a pci complainces

spice flint
#

The tokens API is not recommended, you should use SetupIntent API to collect a paymentMethod instead.

strong ember
#

can u share the link to payment methods api which is equalent to this

spice flint
strong ember
#

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?

spice flint
#

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.

strong ember
#

yes if customer wants to change the payment method shd we setup intent again?

spice flint
#

Yes you are right

strong ember
#

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 ?

spice flint
#

No. You still need to set the newly collected payment method as the default payment for customer or/and subscription,.

strong ember
#

how do we do thta?

spice flint
strong ember
#

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?

spice flint
#

Not card token, it's a payment method.

#

As I mentioned earlier, Tokens API is deprecated and you should use PaymentMethod instead.

strong ember
#

should we hande this in stripe webhooks ?

spice flint
#

how to use the collected payment method to create a susbcription is entirely up to you.

strong ember
#

do we get any event in strip when a payment menthod is added?

spice flint
strong ember
#

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

spice flint
#

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

strong ember
#

Okay so after we create subscription with the payment menthis we have to pay the invoice right?

spice flint
#

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.

strong ember
#

okay so once invoice is paid successfully we will get event invoice.paid right?

spice flint
#

Yes you are right

strong ember
#

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 ?

spice flint
#

1/ No the old payment method won't be shown in the payment method
2/ I have already answered this quesiton.

strong ember
#

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

spice flint
#

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.

strong ember
#

okay tht means it is mandatory to call update subscription and update customer api right?

spice flint
#

For completeness, you can attach multiple payment methods to the same customer.

strong ember
#

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?

spice flint
#

I don't see the point of repeating answers to the same questions.

strong ember
#

I am asking for guidance to understand properly

#

Please advise

spice flint
#

When a setupIntent is succedded, it won't set the newly collected payment method as the customer's invoice_settings.default_payment_method

strong ember
#

here is it confusing

#

you mentioned to update customer and subscription now again invoice?

#

This is the confusion we have

spice flint
#

I don't understand you latest question

strong ember
#

We have been contacting support multiple times and we get different approach each time

spice flint
#

Or can you tell me what you expect vs what you actually experience?

strong ember
#

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?

spice flint
#

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?

strong ember
#

update customer api right?

spice flint
#

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.