payrex / payrex-php
PayRex PHP Library
Installs: 1 073
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^9.1
README
PayRex PHP library provides PHP applications an easy access to the PayRex API. Explore various PHP classes that represents PayRex API resources on object instantiation.
Check example.php see usage examples.
Requirements
PHP 5.6.0 and later.
Composer
You can install the library via Composer. Run the following command:
composer require payrex/payrex-php
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Manual Installation
If you prefer to manually install the library instead of using composer, you can download the latest release. Then, to use the bindings, include the initialize.php
file.
require_once('/path/to/payrex-php/initialize.php');
Dependencies
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that the required extensions are available.
Getting Started
Simple usage looks like:
$client = new \Payrex\PayrexClient('Your PayRex secret api key'); $paymentIntent = $client->paymentIntents->create([ 'amount' => 10000, 'currency' => 'PHP', 'payment_methods' => ['card'] ]); echo $paymentIntent->id;
Handle errors
try { $client = new \Payrex\PayrexClient('Your PayRex secret api key'); $paymentIntent = $client->paymentIntents->create([ 'amount' => 10000, 'currency' => 'PHP', 'payment_methods' => ['card'] ]); } catch(\Payrex\Exceptions\InvalidRequestException $e) { print "<pre>"; print_r($e->getError()); print "</pre>"; }