You can sign up for a Stripe account at https://stripe.com.
PHP 5.3.3 and later.
You can install the bindings via Composer. Add this to your composer.json
:
{
"require": {
"stripe/stripe-php": "2.*"
}
}
Then install via:
composer.phar install
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Simple usage looks like:
\Stripe\Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249');
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015);
$charge = \Stripe\Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'usd'));
echo $charge;
Please see https://stripe.com/docs/api for up-to-date documentation.
If you are using PHP 5.2, you can download v1.18.0 (zip, tar.gz) from our releases page. This version will continue to work with new versions of the Stripe API for all common uses.
This legacy version may be included via require_once("/path/to/stripe-php/lib/Stripe.php");
, and used like:
Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249');
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015);
$charge = Stripe_Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'usd'));
echo $charge;
In order to run tests first install PHPUnit via Composer:
composer.phar update --dev
To run the test suite:
./vendor/bin/phpunit