PayPal Fee Calculator

PayPal Fee Calculator

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>PayPal Fee Calculator</title>
<link rel=”stylesheet” href=”styles.css”>
<Style>/* styles.css */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}

.calculator-container {
max-width: 400px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}

.input-group {
margin-bottom: 15px;
}

.input-group label {
display: block;
margin-bottom: 5px;
}

.input-group select,
.input-group input[type=”number”] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
}

button {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}

button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class=”calculator-container”>
<h1>PayPal Fee Calculator</h1>
<div class=”input-group”>
<label for=”amount”>Transaction Amount:</label>
<input type=”number” id=”amount” placeholder=”Enter amount” min=”0″>
</div>
<div class=”input-group”>
<label for=”transaction-type”>Transaction Type:</label>
<select id=”transaction-type”>
<option value=”goods-and-services”>Goods and Services</option>
<option value=”friends-and-family”>Friends and Family</option>
</select>
</div>
<div class=”input-group”>
<label for=”recipient-location”>Recipient Location:</label>
<select id=”recipient-location”>
<option value=”domestic”>Domestic</option>
<option value=”international”>International</option>
</select>
</div>
<div class=”input-group”>
<label for=”currency”>Currency:</label>
<select id=”currency”>
<option value=”USD”>USD</option>
<option value=”EUR”>EUR</option>
<option value=”GBP”>GBP</option>
<!– Add more currency options as needed –>
</select>
</div>
<button onclick=”calculateFees()”>Calculate Fees</button>
<div id=”result”></div>
</div>

<script>// script.js
function calculateFees() {
const amount = parseFloat(document.getElementById(‘amount’).value);
const transactionType = document.getElementById(‘transaction-type’).value;
const recipientLocation = document.getElementById(‘recipient-location’).value;
const currency = document.getElementById(‘currency’).value;

let feePercentage;
if (transactionType === ‘goods-and-services’) {
feePercentage = recipientLocation === ‘international’ ? 4.4 : 2.9;
} else {
feePercentage = 0;
}

const fee = amount * (feePercentage / 100);
const totalAmount = amount + fee;

document.getElementById(‘result’).innerHTML = `
<p><strong>Transaction Amount:</strong> ${amount} ${currency}</p>
<p><strong>PayPal Fee:</strong> ${fee.toFixed(2)} ${currency}</p>
<p><strong>Total Amount (including fees):</strong> ${totalAmount.toFixed(2)} ${currency}</p>
`;
}
</script>
</body>
</html>

Leave a Comment