#dieselwurks_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1432804962571780198
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
You can use List all Checkout Sessions API and pass payment_intent parameter to get the relevant session - https://docs.stripe.com/api/checkout/sessions/list#list_checkout_sessions-payment_intent
Argh. Can't stripe please enhance this by adding a filter? Would be so nice to get a list of sessions with PIs or sessions with prices or sessions with products rather than having to iterate over all of them.
Wait, that's what you said! hahaha.
Works for PIs but not for products or prices.
I'll try that!
Correct
Still, sessions with prices or sessions with products is something I have to do all of the time by iterating.
You can expand line_items while listing the Checkout Sessions - https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-line_items
So line items should include prices after you list them
https://docs.stripe.com/api/expanding_objects
No I mean "given a price, give me all of the sessions that bought it"
Ah I see. Unfortunately, that's not something we support today.
Generally, users store relevant Product/Price <> Checkout Session IDs in their own database
when they create Checkout Sessions using the API
I see you're using Payment Links so that won't work unfortunately
Yes, because I can offload work onto people who click. I code.
Can you help with PHP? This doesn't work 57 $cs = \Stripe\Checkout\Session::retrieve([ 58 'payment_intent' => $pi, 59 ]);
391950 28/Oct 13:03 php Error Stripe\Exception\UnexpectedValueException: Could not determine which URL to request: Stripe\Checkout\Session instance has invalid ID: in Stripe\ApiResource::resourceUrl() (line 107 of /var/lib/drupal/vendor/stripe/stripe-php/lib/ApiResource.php).
You're using the wrong endpoint I think
Yes, I see that from the documentation but it says that I can provide payment_intent as a parameter but that doesn't work. Hang on...
It might look a bit different for the syntax you're using (without Stripe Client)
The syntax I gave didn't work but this got me the session. I can't figure out how to get the custom_fields.
It should be an array.. What do you see under custom_fields parameter?
Yes, I have them now. I needed to do $cf = $cs['data'][0]->custom_fields; to get them
Great!
kthx muchly!