Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

make sure we're charging fees properly #2158

Closed
chadwhitacre opened this issue Mar 18, 2014 · 18 comments
Closed

make sure we're charging fees properly #2158

chadwhitacre opened this issue Mar 18, 2014 · 18 comments

Comments

@chadwhitacre
Copy link
Contributor

Raised by @rcross on #1664:

So it seems that there was a decision made to change the fee computation function, though there doesn't seem to be a rationalisation for why it was changed. In my opinion, the new function is actually incorrect based on the stated fees.

I would expect (X * 1.029) + .30.

However, even if it is (X + .30) * 1.029 this is not the same as (x + .30) / .0971

It is usually a negligible difference that is rounded out, but on large amounts it does make a difference.

For $100:

100_1.029 + .30 = 103.20
(100 + .30)_1.029 = 103.21 (103.2087)
(100 + .30) / .0971 = 103.30 (103.29557158)

for $5000 = [5145.30, 5145.31, 5149.64]

Is this rounding error intentional?

Related issues: #1031

@chadwhitacre
Copy link
Contributor Author

@rcross Good catch! It's not a rounding error; it's intentional. We should update the About/FAQ pages.

When we launched we were charging an additional $0.30 + 3.9% on credit card transactions, using most of that to cover Balanced's card processing fees, and the rest to cover hosting, etc. The fee computation was actually 100 - ((100 + 0.30) * 1.039) = 4.22 (rounded up), and the About page reflected this (fees weren't mentioned on the FAQ at the time):

We add an additional 30¢ + 3.9% fee when pulling money in from your credit card, to cover credit card processing (as well as hosting and other expenses).

One of our open company principles is to charge as little as possible, so in #1031 we dropped our card processing fee to cost, with the rest of Gittip's funding coming from tips to the Gittip team account on Gittip. The fee computation since 20b5fa0 has been ((100 + 0.30) / (1 - 0.029)) - 100 = 3.30 (rounded up). The reason is that Balanced computes their fee as 0.029N - 0.30, and we want you to end up with 100 in your Gittip balance, so we compute the fee using the inverse of Balanced's fee function.

From the point of view of the amount we actually charge you, $103.30, the fee is indeed (N * 2.9%) + $0.30. However, from the point of view of the amount you are trying to give on Gittip, $100, the fee is (N + 0.30) / 0.971.

@chadwhitacre
Copy link
Contributor Author

See #2160 for modified language:

We upcharge to cover a processing fee of 2.9% + 30¢ when pulling money in from your credit card.

@rcross
Copy link

rcross commented Mar 19, 2014

Thanks for clarifying - sounds like someone should tell Balanced that they aren't calculating their fees correctly then.

fwiw - I still think this is wrong. X - ((X + 0.30) / (1 - 0.029)) = gives you a negative value. I think it should be $fee = Y - (Y -.30)/(1+.029)

Balanced's function (if its as you stated) equally gives an incorrect value, as that would be the value without fees.
This makes the fees equivalent to X_(1/.971) + .30 == X_1.0299 + .30, which suggests we need to say 2.99% (or 3% if rounding) + 30¢
Maybe I'm just being pedantic, but it makes a difference when you start looking at larger sums and it doesn't seem to be inline with how other gateways calculate their fees.

Here is the algebra for my $fee equation:

Where X = the base transaction amount, and Y = the total amount charged,
$fee = X*.029 + .30 
Y = X + $fee
Y = X + X*.029 + .30 
Y = X*(1+.029) + .30
X = (Y -.30)/(1+.029)
$fee = Y - X
$fee = Y - (Y -.30)/(1+.029)

@chadwhitacre
Copy link
Contributor Author

X - ((X + 0.30) / (1 - 0.029)) = gives you a negative value.

Sorry, I misspoke. Corrected above from:

100 - ((100 + 0.30) / (1 - 0.029)) = 3.30

to:

((100 + 0.30) / (1 - 0.029)) - 100 = 3.30

@chadwhitacre
Copy link
Contributor Author

Balanced's function (if its as you stated)

Another error on my part, sorry for being so sloppy here. I've corrected:

N - 0.029N - 0.30

to:

0.029N + 0.30

@chadwhitacre
Copy link
Contributor Author

2.99%

Where is this coming from? Did I introduce 2.99% at some point (rather than 2.9%)?

@rcross
Copy link

rcross commented Mar 19, 2014

1/.971 = 1.029866.... i.e. 2.99%

this is ultimately the crux of the issue. Dividing by (1-%fee) is not the same a multiplying by the actual %fee.

@chadwhitacre
Copy link
Contributor Author

Here is the algebra for my $fee equation:

I believe this is the crucial error:

$fee = X*.029 + .30

Isn't $fee calculated on Y, not X? We have X (the amount you want to give) and a function for $fee in terms of Y. We need to solve for Y.

@chadwhitacre
Copy link
Contributor Author

Here is the problem:

Where X = the target amount by which you want to increment your Gittip balance, and 
      Y = the total amount we are going to charge you in order to hit your target,
$fee = Y*.029 + .30
Y = X + $fee

What is the function for X in terms of Y?

@rcross
Copy link

rcross commented Mar 19, 2014

I'm pretty sure the $fee is calculated based on the amount you want to give. However, my algebra also solves for Y.

In english:
If I want to give $100, then I need to pay $100 * 1.029 + .30 = $103.20 of which $3.20 will go to Balanced

If I want to be charged $100, then I will have ($100 - .30)/(1.029) = $96.89 added to my gittip balance, and a fee of $3.11 will go to Balanced

@rcross
Copy link

rcross commented Mar 19, 2014

as above,

in terms of Y
$fee = Y - (Y -.30)/(1+.029)
X = (Y -.30)/(1+.029)

@chadwhitacre
Copy link
Contributor Author

I'm pretty sure the $fee is calculated based on the amount you want to give.

No, it is not. Balanced computes their fee based on the amount we tell them to charge you.

If we tell them to charge you $100.00, they are going to charge you $100.00, and extract a fee from us of $3.20, and we will credit your Gittip account $96.80.

If we tell them to charge you $103.30, they are going to charge you $103.30, and extract a fee from us of $3.30, and we will credit your Gittip account $100.00.

However, my algebra also solves for Y.

Your algebra begins with a faulty assumption:

$fee = X*.029 + .30

should be:

$fee = Y*.029 + .30

@chadwhitacre
Copy link
Contributor Author

No, it is not.

I should say, that's not how Balanced calculates their fee (per example directly above). We on the other hand need to compute Balanced's based on the amount you want to give. Our fee function needs to be the inverse of Balanced's.

@chadwhitacre
Copy link
Contributor Author

IRC Q.E.D. :-)

@rcross
Copy link

rcross commented Mar 19, 2014

After discussion in IRC, chad is correct on the fact that the fee is calculated based on the amount charge and then deducted.

So, in that case

Where X = the target amount by which you want to increment your Gittip balance, and 
      Y = the total amount we are going to charge you in order to hit your target (and the amount used for calculating fees)

$fee = Y*.029+.30
Y = X + $fee
X = Y - $fee
X = Y -  (Y*.029+.30)
X = Y - Y*.029 - .30
X = Y(1-.029)-.30
Y = (X+.30)/1 - .029) 

So, in english:
If I want to give $100, then I need to pay ($100+ .30)/(1-.029) = $103.2955 ($103.30 rounded) of which $3.30 will go to Balanced

If I want to be charged $100, then I will have $100(1 - .029) - .30 = $96.80 added to my gittip balance, and a fee of $3.20 will go to Balanced

Which makes the current approach correct. Apologies for the effort required to clarify this. It also appears that contrary to my assumption (perhaps I was channeling paypal??) that most other gateways calculate it this way as well, so the change to wording is probably sufficient.

@chadwhitacre
Copy link
Contributor Author

Apologies for the effort required to clarify this.

No apologies necessary! I'm grateful to you for taking the time to hash this out. This is a crucial aspect of Gittip and we need to make sure it is correct. Having this discussion in public means that the next person who has the same question can simply review the ground we've covered here. :-)

Cheers! 🍻

@chadwhitacre
Copy link
Contributor Author

P.S. If you want to dive into PayPal, check out masspay.py (which has pending updates in #2097 #2098 #2099). ;-)

@chadwhitacre
Copy link
Contributor Author

You might also have fun with #449 and steady_state.py (which we're not actually using yet).

duckinator pushed a commit that referenced this issue Mar 25, 2014
Update fee verbiage on About/FAQ; #2158
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants