#marcus_webhooks

1 messages ¡ Page 1 of 1 (latest)

lavish coveBOT
#

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

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

solar mortar
#

I am listening to the invoice paid event over a webhook. The currency for my customers is USD - but my account is paid in Euro by Stripe and my earnings are also paid in Euro by Stripe to my bank account. I want to automate my tax, so whenever I receive money from Stripe I want to calculate the USD amount to Euro so I know what I will receive on my bank account (minus fees.. this is handled separatetly). Is there a field in the payload, or is there an endpoint or something that can tell me the exact amounts in Euro?

stoic harbor
#

hey there, taking a look, just a minute

solar mortar
#

It seems.. I might be able to get it within the same call.. when I extend the object:
stripeInvoice.getPaymentIntentObject().getLatestChargeObject().getBalanceTransactionObject().getExchangeRate();
--- Is that the exchange rate to my own currency (EURO) - and will this be correct and fitting the transaction? How to extend the call to reteieve the Exchange Rate for the invoice?

#

Wait.. I get the invoice over a webhook.. and if I remember correctly.. I cant use extension objects with webooks.. so I guess I need a new just in time call to the stripe api anyway?

stoic harbor
#

I was just about to explain grabbing that payment intent + charge + balance transaction to get the amount that will settle in your account

solar mortar
#

Can I use - BalanceTransaction.retrieve(balanceTransactionId, requestOptions); instead?

#

is the balanceTransactionId the ID of the invoice??

stoic harbor
#

Is that the exchange rate to my own currency (EURO) - and will this be correct and fitting the transaction?
Its the conversion rate of the proceeds of the payment from the presentment currency to what will settle in your balance

#

How to extend the call to reteieve the Exchange Rate for the invoice?
You can't -- this doesnt exist

#

If the customer pays in USD, the "exchange rate" of that payment is between them and their bank

solar mortar
#

stripeInvoice.getPaymentIntentObject().getLatestChargeObject().getBalanceTransactionObject().getExchangeRate(); - you mean this is between them and their banl

#

so thats not what I want at all

stoic harbor
#

is the balanceTransactionId the ID of the invoice??
No, balance transactions are separate object, atomic change to your stripe account balance related to payments, payouts, fees, transfers, etc

#

stripeInvoice.getPaymentIntentObject().getLatestChargeObject().getBalanceTransactionObject().getExchangeRate(); - you mean this is between them and their banl
no, thats the conversion from the USD proceeds of the payment to your euro balance

solar mortar
#

ok so .. which endpoint to use - for invoices, for refunds, for credits

#

or should I use the charge endpoint to get the values I received (Charge succeeded and Charge refunded).. but no idea if this will have the excchange rate

stoic harbor
#

What are you trying to do?

solar mortar
#

ok, it's about tax

#

I want to report, to my accounting app lexware

#

the money I earn and loose

#

so whenever I get or pay money, I want to tell lexware

#

I have a InvoicePaid Webhook Handler

#

And I have a CreditNote Handler

stoic harbor
#

At the start, you asked this:

whenever I receive money from Stripe I want to calculate the USD amount to Euro so I know what I will receive on my bank account (minus fees.. this is handled separatetly)
which is the eur amount on the balance transaction tied to the invoice payment.

now you're asking something else entirely it seems, so i am trying to udnerstand your goal.

solar mortar
#

Well my currency is EURO

#

my clients subscriptiosn run in USD

#

so I need to get the value, at the right time, from the right webhook, convert it to the exact correct EURO that Stripe will give/take from /to me

#

and send it to Lexware

stoic harbor
#

the exact correct EURO that Stripe will give/take from /to me
this is still going to be best represented by the payment balance transaction amount

#

That's the only place that shows the expected amount landing in your balance in euro and after fees

solar mortar
#

BalanceTransaction.retrieve(balanceTransactionId, requestOptions);

#

so this is correct? What is the "balanceTransactionId" - is it the id of a charge or the id of the invoice, credit/refund?

#

How can I retrieve, once / month, the report that shows me all the fees stripe charged me in total?
GPT tells me to listen to these 2 events -

reporting.report_type.updated
reporting.report_run.succeeded
and then see if the report type is THAT in both cases.. is that correct?

"tax.transactions.itemized.2"

stoic harbor
solar mortar
#

so how do I get the right balance transaction for a given invoice / amount??

stoic harbor
stoic harbor
solar mortar
#

yeah but.. the invoice is coming over a webhook. the payment intent is an object and the webhook object cant be extended, right? So either I do a second call TO stripe retrieving the payment intent with last carge and balance transaction.. or maybe how about listening to the carge refunde and charge succeeded events, directly getting the balance transaction id, and making one call to retrieve the fxRate... What's the best way?
//
String balanceTxnId = charge.getBalanceTransaction() - maybe I should instead listen to the carge_refunded and charge_succeed webhook.. will this also give me the amounts paid and the name of the customer similar to the invoice.. and then I could retrieve the balance transaction id from there and retrieve the exchange rate...

lavish coveBOT