PHP 5.3.3 and later.
You can install the bindings via Composer. Add this to your composer.json
:
{
"require": {
"payjp/payjp-php": "0.0.x"
}
}
Then install via:
composer install
To use the bindings, use Composer's autoload:
require_once 'vendor/autoload.php';
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php
file.
require_once '/path/to/payjp-php/init.php';
Simple usage looks like:
\Payjp\Payjp::setApiKey('sk_test_c62fade9d045b54cd76d7036');
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2020);
$charge = \Payjp\Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'jpy'));
echo $charge;
- Request Example
- Please see our official documentation.
In order to run tests first install PHPUnit via Composer:
composer update --dev
To run the test suite:
./vendor/bin/phpunit