A PHP client library for Stripe's API.
More comprehensive documentation for this library can be found here.
Installing via Composer
$ php composer.phar require jlinn/stripe-api-php
use Stripe\Stripe;
$stripe = new Stripe("your_api_key");
use Stripe\Request\Cards\CreateCardRequest;
// create a customer
$request = $stripe->customers->createCustomerRequest();
$request->setEmail("[email protected]")->setDescription("A customer!");
$request->setCard(new CreateCardRequest("4242424242424242", 1, 2020));
$customer = $stripe->customers->createCustomer($request);
// get the newly-created customer's id
$customerId = $customer->getId();
// retrieve a customer
$customer = $stripe->customers()->getCustomer("customer_id");
// create a charge
$request = $stripe->charges->createChargeRequest(350, "usd")->setCustomer($customer->getId());
$stripe->charges->createCharge($request);
// retrieve a charge
$charge = $stripe->charges->getCharge("charge_id");
Currently, all Stripe API calls which do not require Stripe Connect have been implemented. Documentation and Stripe Connect calls are next on the to-do list.