PHPackages                             trendspider/stripe-legacy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. trendspider/stripe-legacy

ActiveLibrary[API Development](/categories/api)

trendspider/stripe-legacy
=========================

Stripe PHP Library

5.8.0(4y ago)011.1kMITPHPPHP &gt;=5.3.3

Since May 4Pushed 4y ago2 watchersCompare

[ Source](https://github.com/TrendSpider/stripe-legacy)[ Packagist](https://packagist.org/packages/trendspider/stripe-legacy)[ Docs](https://stripe.com/)[ RSS](/packages/trendspider-stripe-legacy/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Stripe PHP bindings
===================

[](#stripe-php-bindings)

[![Build Status](https://camo.githubusercontent.com/483a1bca16baafb2d64793f0a47106961498fc3f6f04373b3aeffcbef213496b/68747470733a2f2f7472617669732d63692e6f72672f7374726970652f7374726970652d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/stripe/stripe-php)[![Latest Stable Version](https://camo.githubusercontent.com/579886af8c4442af01fe22461f37dbf3329b3221c31347415a37122652a697fe/68747470733a2f2f706f7365722e707567782e6f72672f7374726970652f7374726970652d7068702f762f737461626c652e737667)](https://packagist.org/packages/stripe/stripe-php)[![Total Downloads](https://camo.githubusercontent.com/b408b5e2eadee497a05327fc40b7d53d824964734affae3e885ccd9998a02a88/68747470733a2f2f706f7365722e707567782e6f72672f7374726970652f7374726970652d7068702f646f776e6c6f6164732e737667)](https://packagist.org/packages/stripe/stripe-php)[![License](https://camo.githubusercontent.com/29be96bc51ad7ea220ebae63928445d06349ae5b3fed550e3359fd1633976152/68747470733a2f2f706f7365722e707567782e6f72672f7374726970652f7374726970652d7068702f6c6963656e73652e737667)](https://packagist.org/packages/stripe/stripe-php)[![Code Coverage](https://camo.githubusercontent.com/452612400c5e9b7ac5cfc0343b517111e9158127c2d3d886eaf756e6917209c7/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7374726970652f7374726970652d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/stripe/stripe-php?branch=master)

You can sign up for a Stripe account at .

Requirements
------------

[](#requirements)

PHP 5.3.3 and later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require stripe/stripe-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):

```
require_once('vendor/autoload.php');
```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/stripe/stripe-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once('/path/to/stripe-php/init.php');
```

Dependencies
------------

[](#dependencies)

The bindings require the following extension in order to work properly:

- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Getting Started
---------------

[](#getting-started)

Simple usage looks like:

```
\Stripe_Legacy\Stripe::setApiKey('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
$charge = \Stripe_Legacy\Charge::create(array('amount' => 2000, 'currency' => 'usd', 'source' => 'tok_189fqt2eZvKYlo2CTGBeg6Uq' ));
echo $charge;
```

Documentation
-------------

[](#documentation)

Please see  for up-to-date documentation.

Legacy Version Support
----------------------

[](#legacy-version-support)

If you are using PHP 5.2, you can download v1.18.0 ([zip](https://github.com/stripe/stripe-php/archive/v1.18.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v1.18.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). 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');
$charge = Stripe_Charge::create(array('source' => 'tok_XXXXXXXX', 'amount' => 2000, 'currency' => 'usd'));
echo $charge;
```

Custom Request Timeouts
-----------------------

[](#custom-request-timeouts)

*NOTE:* We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.

To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.

```
// set up your tweaked Curl client
$curl = new \Stripe_Legacy\HttpClient\CurlClient();
$curl->setTimeout(10); // default is \Stripe_Legacy\HttpClient\CurlClient::DEFAULT_TIMEOUT
$curl->setConnectTimeout(5); // default is \Stripe_Legacy\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT

echo $curl->getTimeout(); // 10
echo $curl->getConnectTimeout(); // 5

// tell Stripe to use the tweaked client
\Stripe_Legacy\ApiRequestor::setHttpClient($curl);

// use the Stripe API client as you normally would
```

Custom cURL Options (e.g. proxies)
----------------------------------

[](#custom-curl-options-eg-proxies)

Need to set a proxy for your requests? Pass in the requisite `CURLOPT_*` array to the CurlClient constructor, using the same syntax as `curl_stopt_array()`. This will set the default cURL options for each HTTP request made by the SDK, though many more common options (e.g. timeouts; see above on how to set those) will be overridden by the client even if set here.

```
// set up your tweaked Curl client
$curl = new \Stripe_Legacy\HttpClient\CurlClient(array(CURLOPT_PROXY => 'proxy.local:80'));
// tell Stripe to use the tweaked client
\Stripe_Legacy\ApiRequestor::setHttpClient($curl);
```

Alternately, a callable can be passed to the CurlClient constructor that returns the above array based on request inputs. See `testDefaultOptions()` in `tests/CurlClientTest.php` for an example of this behavior. Note that the callable is called at the beginning of every API request, before the request is sent.

### Configuring a Logger

[](#configuring-a-logger)

The library does minimal logging, but it can be configured with a [`PSR-3` compatible logger](http://www.php-fig.org/psr/psr-3/) so that messages end up there instead of `error_log`:

```
\Stripe_Legacy\Stripe::setLogger($logger);
```

### Accessing response data

[](#accessing-response-data)

You can access the data from the last API response on any object via `getLastResponse()`.

```
$charge = \Stripe_Legacy\Charge::create(array('amount' => 2000, 'currency' => 'usd', 'source' => 'tok_visa'));
echo $charge->getLastResponse()->headers['Request-Id'];
```

### SSL / TLS compatibility issues

[](#ssl--tls-compatibility-issues)

Stripe's API now requires that [all connections use TLS 1.2](https://stripe.com/blog/upgrading-tls). Some systems (most notably some older CentOS and RHEL versions) are capable of using TLS 1.2 but will use TLS 1.0 or 1.1 by default. In this case, you'd get an `invalid_request_error` with the following error message: "Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at .".

The recommended course of action is to [upgrade your cURL and OpenSSL packages](https://support.stripe.com/questions/how-do-i-upgrade-my-stripe-integration-from-tls-1-0-to-tls-1-2#php) so that TLS 1.2 is used by default, but if that is not possible, you might be able to solve the issue by setting the `CURLOPT_SSLVERSION` option to either `CURL_SSLVERSION_TLSv1` or `CURL_SSLVERSION_TLSv1_2`:

```
$curl = new \Stripe_Legacy\HttpClient\CurlClient(array(CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1));
\Stripe_Legacy\ApiRequestor::setHttpClient($curl);
```

Development
-----------

[](#development)

Install dependencies:

```
composer install
```

Tests
-----

[](#tests)

Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:

```
./vendor/bin/phpunit
```

Or to run an individual test file:

```
./vendor/bin/phpunit tests/UtilTest.php
```

Attention plugin developers
---------------------------

[](#attention-plugin-developers)

Are you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example:

```
\Stripe_Legacy\Stripe::setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info");
```

The method should be called once, before any request is sent to the API. The second and third parameters are optional.

### SSL / TLS configuration option

[](#ssl--tls-configuration-option)

See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1469d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e46be4e0fa46dc083d52da458145a71ba88cff75956aad198117165422ccc6b9?d=identicon)[lafafm](/maintainers/lafafm)

---

Tags

apistripepayment processing

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/trendspider-stripe-legacy/health.svg)

```
[![Health](https://phpackages.com/badges/trendspider-stripe-legacy/health.svg)](https://phpackages.com/packages/trendspider-stripe-legacy)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[ebanx/ebanx

EBANX PHP library

24648.5k](/packages/ebanx-ebanx)[pay-now/paynow-php-sdk

PHP client library for accessing Paynow API

18193.9k2](/packages/pay-now-paynow-php-sdk)[everypay/everypay-php

1742.0k](/packages/everypay-everypay-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
