paypro/paypro-php

PayPro PHP library

1.1.0 2024-08-12 10:18 UTC

README

build License: MIT

The PayPro PHP library can be used to make integrating with the PayPro API easier when using PHP. It provides easy to use classes to interact with all resources available through the API.

It also provides the following:

  • Built-in pagination support
  • Easy configuration
  • Webhook request verification helpers

Requirements

  • PHP >= 7.2

Installation

Composer

You can install the library through Composer

composer require paypro/paypro-php

To use the library, use Composer to autoload:

require_once 'vendor/autoload.php';

Manually

If you don't use Composer you can download the files from GitHub. To use the libary require the init.php file

require_once '/path/to/paypro-php/init.php';

Dependencies

The library requires the following dependencies:

Getting started

In order to use the API you need to have a valid API key. You can find your API key in the PayPro dashboard

Example of using the API:

$paypro = new \PayPro\Client('pp_...');

# Creating a payment
$payment = $paypro->payments->create(['amount' => 500, 'currency' => 'EUR', 'description' => 'Test Payment']);

# Retrieving all subscriptions
$subscriptions = $paypro->subscriptions->list();

# Retrieving a single customer
$customer = $paypro->customers->get('CUSSDGDCJVZH5K');

Using a different endpoint

To use a different endpoint (default: https://api.paypro.nl) you can create the client in the following way:

$paypro = new \PayPro\Client(['api_url' => 'https://api-test.paypro.nl', 'api_key' => 'pp_...']);

Development

If you want to contribute to this project you can fork the repository. Create a new branch, add your feature and create a pull request. We will look at your request and determine if we want to add it.

To run all the tests with PHPUnit:

./vendor/bin/phpunit

To run the code formatter:

./vendor/bin/php-cs-fixer fix -v .

To analyze the code with PHPStan

./vendor/bin/phpstan analyse lib