2

I know this is probably a stupid question. I have tried searching, but can't find what I'm looking for. Or maybe I found it and am just too ignorant to know it. In either case, we are not programmers, just trying to setup a donation button in PayPal and need some help.

We are trying to accept donations using a simple PayPal donation button created using the button generator. For reporting requirements, we must collect the address, occupation, and employer of everyone who contributes.

Is there a simple way to add these required fields to the button code? We don't care if they are mapped to unused PayPal fields (such as auction ID, or Item ID) but we really want to collect this information at PayPal checkout, without creating our own form.

Is there any way to do this just using the button and requiring PayPal to collect those extra fields?

Thanks in advance for any assistance.

4

3 回答 3

4

没有办法要求 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> 
于 2013-04-30T20:12:31.900 回答
0

Have you ever checked out PayPal's website? https://www.paypal.com/us/cgi-bin/?cmd=_donate-intro-outside Also, you request a form for the user to fill out before they get to the PayPal donate.

于 2013-04-30T19:48:28.913 回答
0

您可以像这样使用纯 HTML 创建一个 PayPal 标准表单:

  <input type="hidden" name="item_name" value="Donation to YOUR_BUSINESS_NAME">
  <label><input type="text" name="amount" size="4"/>Donation Amount</label>

  <label><input name="on0" id="checkbox_gift_membership" value="This is a gift membership." type="checkbox">This is a gift membership.</label>

  <table>
   <caption>Gift Recepient information</caption>
   <tbody>
    <tr>
     <td><label><input name="on1" value="Name" type="hidden">Name</label></td>
     <td><input name="os1" maxlength="200" type="text"></td>
    </tr>
    <tr>
     <td><label><input name="on2" value="Address" type="hidden">Address</label></td>
     <td><input name="os2" maxlength="200" type="text"></td>
    </tr>
    <tr>
     <td><label><input name="on3" value="City" type="hidden">City</label></td>
     <td><input name="os3" maxlength="200" type="text"></td>
    </tr>
    <tr>
     <td><label><input name="on4" value="State" type="hidden">State</label></td>
     <td><input name="os4" maxlength="200" type="text"></td>
    </tr>
    <tr>
     <td><label><input name="on5" value="ZIP code" type="hidden">ZIP code</label></td>
     <td><input name="os5" maxlength="200" type="text"></td>
    </tr>
    <tr>
     <td><label><input name="on6" value="Phone number" type="hidden">Phone number</label></td>
     <td><input name="os6" maxlength="200" type="text"></td>
    </tr>
    <tr>
     <td><label><input name="on7" value="Email" type="hidden">Email</label></td>
     <td><input name="os7" maxlength="200" type="text"></td>
    </tr>
   </tbody>
  </table>

  <label><input name="on8" id="checkbox_news_updates" value="I would like to receive news and updates." type="checkbox">I would like to receive news and updates.</label>

  <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

</form>
于 2015-12-04T04:06:21.317 回答