#sebastian_api

1 messages Β· Page 1 of 1 (latest)

golden mangoBOT
#

πŸ‘‹ 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/1292892141064032398

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

lofty yew
#

hey @bold wave

bold wave
#

HI πŸ‘‹

Can you provide more details on your question?

lofty yew
#

Yeah. So right now I built my webhook and deployed it to a vercel link which I then registered on Stripe to listen to payouts.

#

I am then on Stripe browser built in CLI imitating a payout but I am not seeing it appear as something that has registered on the webhook dashboard on Stripe

bold wave
#

How are you "imitating a payout"?

#

Have you triggered a manual payout?

lofty yew
#

I am basically trying to test my webhook to make sure its reacting correctly b4 I put it in production

bold wave
#

Can you look in the Events tab in the Developer section and find the payout.created eventID?

lofty yew
#

I am not seeing this but again this is lvie

#

live

#

let me switch to dev mode

#

test

bold wave
#

These will only show up in test mode

#

You can see the Test Mode banner in the Stripe Shell

lofty yew
#

Yeah they are showing for the default 11 dollar payout

#

So the stripe cli is showing here. Just trying to figure out how I can make the stripe CLI in browser point to my webhook

#

So I can make sure the code is working

bold wave
#

For that, you can use stripe listen and forward events to your Vercel hosted endpoint
https://docs.stripe.com/cli/listen

We recommend doing it in a terminal on your computer

lofty yew
#

oh ok. So the browser CLI isnt meant for that.

bold wave
#

Right. Ideally, what you would do is have a copy of your webhook code running locally on your maching and then forward the webhook events to it using something like

stripe listen --forward-to=http://localhost:4242/
lofty yew
#

ok let me give that a go

bold wave
#

That way, you can test and change your code locally. Once everything is working as you expect, you copy your code over to your Vercel hosting platform.

Running stripe listen generates it's own Webhook signing secret. You will need to use the one from stripe listen for testing locally but use the one associated with your registered webhook endpoint when you are using your hosted code.

lofty yew
#

Where are the docs on this? Once I listen, what commands do I invoke to do a payout.create event

#

Just logged onto my Stripe CLI locally

golden mangoBOT
bold wave
#

You do that in two separate windows, each running their own process

#

Second window, call stripe trigger payout.created

lofty yew
#

Ok so open one window to invoke stripe listen and point to the right local endpoint. THEN, it would give me the webhook signing secret.

#

Got it... then second window call trigger

#

okay doing it now

lofty yew
#

ok so I have one more question

#

I managed to get my local webhook to show dummy data of a payout event.

#
{
  id: 'evt_1Q7KrcEu5lL8dZr6mtlfwsUR',
  object: 'event',
  api_version: '2024-06-20',
  created: 1728322616,
  data: {
    object: {
      id: 'po_1Q7KrcEu5lL8dZr6Kqt1tMX5',
      object: 'payout',
      amount: 1100,
      application_fee: null,
      application_fee_amount: null,
      arrival_date: 1728259200,
      automatic: false,
      balance_transaction: 'txn_1Q7KrcEu5lL8dZr6Q9ZYsU1p',
      created: 1728322616,
      currency: 'usd',
      description: '(created by Stripe CLI)',
      destination: 'ba_1PZcFjEu5lL8dZr6e080vGJU',
      failure_balance_transaction: null,
      failure_code: null,
      failure_message: null,
      livemode: false,
      metadata: {},
      method: 'standard',
      original_payout: null,
      reconciliation_status: 'not_applicable',
      reversed_by: null,
      source_type: 'card',
      statement_descriptor: null,
      status: 'paid',
      type: 'bank_account'
    }
  },
  livemode: false,
  pending_webhooks: 2,
  request: {
    id: 'req_PuaCVrj3LWCu2D',
    idempotency_key: '32ed5b8a-9b49-4bf7-b5c3-e63419c96779'
  },
  type: 'payout.paid'
}
#

