<!DOCTYPE html>
<html>
<head>
<title>Sample Webpage</title>
<!-- <link rel="stylesheet" href="style.css" /> -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
<style>
body {
font-family: "Inter", sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
.container {
margin: 0 auto;
padding: 40px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
background-color: #ffffff;
}
.heading__section {
width: 40%;
display: flex;
flex-direction: column;
}
.heading__3 {
font-size: 36px;
color: rgba(14, 35, 84, 1);
line-height: 52px;
font-weight: 600;
}
.form__section {
width: 40%;
border: 1px solid #cdd0d8;
border-radius: 8px;
}
.form {
width: 80%;
margin: 20px auto;
}
.input-container {
margin-top: 20px;
}
.input-label {
display: block;
font-weight: bold;
margin-bottom: 10px;
}
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #cdd0d8;
border-radius: 8px;
}
select {
width: 80%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #dddddd;
border-radius: 8px;
-moz-appearance: none;
/* Firefox */
-webkit-appearance: none;
/* Safari and Chrome */
appearance: none;
background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24'
xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
background-repeat: no-repeat;
/* position: absolute; */
background-position-x: 100%;
background-position-y: 5px;
padding-right: 30px;
}
.btn-container {
text-align: center;
margin-top: 20px;
}
input[type="submit"] {
width: 50%;
padding: 10px;
background-color: #4caf50;
color: #ffffff;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
}
input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<main class="container">
<section class="heading__section">
<img src="http://cdn.mcauto-images-production.sendgrid.net/f68bcdf32c03483b/817e48b9-9973-4a68-9225-11b13fa25a3f/96x96.png"/>
<h3 class="heading__3">Experience smooth, easy payments with Payaza</h3>
</section>
<section class="form__section">
<form class="form" action="process_form.php" method="POST" id="myForm">
<div class="input-container">
<label class="input-label" for="merchant_key">Merchant Key:</label>
<input
class="input-field"
type="text"
id="merchant_key"
name="merchant_key"
required
/>
</div>
<div class="input-container">
<label class="input-label" for="connection_mode"
>Connection Mode:</label
>
<select id="connection_mode" name="connection_mode">
<option value="Live">Live</option>
<option value="Test">Test</option>
</select>
</div>
<div class="input-container">
<label class="input-label" for="checkout_amount">Amount:</label>
<input
class="input-field"
type="number"
id="checkout_amount"
name="checkout_amount"
required
/>
</div>
<div class="input-container">
<label class="input-label" for="currency_code"
>Currency Code:</label
>
<select id="currency_code" name="currency_code">
<option value="NGN">NGN</option>
<option value="USD">USD</option>
</select>
</div>
<div class="input-container">
<label class="input-label" for="email_address">Email:</label>
<input
class="input-field"
type="email"
id="email_address"
name="email_address"
required
/>
</div>
<div class="input-container">
<label class="input-label" for="first_name">First Name:</label>
<input
class="input-field"
type="text"
id="first_name"
name="name"
required
/>
</div>
<div class="input-container">
<label class="input-label" for="last_name">Last Name:</label>
<input
class="input-field"
type="text"
id="last_name"
name="name"
required
/>
</div>
<div class="input-container">
<label class="input-label" for="phone_number">Phone:</label>
<input
class="input-field"
type="tel"
id="phone_number"
name="phone"
required
/>
</div>
<div class="input-container">
<label class="input-label" for="transaction_reference"
>Reference:</label
>
<input
class="input-field"
type="text"
id="transaction_reference"
name="transaction_reference"
required
/>
</div>
<div class="btn-container">
<input class="input-field" type="submit" value="Submit" />
</div>
</form>
</section>
</main>
</body>
<script>
document
.getElementById("myForm")
.addEventListener("submit", function (event) {
event.preventDefault(); // Prevent form submission
// Get form field values
var merchant_key = document.getElementById("merchant_key").value;
var connection_mode = document.getElementById("connection_mode").value;
var checkout_amount = document.getElementById("checkout_amount").value;
var currency_code = document.getElementById("currency_code").value;
var email_address = document.getElementById("email_address").value;
var first_name = document.getElementById("first_name").value;
var last_name = document.getElementById("last_name").value;
var phone_number = document.getElementById("phone_number").value;
var transaction_reference = document.getElementById(
"transaction_reference"
).value;
console.log("i got hereeeeee");
// Build URL with form field values
var url =
"https://payaza.africa/payment-page?merchant_key=" +
encodeURIComponent(merchant_key) +
"&connection_mode=" +
encodeURIComponent(connection_mode) +
"&checkout_amount=" +
encodeURIComponent(checkout_amount) +
"¤cy_code=" +
encodeURIComponent(currency_code) +
"&email_address=" +
encodeURIComponent(email_address) +
"&first_name=" +
encodeURIComponent(first_name) +
"&last_name=" +
encodeURIComponent(last_name) +
"&phone_number=" +
encodeURIComponent(phone_number) +
"&transaction_reference=" +
encodeURIComponent(transaction_reference);
console.log("=====>", url);
const a = document.createElement("a");
a.href = url;
a.click();
// Redirect to the constructed URL
// window.location.href = "http://127.0.0.1:5500/Webpage.html";
});
</script>
</html>