贝宝定期捐款代码问题
Posted
技术标签:
【中文标题】贝宝定期捐款代码问题【英文标题】:PayPal Recurring Donations Code Issue 【发布时间】:2017-08-27 10:06:18 【问题描述】:我正在尝试在非营利网站上设置定期捐款选项。我对表格不是很好,我不知道我做错了什么。当您在网站上点击提交时,唯一的价值是进行 5 美元的经常性捐赠。有没有办法允许不同的值?我在互联网上找到了这段代码,所以我可能没有正确设置它。谢谢!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<br />
<table>
<tr>
<td><input type="hidden" name="on0" value=""></td>
</tr>
<tr>
<td><select name="os0">
<option value="Donate">Donate : $5.00 USD – monthly</option>
<option value="Donate">Donate : $10.00 USD – monthly</option>
<option value="Donate">Donate : $20.00 USD – monthly</option>
<option value="Donate">Donate : $30.00 USD – monthly</option>
<option value="Donate">Donate : $40.00 USD – monthly</option>
<option value="Donate">Donate : $50.00 USD – monthly</option>
</select></td>
</tr>
</table>
<p>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIJcQYJKoZIhvcNAQcEoIIJYjCCCV4CAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYANk3Dq48yQkbJ6iiWf/ai4nGOOwxgS0PtBMSIjbIkrDHVxb3uEAJbV8sUuXo6DPK5JzbT8ZBVlcrISUEQxrnONj7GioRLjmuktrH5NDC9x27HIu6/D0EK4w2+LhxDjLQIfqWXnKou5C61ixAcdKuIzYPGTCijXIzOuSBxvh7hBFDELMAkGBSsOAwIaBQAwggLtBgkqhkiG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xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xNzAzMDEwMTA0MjlaMCMGCSqGSIb3DQEJBDEWBBRv6PIpECnU/4Vyiq8eR0aXqXhTgTANBgkqhkiG9w0BAQEFAASBgDao26+v5vt5ojSFsER7S1PNEhL3glFG6X/VAtBakfeE5cDjnx/gdc2b8CJhTluube51zbAqKboiC3xY27AglSsdfE5OIqg3fxdYuVu7uTsPVyk0ow92+Vjh1RpflSXctb0WkT/Q/WWJUWTUb/mYiJM9yK7zIJO9MbbvvZ/meRn2-----END PKCS7-----">
<input type="image" src="http://fallforthebook.org/wp-content/uploads/2017/02/donation-button.png" border="0" name="submit" style="border:0px;">
<img class="colorbox-9288" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" ><br />
【问题讨论】:
【参考方案1】:尝试使用唯一名称来区分选项值。示例 Donate1、Donate 2 等等。
<select name="os0">
<option value="Donate1">Donate : $5.00 USD – monthly</option>
<option value="Donate2">Donate : $10.00 USD – monthly</option>
<option value="Donate3">Donate : $20.00 USD – monthly</option>
<option value="Donate4">Donate : $30.00 USD – monthly</option>
<option value="Donate5">Donate : $40.00 USD – monthly</option>
<option value="Donate6">Donate : $50.00 USD – monthly</option>
</select>
【讨论】:
【参考方案2】:发布的代码是一个加密的按钮代码。不能对代码进行任何更改。请参考下面的示例代码
<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="business" value="test@test.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Donate To My Organization">
<input type="hidden" name="item_number" value="1234">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="src" value="1">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted">
<table>
<tr><td>When would you like this donation to Recur</td></tr>
<tr><td><select name="t3">
<option value="D">Daily </option>
<option value="M">Monthly </option>
<option value="Y">Yearly </option>
</select> </td></tr>
<tr><td>How many times would you like this to recur? (including this payment)</td></tr>
<tr><td><select name="srt">
<option value="0">Never End</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select></td></tr>
<tr><td>Enter your Donation Amount</td></tr>
<tr><td><input type="text" name="a3" maxlength="200"></td></tr>
</table>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" >
<img border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" >
</form>
【讨论】:
非常感谢大家!我把我的代码改成了这个,效果很好!【参考方案3】:该按钮无法检测到您列出的选项的原因是该按钮是一个加密按钮,它不会与您在表单中提供的任何其他代码一起生效,因为它已经修复并使用了加密信息。
最佳解决方案是按照以下链接中的步骤操作,您将能够在您的 PayPal 帐户下创建一个新按钮。目前,您提供的按钮代码位于不同的 PayPal 帐户下,因为您是从属于该人的其他地方复制的。
https://www.angelleye.com/how-to-create-a-paypal-button/
此外,关于您对定期捐款的询问,使用贝宝捐款按钮时,此功能将不再可用。唯一的选择是通过创建“订阅”按钮进行定期捐赠。
您可以使用来自@PP_MTS_Azleen 答案的示例按钮作为订阅按钮。但请务必将此代码的值更改为您的 PayPal 帐户电子邮件地址:
【讨论】:
以上是关于贝宝定期捐款代码问题的主要内容,如果未能解决你的问题,请参考以下文章