Skip to content

Instantly share code, notes, and snippets.

@jrstaatsiii
Last active October 15, 2025 14:21
Show Gist options
  • Save jrstaatsiii/54dd26fe0ec0db806526aa26246469e2 to your computer and use it in GitHub Desktop.
Save jrstaatsiii/54dd26fe0ec0db806526aa26246469e2 to your computer and use it in GitHub Desktop.
flywire.js
<script>
function pay() {
var rawAmount = document.getElementById("amount").value;
var cleanAmount = parseFloat(rawAmount.replace(/[^0-9.]/g, ''));
var email = document.getElementById("email").value;
var firstName = document.getElementById("firstName").value;
var lastName = document.getElementById("lastName").value;
var project_number = document.getElementById("projectNumber").value;
var project_address = document.getElementById("address").value;
if (isNaN(cleanAmount) || cleanAmount <= 0) {
alert("Please enter a valid payment amount.");
return;
}
var js_env = "xxxx"; // Redacted
var js_code = "XXX"; // Redacted
var js_return_url = "https://ssmsrfstaging.wpenginepowered.com/make-a-payment/confirmation/";
var config = {
env: js_env,
recipientCode: js_code,
amount: cleanAmount,
email: email,
firstName: firstName,
lastName: lastName,
currency: 'USD',
requestPayerInfo: true,
requestRecipientInfo: true,
recipientFields: {
"project_number": project_number,
"project_address": project_address
},
readonlyFields: ["project_number", "project_address"],
returnUrl: js_return_url
};
var modal = window.FlywirePayment.initiate(config);
modal.render();
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment