There is no standard button in PayPal that lets you do recurring donations; you can do single donations, and you can also do recurring payments or subscriptions, but not the two combined.
But, with a little tweaking of the PayPal button code we can still accomplish a recurring donation button, here’s how…
1. Create a subscription button through your PayPal account.
- Add a drop down menu called Donation Frequency with Monthly/Yearly options
- Add a text field called Enter Your Donation Amount
- You will have to enter an amount but don’t worry about it, we’ll edit that later on anyways, just enter 1.00
- Choose Never for when billing should stop
- Before you click Create Button at the bottom, click on Step 2: Track Inventory etc. and uncheck the Save Button at PayPal option.
- Now you can click Create Button
2. Click Remove Code Protection in the upper right hand corner, then copy the code and paste it into any plain text document so that we can edit it. Here’s what the original code would look like as an example:
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_xclick-subscriptions”>
<input type=”hidden” name=”business” value=”xyz@yourdomain.com”>
<input type=”hidden” name=”lc” value=”CA”>
<input type=”hidden” name=”item_name” value=”Donation to Your Company”>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”src” value=”1″>
<input type=”hidden” name=”a3″ value=”1.00″>
<input type=”hidden” name=”p3″ value=”1″>
<input type=”hidden” name=”t3″ value=”M”>
<input type=”hidden” name=”currency_code” value=”CAD”>
<input type=”hidden” name=”bn” value=”PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted”>
<table>
<tr><td><input type=”hidden” name=”on0″ value=”Donation Frequency”>Donation Frequency</td></tr><tr><td><select name=”os0″>
<option value=”Monthly”>Monthly </option>
<option value=”Annually”>Annually </option>
</select> </td></tr>
<tr><td><input type=”hidden” name=”on1″ value=”Enter Your Donation Amount”>Enter Your Donation Amount</td></tr><tr><td><input type=”text” name=”os1″ maxlength=”200″></td></tr>
</table>
<input type=”image” src=”https://www.paypalobjects.com/en_US/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_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>
3. Now it’s time to edit the code. Edit this line so that the value equals the email address that is associated with your PayPal account.:
<input type=”hidden” name=”business” value=”xyz@yourdomain.com”>
4. Edit this line so that the value equals whatever you want, keeping in mind that this is what the end-user will see when they are sent to the checkout in PayPal:
<input type=”hidden” name=”item_name” value=”Donation to Your Company”>
5. Add this line directly after the item_name line:
<input type=”hidden” name=”item_number” value=”1234″>
6. Remove this line:
<input type=”hidden” name=”a3″ value=”1.00″>
7. Remove this line:
<input type=”hidden” name=”t3″ value=”M”>
8. Edit this section:
<tr><td><input type=”hidden” name=”on0″ value=”Donation Frequency”>Donation Frequency</td></tr><tr><td><select name=”os0″>
<option value=”Monthly”>Monthly </option>
<option value=”Annually”>Annually </option>
</select> </td></tr>
So that it looks like this:
<tr><td>Donation Frequency</td></tr><tr><td><select name=”t3″>
<option value=”M”>Monthly</option>
<option value=”Y”>Annually</option>
</select> </td></tr>
9. Edit this section:
<tr><td><input type=”hidden” name=”on1″ value=”Enter Your Donation Amount”>Enter Your Donation Amount</td></tr><tr><td><input type=”text” name=”os1″ maxlength=”200″></td></tr>
So that it looks like this:
<tr><td>Enter Your Donation Amount</td></tr>
<tr><td><input type=”text” name=”a3″ maxlength=”60″></td></tr>
Now your entire code should look like this:
<table>
<tr>
<td>
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_xclick-subscriptions”>
<input type=”hidden” name=”business” value=”xyz@yourdomain.com”>
<input type=”hidden” name=”lc” value=”CA”>
<input type=”hidden” name=”item_name” value=”Donation to Your Company”>
<input type=”hidden” name=”item_number” value=”1234″>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”src” value=”1″>
<input type=”hidden” name=”p3″ value=”1″>
<input type=”hidden” name=”currency_code” value=”CAD”>
<input type=”hidden” name=”bn” value=”PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted”>
<table>
<tr><td>Donation Frequency</td></tr><tr><td><select name=”t3″>
<option value=”M”>Monthly</option>
<option value=”Y”>Annually</option>
</select> </td></tr>
<tr><td>Enter Your Donation Amount</td></tr>
<tr><td><input type=”text” name=”a3″ maxlength=”60″></td></tr>
</table>
<input type=”image” src=”https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif” border=”0″ name=”submit” alt=”PayPal”>
<img alt=”PayPal” border=”0″ src=”https://www.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>
</td>
</tr>
</table>
Voila!
Keep in mind that you will unfortunately have to have single donations separate, but at least we can create the button for that automatically in PayPal and not have to edit any code.
Hey! This was incredibly helpful! Thank you for your time to write out this article.
I have one question though: Is there a way to add a designation to the donation? At the drop in center where I work each person is required to raise their own salary, so we would have a few different places people could donate the money to. For our situation there would be my personal support, my coworkers personal support and the general budget.
Is there a way I could add a drop box explaining where the money is supposed to be directed?
Thank you for your time!
Hi Steven,
Yes you can add a dropbox, or “options”, to any paypal button, but if you do then you won’t be able to access the Email tab when grabbing the html code for your button…
Brilliant! Thanks, smac! Worked like a charm.
Thank you so much for this helpful tutorial, it’s fantastic! I have a question for you though… I believe the code has changed a bit for the PayPal Donation button as the generated code I received to work through this today had different values from yours. There seems to be many more hidden values now.
Would you happen to know what fixes I would need to do to this current version to get it working as nicely as you did? I attempted to apply your code edits but unfortunately it garnered a PayPal error ‘Invalid Regular period’.
This is the code I am using:
Subscription Frequency
Monthly
Yearly
Your Subscription Amount
Thank you so much for the help!
Tara
Subscription Frequency
Monthly
Yearly
Your Subscription Amount
Oh shoot, I’m sorry. I can’t seem to submit my code to you through the comments. Would you mind if I emailed you?
Hi Tara,
Absolutely, I’ve just sent you an email…
Thanks!
We’ve actually got our paypal donation UI setup so the user can select onetime/monthly and select an amount from a list, all using a single form.
http://www.paw-town-cats.drclue.net/
Just about to make the thing into a w3c web component too.