The client application (app, dApp, or website) should have a form that collects essential details, such as:
<form id="paymentForm">
<input type="email" id="customerEmail" placeholder="Enter your email" required />
<input type="text" id="customerId" placeholder="Enter Customer ID" required />
<input type="number" id="amount" placeholder="Enter Amount in USD" required />
<button type="submit">Pay with PayRam</button>
</form>
<script>
document.getElementById("paymentForm").addEventListener("submit", async (event) => {
event.preventDefault();
const customerEmail = document.getElementById("customerEmail").value;
const customerId = document.getElementById("customerId").value;
const amount = document.getElementById("amount").value;
const response = await fetch("http:yourprojectwebsite.com/initiate-payment", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ customerEmail, customerId, amountInUSD: amount })
});
const result = await response.json();
window.location.href = result.url; // Redirect to PayRam payment link
});
</script>