#deland_webhooks

1 messages ¡ Page 1 of 1 (latest)

jade cragBOT
#

👋 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/1315813346313895956

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

vagrant edge
#

Basically I want to:
payout.created - Create an entry in my database & save a uid in payout metadata for referencing in future events
payout.updated - Update database entry and send the appropriate push notification such for when a payout status is pending paid in-transit failed etc

#

If you have any best practices to recommend I'd appreciate it too

winter fractal
vagrant edge
#

Got it, what would you recommend I do? What are the events I should listen to? At the very least I want to:

  1. Notify customer their payout has initialized & create an entry in my database
  2. Notify customer their payout has been paid/completed & update my entry
#

I can deal with the async issue. But the documentation on what payout.updated tracks is conflicting. A thread on this discord said that payout.updated only triggers when status changes from pending to in-transit

winter fractal
#

You can listen to https://docs.stripe.com/api/events/types#event_types-payout.created event when it's created. Then, you can listen to https://docs.stripe.com/api/events/types#event_types-payout.paid which occurs whenever a payout is expected to be available in the destination account. In cases when payouts fail, you'd listen to https://docs.stripe.com/api/events/types#event_types-payout.failed. There are numerous reasons as to why you might get payout.updated like the payout transition from pending to paid status, or when a trace id for the payout is available: https://docs.stripe.com/payouts/trace-id#api

You can listen to payout.paid event in this case to know when the payout is paid.

vagrant edge
#

Oh so if i don't care about trace IDs, i can ignore payout.updated?

winter fractal
#

That is up to you. Since you only care if the payout is paid or failed, it sounds like you can.

vagrant edge
#

And is payout.failed necessary? I see that payout.paid can contain both failed and paid statuses

winter fractal
#

What do you mean by that? Where do you see it? Can you share the event id with me? Where are you looking?

vagrant edge
#

I might be misunderstanding. But when i trigger a failed test payout, payout.paid also gets the failed status

winter fractal
#

No, that just describes the behavior. You can listen to payout.paid and this event will be sent. If the payout fails, a separate payout.failed notification is also sent, at a later time.

vagrant edge
#

Does that mean i can use payout.paid for both successful and failed payouts? It only triggers when it's "expected" to be available at the destination account.

So if it fails before the "expected" available date, will it trigger immediately? Or will a payout.failed event occur in place of it.

It says that "a seperate payout.failed notifciation will be sent at a later time" which is a bit confusing

#

Makes me assume that if it fails before the expected available date, payout.failed gets sent immediately. And then when the expected available date hits, payout.paid triggers and an additional payout.failed event is sent at a later time.

winter fractal
#

No, you would want to listen to both

#

You should not see payout.failed before payout.paid. You would get payout.paid first... then if it fails you get payout.failed.

vagrant edge
#
# Send 'Payout Paid' alert
        if payout_status == "paid":
            NotifyHostPayoutPaid(host_id, payout_id, payout_amount_dollar_string, payout_destination_formatted)
        # Send 'Payout Failed' alert
        elif payout_status == "failed":
            NotifyHostPayoutFailed(host_id, payout_id, payout_amount_dollar_string)
            # Capture a payout issue for Sentry tracking
            logging.exception(
                f"Payout failed (payout.paid event) for payout ID: {payout_id} | payoutErrorCode: {payout_error_code}"
            )
#

I sent a failed payout on the dashboard. payout.paid gets both paid and failed statuses

winter fractal
#

Can you share the event id please?

#

What does 'payout.paid gets both paid and failed statuses' mean?

vagrant edge
#

The payout object that payout.paid event holds can have paid and failed as the status's value

#

Let me grab the event

#

evt_1QUGipPPpHfUvljySOV60HAo

winter fractal
vagrant edge
#

So how do i make sure I don't send the wrong alert to my customers?

winter fractal
#

you can look at the status on the event

vagrant edge
#

Yes but if it can change from paid to failed?

winter fractal
#

You listen to payout.paid and look at the status. If it's 'paid' send your notification. If the status is 'failed', you do not. In some cases, payout.paid can have status 'paid' , you let your customer know anyways but you might get a separate payout.failed. In this case, you send another notification that the payout failed.

vagrant edge
#

Okay i understand. I was hoping there was a way to avoid sending a paid alert followed by a failed alert. But that's alright

#

Thanks for your help