#Joe
1 messages · Page 1 of 1 (latest)
Hi there, so you want to attach the checkout session's metadata to a payout object?
Yes without having to navigate through the objects to get to the checkout session
I don't think that's possible. A payout can contains many balance transactions which were contributed by many checkout sessions.
In another word, payout and checkout session have no direct 1:1 relationship.
right and I get that
since I'm able to also populate the paymentIntent's metadata at checkout session creation, I wasn't sure if there was another way
The paymentIntent and checkout session have a direct 1-to-1 relationship, in fact you can set a metadata to payment_intent_data when creating a checkout session.
I'm on the Connect platform and have a single webhook setup. I use the checkout session metadata to re-forward the webhook to the correct destination based on the connected account. It works fine for checkout session completed event , but then will completely fail for payout paid event since I cannot populate the metadata
What do you mean by single webhook setup? are you using connect webhook? https://stripe.com/docs/connect/webhooks
I have a single hosted endpoint setup on the Platform account. When the event is sent to the url, I read the metadata on it and reforward it based on the metadata
OK, that's a connect account. what information do you rely on from metadata?
on the checkout session and payment intent, I put a url in the metadata. When my generic webhook API reads the event, it checks the event's metadata field where this url is to know where to redirect the event.
What do you mean by where to redirect the event ?
In stripe the webhook url is set to api.com/webhook/handler. Checkout.Session.Completed event occurs and api.com/webhook/handler receives the event. api.com/webhook/handler reads the event and looks for meta[url]=abc.com/webhook/handler and if it exists, it forwards the event to abc.com/webhook/handler
Hmm, I still don't see how it's related to payout, maybe I miss something?
I'm telling you how I currently handle this for checkout.session.completed events. Currently I use checkout.session.completed events to know when payments are made. Now I want to know when payout paid occurs. I use metadata to reforward the webhook event to the correct url.
I want to know when payout paid occurs. I use metadata to reforward the webhook event to the correct url. -> I don't understand this part, can you elaborate more?
Or walk me through with an example so that I can better understand you.
The Connect Webhook setup on the platform account will send all events its configured for to a url, lets call it url1.com . url1.com is a generic API endpoint that consumes stripe events and checks for a specific metadata field, lets call it "metadata":{"newurl":"merchant2.com"}. This generic API only serves as a forwarding service to distribute requests for individual connected accounts while utilizing the platform api key. The generic API endpoint sends the request off the merchant2.com where it can be read and evaluated in the target system. The target system at merchant2.com reads the request, validates it, and makes changes in the system with this new behavior.
This is how I currently handled checkout.session.completed events. We need the same desired behavior and I wanted to use the same structure we use to get the webhook event to the desired url for payout paid events.
Thanks for the explanation. So basically you need to pass along some data to the payout object's metadata. Are you using auto payout or manual payout?
auto
In auto payout, Stripe creates the payout object automatically and I don't see an option for you to pass custom data to payouts
very unfortunate
If this metadata is very important to your business logic, you can consider using manual payout and pass the metadata in when creating the payout
I don't think manual payouts are really an option for me. It's just another step for merchants to take when they just want their money paid out without extra input.
Unless I'm mistaken, I need to use the metadata because I need to distribute the events to different urls based on the account. The only way to do that built in to stripe is to use each individual connected accounts webhook and use their separate api keys to read it which is a major headache.
Is there a reason why you don't want to handle the payout.created event in the connect webhook?