<img src=“https://travis-ci.org/stripe/stripe-php.svg?branch=master” alt=“Build Status” /> <img src=“https://poser.pugx.org/stripe/stripe-php/v/stable.svg” alt=“Latest Stable Version” /> <img src=“https://poser.pugx.org/stripe/stripe-php/downloads.svg” alt=“Total Downloads” /> <img src=“https://poser.pugx.org/stripe/stripe-php/license.svg” alt=“License” />
You can sign up for a Stripe account at stripe.com.
PHP 5.2 and later.
You can install the bindings via Composer. Add this to your composer.json
:
{ "require": { "stripe/stripe-php": "1.*" } }
Then install via:
composer.phar install
To use the bindings, either user Composer’s autoload:
require_once('vendor/autoload.php');
Or manually:
require_once('/path/to/vendor/stripe/stripe-php/lib/Stripe.php');
Obtain the latest version of the Stripe PHP bindings with:
git clone https://github.com/stripe/stripe-php
To use the bindings, add the following to your PHP script:
require_once("/path/to/stripe-php/lib/Stripe.php");
Simple usage looks 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;
Please see stripe.com/docs/api for up-to-date documentation.
In order to run tests you have to install SimpleTest via Composer (recommended way):
composer.phar update --dev
Run test suite:
php ./test/Stripe.php