#Gyan
1 messages ยท Page 1 of 1 (latest)
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.
i am listening to charge.succeeded and charge.failed event types.
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?
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?
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
Yes, the metadata field is updatable on objects.
If that is a Charge object that you found that on, then you would update that object:
https://stripe.com/docs/api/charges/update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.