#caleb-hailey_webhooks

1 messages ¡ Page 1 of 1 (latest)

stone gyroBOT
#

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

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

sand escarp
#

Some of our Stripe payments are processed via third-party integration with Stripe (e.g. Shopify), and for those transactions the fees that are present match the eventual payouts (and corresponding deposits in our bank account). But some payments are processed via Stripe Invoices (which we generate via the API) and we cannot figure out how to find all of the fees.

In the Stripe dashboard the payout shows the detail I'm looking for: po_1Q2R3qBCXur6eGR1KErkJV6u

twilit minnow
#

Hi there, you can get the fee details from payment_intent->latest_charge->balance_transaction->fee_details

sand escarp
#

ok, let me try that real quick...

#

(thank you btw!)

#

ok, yeah, this is as far as I've gotten and I only see one of the two fees there

#
curl -H "Authorization: Bearer ${STRIPE_SECRET_KEY}" -XGET "https://api.stripe.com/v1/payment_intents/pi_3PxXnrBCXur6eGR11LqJgVIg?expand[]=latest_charge.balance_transaction" | jq .
twilit minnow
#

The 0.4% invoice fee isn't included in the fee_details

sand escarp
#

ah, yeah, that's what I'm looking for though

#

it it accessible anywhere programmatically?

#

webhook or API?

#

or if not the exact fee information, is there a way to link invoices <--> payouts in a way where I could just do the math (invoice - payout == fees)?

twilit minnow
#

Let me check and I'll get back to you

sand escarp
#

I can see the data I need in the dashboard, just can't find it in the API

#

The line that says "Charges" is the 2.9% + $0.30, which is present in the API... what I need is the line that says "Stripe Fees" which is the 0.4% + ???

#

...or even linking from payment_intent to payout would work as well I suppose

twilit minnow
sand escarp
#

this looks like it works!

curl -H "Authorization: Bearer ${STRIPE_SECRET_KEY}" -XGET "https://api.stripe.com/v1/balance_transactions?payout=po_1Q2R3qBCXur6eGR1KErkJV6u" | jq .
twilit minnow
#

Yes you are right

sand escarp
#

ok, now I just need to figure out the right webhook to be notified when these values are available

#

perhaps use the payout.created webhook, then query the balance_transactions API with the payout ID to get the fee details?

twilit minnow
#

That sounds like a good idea!