Download the class library and extract the contents do a directory in your project structure.
Upload the files to your web server.
Open /includes/config-sample.php and adjust the values with your own Sandbox and Production API credentials. then Save-As config.php
There are detailed comments inside the config file to help you fill it out correctly.
For security purposes, it is recommended that you move this config file to a location outside of the web root for your application, and then include it in your project using an absolute path.
To use the library in your project, include the following into your file(s).
Open the template file that corresponds to the API call you'd like to make.
Example: If we want to make a call to the RefundTransaction API we open RefundTransaction.php
You may leave the file here, or save this file to the location on your web server where you'd like this call to be made.
I like to save the files to a separate location and keep the ones included with the library as empty templates.
Each template file includes PHP arrays for every parameter available to that particular API. Simply fill in the array parameters with your own dynamic (or static) data. This data may come from...
When you run the file you will get a $PayPalResult array that consists of all the response parameters from PayPal, original request parameters sent to PayPal, and raw request/response info for troubleshooting.
You may refer to the PayPal API Reference Guide for details about what response parameters you can expect to get back from any successful API request.
Example: When working with RefundTransaction, I can see that PayPal will return a REFUNDTRANSACTIONID, FEEREFUNDAMT, etc. As such, I know that those values will be included in $PayPalResult['REFUNDTRANSACTIONID'] and $PayPalResult['FEEREFUNDAMT'] respectively.
If errors occur they will be available in $PayPalResult['ERRORS'].
Fully Functional Demos
The library comes usage samples, but if you prefer fully functioal demos built into a shopping cart environment take a look at our PayPal PHP SDK Demo Kits.
The result of the API call will come back in $PayPalResult['ACK'].
Remember when checking the value that it could be Success, Failure, SuccessWithWarning, or FailureWithWarning. Simply checking for Success isn't enough.
You may use $PayPal->APICallSuccessful($Ack) to do this for you.
Create at least one sandbox Seller account and one sandbox Buyer account from within your developer account.
These accounts can be used to go through the entire process of buying items within your application, and reviewing what each party involved will see in their PayPal account when the transaction is completed.