PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / stripe / stripe-php / README.md
ameliabooking / vendor / stripe / stripe-php Last commit date
data 3 years ago lib 6 months ago CHANGELOG.md 1 year ago CONTRIBUTING.md 1 year ago LICENSE 6 years ago OPENAPI_VERSION 1 year ago README.md 1 year ago VERSION 1 year ago composer.json 1 year ago init.php 1 year ago justfile 1 year ago
README.md
322 lines
1 # Stripe PHP bindings
2
3 [](https://github.com/stripe/stripe-php/actions?query=branch%3Amaster![Build Status](https://github.com/stripe/stripe-php/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-php/actions?query=branch%3Amaster](https://github.com/stripe/stripe-php/actions?query=branch%3Amaster)
4 [](https://packagist.org/packages/stripe/stripe-php![Latest Stable Version](https://poser.pugx.org/stripe/stripe-php/v/stable.svg)](https://packagist.org/packages/stripe/stripe-php](https://packagist.org/packages/stripe/stripe-php)
5 [](https://packagist.org/packages/stripe/stripe-php![Total Downloads](https://poser.pugx.org/stripe/stripe-php/downloads.svg)](https://packagist.org/packages/stripe/stripe-php](https://packagist.org/packages/stripe/stripe-php)
6 [](https://packagist.org/packages/stripe/stripe-php![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php](https://packagist.org/packages/stripe/stripe-php)
7
8 The Stripe PHP library provides convenient access to the Stripe API from
9 applications written in the PHP language. It includes a pre-defined set of
10 classes for API resources that initialize themselves dynamically from API
11 responses which makes it compatible with a wide range of versions of the Stripe
12 API.
13
14 ## Requirements
15
16 PHP 5.6.0 and later.
17
18 ## Composer
19
20 You can install the bindings via [](http://getcomposer.org/Composer](http://getcomposer.org/](http://getcomposer.org/). Run the following command:
21
22 ```bash
23 composer require stripe/stripe-php
24 ```
25
26 To use the bindings, use Composer's [](https://getcomposer.org/doc/01-basic-usage.md#autoloadingautoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading](https://getcomposer.org/doc/01-basic-usage.md#autoloading):
27
28 ```php
29 require_once 'vendor/autoload.php';
30 ```
31
32 ## Manual Installation
33
34 If you do not wish to use Composer, you can download the [](https://github.com/stripe/stripe-php/releaseslatest release](https://github.com/stripe/stripe-php/releases](https://github.com/stripe/stripe-php/releases). Then, to use the bindings, include the `init.php` file.
35
36 ```php
37 require_once '/path/to/stripe-php/init.php';
38 ```
39
40 ## Dependencies
41
42 The bindings require the following extensions in order to work properly:
43
44 - [](https://secure.php.net/manual/en/book.curl.php`curl`](https://secure.php.net/manual/en/book.curl.php](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer
45 - [](https://secure.php.net/manual/en/book.json.php`json`](https://secure.php.net/manual/en/book.json.php](https://secure.php.net/manual/en/book.json.php)
46 - [](https://secure.php.net/manual/en/book.mbstring.php`mbstring`](https://secure.php.net/manual/en/book.mbstring.php](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)
47
48 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.
49
50 ## Getting Started
51
52 Simple usage looks like:
53
54 ```php
55 $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
56 $customer = $stripe->customers->create([
57 'description' => 'example customer',
58 'email' => 'email@example.com',
59 'payment_method' => 'pm_card_visa',
60 ]);
61 echo $customer;
62 ```
63
64 ### Client/service patterns vs legacy patterns
65
66 You can continue to use the legacy integration patterns used prior to version [](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-147.33.0](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-14](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-14). Review the [](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) for the backwards-compatible client/services pattern changes.
67
68 ## Documentation
69
70 See the [](https://stripe.com/docs/api/?lang=php#introPHP API docs](https://stripe.com/docs/api/?lang=php#intro](https://stripe.com/docs/api/?lang=php#intro).
71
72 ## Legacy Version Support
73
74 ### PHP 5.4 & 5.5
75
76 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.
77 Otherwise, you can still use Stripe by downloading stripe-php v6.43.1 ([](https://github.com/stripe/stripe-php/archive/v6.43.1.zipzip](https://github.com/stripe/stripe-php/archive/v6.43.1.zip](https://github.com/stripe/stripe-php/archive/v6.43.1.zip), [](https://github.com/stripe/stripe-php/archive/6.43.1.tar.gztar.gz](https://github.com/stripe/stripe-php/archive/6.43.1.tar.gz](https://github.com/stripe/stripe-php/archive/6.43.1.tar.gz)) from our [](https://github.com/stripe/stripe-php/releasesreleases page](https://github.com/stripe/stripe-php/releases](https://github.com/stripe/stripe-php/releases). 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.
78
79 ### PHP 5.3
80
81 If you are using PHP 5.3, you should upgrade your environment as this version has been past end of life since August 2014.
82 Otherwise, you can download v5.9.2 ([](https://github.com/stripe/stripe-php/archive/v5.9.2.zipzip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gztar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [](https://github.com/stripe/stripe-php/releasesreleases page](https://github.com/stripe/stripe-php/releases](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
83
84 ## Custom Request Timeouts
85
86 > **Note**
87 > 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 [](https://stripe.com/docs/api/?lang=php#idempotent_requestsidempotency tokens](https://stripe.com/docs/api/?lang=php#idempotent_requests](https://stripe.com/docs/api/?lang=php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.
88
89 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.
90
91 ```php
92 // set up your tweaked Curl client
93 $curl = new \Stripe\HttpClient\CurlClient();
94 $curl->setTimeout(10); // default is \Stripe\HttpClient\CurlClient::DEFAULT_TIMEOUT
95 $curl->setConnectTimeout(5); // default is \Stripe\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT
96
97 echo $curl->getTimeout(); // 10
98 echo $curl->getConnectTimeout(); // 5
99
100 // tell Stripe to use the tweaked client
101 \Stripe\ApiRequestor::setHttpClient($curl);
102
103 // use the Stripe API client as you normally would
104 ```
105
106 ## Custom cURL Options (e.g. proxies)
107
108 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.
109
110 ```php
111 // set up your tweaked Curl client
112 $curl = new \Stripe\HttpClient\CurlClient([CURLOPT_PROXY => 'proxy.local:80']);
113 // tell Stripe to use the tweaked client
114 \Stripe\ApiRequestor::setHttpClient($curl);
115 ```
116
117 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.
118
119 ### Configuring a Logger
120
121 The library does minimal logging, but it can be configured
122 with a [`PSR-3` compatible logger][psr3] so that messages
123 end up there instead of `error_log`:
124
125 ```php
126 \Stripe\Stripe::setLogger($logger);
127 ```
128
129 ### Accessing response data
130
131 You can access the data from the last API response on any object via `getLastResponse()`.
132
133 ```php
134 $customer = $stripe->customers->create([
135 'description' => 'example customer',
136 ]);
137 echo $customer->getLastResponse()->headers['Request-Id'];
138 ```
139
140 ### SSL / TLS compatibility issues
141
142 Stripe's API now requires that [](https://stripe.com/blog/upgrading-tlsall connections use TLS 1.2](https://stripe.com/blog/upgrading-tls](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 [](https://stripe.com/blog/upgrading-tlshttps://stripe.com/blog/upgrading-tls](https://stripe.com/blog/upgrading-tls](https://stripe.com/blog/upgrading-tls).".
143
144 The recommended course of action is to [](https://support.stripe.com/questions/how-do-i-upgrade-my-stripe-integration-from-tls-1-0-to-tls-1-2#phpupgrade 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](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`:
145
146 ```php
147 $curl = new \Stripe\HttpClient\CurlClient([CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]);
148 \Stripe\ApiRequestor::setHttpClient($curl);
149 ```
150
151 ### Per-request Configuration
152
153 For apps that need to use multiple keys during the lifetime of a process, like
154 one that uses [Stripe Connect][connect], it's also possible to set a
155 per-request key and/or account:
156
157 ```php
158 $customers = $stripe->customers->all([],[
159 'api_key' => 'sk_test_...',
160 'stripe_account' => 'acct_...'
161 ]);
162
163 $stripe->customers->retrieve('cus_123456789', [], [
164 'api_key' => 'sk_test_...',
165 'stripe_account' => 'acct_...'
166 ]);
167 ```
168
169 ### Configuring CA Bundles
170
171 By default, the library will use its own internal bundle of known CA
172 certificates, but it's possible to configure your own:
173
174 ```php
175 \Stripe\Stripe::setCABundlePath("path/to/ca/bundle");
176 ```
177
178 ### Configuring Automatic Retries
179
180 The library can be configured to automatically retry requests that fail due to
181 an intermittent network problem:
182
183 ```php
184 \Stripe\Stripe::setMaxNetworkRetries(2);
185 ```
186
187 [Idempotency keys][idempotency-keys] are added to requests to guarantee that
188 retries are safe.
189
190 ### Telemetry
191
192 By default, the library sends telemetry to Stripe regarding request latency and feature usage. These
193 numbers help Stripe improve the overall latency of its API for all users, and
194 improve popular features.
195
196 You can disable this behavior if you prefer:
197
198 ```php
199 \Stripe\Stripe::setEnableTelemetry(false);
200 ```
201
202 ### Public Preview SDKs
203
204 Stripe has features in the [](https://docs.stripe.com/release-phasespublic preview phase](https://docs.stripe.com/release-phases](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `-beta.X` suffix like `12.2.0-beta.2`.
205 We would love for you to try these as we incrementally release new features and improve them based on your feedback.
206
207 The public preview SDKs are a different version of the same package as the stable SDKs. These versions are appended with `-beta.X` such as `15.0.0-beta.1`. To install, choose the version that includes support for the preview feature you are interested in by reviewing the [](https://github.com/stripe/stripe-dotnet/releases/releases page](https://github.com/stripe/stripe-dotnet/releases/](https://github.com/stripe/stripe-dotnet/releases/) and then use it in the `composer require` command:
208
209 ```bash
210 composer require stripe/stripe-php:v<replace-with-the-version-of-your-choice>
211 ```
212
213 > **Note**
214 > There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific 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 version of the public preview SDK.
215
216 Some preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If the preview feature you are interested in has this requirement, use the function `addBetaVersion` (available only in the public preview SDKs):
217
218 ```php
219 Stripe::addBetaVersion("feature_beta", "v3");
220 ```
221
222 ### Custom requests
223
224 If you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `rawRequest` method on the StripeClient.
225
226 ```php
227 $stripe = new \Stripe\StripeClient('sk_test_xyz');
228 $response = $stripe->rawRequest('post', '/v1/beta_endpoint', [
229 "caveat": "emptor"
230 ], [
231 "stripe_version" => "2022-11_15",
232 ]);
233 // $response->body is a string, you can call $stripe->deserialize to get a \Stripe\StripeObject.
234 $obj = $stripe->deserialize($response->body);
235
236 // For GET requests, the params argument must be null, and you should write the query string explicitly.
237 $get_response = $stripe->rawRequest('get', '/v1/beta_endpoint?caveat=emptor', null, [
238 "stripe_version" => "2022-11_15",
239 ]);
240 ```
241
242 ## Support
243
244 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.
245
246 ## Development
247
248 [](CONTRIBUTING.mdContribution guidelines for this project](CONTRIBUTING.md](CONTRIBUTING.md)
249
250 We use [](https://github.com/casey/justjust](https://github.com/casey/just](https://github.com/casey/just) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`.
251
252 To get started, install [Composer][composer]. For example, on Mac OS:
253
254 ```bash
255 brew install composer
256 ```
257
258 Install dependencies:
259
260 ```bash
261 just install
262 # or: composer install
263 ```
264
265 The test suite depends on [stripe-mock], so make sure to fetch and run it from a
266 background terminal ([stripe-mock's README][stripe-mock] also contains
267 instructions for installing via Homebrew and other methods):
268
269 ```bash
270 go install github.com/stripe/stripe-mock@latest
271 stripe-mock
272 ```
273
274 Install dependencies as mentioned above (which will resolve [](http://packagist.org/packages/phpunit/phpunitPHPUnit](http://packagist.org/packages/phpunit/phpunit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:
275
276 ```bash
277 just test
278 # or: ./vendor/bin/phpunit
279 ```
280
281 Or to run an individual test file:
282
283 ```bash
284 just test tests/Stripe/UtilTest.php
285 # or: ./vendor/bin/phpunit tests/Stripe/UtilTest.php
286 ```
287
288 Update bundled CA certificates from the [Mozilla cURL release][curl]:
289
290 ```bash
291 ./update_certs.php
292 ```
293
294 The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with:
295
296 ```bash
297 just format
298 # or: ./vendor/bin/php-cs-fixer fix -v .
299 ```
300
301 ## Attention plugin developers
302
303 Are you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example:
304
305 ```php
306 \Stripe\Stripe::setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info");
307 ```
308
309 The method should be called once, before any request is sent to the API. The second and third parameters are optional.
310
311 ### SSL / TLS configuration option
312
313 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`.
314
315 [composer]: https://getcomposer.org/
316 [connect]: https://stripe.com/connect
317 [curl]: http://curl.haxx.se/docs/caextract.html
318 [idempotency-keys]: https://stripe.com/docs/api/?lang=php#idempotent_requests
319 [php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
320 [psr3]: http://www.php-fig.org/psr/psr-3/
321 [stripe-mock]: https://github.com/stripe/stripe-mock
322