'How to get metadata object from retrieveSetupIntent?

I'm using the client side retrieveSetupIntent call to get a setupIntent, but the metadata object is undefined.

const { setupIntent, error } = await stripe.retrieveSetupIntent(setupClientSecret);
console.log('metadata :', setupIntent.metadata); // This doesn't work, no metadata

However, in the setup_intent.succeeded webhook the metadata object is present, just not when using this client side call.

Does anyone know if/how this can be done?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source