/paypal-php-library

PHP PayPal SDK Class Library for Classic APIs

Primary LanguagePHP

Angell EYE PayPal PHP Library

This PHP class library for PayPal makes it easy to integrate PayPal APIs, including the PayPal REST APIs and Classic APIs like the Payments Standard Button Manager, Invoicing, General Merchant APIs, and Permissions.


Server Requirements

  • PHP version 5.3.0 or newer.
  • cURL

Installation

Video Overview

Install via Composer or Manual Download Overview Video

Composer Install

Create a composer.json file with the following section and run composer update.

    "require": {
		"php": ">=5.3.0",
		"ext-curl": "*",
		"angelleye/paypal-php-library": "3.0.*"
	}

Manual Install (without Composer)

  • Download the class library and extract the contents do a directory in your project structure.
  • Upload the files to your web server.

Setup

Open /samples/config/config-sample.php, fill out your details accordingly, and save-as config.php to a location of your choice.

To use the library in your project, include the following into your file(s).

  • /path/to/config.php
  • autoload.php

Usage

  • 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 up /templates/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.
    • Note that you can also copy/paste the template code into your own file(s).
  • Each template file prepares the PayPal class object for you and 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:

    • Session Variables
    • General Variables
    • Database Recordsets
    • Static Values
    • Etc.
  • 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 Developer Documentation 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']

You may refer to this overview video of how to use the library, and there are also samples provided in the /samples directory as well as blank templates ready to use under /templates.

If you need additional help you may place an order for premium support.

Fully Functional Demos

The library comes with basic usage samples, but if you feel more comfortable seeing the integration inside a fully functional demo that is built into a basic shopping cart system, take a look at our demo kits available on our website.

You can find our FREE demos inside /demo directory. If you have purchased any demo then you just need to add those inside demo directory and its ready to go.

Tutorials

Supported APIs

REST APIs

Payments Standard Button Manager

Button Manager

Invoicing

Merchant

Permissions

PayPal Manager (PayFlow Gateway)

Financing Banners

  • FinancingBannerEnrollment

Deprecated

  • DoMobileCheckoutPayment
  • GetAccessPermissionsDetails
  • GetAuthDetails
  • SetAccessPermissions
  • SetAuthFlowParam
  • SetMobileCheckout
  • UpdateAccessPermissions
  • Adaptive Accounts
  • Adaptive Payments

Resources