创建收集所需自定义数据的PayPal按钮

时间:2013-04-30 19:46:43

标签: paypal

我知道这可能是一个愚蠢的问题。我试过搜索,但无法找到我正在寻找的东西。或许我找到了它,而且我太无知了。在任何一种情况下,我们都不是程序员,只是尝试在PayPal中设置捐赠按钮并需要一些帮助。

我们正在尝试使用按钮生成器创建的简单PayPal捐赠按钮接受捐赠。对于报告要求,我们必须收集每个贡献者的地址,职业和雇主。

是否有一种简单的方法可以将这些必填字段添加到按钮代码中?我们不关心它们是否映射到未使用的PayPal字段(例如拍卖ID或商品ID),但我们确实希望在PayPal结帐时收集此信息,而无需创建我们自己的表单。

有没有办法只使用按钮并要求PayPal收集这些额外的字段?

提前感谢您的任何帮助。

3 个答案:

答案 0 :(得分:3)

无法要求PayPal收集数据。但是,您可以使用类似以下示例的内容。我过去曾经用过这个。

<script type="text/javascript"> 

function UpdateForm (obj1) { 

var themessage = "You are required to complete the following fields: ";

if (obj1.amount.value=="") {
themessage = themessage + " - Amount";
}

if (obj1.item_name.value=="") {
themessage = themessage + " - Candidate's Name";
}

if (obj1.firstname.value=="") {
themessage = themessage + " - First Name";
}

//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
obj1.submit();
}
else {
alert(themessage);
return false;
   }


 obj1.item_name.value = "Donation for: " + obj1.item_name.value ;
 obj1.os0.value = obj1.firstname.value + " " + obj1.lastname.value +"- Address: " + obj1.address1.value +  " " + obj1.address2.value + ", " + obj1.city.value + ", " + obj1.state.value +  " " + obj1.zip.value; // + obj1.myopt4.value + ...
 obj1.os1.value = obj1.company.value + " Occupation" + obj1.occupation.value + " Email:" + obj1.email.value + " Phone (" + obj1.phonetype.value + ") :" + obj1.phone1.value;
}

</script>

<!-- content -->
        <p class="p1">This sample is a donation button that uses JavaScript to collect the information in the text fields provided and passes it over to PayPal. It also checks to make sure the information has been filled in before allowing the user to click the button. You can view the source code of this page, and see the script that is being used.</p>
        <form method="post" name="donationform" id="donationform" action="https://www.paypal.com/cgi-bin/webscr" onsubmit="this.target='paypal'; return UpdateForm(this);">
<input type="hidden" name="business" value="your_email@my_site.com">
<input type="hidden" name="no_shipping" value="1">
  <input type="hidden" name="cmd" value="_xclick">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
  <td width="149">Contribution Amount:</td>
  <td width="451"><input name="amount" type="text" id="amount" size="10"> 
(Limit: $500 per person or organization)
  </td>  
</tr>
<tr>
<td>Contribution For (Candidate's Name):</td>
<td><input type="text" name="item_name" size="40" value=""></td>
</tr>
<tr>
  <td>First Name:</td>
  <td><input name="firstname" type="text" id="firstname" size="40" value="" ></td>
</tr>
<tr>
  <td>Last Name :</td><td><input name="lastname" type="text" id="lastname" size="40" value="" ></td></tr>
<tr>
  <td>Address 1 :</td><td><input name="address1" type="text" id="address1"  size="40" value="" ></td></tr>
<tr>
  <td>Address 2 :</td><td><input name="address2" type="text" id="address2"  size="40"></td></tr>
<tr>
  <td>City:</td><td><input name="city" type="text" size="40"  id="city" value="" ></td></tr>
<tr>
  <td>State:</td><td><input name="state" type="text" size="40"  id="state" value="" ></td></tr>
<tr>
  <td>Zip:</td><td><input name="zip" type="text" size="40"  id="zip" value="" ></td></tr>
<tr>
  <td>Employer:</td><td><input name="company" type="text" id="company" size="40" value="" ></td></tr>
<tr>
  <td>Occupation:</td><td><input name="occupation" type="text"  id="occupation" size="40" value="" ></td></tr>
<tr>
  <td>Email:</td><td><input name="email" type="text" id="email" size="40"  value="" >
    <label></label></td></tr>
<tr>
  <td>Phone:</td><td><input name="phone1" type="text" id="phone1" size="13" maxlength="13" value="">
    <select name="phonetype">
                                         <option value="">Phone Type-</option>
                                <option value="Home">Home</option>
                                <option value="Work">Work</option>
                                <option value="Mobile">Mobile</option>
                              </select>
                              </td></tr>
</table>    

<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="on0" value="Donor">
<input type="hidden" name="os0" value="">
<input type="hidden" name="bn" value="PP-DonationsBF">
<input type="hidden" name="on1" value="Employer">
<input type="hidden" name="os1" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<br /><br />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="/pixel.gif" width="1" height="1">
</form> 

答案 1 :(得分:0)

你有没有看过PayPal的网站? https://www.paypal.com/us/cgi-bin/?cmd=_donate-intro-outside 此外,您要求用户填写表格,然后才能获得PayPal捐款。

答案 2 :(得分:0)

您可以使用纯HTML创建PayPal标准表单,如下所示:                                               

Array
(
[0] => Array
    (
        [East] => 2
        [North] => 2
    )

)