#elka_code

1 messages Β· Page 1 of 1 (latest)

limber cedarBOT
#

πŸ‘‹ 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/1326530299894566923

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

smoky depot
#

I want edit What are you working on with this :
I am creating a service for lawyers that will allow them to manage fee agreements online and make payments in instalments under cover of this agreement.

#

A screen to my local BDD is need πŸ™‚

turbid briar
smoky depot
#

Yes but we cant accept more stripe fee πŸ™‚

#

that's why i'am implement this system

turbid briar
#

I don't know anything about fees, you can ask your Sales contact or contact https://support.stripe.com/?contact=true

#

anyways, if you prefer using the Invoicing API over Subscriptions

#

I can help you with that

smoky depot
#

Your invoice scheduling service generates additional stripe fees (0.7% I believe).

#

If is possible yes πŸ™‚

turbid briar
smoky depot
#

I want to manage price HT and VAT value

turbid briar
#

why not just use a Tax Rate?

smoky depot
#

Because if i use it Totals are wrong

turbid briar
#

what's the tax rate here?

smoky depot
#

If i got in my Database 1 facture at 100€ HT
i need send at stripe 3 facture:

  • One at 33.33
  • one at 33.33
  • one at 33.34
#

33.33 *1.2 = 40
33.33 * 1.2 = 40
33.34 *1.2 =40.01

#

total TTC 120.01

turbid briar
#

ok I understand the concept instead of 1 invoice you want 3 invoices at different due dates

smoky depot
#

Exactly !

turbid briar
#

so it's 20%

#

right?

smoky depot
#

You can see in my BDD screen,
Yes for moment is20% but in future i will got various tax rates

turbid briar
#

sure

#

I'm not sure why you want to collect 120.01 instead of 120

smoky depot
#

it's my problem

#

to find out more

turbid briar
#

actually you just need to collect 3 * 40 with inclusive tax of 20% rate

smoky depot
#

So you purpose to split the Total TTC to the "main invoice" instead of total HT ?

turbid briar
#

yes it's going to be 33.33 and 6.67 for 3 invoices

#

yes I think that's how you should approach this

smoky depot
#

you are my πŸ¦† of day

#

I will test this approach

turbid briar
#

if you're using the API, you need to create the tax rate

#

then you create your customer and an invoice for that customer

#

for the invoice item

#

other than the customer and the invoice IDs

#

you can pass a price_data

smoky depot
#

Create tax sure ? πŸ€” we cant let stripe understand this automatically

turbid briar
#
price_data:{
  currency:"eur",
  product: "prod_xxx",
  unit_amount: 4000,
  tax_behavior: "inclusive"
},
quantity: x,
tax_rates: [txr_xxx]
smoky depot
#

