#idhruv

1 messages · Page 1 of 1 (latest)

leaden wagonBOT
real oyster
#

Hey there

minor goblet
#

hi

real oyster
#

Which response specifically? After you confirm?

#

Are you confirming client-side?

minor goblet
#

basically, I am not confirming immediately but this is the process:

Client chooses a new card -> It gets through setup intent process -> they choose to go with monthly payment on backend -> the response is then transferred to ui and then we confirm the card

#

but the process fails in between when on the backend we are trying to create customer as for some parameters there we need to pass pm which we dont have upfront

real oyster
#

Hmm I don't really understand

#

You don't need anything to create a Customer

#

Are you trying to set the invoice_settings.default_payment_method before you have the PaymentMethod?

#

Is that the issue?

#

What parameter do you "need" when creating the Customer?

minor goblet
#

basically, we have two payment methods, Daily/Hourly and Monthly. For both of these payments we need payment_method when user tries to make the payment with existing card, however, to save the existing card we need certain details like pm and other such info

#

with creating the customer I was talking about our new workflow where we proceed to backend api without creating any setupintents, then we create new customer and attach the response of paymentIntent which has payment method in it

#

However, this fails miserably when payment intent is not able to provide us payment method like it happens many times in the case of monthly payments

real oyster
#

This is a bit hard to talk about in the abstract, it may be helpful for me to look at an example of exactly what you are doing. Do you have an example of hitting an error?

minor goblet
#

req_qUb9dZTCUMpjnU plz have a look, this shows default_payment_method as null

#

and this never resulted in failure while testing it with test clocks, however on live it resulted in disaster for us

#

payment just doesn't go through, it shows default_payment_method as null. Now client made payments for this subscription with new card so we didn't had payment method upfront to attach with the request.

real oyster
#

Okay so this is a Subscription Schedule where you are starting it in the future.

minor goblet
#

yep

#

future dated

real oyster
#

So you intend to collect a PaymentMethod via a SetupIntent while the customer is on-session, correct?

minor goblet
#

yea basically when he first uses his card and he is online on the page

real oyster
#

What does "uses his card" mean exactly? Like they aren't paying for anything at this point, right? It is for the Subscription payment in the future. You just want to collect and store the card details, yes?

minor goblet
#

we have this input field on UI and that's it. The next page will appear once card saving process, as well as configuring subscription is done

#

if it is daily/hourlye immediately cut the charge

#

if it is monthly, we configure subscription schedule for given date and show payment success

#

if the checkbox is ticked, we save the card for future. if unticked we remove the card at the end of payment process

#

What does "uses his card" mean exactly?
Meaning entering the card details and pressing pay button as in the image above.

real oyster
#

Got it

#

Okay so yeah if you are going to schedule a Subscription then you need to be creating a SetupIntent to store these card details.

#

You mentioned this above already, but I don't see a SetupIntent created for the Customer that you provided an example for.

minor goblet
#

true, so i am fixing it right now. it was not getting created before

real oyster
#

Gotcha

#

So what can I help with exactly then? Are you confused where in the process to do this?

minor goblet
#

while testing i get this response from setup Intent, now in order to save the card i also need payment_method

#

hence the query, how exactly should i get PM from this response?

#

if i confirm the card immediately it will show a popup for 3ds card, but that process (confirmation for all cards) is anyways taking place after payment intent is confirmed in later stage on our UI. so is it mandatory to confirm immediately after creating setupIntent?

real oyster
#

Ah okay I see the confusion

#

Yes you would confirm the SetupIntent client-side here just like you would with a PaymentIntent

#

The SetupIntent will then handle 3DS for you (if necessary) and then on future payments that use that PaymentMethod we will apply an exemption for 3DS since it has already been completed.

#

Are you using Card Element here?

#

Or Payment Element?

minor goblet
#

oh okay. we are using card element

real oyster
#

Got it. Then yeah, you want to pass the SetupIntent's client_secret to your frontend and use confirmCardSetup to confirm it.

#

Then you get a PaymentMethod ID back and you pass that back to your backend to be set as the Customer's default

#

So then it is used when the Sub actually starts

minor goblet
#

got it

#

thanks a lot mate!