jlinn / stripe-api-php
A PHP client library for Stripe's REST API
Installs: 869
Dependents: 0
Suggesters: 0
Security: 0
Stars: 81
Watchers: 10
Forks: 13
Open Issues: 4
Requires
- php: >=5.3.2
- guzzle/guzzle: ~3.8
- jms/serializer: ~0.15
Requires (Dev)
- phpunit/phpunit: ~3.7
This package is not auto-updated.
Last update: 2024-12-21 13:56:53 UTC
README
A PHP client library for Stripe's API.
Documentation
More comprehensive documentation for this library can be found here.
Usage
Installing via Composer
$ php composer.phar require jlinn/stripe-api-php
Making API Calls
Initialize the client object
use Stripe\Stripe; $stripe = new Stripe("your_api_key");
Charges calls
// create a charge $request = $stripe->charges->createChargeRequest(350, "usd")->setCustomer($customer->getId()); $stripe->charges->createCharge($request); //Without a Customer $card Request = new CreateCardRequest($number, $expMonth, $expYear, $cvc); $request = $stripe->charges->createChargeRequest(350, "usd")->setCard($card); $stripe->charges->createCharge($request); // retrieve a charge $charge = $stripe->charges->getCharge("charge_id");
Customers calls
use Stripe\Request\Cards\CreateCardRequest; // create a customer $request = $stripe->customers->createCustomerRequest(); $request->setEmail("foo@bar.com")->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");
Development Status
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.