I actually do this

        try{
            $clientStripe->invoiceItems->create([
                'customer' => $signatureRequest->getCustomer()->getStripeId(),
                'invoice' => $stripeInvoiceId,
                'price' => $priceId,
                'quantity' => $item->getQuantity(),
            ], [
                'stripe_account' => $signatureRequest->getLawyer()->getSociety()->getStripeAccId(),
            ]);
        }catch (\

I create price on same product when i split invoices

#

I will work on this

#

Thanks a lot πŸ™‚

turbid briar
#

yes but you don't need to create the price ahead of time

smoky depot
#

I need cause of stats 😒

#

We have some graph

turbid briar
smoky depot
#

and i got all of product and price in my Database 😹

turbid briar
smoky depot
#

be honest i am agree with u

turbid briar
#

what if tomorrow you want to offer 4 installment plans instead of 3, you would have to create all prices for all products, it's a big hassle

smoky depot
#

That's not quite how it works in the base.
But I understand the idea you're proposing.

The reality is that I don't have that many products, and I always check if there's more than one.

It's just that it's easier to know which connected_account.

But when there's a need for a product, users can create their price directly.

#

It's B2B2C, my customers need to manage their products and prices for their customers.

#

But I think we're straying from the subject. I don't mind, on the contrary, I'm always open to technical advice.

turbid briar
#

yes that's the point of these discussions on Discord

#

to help guide you through the best choices for your use-case

smoky depot
#

To come back to the solution you proposed, if the total including VAT is 100€, it no longer works.

turbid briar
#

why?

#

it still does

#

that's why I said you need to pass in the price_data yourself

#

this time around the 3 invoices will be 33.33 * 2 and 33.34 TTC

#

the total of your invoices should always be equal to the total you need to collect

#

I really do think that you should pass price_data in your case rather than using price IDs

smoky depot
#

Humm ok

#

But it's nor sorry i make time to answer

#

i'm thinking

turbid briar
smoky depot
#

100 TTC = 83.33 HT
33.33 TTC = 26.67 HT
33.33 TTC = 26.67 HT
33.34 TTC = 26.68 HT

#

If I'm not mistaken

turbid briar
#

don't overthink the VAT and HT values

#

you just need to think of TTC

#

and pass the tax rate (in this case 20%)

#

Stripe will do the calculation for you

smoky depot
#

Yes, but the problem is that we edit the invoices and for accounting purposes we are obliged to have the information.

#

I will make some screenshoot for you u will see

turbid briar
smoky depot
#

That''s my front end vuejs my backend api is in php symfony

limber cedarBOT
turbid briar
#

you don't need to think about this, you just use the numbers generated from the invoice

smoky depot
#

Yes but how i can show invoice in 3 month

#

I can't create it that far into the future with the api

#

so I need to anticipate all the β€œsplit” invoices ?

turbid briar
#

using invoice preview

smoky depot
#

I know what you mean

turbid briar
#

of HT and VAT

smoky depot
#

sorry for the inconvenience but it's really important we're about to finalize a big project

#

but

turbid briar
#

what is still blocking for you?

smoky depot
#

And if I only use the preview data
For an InvoiceItem at 33.33 incl. VAT, I'll get 26.67 excl.
For the second at 33.33 incl. VAT, I'll get 26.67 excl.
For the last one at 33.34 incl. VAT, I'll get 26.68 excl.
If I calculate the 3 invoices, I get a total of 100€ including tax and a total of 80.02€ excluding tax instead of 80€.

Except that I'm displaying the total of the main invoice at 100€ inc. tax and 80 ex.

#

look at 2nd screenshoot

#

In red main invoice in green split invoice

turbid briar
#

invoice at 100€ inc. tax and 80 ex.
the calculation is wrong though

smoky depot
#

Yes, if I divide the amount TTC or HT there is always a case where I end up with distorted amounts when I send to stripe

turbid briar
#

if invoice is 100EUR TTC then you have 83.34 HT

smoky depot
#

Simply because the euro rounding policy is in Half Up

turbid briar
#

not 80

smoky depot
#

ah yes

#

my bad

turbid briar
#

no worries

#

but what I showed you in my screenshot is correct

#

I added the 3 invoice items to the same invoice

#

but it's the same if you put them each on a separate invoice

smoky depot
#

In your screenshoot is not the same invoice ? it's 3 different invoices

turbid briar
#

no in my screenshot it's 3 invoice items on the same invoice

smoky depot
#

Me i got 3 invoice with 1 invoice item

#

i think is the problem

turbid briar
#

no it's not

#

I just added them like this to show you the totals

smoky depot
#

Hum ok πŸ™‚

#

We can let open this thread for the time i testing ? for history ?

#

Or it's difficult for you

turbid briar
#

1st and second invoice

smoky depot
#

ok and last ?

#

πŸ™

turbid briar
#

I told you, you don't have to worry about tax calculation

#

leave that with us

smoky depot
#

Ok i trust you i test and i marry you (joke )

#

The thing is, I need to pre-calculate the value before and after tax of all invoices in advance πŸ™‚

turbid briar
#

you can use the invoice preview as I suggested

smoky depot
#

But I'll get back to it, I understand the information better thanks to you πŸ™‚

#

Yes i will work on

turbid briar
smoky depot
#

Damn i was sorry

turbid briar
#

no worries

smoky depot
#

I'm going back to the code, I'll come back later to tell you about the success if the thread is still open, otherwise thanks for everything.

frosty plover
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

smoky depot
#

oh πŸ‘‹ ! Good luck @frosty plover i was testing, but if you have another approach i reading you

frosty plover
#

Np!