PDN - Subscriptions Overview


Introduction


This document will give you with the basic information needed to create and add PayPal Subscriptions buttons to your website. PayPal Subscriptions buttons let you accept recurring payments for a product or service (e.g. a weekly newsletter) on your website.

Before you begin, you should have a basic understanding of HTML and be able to edit and post pages on your website. The process of creating and adding a button is outlined below. If you need more detailed instructions, or information for a more advanced implementation, please see the Subscriptions and Recurring Payments Manual (PDF, 682 KB, August 2006).

Prerequisites


When you create and add a PayPal Subscriptions button, you will need the following:

REQUIRED
  • A PayPal Premier or Business account
  • The email address at which you will receive payment
  • Item Name
  • Item Price
  • Length of billing cycle
  • Number of recurrences of billing cycle
OPTIONAL
  • The URL for the web page users see after a successful transaction
  • The URL for the web page users see after cancelling a transaction
  • An image for the Single Item Purchase button (several buttons are available)
  • The URL of your 50 x 150 pixel logo
  • Optional item details (including item id, shipping and sales tax rates)
  • Trial Period information (cost and length)

Implementation Overview


Subcriptions flowchart

Implementation Details


You may follow the steps below to create each of your buttons, or, if you are comfortable editing HTML by hand, you may create additional buttons by changing the values in the first button you create.

If you would like more detailed information on any of the following steps, please see the Subscriptions and Recurring Payments Manual (PDF, 682 KB, August 2006).
  1. Login to PayPal
    Login to your PayPal account. Click on the Merchant Services tab and choose Subscriptions under the 'Website Payments' heading to go to the Button Generator. If you do not have a Premier or Business account, you will need to upgrade before continuing.
  2. Select an image for the 'Subscribe' button
  3. Enter the subscription details
    This includes Item Name and Number
  4. Decide if you want to use password management (optional advanced feature)
  5. Define trial period(s) (optional)
    Enter the period length and cost (e.g. $5.00 USD for 2 weeks)
  6. Define regular billing cycle
    Enter the cost, and, if you would like the subscription to automatically renew, cycle length (e.g. $5.00 USD every 2 weeks for 25 cycles)
  7. Decide if you would like to reattempt on failure
    Subscriptions can be automatically cancelled if a payment fails
  8. Add your logo to the PayPal payment pages (optional)
  9. Add your Successful payment and Cancelled payment pages (optional)
  10. Copy and paste the PayPal code onto your website
  11. Test your button
    Click the button to verify that it is working properly. Please remember that you will not be able to complete the payment flow since you may not send payments to yourself.

Implementation Details


If you would like to edit your code by hand, the variables you need to change are highlighted below.

A Minimal Implementation

The example code below shows the minimum information you need to create a single item purchase button. This sample creates a button to subscribe to Dave's Mercedes Newsletter for $9.99 USD per month. Several of the variables include comments explaining their meaning:

<!-- Begin PayPal Logo -->
<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="dave@davesgarage.com">
<input type="hidden" name="item_name" value="dave's mercedes newsletter">
<input type="hidden" name="item_number" value="1111">
<input type="hidden" name="no_note" value="1"> <!-- required field -->
<input type="hidden" name="a3" value="9.99"> <!-- price of subscription -->
<input type="hidden" name="p3" value="1"> <!-- billing cycle length -->
<input type="hidden" name="t3" value="M"> <!-- billing cycle unit=month -->
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-butcc-subscribe.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
<!-- End PayPal Logo -->

To make this a payment button for a different item, you would need to edit five variables: item_name, item_number, a3, p3, and t3.

A Full Implementation

The sample code below creates a button with URLs for successful payment and payment cancellation pages, does not prompt the buyer to include a note or their shipping address, includes a free one month trial period.

<!-- Begin PayPal Logo -->
<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="dave@davesgarage.com">
<input type="hidden" name="item_name" value="dave's mercedes newsletter">
<input type="hidden" name="item_number" value="1111">
<input type="hidden" name="image_url" value="http://www.davesgarage.com/logo.gif">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://www.davesgarage.com/success.html">
<input type="hidden" name="cancel_return" value="http://www.davesgarage.com/cancel.html">
<input type="hidden" name="a1" value="0.00"> <!-- free trial=yes -->
<input type="hidden" name="p1" value="1"> <!-- length of trial period -->
<input type="hidden" name="t1" value="M"> <!-- period of trial=month -->
<input type="hidden" name="a3" value="9.99"> <!-- price of subscription -->
<input type="hidden" name="p3" value="1"> <!-- billing cycle length -->
<input type="hidden" name="t3" value="M"> <!-- billing cycle unit=month -->
<input type="hidden" name="src" value="1"> <!-- recurring=yes -->
<input type="hidden" name="sra" value="1"> <!-- reattempt=yes -->
<input type="hidden" name="srt" value="12"> <!-- # of recurring payments -->
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-butcc-subscribe.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
<!-- End PayPal Logo -->


Again, several of the variables include comments explaining their meaning.

If you have the ability to dynamically generate portions of your site, you could save time by populating your PayPal Single Item Purchase buttons automatically, updating the variables with information from your database.

Conclusion


A PayPal Subscriptions button lets you add an easy, fast, and flexible payment method to your website so you may accept automatically recurring payments for an item or service. More detailed information about the buttons, including a walk-through of the payment process, complete descriptions of all the code variables, and information on integrating PayPal Subscriptions with your website's back-end operations can be found in the Subscriptions and Recurring Payments Manual (PDF, 682 KB, August 2006).