paypal / here-sideloader-api-samples

Sideloader API samples that enable to integrate PayPal Here into other apps
Other
24 stars 32 forks source link

Set tax rate BEFORE DISCOUNT #38

Closed EddieLukeAtmey closed 8 years ago

EddieLukeAtmey commented 8 years ago

So, my iOS app is design to set the tax rate before discount, but when I tried using pph, sending an invoice with both discount and taxRate, it'll always be tax after discount. Therefore, the grandTotal will be incorrect from my original order (tax after discount would < tax before discount). How can I fix this? Should I have to recalculate my taxRate base on the discount??????

EddieLukeAtmey commented 8 years ago

As for now, I'm tending to use a work-around solutions:

Remove taxRate (taxRate = 0), add unit taxAmount to unit price and send invoice to pph. I don't think it's a good practice, but we're running out of time (submit app schedule). At least, suggest me another work-around that is better. Thanks.

jaredegan commented 8 years ago

There's currently no mechanism to control the order of these calculations. Your workaround sounds fine in my opinion. Another thing you could do that might look cleaner is to take the total of all the tax and add it as a new item called "Tax". That way the breakdown will still show tax as tax and your unit prices will seem more consistent.

djMax commented 8 years ago

Just to make sure I understand - can you provide an example with real numbers and totals? I agree with Jared that your workaround sounds ok, but there might be other ways to get it to do what you want. With real numbers I can run some tests over here and see.

EddieLukeAtmey commented 8 years ago

Thanks Jaredegan for your workaround solution. After discussed with my manager, we decide over my solution. I think paypal here should have an option to set tax AFTER or BEFORE discount.

@djMax Okay, here's some real numbers of my case:

Name Price Tax Qty Total
productA $ 500 10% 1 $ 550
productB $ 1 10% 1 $ 1.1

name value
Subtotal $ 501
Tax amount $ 50.1 (desired)
$ 45.09 (pph value)
Discount (10%) $ 50.1
GrandTotal $ 501 (desired)
$ 495.99 (pph value)
djMax commented 8 years ago

Sorry for the slow reply... So, I think a field called "taxCalculatedAfterDiscount" should fix this (at the invoice level). It should be passed as true for your desired result. Can you let me know if that works.

EddieLukeAtmey commented 8 years ago

@djMax WOW! It really does work. Only that the desired in my case is set "taxCalculatedAfterDiscount" = false. Thank you so much. We've already submit the app that have the workaround solution, so we'll include this fix in the next version.