But I am trying to see how I can monitor someones money step by step.

so the way it works in my app is that I do a transfer.

The transfer lands the money in the person's account.

Then later that day, the payout starts. I am trying to see if there is a shared txid to reflect that money.

teal coyote
lofty yew
#

So is the destination property in the payload I shared above the destination payment?

teal coyote
#

the above example is for a payout object. Destination payment ID property lives on a Transfer object..

lofty yew
#

I guess the only way to associate a transfer with a payout would be the match the dollar value being moved.

#

Bc I do a transfer, and then there is the payout but I am trying to communicate with my end users on what part of the journey their money is on if that makes sense

teal coyote
#

Is the payout automatic?

#

Or are you creating it using the API?

lofty yew
#

Either/Or works for me. Right now its automatic on my dashboard but I am more than happy to do it manually if it gives me that control I need to document where the money is at on its way to my user's bank account

teal coyote
#

Comparing the dollar value won't work as automatic payouts basically moves 100% balance that the stripe account has. If you're using automatic payouts, you can do - https://docs.stripe.com/expand/use-cases#charges-in-payout:~:text=If you’re using,property%3A

source.source_transfer on a payout should give you the "transfer" to the connected account & you can look at source_transaction to find the actual/originating charge on platform.

This way you can track backwards from payout -> transfer -> originating charge

#

With manual payouts, you basically control everything so you'd need to track everything yourself

lofty yew
#

I dont see a source _* anywhere on the payout object

teal coyote
#

Check the example in the URL I shared above.. BalanceTransaction object would have the source.. You'd pass payout as a parameter

lofty yew
#

Ok so lets start with step 1.. Below is a real transfer object from my dashboard

{
  "id": "tr_1Q2yKJEu5lL8dZr6WGrSscNI",
  "object": "transfer",
  "amount": 13211,
  "amount_reversed": 0,
  "balance_transaction": "txn_1Q2yKJEu5lL8dZr6Urfe9nMK",
  "created": 1727282671,
  "currency": "usd",
  "description": null,
  "destination": "acct_1Q1sa1IV3eXVgtcs",
  "destination_payment": "py_1Q2yKJIV3eXVgtcsBB9rvi0O",
  "livemode": true,
  "metadata": {
  },
  "reversals": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/transfers/tr_1Q2yKJEu5lL8dZr6WGrSscNI/reversals"
  },
  "reversed": false,
  "source_transaction": null,
  "source_type": "card",
  "transfer_group": "FIRST_PAYOUT"
}
#

source_transaction here is null

#

so I am wondering what property can I grab that I can use to connect it to the respective payout once this money goes to their bank

teal coyote
#

tr_xxx object is created on the platform but destination_payment -> py_xxx is created on the connected account

When a payout is created, this py_xxx should be listed as source on one of the payment type BalanceTransaction objects (txn_xxx)

Since there's no payout created right after a transfer, there's no way to connect tr_xxx to a future payout po_xxx

Instead, when you receive a payout.created event, you'd retrieve the balance transactions and map it to the transfer. So going the other way around/in reverse.

lofty yew
#

Are you telling me there is a way for me to manually create a payout right after a successful transfer?

teal coyote
#

Once the balance is available after a transfer, yeah you can create a payout manually

#

Automatic payouts are created based on the payout schedule of the account

lofty yew
#

okay so you are recommending just looking up the BalanceTransaction object to see what money is sitting in the persons account.

#

or at least what transactions are actively sitting there right?

teal coyote
#

You can listen to webhook events. As a platform, you can create a connect type webhook endpoint and listen to balance.available events..

When you create a transfer and the funds settle on the connected account, you'd receive the above event - after which you can call the API to create the payout manually

lofty yew
#

Awesome. Thank you very much.

#

Appreciate the help.

teal coyote
#

NP! πŸ™‚ Happy to help