在付款按钮上添加自己的金额 [英] Adding Own amount on payment button

查看:96
本文介绍了在付款按钮上添加自己的金额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何在付款按钮中插入自定义金额。供应商(Payfast)不允许只有支付链接,客户可以在其中输入自己的金额,金额必须在链接中指定。

Does anyone know how I could go about inserting a custom amount in a payment button. The vender (Payfast) does not allow just a payment link where a customer can enter their own amount, the amount has to be specified in the link.

以下是链接:

<a href="https://www.payfast.co.za/eng/process?cmd=_paynow&receiver=support%40payfast.co.za&?item_name=Black+Eye+Boxing+Gloves&amount=129.99″>

在按下之前,我希望用客户进入某个字段的金额替换为129.99的金额链接。这可能吗?唯一的其他途径似乎是严厉的黑客攻击精致的电子商务插件,如woocommerce +命名你的价格...我相信有一个简单,优雅的解决方案......

The amount of 129.99 I want to have replaced with the amount a customer enters into a field before pressing the link. Is this possible? The only other route seems to be severe hacking of sophisticated ecommerce plugins like woocommerce + name your price... I am sure there is a simple, elegant solution...

推荐答案

默认情况下,将标签中的href属性留空,并为其指定一个

By default leave the href attribute in the tag empty and give it a id

<input type='text' name='payment' onblur="add_value(this.value);">
<a id='pay_button'>Pay</a>
<script type='text/javascript'>
function add_value(value)
{
var url = 'https://www.payfast.co.za/eng/process?md=_paynow&receiver=support%40payfast.co.za&?item_name=Black+Eye+Boxing+Gloves&amount='+value;
var elem = document.getElementById('pay_button');
elem.setAttribute("href", url);
}
</script>

这篇关于在付款按钮上添加自己的金额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