#xfechx-balancetransactions-expand
1 messages · Page 1 of 1 (latest)
Hi what are you questions
Hi @pearl furnace
I need for tax accounting purposes, to provide my tax accountant with formal tax invoices from specific date range (in my case for 2021). The tax invoices should be on the settlement currency (not on the charged currency) and have customer details (email, name, address) as well as my business details. Is there something already out there to be used so that I can print all of the tax invoices that I need to generate?
I need a tax invoice for each specific charge
Oh hm. That would be a better question for our support team. We just help developers use the api in here, and I'm not sure how to do this/if it's possible
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Note that we have an ongoing incident with the dashboard right now though
I do think it is a dev question
How so?
because to do this, the API should be involved
The invoice objects are created in the currency the customer is charged in
I am talking about tax invoices, not stripe invoices.
stripe invoices are not a formal requirement in all countries, they do not have a standard
and invoices are not generated for charges
stripe invoices are related to billing/subscriptions, etc. And just recently Stripe added the invoicing capability to generate one-off invoices.
But many of these charges (2021) are only charges, they are not necessarily invoices.
And they are all in different currencies.
So yes it is a design/dev quesgtion
question*
support will only know about their products. That is useless for me
I am sure many people have this issue
So you want to generate one-off invoices for charges that weren't created via invoicing in the settlement currency not the currency charged?
TAX INVOICES (i.e tax receipts) for tax purposes.
for charges from 2021
for each of them
no they were not necessarily created using invoicing. Some are subscription charges, some are checkout charges, etc.
If you're talking about these, then go to support: https://support.stripe.com/topics/tax-invoices
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
That's not an api feature
I'm not familiar with those
And they're dashboard only
nope
not talking about those
do I need to explain again?
or do you want to read a bit more carefully, sorry
tax invoices are the tax receipts that stripe need to formally generate legally for their platform customers. ie. for me.
Me as a business, I have to generate tax recepts also for my customers and I need to provide these to my tax accountant.
So I need to find a way to generate them, using the API, because there is not a feature out of the dashboard-box
so for each charge, I need to generate a (PDF) tax invoice that includes my business tax number, business name, address, customer name, address, charge description and the settlement need to be in EUR (even if the charge was made in a different currency)
these pdf documents are tax invoices, which are required in certain countries, like Germany.
is it clearer?
hello
Hi 👋
I"m stepping in as my colleague needs to go. However, based on what I have read of this thread your best option is to reach out to Support to address this issue
ok, will reach right now and brb
because to me this seems like a design and development issue, using the API. Support won't know about this.
FYI
this is the code that chat GPT has helped generate:
ChatGPT has been known to invent APIs and functions that have never existed in the Stripe client libraries. You can attempt to use it if you want but I cannot offer any support for it.
hmm so I feel a bit on a dead end
I am trying to obtain help here and you send me to support, support doesn't help with this topic.
you can ignore the chatgpt generated code. I need design help
What data do you need?
I explained above.
I need to, for each payment on 2021
generate a pdf, that has multiple data.
Should I retrieve charges, or should I retrieve payments?
also payments are divided onto two categories, correct? Py, and PI
what should be more effective, charges, payment intents, or payments?
Also, I need the currency to be converted for each of the payments to EUR (settlement currency)
py_ are payments that are the result of non-direct charges such as transfers
pi_ are Payment Intents
If you are just interested in the payments then I recommend using the Charges API
also transfers, please.
so charges, transfers and anything that landed on my account.
This is for tax accounting purposes
In that case, if you wanted to centralize this effort, your best option would be the Balance Transactions API
so I need to account for everything
That will account for anything that impacted the balance of your account
nope, i don't think so , sorry. Because balance doesn't have customer data
transfers, charges and payments do
balance are reconciliations (sums, minus) from moneys received
unless i am wrong
You are not going to get everything you want from one API. But I'm not talking about the balance but the Balance Transactions as a place to start: https://stripe.com/docs/api/balance_transactions/object
The BalanceTransaction object includes the source that triggered the transaction. That will be the Transfer for changes in your balance that were due to transfers or the Charge for payments
You can expand the source property to make less API calls
But you will likely still need to inspect the object returned in the source property and determine how to get customer details from there.
ok, I always kind of struggle expanding
would you mind providing me an example for expanding the source to obatin customer data?
PHP syntax for expanding has always confused me
yes me too. But unfortunately that is the language I use
Okay I just made a simple List request (using Python) and I passed "data.source" as the expand parameter
I have a transaction that iboth includes all the billing details and the source object which is a Charge
awesome
how can I achieve that in PHP?
and if it was the case of a transfer, will it also include the billing details from the platform where the transfer comes from?
$stripe->balanceTransactions->all(['limit' => 3], ['expand'=>['data.source']);
Maybe? But I'm not great at PHP
ok, will try first with this code, then go more complex with filtering with dates
just to make sure this works and expands the needed meta
so with Balance Transactions I pretty much get every charge, payment and transfer?
not sure how many objects there are apart from charge and transfer
Yup. You will want to inspect the type to see what kind of source you will get: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing
We have a good explainer doc for these objects here: https://stripe.com/docs/reports/balance-transaction-types
all balance transactions will be in the settlement currency , correct?
They will have the currency property you can review: https://stripe.com/docs/reports/balance-transaction-types
(add hoc question)
when creating a new stripe client, do I also need to send connect details there? or only on the function calls within the stripe object?
can't see anything related to currencies in the URL you provided..
only the stripe_fx fee ,
It's a property of the BalanceTransaction object: https://stripe.com/docs/api/balance_transactions/object?lang=php#balance_transaction_object-currency
As for Connect requests, we recommend passing the Stripe Account header per request
with this one:
$stripe->balanceTransactions->all(['limit' => 3], ['expand'=>['data.source']); where does the connect parameter go?
Based on the PHP syntax we show here: https://stripe.com/docs/api/connected_accounts I think it the second array.
ok will try this
global $secret_key, $connect;
$connected_account = array('stripe_account' => $connect);
$stripe = new \Stripe\StripeClient($secret_key, $connected_account);
$balance_transactions = $stripe->balanceTransactions->all(['limit' => 3], ['expand'=>['data.source']], $connected_account);
print_r($balance_transactions);
}```
hmm something is wrong with the expand, php is complaining:
Fatal error: Uncaught Stripe\Exception\InvalidArgumentException: Got unexpected keys in options array: expand
Okay can you try moving the expand key to the same array as the limit parameter?
xfechx-balancetransactions-expand
yes that works