#xfechx-balancetransactions-expand

1 messages · Page 1 of 1 (latest)

lapis prairieBOT
pearl furnace
#

Hi what are you questions

heavy marlin
#

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

pearl furnace
#

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

#
#

Note that we have an ongoing incident with the dashboard right now though

heavy marlin
#

I do think it is a dev question

pearl furnace
#

How so?

heavy marlin
#

because to do this, the API should be involved

pearl furnace
#

The invoice objects are created in the currency the customer is charged in

heavy marlin
#

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

pearl furnace
#

So you want to generate one-off invoices for charges that weren't created via invoicing in the settlement currency not the currency charged?

heavy marlin
#

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.

pearl furnace
#

If you're talking about these, then go to support: https://support.stripe.com/topics/tax-invoices

#

That's not an api feature

#

I'm not familiar with those

#

And they're dashboard only

heavy marlin
#

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?

lapis prairieBOT
heavy marlin
#

hello

bronze surge
#

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

heavy marlin
#

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.

#

this is the code that chat GPT has helped generate:

bronze surge
#

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.

heavy marlin
#

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

bronze surge
#

What data do you need?

heavy marlin
#

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)

bronze surge
#

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

heavy marlin
#

also transfers, please.

#

so charges, transfers and anything that landed on my account.

#

This is for tax accounting purposes

bronze surge
#

In that case, if you wanted to centralize this effort, your best option would be the Balance Transactions API

heavy marlin
#

so I need to account for everything

bronze surge
#

That will account for anything that impacted the balance of your account

heavy marlin
#

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

bronze surge
#

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.

heavy marlin
#

ok, I always kind of struggle expanding

#

would you mind providing me an example for expanding the source to obatin customer data?

bronze surge
#

PHP syntax for expanding has always confused me

heavy marlin
#

yes me too. But unfortunately that is the language I use

bronze surge
#

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

heavy marlin
#

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?

bronze surge
#
$stripe->balanceTransactions->all(['limit' => 3], ['expand'=>['data.source']);

Maybe? But I'm not great at PHP

heavy marlin
#

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

bronze surge
heavy marlin
#

all balance transactions will be in the settlement currency , correct?

bronze surge
heavy marlin
#

(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 ,

bronze surge
#

As for Connect requests, we recommend passing the Stripe Account header per request

heavy marlin
#

with this one:
$stripe->balanceTransactions->all(['limit' => 3], ['expand'=>['data.source']); where does the connect parameter go?

bronze surge
heavy marlin
#

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

lapis prairieBOT
bronze surge
#

Okay can you try moving the expand key to the same array as the limit parameter?

frank parcel
#

xfechx-balancetransactions-expand

heavy marlin
#

yes that works