There is a nice and open source program called Website Payments Pro 4 Paypal.
From the project page:
It is an object-oriented PHP5 framework engineered to integrate easily with the Website Payments Pro API from Paypal. Complete the DoDirectPayment, SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckoutPayment operations in just 3 lines or less.
Version 0.2.0 has been released.
=> Software name: Website Payments Pro 4 Paypal
=> License: BSD License
=> Download link: Click here to download