#Joe

1 messages · Page 1 of 1 (latest)

solar hamletBOT
sleek jolt
#

Hi there, so you want to attach the checkout session's metadata to a payout object?

hexed merlin
#

Yes without having to navigate through the objects to get to the checkout session

sleek jolt
#

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.

hexed merlin
#

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

sleek jolt
#

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.

hexed merlin
#

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

sleek jolt
hexed merlin
#

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

sleek jolt
#

OK, that's a connect account. what information do you rely on from metadata?

hexed merlin
#

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.

sleek jolt
#

What do you mean by where to redirect the event ?

hexed merlin
sleek jolt
#

Hmm, I still don't see how it's related to payout, maybe I miss something?

hexed merlin
#

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.

sleek jolt
#

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.

hexed merlin
#

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.

sleek jolt
#

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?

hexed merlin
#

auto

sleek jolt
#

In auto payout, Stripe creates the payout object automatically and I don't see an option for you to pass custom data to payouts

hexed merlin
#

very unfortunate

sleek jolt
#

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

hexed merlin
#

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.

sleek jolt
#

Is there a reason why you don't want to handle the payout.created event in the connect webhook?