#Fedegara

1 messages ยท Page 1 of 1 (latest)

gaunt cradleBOT
tranquil wind
#

Hi ๐Ÿ‘‹ can you elaborate? Are you encountering an error when trying to include metadata?

cobalt anchor
#

Hi Toby

#

thanks for the help

#

look i create a new Session but i wanna retrieve some metadata when the client have payment erroes on the session checkout

#

but my session create is of a subscription so i receive an error that says "Yu can not pass setup_intent_data in subscription mode."

tranquil wind
#

That is expected, as mentioned in our API spec, setup_intent_data is only available when you're creating a Checkout Session with mode set to setup.

When you set mode to subscription, you can use subscription_data instead:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data

cobalt anchor
#

yes

#

but my question how can attach that payment intent for example to my checkout session without the metadata?

tranquil wind
#

I don't understand. You don't attach Payment Intents to Checkout Sessions. When working in subscription mode, the Checkout Session will create a Subscription which will create an Invoice which will create a Payment Intent.

cobalt anchor
#

But i am creation a session that retrive me an url

#

to stripe to put my credit card and make the payment

#

if this credit card has a problem that generate a payment intent error

#

that i cannot attach to my system,because in the creation y cannot put metada to him

tranquil wind
#

I believe you can still use subscription_data.metadata. When you received an event about a failed payment, you'll need to the check the Payment Intent to see if it is associated with an Invoice by checking its invoice field:
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-invoice

If it is associated with an Invoice, you then check whether that Invoice is associated with a Subscription by checking the Invoice's subscription field:
https://stripe.com/docs/api/invoices/object#invoice_object-subscription

You can then check the associated Subscription for the metadata that you included.

cobalt anchor
#

that field dont return

#

exmaple

#
tranquil wind
#

I'm not sure what you're trying to convey. What field are you referring to when you say "field dont return"?

cobalt anchor
#

thanks toby for the help

#

i found a way on my code

#

thanks for the help dude

tranquil wind
#

๐Ÿ‘ happy to help!