#latwelve
1 messages · Page 1 of 1 (latest)
So metadata isn't copied in all scenarios
We only copy metadata from PI -> Charge once when the PI is confirmed
If you share the PI ID, I can see what happened here
hello
pi_3MYZ37IEG6XkSwCO05WyQNTh
there is an example. the metadata actually originates from the checkout seession so i can see it in that example
I was hoping I could pull back a list of charges and at the same time pull in any of my custom metadata that existed from 1 call like so:
$charges = $stripe->charges->all(
[
'limit' => 5,
'created' => [
'gte' => $start_of_month,
'lte' => $end_of_month
],
// 'expand' => ['data.metadata'],
]);
So i'm guessing it looks like the metadata is only sitting on the Session and not coming across to the charge or pi
Yeah to set the metadata on the PI you need to set it here: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so it does exist on the session
but its how i pull it from a charge or the "charges" call without having to make too many other calls
oo thinking about it actually just getting the charge "items" names should solve my current problem
is it possible to pull back all item names with the charges() request?
Sorry. I wasn't clear. There's multiple places to set metadata. If you set it on the session here: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata metadata will only exist on the sessino
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you set it at that first link I sent, it will only be set on the PaymentIntent
ignore me!
if its only set on the session then i guess theres no way to pull it into the charges() call easily
so I'll have to look it up each time?
Yeah
I recommend setting it on the payment intent: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata so you can pull it easily
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I think I'll have to do that going forwards but just for now I'll need a report for existing entries - is there a way to pull the checkout session ID so I can loop over it from a single charge?
You can use this endpoint: https://stripe.com/docs/api/checkout/sessions/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thanks
Will need PaymentIntent id though