#Louis Daubié

1 messages · Page 1 of 1 (latest)

pine galleonBOT
lyric crag
#

Hi there!

#

You can only add metadata from the backend using a secret key.

waxen dagger
#

I am not sur to understand, i try something like this actually :
const setupIntent = await stripe.setupIntents.create({
customer: customer.stripeCustomerId,
metadata: {
cardName,
},
});

lyric crag
#

Yes this should work.

waxen dagger
#

But i got nothing in metadata when i log the result of :
await stripe.paymentMethods.list({
customer: customer.stripeCustomerId,
type: 'card',
});

lyric crag
#

I mean, you forgot to set a key to your metadata:

metadata: {
   key: "value",
},
waxen dagger
#

cardName is a key..

lyric crag
#

In your case:

metadata: {
   cardName: cardName,
},
waxen dagger
#

and value i am using js

lyric crag
waxen dagger
#

futhermore i try with this, same result :
const setupIntent = await stripe.setupIntents.create({
customer: customer.stripeCustomerId,
metadata: {
test: 'test',
},
});

lyric crag
#

Looks correct to me. Can you share the SetupIntent ID?

waxen dagger
#

log

#

pm_1MxnRNJOEn8vXy6hMzDd6mPw

lyric crag
#

This is the SetupIntent ID, and we can see the metadata here: seti_1MxnRMJOEn8vXy6hwD8NAQFk

#

So what is the issue?

waxen dagger
#

when i log the metadata it's empty

#

await stripe.paymentMethods.list({
customer: customer.stripeCustomerId,
type: 'card',
});

lyric crag
#

You are checking the Payment Method here, but you set the metadata on the SetupIntent.

#

If you want the metadata on the PaymentMethod, then you need to set it yourself.

waxen dagger
#

So i need to do an other api call for add the metadata ?
Because actualy the front end use the client_secvret generate by the paymentItent on the back and send the data directly to stripe

lyric crag
waxen dagger
#

ok thanks

pine galleonBOT