#Gyan

1 messages ยท Page 1 of 1 (latest)

drowsy moatBOT
jagged bridge
#

Hi ๐Ÿ‘‹ which types of events are you planning to listen for? metadata does not transfer between objects, so the type of events that you're planning to listen for will impact where you need to place that information.

hybrid bane
#

i am listening to charge.succeeded and charge.failed event types.

jagged bridge
#

With our current recommended approaches, you likely won't be interacting directly with the Charge objects, so you'll probably need to use the Charge's ID to find a higher-order object where you can place those values.

How are you planning to, or how did you, build your payment process? Are you using our Payment Element approach, Checkout Sessions, or perhaps something else?

hybrid bane
#

Yes, I am using the custom implemention, Direct API way

#

it uses PaymentElements

#

The events that i receive does have a metadata object,:
"metadata": {
"integration_check": "accept_a_payment"
}

#

Is there anyway to add some more values to this object from wherever it is coming?

jagged bridge
#

Gotcha, then storing the meatadata on the Payment Intent that you create is one option.
https://stripe.com/docs/api/payment_intents/create#create_payment_intent-metadata

You could inspect the contents of the Charge object returned in the events that you mentioned, and within it you will find the ID of the Payment Intent:
https://stripe.com/docs/api/charges/object#charge_object-payment_intent

You can then use that ID to retrieve the associated Payment Intent and check the contents of it's metadata:
https://stripe.com/docs/api/payment_intents/retrieve

jagged bridge