带有“min_amount”和“set_customer_limit”的PayPal按钮
我创建了一个带有文本输入的非托管PayPal按钮,让用户定义要支付的金额。这是一个订阅按钮。
现在的问题是,必须有一个最低支付金额,比如101(瑞士法郎- 瑞士法郎)。
根据PayPal HTML-Variables的文档,我可以将隐藏输入中的以下var添加到我的表单中,以使其正常工作。
-
set_customer_limit
值为max_limit_own
-
min_amount
值为101
set_customer_limit
正在工作,但min_amount
不起作用。接受任何金额。
我在技术支持处打开了一张票,但直到现在才回复。
这是我的表格:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<!-- //... -->
<input type="hidden" name="cancel_return" value="mydomain.com/cancel">
<input type="hidden" name="return" value="mydomain.com/paid">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="src" value="1">
<input type="text" name="a3" value="101.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="currency_code" value="CHF">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHostedGuest">
<!-- the concerned inputs -->
<input type="hidden" name="set_customer_limit" value="max_limit_own">
<input type="hidden" name="min_amount" value="101">
<!-- ---- -->
<input type="image" src="https://www.paypalobjects.com/de_DE/CH/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>
至于目前,我只是用JavaScript验证了最低数量,这并不真正安全......
编辑
作为一个想法,我可以实现另一个表单(通过AJAX,onchange,onkeyup等提交),它设置用户在PayPal表单之前给出的最小金额,然后将其放入PayPal输入(再次设置为隐藏):
<input type="hidden" name="a3" value="<?php echo $_POST['pre_min_amount'] ?>">
这样,我可以在提交PayPal表格之前用PhP验证最低金额。但这对我来说似乎不是一个干净的方式。如果有人能给我一个提示,真的很高兴!