Download the PHP package stevethomas/paypal-ipn without Composer

On this page you can find all versions of the php package stevethomas/paypal-ipn. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package paypal-ipn

PayPal IPN Listener Build Status

A PayPal IPN (Instant Payment Notification) listener for PHP >=5.3.0. If you are looking for a < 5.3.0 compatible PayPal IPN Listener i highly recommend - https://github.com/Quixotix/PHP-PayPal-IPN (This package is heavily based around this).

Features

Prerequisites

  1. PHP >=5.3.0
  2. A good understanding of how the PayPal Instant Payment Notification system works. see https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf
  3. This package can be installed using composer or can be integrated manually. If you are not using an autoloader make sure you include all of the php files in the src directory.

Note: All of the code examples in the rest of this document assume you have the required files above included manually or autoloaded.

Architecture

This package is built out of a few components that work together:

  1. Listener - Listens for and processes the IPN
  2. Request - Communicates with PayPal
  3. Response - Handles response from PayPal

The request and response components are swappable. If you have a certain way you need to implement the request, or handle the response you can do this by extending the base classes: PayPal\Ipn\Request and PayPal\Ipn\Response.

PayPal\Ipn\Request is abstract and must be extended.

By default 2 request components are provided:

  1. PayPal\Ipn\Request\Curl - sends the request to PayPal via Curl
  2. PayPal\Ipn\Request\Socket - sends the request to PayPal via sockets (fsock)

1 response component is provided:

  1. PayPal\Ipn\Response - saves the HTTP status and body from the response from PayPal

Workflow

  1. Create an instance of the request component you want to use to communicate with PayPal. If you want to use a custom repsonse component, instantiate this first and pass to the request components constructor.
  2. Configure any properties required on the request component (set custom request properties etc.)
  3. Create an instance of the listener component and pass it the request component in its constructor.
  4. Configure any properties required on the listener component (set mode etc.)
  5. Get the listener component to verify the IPN by calling the verifyIpn() method. If the IPN is verified this method will return true, otherwise it will return false. This should be done in a try catch block as the listener or request components may throw exceptions.
  6. You can use the method getReport() to get the details of the request and the response.

A report will look like:

You can switch between sandbox or production mode. You do this by calling setMode($mode) on the listener component. Valid values for $mode are sandbox or production. This will set where the request is made too (PayPals sandbox server or production server). Internally this calls the setHost() method of the request component.

By default the mode is set to production (this is done in the listener / request component constructor).

Creating Custom Request Components

To create a custom request component you must extend PayPal\Ipn\Request as this has the base methods and properties that the listener component is dependent on. There is only 1 abstract method that needs to be implemented: send(). This is the method that makes the request to PayPal.

Creating Custom Response Components

To create a custom response component you should extend PayPal\Ipn\Response as this has the base methods and properties that the request component is dependent on. There are no abstract methods that need to be implemented, but any custom setters for for the statusCode or body must set the respective protected properties.

Using Custom Components

Request

Using your custom request component is as simple as

  1. create an instance of the component
  2. configure the component
  3. pass to the constructor of the listener component
Response

Using your custom response component is as simple as

  1. create an instance of the component
  2. configure the component
  3. pass to the constructor of the request component

Note: The request component constructor accepts 2 parameters: custom set of data and custom response object. For the request component to just use the data in the $_POST array pass false (if passing a custom response). See notes below.

Notes

Data Source

By default the data in the $_POST array will be used to verify the IPN. In some situations you may not have access to $_POST (some frameworks unset this and use custom accessors). To get around this you can pass an array of data to the constructor of the request component:

Testing

PayPal provide an Instant Payment Notification (IPN) simulator here: https://developer.paypal.com/webapps/developer/applications/ipn_simulator

The simulator only tells you if the IPN was sent successfully. To get more information about the status of the IPN (what data was sent, what response it got etc.) you need to record this somewhere (use the listener components getStatus() method and write to file somewhere etc).


All versions of paypal-ipn with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stevethomas/paypal-ipn contains the following files

Loading the files please wait ....