12 // @var string The Stripe API key to be used for requests.
13 public static $apiKey;
15 // @var string The Stripe client_id to be used for Connect requests.
16 public static $clientId;
18 // @var string The base URL for the Stripe API.
19 public static $apiBase = 'https://api.stripe.com';
21 // @var string The base URL for the OAuth API.
22 public static $connectBase = 'https://connect.stripe.com';
24 // @var string The base URL for the Stripe API uploads endpoint.
25 public static $apiUploadBase = 'https://uploads.stripe.com';
27 // @var string|null The version of the Stripe API to use for requests.
28 public static $apiVersion = null;
30 // @var string|null The account ID for connected accounts requests.
31 public static $accountId = null;
33 // @var string Path to the CA bundle used to verify SSL certificates
34 public static $caBundlePath = null;
36 // @var boolean Defaults to true.
37 public static $verifySslCerts = true;
39 // @var array The application's information (name, version, URL)
40 public static $appInfo = null;
42 // @var Util\LoggerInterface|null The logger to which the library will
44 public static $logger = null;
46 // @var int Maximum number of request retries
47 public static $maxNetworkRetries = 0;
49 // @var float Maximum delay between retries, in seconds
50 private static $maxNetworkRetryDelay = 2.0;
52 // @var float Initial delay between retries, in seconds
53 private static $initialNetworkRetryDelay = 0.5;
55 const VERSION
= '6.10.0';
58 * @return string The API key used for requests.
60 public static function getApiKey()
66 * @return string The client_id used for Connect requests.
68 public static function getClientId()
70 return self
::$clientId;
74 * @return Util\LoggerInterface The logger to which the library will
77 public static function getLogger()
79 if (self
::$logger == null) {
80 return new Util\
DefaultLogger();
86 * @param Util\LoggerInterface $logger The logger to which the library
87 * will produce messages.
89 public static function setLogger($logger)
91 self
::$logger = $logger;
95 * Sets the API key to be used for requests.
97 * @param string $apiKey
99 public static function setApiKey($apiKey)
101 self
::$apiKey = $apiKey;
105 * Sets the client_id to be used for Connect requests.
107 * @param string $clientId
109 public static function setClientId($clientId)
111 self
::$clientId = $clientId;
115 * @return string The API version used for requests. null if we're using the
118 public static function getApiVersion()
120 return self
::$apiVersion;
124 * @param string $apiVersion The API version to use for requests.
126 public static function setApiVersion($apiVersion)
128 self
::$apiVersion = $apiVersion;
134 private static function getDefaultCABundlePath()
136 return realpath(dirname(__FILE__
) . '/../data/ca-certificates.crt');
142 public static function getCABundlePath()
144 return self
::$caBundlePath ?
: self
::getDefaultCABundlePath();
148 * @param string $caBundlePath
150 public static function setCABundlePath($caBundlePath)
152 self
::$caBundlePath = $caBundlePath;
158 public static function getVerifySslCerts()
160 return self
::$verifySslCerts;
164 * @param boolean $verify
166 public static function setVerifySslCerts($verify)
168 self
::$verifySslCerts = $verify;
172 * @return string | null The Stripe account ID for connected account
175 public static function getAccountId()
177 return self
::$accountId;
181 * @param string $accountId The Stripe account ID to set for connected
184 public static function setAccountId($accountId)
186 self
::$accountId = $accountId;
190 * @return array | null The application's information
192 public static function getAppInfo()
194 return self
::$appInfo;
198 * @param string $appName The application's name
199 * @param string $appVersion The application's version
200 * @param string $appUrl The application's URL
202 public static function setAppInfo($appName, $appVersion = null, $appUrl = null, $appPartnerId = null)
204 self
::$appInfo = self
::$appInfo ?
: [];
205 self
::$appInfo['name'] = $appName;
206 self
::$appInfo['partner_id'] = $appPartnerId;
207 self
::$appInfo['url'] = $appUrl;
208 self
::$appInfo['version'] = $appVersion;
212 * @return int Maximum number of request retries
214 public static function getMaxNetworkRetries()
216 return self
::$maxNetworkRetries;
220 * @param int $maxNetworkRetries Maximum number of request retries
222 public static function setMaxNetworkRetries($maxNetworkRetries)
224 self
::$maxNetworkRetries = $maxNetworkRetries;
228 * @return float Maximum delay between retries, in seconds
230 public static function getMaxNetworkRetryDelay()
232 return self
::$maxNetworkRetryDelay;
236 * @return float Initial delay between retries, in seconds
238 public static function getInitialNetworkRetryDelay()
240 return self
::$initialNetworkRetryDelay;