Download the PHP package stripe/stripe-php without Composer
On this page you can find all versions of the php package stripe/stripe-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
More information about stripe/stripe-php
Files in stripe/stripe-php
Rated 3.00 based on 2 reviews
Informations about the package stripe-php
Stripe PHP bindings
The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the Stripe API.
PHP 5.6.0 and later.
You can install the bindings via Composer. Run the following command:
To use the bindings, use Composer's autoload:
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the
The bindings require the following extensions in order to work properly:
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.
Simple usage looks like:
Client/service patterns vs legacy patterns
See the PHP API docs.
See video demonstrations covering how to use the library.
Legacy Version Support
PHP 5.4 & 5.5
If you are using PHP 5.4 or 5.5, you should consider upgrading your environment as those versions have been past end of life since September 2015 and July 2016 respectively. Otherwise, you can still use Stripe by downloading stripe-php v6.43.1 (zip, tar.gz) from our releases page. This version will work but might not support recent features we added since the version was released and upgrading PHP is the best course of action.
If you are using PHP 5.3, you should upgrade your environment as this version has been past end of life since August 2014. Otherwise, you can download v5.9.2 (zip, tar.gz) from our releases page. This version will continue to work with new versions of the Stripe API for all common uses.
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 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.
Custom cURL Options (e.g. 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.
Alternately, a callable can be passed to the CurlClient constructor that returns the above array based on request inputs. See
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
The library does minimal logging, but it can be configured
PSR-3 compatible logger so that messages
end up there instead of
Accessing response data
You can access the data from the last API response on any object via
SSL / TLS compatibility issues
Stripe's API now requires that all connections use TLS 1.2. 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 https://stripe.com/blog/upgrading-tls.".
The recommended course of action is to upgrade your cURL and OpenSSL packages 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
For apps that need to use multiple keys during the lifetime of a process, like one that uses Stripe Connect, it's also possible to set a per-request key and/or account:
Configuring CA Bundles
By default, the library will use its own internal bundle of known CA certificates, but it's possible to configure your own:
Configuring Automatic Retries
The library can be configured to automatically retry requests that fail due to an intermittent network problem:
Idempotency keys are added to requests to guarantee that retries are safe.
Request latency telemetry
By default, the library sends request latency telemetry to Stripe. These numbers help Stripe improve the overall latency of its API for all users.
You can disable this behavior if you prefer:
Stripe has features in the beta phase that can be accessed via the beta version of this package.
We would love for you to try these and share feedback with us before these features reach the stable phase.
composer require command with an exact version specified to install the beta version of the stripe-php pacakge.
Note There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your composer.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.
We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
If your beta feature requires a
Stripe-Version header to be sent, use the
apiVersion property of
config object to set it:
New features and bug fixes are released on the latest major version of the Stripe PHP library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
Get Composer. For example, on Mac OS:
Install dependencies as mentioned above (which will resolve PHPUnit), then you can run the test suite:
Or to run an individual test file:
Update bundled CA certificates from the Mozilla cURL release:
The library uses PHP CS Fixer for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with:
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:
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
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),