#myz123-metadata

1 messages ยท Page 1 of 1 (latest)

misty jettyBOT
vapid remnant
#

Hi ๐Ÿ‘‹ it's hard to tell with how cropped those screenshots are, but it looks like you may be looking at two different objects. Is the first screenshot your request to create a Checkout Session with metadata, and then your second screenshot you looking at a Payment Intent?

elder frigate
#

The second screen is my stripe console. I listen to payment_intent.succeeded event

vapid remnant
#

Yup, so those are two different objects, one is a Checkout Session and the other is a Payment Intent. Most of the time metadata is not copied from one object to related objects, so you will either need to change how you're setting the metadata or where you're looking for it.

If you want to pass metadata to the Payment Intent that a Checkout Session creates, then you will want to use the payment_intent_data.metadata field when creating the Checkout Session:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata

#

myz123-metadata

elder frigate
#

Thanks

#

@vapid remnant payment_intent.succeeded and checkout.session.completed. Do you both work after a successful payment. What are the differences between them?

vapid remnant
#

They both work if you're only creating Checkout Sessions with a mode of payment.

payment_intent.succeeded is triggered when a Payment Intent moves to a succeeded state.

checkout.session.completed is triggered when a Customer completes the flow in a Checkout Session. Since Checkout Sessions can be run in three different modes, this could be them completing a payment, a setup, or creating a Subscription.

#

The Events will also contain different objects. payment_intent.succeeded will contain a Payment Intent, whereas checkout.session.completed will contain a Checkout Session object.

elder frigate
#

So which one I should use? I only have a checkout page.

#

Will checkout.session.completed be triggered from a failure payment?