【问题标题】:PayPal code works until I add prices for options?在我为选项添加价格之前,PayPal 代码是否有效?
【发布时间】:2015-07-28 00:59:37
【问题描述】:

不知道具体要问什么,但我已按照 PayPal 开发者网站上的说明进行操作: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/buynow_buttons/

还有一个问题。我有一个表格:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="myemail@myaddress.com">
    <input type="hidden" name="bn" value="MR_BuyNow_WPS_CA">
    <input type='hidden' name='lc' value='CA'>
    <input type="hidden" name="currency_code" value="CAD">
    <input type="hidden" name="no_shipping" value="0">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="return" value="/design/payments/success/">
    <input type="hidden" name="cancel_return" value="/design/payments/failed/">
    <input type="hidden" name="cbt" value="Return to MR">
    <input type="hidden" name="item_number" value="buy-time">
    <table>
        <tr><td>
            <p>Provide the following:</p>
        </td></tr>
        <tr><td>
            <div class="row collapse">
                <div class="small-3 columns">
                    <span class="prefix"><span data-tooltip aria-haspopup="true" class="has-tip" title="Please provide your full name as it appears on the order form.">Name:</span></span>
                </div>
                <div class="small-9 columns">
                    <input type="text" placeholder="What is your name?" name="os0" maxlength="200">
                </div>
            </div>
            <div class="row collapse">
                <div class="small-12 columns">
                    <select name="item_name">
                        <option value="Maintenance Hours">Maintenance</option>
                        <option value="General Work Hours">General Work (Additions, etc.)</option>
                    </select> 
                </div>
            </div>
            <div class="row collapse">
                <div class="small-12 columns">
                    <select name="os1">
                        <option value="2 Hours ($50/Hour)">2 Hours ($50/Hour) - $100.00 CAD</option>
                        <option value="3 Hours ($45/Hour)">3 Hours ($45/Hour) - $135.00 CAD</option>
                        <option value="4 Hours ($45/Hour)">4 Hours ($45/Hour) - $180.00 CAD</option>
                        <option value="5 Hours ($45/Hour)">5 Hours ($45/Hour) - $225.00 CAD</option>
                        <option value="6 Hours ($45/Hour)">6 Hours ($45/Hour) - $270.00 CAD</option>
                    </select> 
                </div>
            </div>
        </td></tr>
    </table>

    <input type="hidden" name="on0" value="Client">
    <input type="hidden" name="on1" value="Hours">
    <input type="image" class="payments-buy" src="http://mrobertsdesign.ca/img/payments_buy.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>

现在它在技术上可以正常工作(至少会进入贝宝购买页面),直到我实际添加按钮的价格:

<input type="hidden" name="option_select0" value="2 Hours">
<input type="hidden" name="option_amount0" value="100.00">
<input type="hidden" name="option_select1" value="3 Hours">
<input type="hidden" name="option_amount1" value="135.00">
<input type="hidden" name="option_select2" value="4 Hours">
<input type="hidden" name="option_amount2" value="180.00">
<input type="hidden" name="option_select3" value="5 Hours">
<input type="hidden" name="option_amount3" value="225.00">
<input type="hidden" name="option_select4" value="6 Hours">
<input type="hidden" name="option_amount4" value="270.00"> 

如果有任何经验的人能指出我遗漏的东西,那就太好了 =)

【问题讨论】:

    标签: html forms paypal


    【解决方案1】:

    我不完全确定您的目标是什么,但是使用 PayPal 的内置下拉菜单作为按钮会更容易吗?由于您基本上是在说小时费率打折,您可以使用设置为 50 美元的“立即购买”按钮,如果他们选择 3 个或更多数量,则折扣为 45 美元。希望这会有所帮助。

    【讨论】:

    • 其实你帮了很多忙,这是个好主意...不过我想设置一个限制,我不希望有人能买我的生活哈哈,但我不希望如果可以通过这种方式使用他们的内置功能,如果我更改贝宝帐户,那么麻烦会少得多
    【解决方案2】:

    事实证明,&lt;option value="A"&gt;&lt;input type="hidden" name="option_selectX" value="B"&gt;&lt;input type="hidden" name="option_amountX" value="C"&gt; 中的 ABC 的值必须 (1) 不能包含任何大写字母、特殊字符或空格,(2) 它也必须是字母数字或至少包含一个字母,并且 (3) 是一个完整的短语:

    接受:

    1plug
    thisisananswer
    5000b
    

    我不接受:

    1
    1 plug
    5000
    this is an answer
    

    这对我来说很奇怪,因为 &lt;option value="A"&gt; 的值在我包含 &lt;input type="hidden" name="option_selectX" value="B"&gt;&lt;input type="hidden" name="option_amountX" value="C"&gt; 之前可能包含空格。

    我花了一点时间试错才弄明白。

    【讨论】:

      猜你喜欢
      • 2013-12-18
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      • 2014-05-04
      • 2012-11-19
      • 2020-09-29
      • 1970-01-01
      • 2016-01-23
      相关资源
      最近更新 更多