#marcus_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ 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.
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?
hey there, taking a look, just a minute
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?
I was just about to explain grabbing that payment intent + charge + balance transaction to get the amount that will settle in your account
Can I use - BalanceTransaction.retrieve(balanceTransactionId, requestOptions); instead?
is the balanceTransactionId the ID of the invoice??
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
stripeInvoice.getPaymentIntentObject().getLatestChargeObject().getBalanceTransactionObject().getExchangeRate(); - you mean this is between them and their banl
so thats not what I want at all
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
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
What are you trying to do?
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
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 theeuramount 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.
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
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
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"
Neither, it is the balance transaction, that is a separate object type
so how do I get the right balance transaction for a given invoice / amount??
This is very different than what you asked originally.
You should be able to get this from the reports you can produce in your dashboard, but we can't offer much guidance on that.
Refer to this: https://docs.stripe.com/reports/balance
See the "Balance change from activity summary" section, which includes fees.
This is what we already looked at, going from the invoice -> payment_intent -> latest_charge -> balance_transaction
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...