我有一个在线支付表格,我的客户可以使用它通过托管支付门户向我付款。如果客户使用借记卡付款,则不会产生额外费用。但是,如果客户通过信用卡付款,则需额外支付 2.5% 的管理费。我创建了一个遵循相同结构的基本表单,并使用弹出窗口来显示它们持有正确的值。我遇到的问题是,当我尝试将该值传递给支付门户时,我得到了一个“故障 8”代码。我试图与支付解决方案的提供商解决问题,但他们的帮助不大,我不热衷于升级到他们的“高级计划”和另外 12 个月的麻烦。
基本形式是:
<HTML> <HEAD> <TITLE>Test Input</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function cardHandlingFee (form) { var Notes = form.Notes.value; var amountPaid = form.amountPaid.value; var clientname = form.clientname.value; var CustomerEmail = form.CustomerEmail.value; var percent = 0.025; var CreditCardCharge; var totalCharge;
if ( Notes == "Debit Card" ) { TransactionAmount = amountPaid; alert ("You typed: " + TransactionAmount); } else { CreditCardCharge = amountPaid * percent; totalCharge = parseFloat(amountPaid) + parseFloat(CreditCardCharge); TransactionAmount = totalCharge.toFixed(2); alert ("You typed: " + TransactionAmount); } }
</SCRIPT> </HEAD> <BODY>
<form id="contactform" action="https://(PAYMENT-SOLUTION DETAILS)" method="POST" name="confirm">Enter something in the box: <BR> <p class="padding:2px"> <select id="CardType" name="Notes" required> <option value="Credit Card">Credit Card</option> <option value="Debit Card">Debit Card</option> </select></p>
<p class="padding:2px"><input id="amountPaid" type="number" name="amountPaid" min="0" max="9999" step="0.01" size="4" /> <script type='text/javascript'>
quote = 'This is the quote of the day!';
document.contactForm.TransactionAmount.value = TransactionAmount;
alert(document.contactForm.TransactionAmount.value);
</script>
<p class="padding:2px">Clients full name*<br /><input type="text" name="clientname" value="" /></p>
<p class="padding:2px">Your email address*<br /><input type="email" name="CustomerEmail" value="" /></p>
<input type="submit" onClick="cardHandlingFee(this.form);" value="Submit Card" />
<input type="hidden" name="CustomerID" value="(CLIENT CUS ID)" /> <input type="hidden" id="TransactionAmount" name="TransactionAmount" /> <input type="hidden" name="TransactionCurrency" value="826" /> <input type="hidden" name="RedirectorSuccess" value="http://(CLIENT SITE)/success" /> <input type="hidden" name="RedirectorFailed" value="http://(CLIENT SITE/failed" /> </FORM>
</BODY> </HTML>
对于用这种方法或其他方法解决问题的任何帮助,我将不胜感激。这是在我的 WordPress 网站中。我尝试过 Jquery、Jscript、.innerHTML,但我现在很难过。