├── VERSION ├── .coveralls.github-actions.yml ├── lib ├── Exception │ ├── BadMethodCallException.php │ ├── InvalidArgumentException.php │ ├── UnexpectedValueException.php │ ├── OAuth │ │ ├── ExceptionInterface.php │ │ ├── InvalidScopeException.php │ │ ├── UnsupportedGrantTypeException.php │ │ ├── InvalidRequestException.php │ │ ├── UnsupportedResponseTypeException.php │ │ ├── InvalidClientException.php │ │ ├── UnknownOAuthErrorException.php │ │ ├── InvalidGrantException.php │ │ └── OAuthErrorException.php │ ├── IdempotencyException.php │ ├── PermissionException.php │ ├── AuthenticationException.php │ ├── ApiConnectionException.php │ ├── RateLimitException.php │ ├── UnknownApiErrorException.php │ ├── ExceptionInterface.php │ ├── InvalidRequestException.php │ ├── SignatureVerificationException.php │ └── CardException.php ├── Discount.php ├── OrderItem.php ├── LoginLink.php ├── Issuing │ ├── CardDetails.php │ ├── Dispute.php │ ├── Cardholder.php │ └── Transaction.php ├── SourceTransaction.php ├── Service │ ├── Checkout │ │ ├── CheckoutServiceFactory.php │ │ └── SessionService.php │ ├── MandateService.php │ ├── BillingPortal │ │ ├── SessionService.php │ │ └── BillingPortalServiceFactory.php │ ├── Sigma │ │ ├── SigmaServiceFactory.php │ │ └── ScheduledQueryRunService.php │ ├── Reporting │ │ ├── ReportingServiceFactory.php │ │ ├── ReportTypeService.php │ │ └── ReportRunService.php │ ├── AccountLinkService.php │ ├── BalanceService.php │ ├── Terminal │ │ ├── TerminalServiceFactory.php │ │ ├── ConnectionTokenService.php │ │ ├── ReaderService.php │ │ └── LocationService.php │ ├── Radar │ │ ├── RadarServiceFactory.php │ │ ├── EarlyFraudWarningService.php │ │ ├── ValueListItemService.php │ │ └── ValueListService.php │ ├── Issuing │ │ ├── IssuingServiceFactory.php │ │ ├── TransactionService.php │ │ ├── CardService.php │ │ ├── DisputeService.php │ │ └── CardholderService.php │ ├── CountrySpecService.php │ ├── ExchangeRateService.php │ ├── TokenService.php │ ├── EphemeralKeyService.php │ ├── OrderReturnService.php │ ├── EventService.php │ ├── BalanceTransactionService.php │ ├── AbstractServiceFactory.php │ ├── ReviewService.php │ ├── ApplePayDomainService.php │ ├── FileLinkService.php │ ├── TaxRateService.php │ ├── FileService.php │ ├── PriceService.php │ ├── AbstractService.php │ ├── RefundService.php │ ├── TopupService.php │ ├── PlanService.php │ ├── DisputeService.php │ ├── ProductService.php │ ├── InvoiceItemService.php │ └── SkuService.php ├── RequestTelemetry.php ├── Terminal │ ├── ConnectionToken.php │ ├── Location.php │ └── Reader.php ├── UsageRecordSummary.php ├── ApiOperations │ ├── Delete.php │ ├── Retrieve.php │ ├── Create.php │ ├── All.php │ ├── Update.php │ └── Request.php ├── AccountLink.php ├── ApiResponse.php ├── BitcoinTransaction.php ├── Util │ ├── DefaultLogger.php │ ├── Set.php │ ├── RandomGenerator.php │ ├── LoggerInterface.php │ └── CaseInsensitiveArray.php ├── HttpClient │ └── ClientInterface.php ├── OAuthErrorObject.php ├── UsageRecord.php ├── RecipientTransfer.php ├── SingletonApiResource.php ├── ApplePayDomain.php ├── Mandate.php ├── Radar │ ├── ValueListItem.php │ ├── ValueList.php │ └── EarlyFraudWarning.php ├── ExchangeRate.php ├── FileLink.php ├── BillingPortal │ └── Session.php ├── Webhook.php ├── StripeClientInterface.php ├── EphemeralKey.php ├── OrderReturn.php ├── CountrySpec.php ├── CreditNoteLineItem.php ├── Sigma │ └── ScheduledQueryRun.php ├── TaxRate.php ├── LineItem.php ├── Reporting │ ├── ReportType.php │ └── ReportRun.php ├── Balance.php ├── WebhookEndpoint.php ├── ThreeDSecure.php ├── AlipayAccount.php ├── ApplicationFeeRefund.php ├── InvoiceLineItem.php ├── SKU.php ├── Coupon.php ├── Recipient.php ├── Capability.php ├── File.php └── Review.php ├── phpstan.neon.dist ├── .editorconfig ├── phpstan-baseline.neon ├── update_certs.php ├── .gitignore ├── phpdoc.dist.xml ├── composer.json ├── Makefile ├── LICENSE └── .php_cs.dist /VERSION: -------------------------------------------------------------------------------- 1 | 7.37.1 2 | -------------------------------------------------------------------------------- /.coveralls.github-actions.yml: -------------------------------------------------------------------------------- 1 | service_name: github-actions 2 | coverage_clover: clover.xml 3 | json_path: coveralls-upload.json 4 | -------------------------------------------------------------------------------- /lib/Exception/BadMethodCallException.php: -------------------------------------------------------------------------------- 1 | $fp, 11 | \CURLOPT_TIMEOUT => 3600, 12 | \CURLOPT_URL => 'https://curl.haxx.se/ca/cacert.pem', 13 | ]; 14 | 15 | $ch = \curl_init(); 16 | \curl_setopt_array($ch, $options); 17 | \curl_exec($ch); 18 | \curl_close($ch); 19 | \fclose($fp); 20 | -------------------------------------------------------------------------------- /lib/SourceTransaction.php: -------------------------------------------------------------------------------- 1 | jsonBody) { 14 | return null; 15 | } 16 | 17 | return \Stripe\OAuthErrorObject::constructFrom($this->jsonBody); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/Exception/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | private static $classMap = [ 16 | 'sessions' => SessionService::class, 17 | ]; 18 | 19 | protected function getServiceClass($name) 20 | { 21 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/RequestTelemetry.php: -------------------------------------------------------------------------------- 1 | requestId = $requestId; 24 | $this->requestDuration = $requestDuration; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Service/MandateService.php: -------------------------------------------------------------------------------- 1 | request('get', $this->buildPath('/v1/mandates/%s', $id), $params, $opts); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/Service/BillingPortal/SessionService.php: -------------------------------------------------------------------------------- 1 | request('post', '/v1/billing_portal/sessions', $params, $opts); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/Service/BillingPortal/BillingPortalServiceFactory.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | private static $classMap = [ 16 | 'sessions' => SessionService::class, 17 | ]; 18 | 19 | protected function getServiceClass($name) 20 | { 21 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Service/Sigma/SigmaServiceFactory.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | private static $classMap = [ 16 | 'scheduledQueryRuns' => ScheduledQueryRunService::class, 17 | ]; 18 | 19 | protected function getServiceClass($name) 20 | { 21 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore build files 2 | build/* 3 | 4 | # Mac OS X dumps these all over the place. 5 | .DS_Store 6 | 7 | # Ignore the SimpleTest library if it is installed to /test/. 8 | /test/simpletest/ 9 | 10 | # Ignore the /vendor/ directory for people using composer 11 | /vendor/ 12 | 13 | # If the vendor directory isn't being commited the composer.lock file should also be ignored 14 | composer.lock 15 | 16 | # Ignore PHPUnit coverage file 17 | clover.xml 18 | 19 | # Ignore IDE's configuration files 20 | .idea 21 | 22 | # Ignore PHP CS Fixer local config and cache 23 | .php_cs 24 | .php_cs.cache 25 | 26 | # Ignore PHPStan local config 27 | .phpstan.neon 28 | 29 | # Ignore phpDocumentor's local config and artifacts 30 | .phpdoc/* 31 | phpdoc.xml 32 | -------------------------------------------------------------------------------- /lib/Service/Reporting/ReportingServiceFactory.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | private static $classMap = [ 17 | 'reportRuns' => ReportRunService::class, 18 | 'reportTypes' => ReportTypeService::class, 19 | ]; 20 | 21 | protected function getServiceClass($name) 22 | { 23 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/Service/AccountLinkService.php: -------------------------------------------------------------------------------- 1 | request('post', '/v1/account_links', $params, $opts); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Terminal/ConnectionToken.php: -------------------------------------------------------------------------------- 1 | Fleet 10 | * Management. 11 | * 12 | * @property string $object String representing the object's type. Objects of the same type share the same value. 13 | * @property string $location The id of the location that this connection token is scoped to. 14 | * @property string $secret Your application should pass this token to the Stripe Terminal SDK. 15 | */ 16 | class ConnectionToken extends \Stripe\ApiResource 17 | { 18 | const OBJECT_NAME = 'terminal.connection_token'; 19 | 20 | use \Stripe\ApiOperations\Create; 21 | } 22 | -------------------------------------------------------------------------------- /lib/UsageRecordSummary.php: -------------------------------------------------------------------------------- 1 | true if the object exists in live mode or the value false if the object exists in test mode. 10 | * @property \Stripe\StripeObject $period 11 | * @property string $subscription_item The ID of the subscription item this summary is describing. 12 | * @property int $total_usage The total usage within this usage period. 13 | */ 14 | class UsageRecordSummary extends ApiResource 15 | { 16 | const OBJECT_NAME = 'usage_record_summary'; 17 | } 18 | -------------------------------------------------------------------------------- /lib/Service/BalanceService.php: -------------------------------------------------------------------------------- 1 | Accounting 11 | * for negative balances. 12 | * 13 | * @param null|array $params 14 | * @param null|array|\Stripe\Util\RequestOptions $opts 15 | * 16 | * @throws \Stripe\Exception\ApiErrorException if the request fails 17 | * 18 | * @return \Stripe\Balance 19 | */ 20 | public function retrieve($params = null, $opts = null) 21 | { 22 | return $this->request('get', '/v1/balance', $params, $opts); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/Service/Terminal/TerminalServiceFactory.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | private static $classMap = [ 18 | 'connectionTokens' => ConnectionTokenService::class, 19 | 'locations' => LocationService::class, 20 | 'readers' => ReaderService::class, 21 | ]; 22 | 23 | protected function getServiceClass($name) 24 | { 25 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/ApiOperations/Delete.php: -------------------------------------------------------------------------------- 1 | instanceUrl(); 25 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); 26 | $this->refreshFrom($response, $opts); 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/Service/Terminal/ConnectionTokenService.php: -------------------------------------------------------------------------------- 1 | request('post', '/v1/terminal/connection_tokens', $params, $opts); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/AccountLink.php: -------------------------------------------------------------------------------- 1 | Connect 12 | * Onboarding. 13 | * 14 | * @property string $object String representing the object's type. Objects of the same type share the same value. 15 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. 16 | * @property int $expires_at The timestamp at which this account link will expire. 17 | * @property string $url The URL for the account link. 18 | */ 19 | class AccountLink extends ApiResource 20 | { 21 | const OBJECT_NAME = 'account_link'; 22 | 23 | use ApiOperations\Create; 24 | } 25 | -------------------------------------------------------------------------------- /lib/ApiOperations/Retrieve.php: -------------------------------------------------------------------------------- 1 | refresh(); 27 | 28 | return $instance; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/Service/Radar/RadarServiceFactory.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | private static $classMap = [ 18 | 'earlyFraudWarnings' => EarlyFraudWarningService::class, 19 | 'valueListItems' => ValueListItemService::class, 20 | 'valueLists' => ValueListService::class, 21 | ]; 22 | 23 | protected function getServiceClass($name) 24 | { 25 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/ApiResponse.php: -------------------------------------------------------------------------------- 1 | body = $body; 41 | $this->code = $code; 42 | $this->headers = $headers; 43 | $this->json = $json; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/BitcoinTransaction.php: -------------------------------------------------------------------------------- 1 | currency that the transaction was converted to in real-time. 9 | * @property int $bitcoin_amount The amount of bitcoin contained in the transaction. 10 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. 11 | * @property string $currency Three-letter ISO code for the currency to which this transaction was converted. 12 | * @property string $receiver The receiver to which this transaction was sent. 13 | */ 14 | class BitcoinTransaction extends ApiResource 15 | { 16 | const OBJECT_NAME = 'bitcoin_transaction'; 17 | } 18 | -------------------------------------------------------------------------------- /lib/Util/DefaultLogger.php: -------------------------------------------------------------------------------- 1 | 0) { 20 | throw new \Stripe\Exception\BadMethodCallException('DefaultLogger does not currently implement context. Please implement if you need it.'); 21 | } 22 | 23 | if (null === $this->destination) { 24 | \error_log($message, $this->messageType); 25 | } else { 26 | \error_log($message, $this->messageType, $this->destination); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/Util/Set.php: -------------------------------------------------------------------------------- 1 | _elts = []; 15 | foreach ($members as $item) { 16 | $this->_elts[$item] = true; 17 | } 18 | } 19 | 20 | public function includes($elt) 21 | { 22 | return isset($this->_elts[$elt]); 23 | } 24 | 25 | public function add($elt) 26 | { 27 | $this->_elts[$elt] = true; 28 | } 29 | 30 | public function discard($elt) 31 | { 32 | unset($this->_elts[$elt]); 33 | } 34 | 35 | public function toArray() 36 | { 37 | return \array_keys($this->_elts); 38 | } 39 | 40 | public function getIterator() 41 | { 42 | return new ArrayIterator($this->toArray()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/ApiOperations/Create.php: -------------------------------------------------------------------------------- 1 | json, $opts); 27 | $obj->setLastResponse($response); 28 | 29 | return $obj; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/Util/RandomGenerator.php: -------------------------------------------------------------------------------- 1 | null, 27 | 'error_description' => null, 28 | ], $values); 29 | parent::refreshFrom($values, $opts, $partial); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/UsageRecord.php: -------------------------------------------------------------------------------- 1 | Metered 11 | * Billing. 12 | * 13 | * @property string $id Unique identifier for the object. 14 | * @property string $object String representing the object's type. Objects of the same type share the same value. 15 | * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. 16 | * @property int $quantity The usage quantity for the specified date. 17 | * @property string $subscription_item The ID of the subscription item this usage record contains data for. 18 | * @property int $timestamp The timestamp when this usage occurred. 19 | */ 20 | class UsageRecord extends ApiResource 21 | { 22 | const OBJECT_NAME = 'usage_record'; 23 | } 24 | -------------------------------------------------------------------------------- /lib/Service/Issuing/IssuingServiceFactory.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | private static $classMap = [ 20 | 'authorizations' => AuthorizationService::class, 21 | 'cardholders' => CardholderService::class, 22 | 'cards' => CardService::class, 23 | 'disputes' => DisputeService::class, 24 | 'transactions' => TransactionService::class, 25 | ]; 26 | 27 | protected function getServiceClass($name) 28 | { 29 | return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/RecipientTransfer.php: -------------------------------------------------------------------------------- 1 | refresh(); 15 | 16 | return $instance; 17 | } 18 | 19 | /** 20 | * @return string the endpoint associated with this singleton class 21 | */ 22 | public static function classUrl() 23 | { 24 | // Replace dots with slashes for namespaced resources, e.g. if the object's name is 25 | // "foo.bar", then its URL will be "/v1/foo/bar". 26 | $base = \str_replace('.', '/', static::OBJECT_NAME); 27 | 28 | return "/v1/{$base}"; 29 | } 30 | 31 | /** 32 | * @return string the endpoint associated with this singleton API resource 33 | */ 34 | public function instanceUrl() 35 | { 36 | return static::classUrl(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/ApplePayDomain.php: -------------------------------------------------------------------------------- 1 | true if the object exists in live mode or the value false if the object exists in test mode. 11 | */ 12 | class ApplePayDomain extends ApiResource 13 | { 14 | const OBJECT_NAME = 'apple_pay_domain'; 15 | 16 | use ApiOperations\All; 17 | use ApiOperations\Create; 18 | use ApiOperations\Delete; 19 | use ApiOperations\Retrieve; 20 | 21 | /** 22 | * @return string The class URL for this resource. It needs to be special 23 | * cased because it doesn't fit into the standard resource pattern. 24 | */ 25 | public static function classUrl() 26 | { 27 | return '/v1/apple_pay/domains'; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /phpdoc.dist.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | build/phpdoc 10 | 11 | 12 | latest 13 | 14 | 15 | lib 16 | 17 | api 18 | 24 | 25 | php 26 | 27 | stripe-php 28 | 29 | 30 |