#Braunson - charge_id
1 messages · Page 1 of 1 (latest)
I'm in test mode but an example is ch_3Kw9KgCOn1yQl7Wa0a4npG8O
If you search for that charge id in your Dashboard, you should be able to see 'All Activity' where it will show the Session creation: https://dashboard.stripe.com/test/payments/pi_3Kw9KgCOn1yQl7Wa0PlOnTfq
Yes but how to do this programmatically, I have the charge_id (from a Checkout Session) via the webhook but have no way to lookup the sessions line items (for a description of the charge on my end).
Ultimately the checkout session does not set the description on the charge (which I want to do but don't see that as being possible). So on my end (on my project) when looking up a charge for the user, there's no description and no identifier of what this charge is for. So I was looking to get the Checkout Session's line item(s) to display those but there is no way programmatically I can see to lookup a checkout session from a charge_id or payment_intent
Let me test something on my test account
So you can retrieve the payment intent from the charge_id, https://stripe.com/docs/api/charges/retrieve. Then, use the checkout sessions list https://stripe.com/docs/api/checkout/sessions/list and filter through the payment intent id to attain that information.
Oh wow, though there may have been an easier way. Thanks pgsk. Sidenote, any way to set the charge description for a checkout session?
Could you leverage the metadata for the checkout session, https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata ?
I do set the metadata when creating the Checkout Session however it doesn't pass through to the charge object itself, actually it doesn't seem to be setting at all. I wonder if this is due to the API version we are using.
So I am passing metadata when creating the Checkout Session (for example req_XBC4eofTl9KStY) but it's not being passed to the charge.