我正在使用PayPal订阅 我有paypal订阅按钮的问题。我订阅了4个订阅选项按钮。我想在查询字符串中添加此选定选项。所以我的查询字符串将如下所示:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-lick&hosted_button_id=Y1TOJTYQ2ALDJ&os0=Silver Membership
在上面的查询字符串中,我想为os0参数设置选定的选项。
我的代码:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="hosted_button_id" value="X9TEPZ7Q2ALDJ"/>
<table>
<tr><td><input type="hidden" name="on0" value="Memberships">Memberships</td></tr><tr><td>
<select name="os0">
<option value="Registration - One month">Registration - One month : $1.00USD - monthly</option>
<option value="Trial Membership">Trial Membership : $25.00USD - monthly</option>
<option value="Silver Membership">Silver Membership : $250.00USD - yearly</option>
<option value="Gold Membership">Gold Membership : $400.00USD - yearly</option>
</select>
</td></tr>
</table>
<input type="hidden" name="currency_code" value="USD"/>
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online."/>
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"/>
<a id="paypalDonate" target="_blank" href ="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y1TOJTYQ2ALDJ&os0=document.getelementbyid(os0).value">
<img border="0" id="payPalImage" src="https://www.paypalobjects.com/en_GB/i/btn/btn_subscribeCC_LG.gif" alt="Donate to DevtheWeb.NET" />
</a>
</form>
答案 0 :(得分:0)
这是不可能的。要么不使用下拉菜单并使用PayPal提供给您的电子邮件链接(基本上是您拥有的链接,减去选项选项),或使用<form>
POST。
您无法将下拉选项与链接组合在一起。
答案 1 :(得分:0)
我通过使用ImageButton而不是锚标记解决了这个问题。
如下:
<asp:ImageButton ID="payPalImage" ImageUrl="https://www.paypalobjects.com/en_GB/i/btn/btn_subscribeCC_LG.gif" runat="server" OnClick="payPalImage_Click" />
在ImageButton的click事件中,在后端文件(.cs文件)中,我附加了所选的订阅选项,如:
protected string _SubscriptionVal = "";
....
protected void payPalImage_Click(object sender, ImageClickEventArgs e)
{
_SubscriptionVal = Request["os0"];
Response.Redirect("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X34EQZ8Q2AFASLDJ&os0="+_SubscriptionVal);
}
最后我能够使用适当的值重定向到paypal帐户。