#Loren

1 messages · Page 1 of 1 (latest)

tall pecanBOT
hoary kernel
#

Hi there

#

You added: (Obviously I can stick metadata into the payment_intent when I first create it, but that is before the user has filled out the fields since I need the payment_intent to create the element to just show the fields to begin with)

#

The most common way to capture name/email/phone would be through Billing Details with confirmPayment(). However you can't pass other metadata client-side as that would be a security issue. You should instead pass that data to your server and update the PaymentIntent server-side to set that metadata

dense lichen
#

Thanks. I tried setting billing_details but that data never appeared on the other end of the webhook so I assumed it was broken. should it work?

hoary kernel
#

Yeah it gets stored on the PaymentMethod object

#

So when you receive payment_intent.succeeded you can retrieve the PaymentIntent and expand the latest_charge and then look at the payment_method_details

#

Otherwise you can just retrieve the PaymentMethod directly and see that data

dense lichen
#

Got it, so I've got 2 options, stick what I can in billing_details and make an extra API call on the webhook end of things to expand out the data, or make an extra API call on client submit to update the metadata server-side, then process the transaction. If I go with option #2, does it make the most sense to update the metadata and confirm the payment at the same time (both server-side) rather than bouncing back to the client to confirm the payment?

hoary kernel
#

Well let's back up a moment

#

When do you actually collect this data?

#

Before you render Payment Element?

#

Also are you using the standard Payment Element flow (pass the client secret to the client to render Payment Element) or are you using the deffered intent flow?

dense lichen
#

The fields are next to the payment element (one screen with the card element and few fields I control)

#

Yes, standard element flow (pass the client secret to the client)

#

I don't know what the deferred intent flow is, but maybe that would be useful here?

hoary kernel
#

With that flow you can just set the metadata when you create your PaymentIntent as you have to call your server for that anyway

#

Only downside of deferred intent really is that there are a few payment methods that we are still working on fully supporting in that flow (like ACH)

dense lichen
#

Aha! Yes this looks exactly right, might take ~a few mins to wire it up. Thank you!

#

Can't believe I missed this in the docs

hoary kernel
#

Np

#

It is relatively new