Skip to content

Instantly share code, notes, and snippets.

@luisgdev
Created September 7, 2022 21:37
Show Gist options
  • Select an option

  • Save luisgdev/681a0ae1c83ed647e63087abc83a5fc0 to your computer and use it in GitHub Desktop.

Select an option

Save luisgdev/681a0ae1c83ed647e63087abc83a5fc0 to your computer and use it in GitHub Desktop.
Paypal Fee Calculator
def paypal_fee() -> None:
"""
Paypal Fee Calculator
"""
FEE_RATE: float = 0.054
TRANSACTION_CHARGE: float = 0.3
print("Let's calculate a paypal transaction fee.")
amount = float(input("Amount ($): "))
fee = amount * FEE_RATE + TRANSACTION_CHARGE
full_amount = (amount + TRANSACTION_CHARGE) / (1 - FEE_RATE)
print(
f" * Sending: $ {amount}, "
f"they receive: $ {round(amount-fee, 2)}, "
f"fee is: $ {round(fee, 2)}"
)
print(
f" * Sending: $ {round(full_amount, 2)}, "
f"they receive: $ {round(amount, 2)}, "
f"fee is: $ {round(full_amount-amount, 2)}"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment