Skip to content

Instantly share code, notes, and snippets.

@chihebnabil
Last active July 11, 2017 11:05
Show Gist options
  • Save chihebnabil/9aef9a86cdbcb5fd90cf667ba39f0278 to your computer and use it in GitHub Desktop.
Save chihebnabil/9aef9a86cdbcb5fd90cf667ba39f0278 to your computer and use it in GitHub Desktop.
Paypal Fee Calculator
// Paypal Fee Calculator
// default sum
var sum = 100;
// default rate
feeRate = 0.049;
// default fee
fee = sum * feeRate + 0.3
// to get sum you need to demand to your client sum2
var sum2 = (0.3 + sum) / (1 - feeRate)
// paypal fees deppends on value of sum
switch (true) {
case (sum >= 0 && sum <= 3000):
//alert(sum2);
//alert(sum- fee);
break;
case (sum > 3000 && sum <= 10000):
feeRate = 0.044;
break;
case (sum > 10000 && sum <= 100000):
feeRate = 0.042;
break;
case (sum > 100000):
feeRate = 0.039;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment