I come across a lot of PHP developers looking to build a recurring payments system with PayPal.  I’ve found myself repeating this same information so many times I decided to write up a quick outline and some instruction on how to get this done.

Using these tools you can get a quality recurring payments system in place with a fully automated back-end without much hassle.


First, grab our PayPal PHP library from GitHub. It’s also available on Packagist and ready for Composer if you’re using that.

The API’s you’ll be working with specifically are as follows.

PayPal Express Checkout

PayPal Payments Pro

  • DoDirectPayment (optional / as-needed)
  • CreateRecurringPaymentsProfile (same as with Express Checkout, but you’d include card details in the request.)

The CreateRecurringPaymentsProfile request is the one where all of the details about setting up the profile and everything would take place.

Bonus Tip

There is a caveat when dealing with a free trial that I see come up a lot.  The CreateRecurringPaymentsProfile request contains specific parameters for trial amount, trial period, etc.  These are only used when you’re offering a discounted trial period, though, and do have an actual amount to use for the trial period.

With a free trial you will actually just leave the trial parameters empty, and instead you’ll setup the regular parameters as required and you’ll set the start date of the profile for 1 month from the current date (or however long the trial is going to be for).  This will create an active profile immediately, but it won’t charge anything until the profile start date, which is the date the first payment would trigger if the profile was not canceled or suspended by that time.On that note, you’ll also want to work with the following API’s to help manage the recurring profiles.

Finally, Instant Payment Notification (IPN) is what you’ll use to automate the processing of recurring payments, failed payments, canceled or suspended profiles (and anything else you might want to automate with regards to the PayPal account.)

We provide a PHP template for IPN that is rather rudimentary because it was developed years ago, but we still use it in almost every project we do as it’s fully functional and very useful. There are some other IPN libraries available on Packagist, though, that are more robust in terms of compatibility with PHP 5.3 and namespacing, etc, so you might be more interested in those solutions for IPN.


This is a very quick outline of what it would take to build a recurring payments system on PayPal Express Checkout and Website Payments Pro 3.0 (DoDirectPayment).  If you’re already familiar with our PayPal PHP library you could have this all up and running in just a few hours at most.  Even if you’ve never used it before it shouldn’t take you more than a day to get comfortable and start banging out recurring payments profiles!