#harinth-setupintent-metadata

1 messages · Page 1 of 1 (latest)

hardy oracle
#

hello @past garnet , let's talk here

#

metadata is only accessible via secret key, not publishable, so this is expected

your curl snippet is making a request with your secret API key

past garnet
#

Yes, but I can retrieve everything else but without metadata

hardy oracle
#

yes but I explained, by design metadata is not returned when fetched via publishable key. You have to fetch the SetupIntent on your server-side to see metadata and return that to your client-side if needed.

past garnet
#

So do I need to pass that information along with return url inorder to use that there?

hardy oracle
#

no

#

yes but I explained, by design metadata is not returned when fetched via publishable key. You have to fetch the SetupIntent on your server-side to see metadata and return that to your client-side if needed.

you want metadata on your webpage right?

you do this

You have to fetch the SetupIntent on your server-side to see metadata and return that to your client-side if needed.

past garnet
#

The scenario is, I have a contact Id value. I will have to add a payment method under a customer related to the contact Id. In the retrieve setupIntent I need to save the payment method along with that contact Id

hardy oracle
#

yeah so you need to do what I said above, did you understand that part? I can detail if it wasn't clear

#

you need to do

webpage --> your server endpoint --> retrieve SetupIntent from Stripe

right now you're doing

webpage --> retrieve SetupIntent from Stripe

and that does NOT return metadata

past garnet
hardy oracle
#

I'm not clear on how your integration works but typically it would be your webpage making an AJAX request to your server endpoint where your server-side endpoint accepts a SetupIntent ID and retrieves it

past garnet
#

On clicking a link in my webpage(Add card), a stripe customer will create in the background and the form to enter card details comes up. After entering details and submit, I am creating a setupIntent and the same get retrieved from the return url via javascript. The payment method id I get from setupIntent.payment_method should be saved in the db along with a contact I'd

This is what I need. I am not sure whether I am doing it correctly.

I thought to use that contact I'd in setupIntent as metadata and retrieve it from the return url metadata and send an ajax to store the payment method id along with that contact

hardy oracle
#

sorry I think we're talking past each other

basically what you need to do is what I mentioned above

you do not need to fetch the SetupIntent from yoru client-side JS, rather you need to have it fetched from your server

past garnet
#

Ok, thank you so much

#

I will do the needful based on this

#

We should keep payment method id in our db for making payment via payment Intent right?

#

In future

midnight arrow
#

Yes, you're welcome to keep the payment method ID in your own database so you can easily reference it for use with future Payment Intents

past garnet
#

Ok. Thank you

#

I have one more question.
I have stored lot of cards already in my db with card_xxx and fingerprint. Is there a way to convert those to payment method id, so that I can use those for payment Intent in future

midnight arrow
#

There is no way to convert those to Payment Methods, but these cards should be backwards compatible. You should be able to use any card_xxx ID where you would use a payment method ID

past garnet
#

Can I use card_xxx in payment Intent?

midnight arrow
#

Yup! Just use card_xxx where you would pass in payment_method

past garnet
#

Okay, so no need to pass pm_xxx always right?

midnight arrow
#

Correct - if you have older card_xxx objects then you are free to use those

past garnet
#

Ok. Thank you