The Subscription Module Add-on with PayPal allows WP-Members to limit a user to a specific subscription period and allows you to charge for subscriptions using PayPal’s IPN.
The new 0.2 release offers an option for recurring payments and an improved admin interface. You also no longer need to add functions for wpmem_post_register_data and wpmem_payment_button filters. These are built into the plugin.
Registration and Payment Flow
The PayPal subscription extension utilizes the PayPal Instant Payment Notification (IPN) system to notify your site that a user has paid and to extend their subscription expiration date accordingly.
The registration flow when using the extension is as follows:
- User registers on your site, a new user account is created and login credentials are emailed
- Upon successful registration, the user is presented a PayPal button to take them to PayPal to complete payment
- Upon successful payment, the user is returned to your site
It is important to note that while a user account is created for the user, they are unable to view any restricted content until their payment is processed by PayPal and the IPN is successfully passed. The user is still able to login and view their profile which will indicate that they have not completed payment. This way, if they leave the registration process without completing payment, they can return to complete payment later. But in the meantime, if they try to access any restricted content, they will not only not be able to view the content, they will also be presented with a message indicating they need to complete payment and a PayPal payment button.
This extension installs as a plugin. You can download the installation package as a zip file. Then use the new plugin uploader or unzip the package and FTP transfer to your plugin’s folder.
Once the extension is installed, you can go to Plugins > Installed Plugins to activate.
Setting Up the Extension
The first thing you need to do to set up the PayPal Subscription extension is to go to the WP-Members Options tab and indicate that you are using time-based expiration. You will notice that with the inclusion of the extension, there are two additional settings available; one for time-based expiration and the other for offering a trial period. Select trial period only if you are offering a trial period for your subscription. These settings are highlighted in red in the image to the right.
The next step in setup is to configure the extension’s options. These are found in the Subscriptions tab.
First set the time period, price, and name for your trial period (if used) and regular subscription period. Indicate the currency the price is in, and the type of transaction you will use (basic/regular billing or automated recurring billing).
Next, you will need to indicate your PayPal User ID and whether this is live or sandbox. NOTE: if you are using the sandbox for testing, the PayPal User ID MUST be that of a sandbox user account, NOT your regular PayPal ID.
It is highly recommended that you test your setup with the PayPal sandbox prior to going live. This will allow you to make sure that PayPal can find your IPN listener and that the IPN listener if functioning correctly.
If you have difficulty getting transactions to work in the sandbox, you may wish to enable logging with the toggle in the settings. This will allow you to gain some additional information on what is being sent through the IPN. An additional testing step may include using the PayPal IPN simulator (more on this in the section on the PayPal developer tools below).
If you want to include a login page for the return from PayPal, set this page in the optional setting.
If you are not using a free trial, it is recommended that you set the extension’s settings to display the PayPal payment button in the successful registration message.
PayPal Developer Tools
It is highly recommended that you test your setup with the PayPal sandbox. You use this by going to http://developer.paypal.com and creating a developer account. Once you have an account, you can login and go to Applications > Sandbox Accounts.
In the sandbox, you will need to create at least two accounts, one for the merchant and one for the buyer. Use the merchant for the User ID in the extension’s settings when you are testing with the sandbox. Use the buyer account to “pay” for the subscription when testing the registration process. That test user should receive a valid transaction and have their expiration date set according to your subscription period. If so, good – you can go live. If not, then you should do additional testing to see why the transaction did not work.
You can also use Applications > IPN Simulator to send a simulated IPN transaction without actually registering a user. This will allow you to determine if PayPal can see your IPN and the IPN is properly functioning.
Get the IPN handler information from the extension’s settings tab under IPN Location. Paste that into the handler URL. Select Web Accept for the transaction type.
That will give you a large amount of other options in the form. You can leave all of these as-is. I recommend two tests:
- Send through the first test with just the defaults. You should get an indication of a valid IPN test if it finds the listener and the listener responds. If not, you may need to troubleshoot why it can’t find the listener. (NOTE: your test site MUST be out in the open for this to work and the domain must be valid. If you are testing on localhost or some test system that is not open, PayPal won’t be able to see it and you won’t be able to test it).
- Second, you should test with a user ID from your test system. That would be the numeric user_ID of a registered user on your test site. Enter that in the field at the bottom marked “custom”. If you get a successful IPN transaction, then take a look at the user’s expiration in their profile. You should see the expiration advance by one unit of time.
Once you’ve tested the IPN and it works, you can go live and use your regular PayPal ID (should be an email address – not a numeric merchant account number).
Get the Extension
You can download the extension on the downloads page.