Stripe.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Stripe
  5. *
  6. * @package Stripe
  7. */
  8. class Stripe
  9. {
  10. // @var string The Stripe API key to be used for requests.
  11. public static $apiKey;
  12. // @var string The base URL for the Stripe API.
  13. public static $apiBase = 'https://api.stripe.com';
  14. // @var string The base URL for the Stripe API uploads endpoint.
  15. public static $apiUploadBase = 'https://uploads.stripe.com';
  16. // @var string|null The version of the Stripe API to use for requests.
  17. public static $apiVersion = null;
  18. // @var string|null The account ID for connected accounts requests.
  19. public static $accountId = null;
  20. // @var boolean Defaults to true.
  21. public static $verifySslCerts = true;
  22. // @var array The application's information (name, version, URL)
  23. public static $appInfo = null;
  24. const VERSION = '3.23.0';
  25. /**
  26. * @return string The API key used for requests.
  27. */
  28. public static function getApiKey()
  29. {
  30. return self::$apiKey;
  31. }
  32. /**
  33. * Sets the API key to be used for requests.
  34. *
  35. * @param string $apiKey
  36. */
  37. public static function setApiKey($apiKey)
  38. {
  39. self::$apiKey = $apiKey;
  40. }
  41. /**
  42. * @return string The API version used for requests. null if we're using the
  43. * latest version.
  44. */
  45. public static function getApiVersion()
  46. {
  47. return self::$apiVersion;
  48. }
  49. /**
  50. * @param string $apiVersion The API version to use for requests.
  51. */
  52. public static function setApiVersion($apiVersion)
  53. {
  54. self::$apiVersion = $apiVersion;
  55. }
  56. /**
  57. * @return boolean
  58. */
  59. public static function getVerifySslCerts()
  60. {
  61. return self::$verifySslCerts;
  62. }
  63. /**
  64. * @param boolean $verify
  65. */
  66. public static function setVerifySslCerts($verify)
  67. {
  68. self::$verifySslCerts = $verify;
  69. }
  70. /**
  71. * @return string | null The Stripe account ID for connected account
  72. * requests.
  73. */
  74. public static function getAccountId()
  75. {
  76. return self::$accountId;
  77. }
  78. /**
  79. * @param string $accountId The Stripe account ID to set for connected
  80. * account requests.
  81. */
  82. public static function setAccountId($accountId)
  83. {
  84. self::$accountId = $accountId;
  85. }
  86. /**
  87. * @return array | null The application's information
  88. */
  89. public static function getAppInfo()
  90. {
  91. return self::$appInfo;
  92. }
  93. /**
  94. * @param string $appName The application's name
  95. * @param string $appVersion The application's version
  96. * @param string $appUrl The application's URL
  97. */
  98. public static function setAppInfo($appName, $appVersion = null, $appUrl = null)
  99. {
  100. if (self::$appInfo === null) {
  101. self::$appInfo = array();
  102. }
  103. self::$appInfo['name'] = $appName;
  104. self::$appInfo['version'] = $appVersion;
  105. self::$appInfo['url'] = $appUrl;
  106. }
  107. }