Payment Rails1 PHP Library
The Payment Rails PHP library provides integration access to the Payment Rails API.
PHP version >= 5.4.0 is required.
The following PHP extensions are required:
curl json mbstring openssl
git clone https://github.com/PaymentRails/php-sdk.git
To install the bindings via Composer, add the following to composer.json
:
composer require paymentrails/php-sdk
Then run composer install
Please follow the installation procedure and then run the following:
<?php
// This line is for the Composer autoloader
require_once 'vendor/autoload.php';
// Or use this if installed via git clone
// require_once 'php-sdk/lib/autoload.php';
use PaymentRails;
// Configure API key authorization: merchantKey
PaymentRails\Configuration::environment('production');
PaymentRails\Configuration::publicKey(YOUR_PUBLIC_KEY);
PaymentRails\Configuration::privateKey(YOUR_PRIVATE_KEY);
try {
$recipients = PaymentRails\Recipient::all();
foreach ($recipients as $rcpt) {
print_r($rcpt->id . "\n");
}
} catch (Exception $e) {
echo 'Exception when calling PaymentRails\\Recipient::all ', $e->getMessage(), PHP_EOL;
}
All URIs are available at http://docs.paymentrails.com/
- Clone this repo.
- Install dependencies by running
composer install
from the project root. - Access the SDK source code from your code by using
PaymentRails
namespace as per the path you put the SDK source code on.
To run the tests in the terminal, use the PHPUnit test suite from within the tests
directory, like the following:
$ ../vendor/bin/phpunit integration/RecipientTest.php
Footnotes
-
Payment Rails is now Trolley, we'll be updating our SDKs to support the new domain during the first half of 2022. ↩