#xfechx-balancereconciliation-php
1 messages · Page 1 of 1 (latest)
where is the history of all the conversation, please?
@solemn pendant you had a question about expand and you seemed unblocked and I'm cleaning up Discord as there are 30+ different people in the past hour
Happy to talk here if you do have more questions! Let me know otherwise if I can archive this thread
yes I do..
we were still figuring out charges, payments and transfers
when I said it worked, it was only a piece of code
this is annoying
Happy to help if you have more questions. I read the thread it seems the real issue was understanding Expand. Now that you have the code working you seemed to have the pieces you were missing
It's not my fault you have a lot of work and questions for a lot of people.
i am not here every day
no the real question was not expand, you did not read properly, sorry man
I'm happy to help if you have further questions now that you have understood how to use Expand
it was about listing all charges, transfers and payments on a specific currency with customer data
it was about balanceTransactions
the other developer was helping me to figure out this
I need to generate tax invoices (pdfs) for each charge and transfer, each of this tax invoices should include customer data, and it should be in EUR, and it should be for the year 2021
he was suggesting to use balance transactions
here for example
That's one approach yes. And you seem to have figured out how to list BalanceTransactions and how to use Expand which is documented and explained in details here: https://stripe.com/docs/expand
You can go from a BalanceTransaction to what caused it by looking at the source property, what you are expanding now, which will have the information you're after
I cannot see the customer billing data
{
echo "$extraString<br><pre>\n" . json_encode($obj, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES) . "\n</pre><br>";
}```
I have this function locally in my PHP install to "pretty print" the API resource
you should try to use this or something like this instea of var_dump() as it'll make it so much easier to read the response/JSON as a human
xfechx-balancereconciliation-php
At a high level, the BalanceTransaction represents money moving into or out of your account balance. They are like a low level record. They link to other objects that caused them. For example a Charge will cause money in, a Refund will cause money out. A Customer creation moves no money, etc.
thing is. I need each charge OR transfer OR any payment received in my account, to be printed
Each BalanceTransaction will have source: 'ch_123' or source: 're_123' etc.
there's no such filter, so you get it all and you ignore what you don't care about in that case
because then with each money in, I need to generate a formal tax invoice, for accounting tax purposes in germany
here they are very strict with tax rules
I know.. but will i be able to get all that info from balancetransaction API call only?
using expand
like customer data
let me print the json in pretty format
yeah
that will make my explanation so much clearer
okay so now as a human this is a lot easier to read
ah so, much better
you can scroll slowly and see things "change" like source was likely source: "ch_3NOfKgHlZBj3A1TO0uiZVImZ" and now it's the whole Charge
and so on that Charge you see "customer": "cus_LPo6srv8zE1x7W", now right?
one thing at a time to make sure you understand
okay so that customer, you can also expand it at the same time. You can expand multiple levels: https://stripe.com/docs/expand#multiple-levels
so you can do $balance_transactions = $stripe->balanceTransactions->all([ 'limit' => 3, 'expand'=>['data.source.customer']], ]);
and instead of seeing customer: "cus_123" you will see the entire Customer object there
and you can expand multiple separate things depending on what source turns out to be
'limit' => 3,
'expand'=>[
'data.source.customer',
'data.source.payment_intent',
'data.source.invoice',
]],
]);```
like for example you can see a Charge's Customer, PaymentIntent and Invoice all in that call. And then you basicaly have to handle all "types" of BalanceTransactions because based on the type the thing inside source will change
sometimes it will be a Refund, or a Payout which you said you don't care about and you'd ignore
or you pass the type parameter on the list call to do them one by one. It's all a bit dependent on what you're after
ok super
so the last question, before i leave you alone
currency
if a original charge was in AUD, but settlement currency in EUR. I need the EUR, not the AUD for example
because I cannot provide tax office with tax invoices in currencies other than EUR
(meaning the settlement currency of the platform)
Just to be clear: you can ask me as many questions as you want/need. Just my team is small and when Discord spikes really high like it did this morning we archive threads a bit faster since we can always reopen new ones as needed (like you did). So if I archive after and you have more questions you can just ask again 🙂
yes, i also have to go. But thanks heaps for your help.
currency conversion is a bit complex, it depends on a lot of factors and whether Connect is involved or not so you can read:
But the trick overall is to basically compare the BalanceTransaction's amount and currency which is what happened to your Stripe account's balance, and the original object's amount and currency like the Charge or Refund which is what the end customer saw.
So if you are in Germany with a 10€ Charge you will get 10€ on the Charge and 10€ on the BalanceTransaction. But if you charge a US customer for $10 you will see $10 on the Charge and say 9€ on the BalanceTransaction as we converted. And if you refund you will see -9€ for a -$10 refund so that the Customer gets back $10 for real (and exchange rates will fluctuate and change those values)
yes, so my question specifically is for example, with my german stripe account, I have customers which pay me sometimes in usd, or aud, or mxn... but for tax office - I have to provide tax invoices in EUR, so not sure how to do that, will I have to make functions to make exchanges, or what is the best approach?
ok, so I for example, would need to grab the amounts and currencies from the balancetransaction instead of from the charges
but I can get customer info from the source (i.e charge)
correct?
exactly
if it were me I'd basically log all in my reporting: what you charged which is the Charge amount, what you got in the BT which is the BT amount, but also the amount net (after Stripe fees) and such. There are many separate pieces that are an "amount" and it depends what you wnat to report exactly
yeah, that would be great. But my accountant is a bit funny
he needs things exactly how he needs them, so I kind of also need to simplify
yeah I guess if I were you I'd generate maybe 2 reports with the same data
like a CSV with all the columns and info for you to make sense of it, and one with exact the info they need
if you keep the right txn_123 on both reports you can at least dig into why something happened to a given BalanceTransaction
ok, perfect. How can I keep the record of this conversation? So that I can open again tomorrow when I am back onto this project?
Thanks a lot, you did help me a lot
or you can use the search in Discord to search for messages from yourself
ok, bye for now @golden orchid cheers!