├── 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 | false if the object exists in test mode.
13 | * @property \Stripe\StripeObject $multi_use
14 | * @property string|\Stripe\PaymentMethod $payment_method ID of the payment method associated with this mandate.
15 | * @property \Stripe\StripeObject $payment_method_details
16 | * @property \Stripe\StripeObject $single_use
17 | * @property string $status The status of the mandate, which indicates whether it can be used to initiate a payment.
18 | * @property string $type The type of the mandate.
19 | */
20 | class Mandate extends ApiResource
21 | {
22 | const OBJECT_NAME = 'mandate';
23 |
24 | use ApiOperations\Retrieve;
25 | }
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2010-2019 Stripe, Inc. (https://stripe.com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/Service/CountrySpecService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/country_specs', $params, $opts);
20 | }
21 |
22 | /**
23 | * Returns a Country Spec for a given Country code.
24 | *
25 | * @param string $id
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\CountrySpec
32 | */
33 | public function retrieve($id, $params = null, $opts = null)
34 | {
35 | return $this->request('get', $this->buildPath('/v1/country_specs/%s', $id), $params, $opts);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/Service/Sigma/ScheduledQueryRunService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/sigma/scheduled_query_runs', $params, $opts);
20 | }
21 |
22 | /**
23 | * Retrieves the details of an scheduled query run.
24 | *
25 | * @param string $id
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\Sigma\ScheduledQueryRun
32 | */
33 | public function retrieve($id, $params = null, $opts = null)
34 | {
35 | return $this->request('get', $this->buildPath('/v1/sigma/scheduled_query_runs/%s', $id), $params, $opts);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/ApiOperations/All.php:
--------------------------------------------------------------------------------
1 | json, $opts);
27 | if (!($obj instanceof \Stripe\Collection)) {
28 | throw new \Stripe\Exception\UnexpectedValueException(
29 | 'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
30 | );
31 | }
32 | $obj->setLastResponse($response);
33 | $obj->setFilters($params);
34 |
35 | return $obj;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/Util/LoggerInterface.php:
--------------------------------------------------------------------------------
1 | Fleet
10 | * Management.
11 | *
12 | * @property string $id Unique identifier for the object.
13 | * @property string $object String representing the object's type. Objects of the same type share the same value.
14 | * @property \Stripe\StripeObject $address
15 | * @property string $display_name The display name of the location.
16 | * @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.
17 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
18 | */
19 | class Location extends \Stripe\ApiResource
20 | {
21 | const OBJECT_NAME = 'terminal.location';
22 |
23 | use \Stripe\ApiOperations\All;
24 | use \Stripe\ApiOperations\Create;
25 | use \Stripe\ApiOperations\Delete;
26 | use \Stripe\ApiOperations\Retrieve;
27 | use \Stripe\ApiOperations\Update;
28 | }
29 |
--------------------------------------------------------------------------------
/lib/Issuing/Dispute.php:
--------------------------------------------------------------------------------
1 | card issuer, you can dispute
8 | * transactions that you do not recognize, suspect to be fraudulent, or have some
9 | * other issue.
10 | *
11 | * Related guide: Disputing
13 | * Transactions
14 | *
15 | * @property string $id Unique identifier for the object.
16 | * @property string $object String representing the object's type. Objects of the same type share the same value.
17 | * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this dispute.
18 | * @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.
19 | * @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed.
20 | */
21 | class Dispute extends \Stripe\ApiResource
22 | {
23 | const OBJECT_NAME = 'issuing.dispute';
24 |
25 | use \Stripe\ApiOperations\All;
26 | use \Stripe\ApiOperations\Create;
27 | use \Stripe\ApiOperations\Retrieve;
28 | use \Stripe\ApiOperations\Update;
29 | }
30 |
--------------------------------------------------------------------------------
/lib/Radar/ValueListItem.php:
--------------------------------------------------------------------------------
1 | Managing List
11 | * Items.
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 int $created Time at which the object was created. Measured in seconds since the Unix epoch.
16 | * @property string $created_by The name or email address of the user who added this item to the value list.
17 | * @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.
18 | * @property string $value The value of the item.
19 | * @property string $value_list The identifier of the value list this item belongs to.
20 | */
21 | class ValueListItem extends \Stripe\ApiResource
22 | {
23 | const OBJECT_NAME = 'radar.value_list_item';
24 |
25 | use \Stripe\ApiOperations\All;
26 | use \Stripe\ApiOperations\Create;
27 | use \Stripe\ApiOperations\Delete;
28 | use \Stripe\ApiOperations\Retrieve;
29 | }
30 |
--------------------------------------------------------------------------------
/lib/Service/ExchangeRateService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/exchange_rates', $params, $opts);
21 | }
22 |
23 | /**
24 | * Retrieves the exchange rates from the given currency to every supported
25 | * currency.
26 | *
27 | * @param string $id
28 | * @param null|array $params
29 | * @param null|array|\Stripe\Util\RequestOptions $opts
30 | *
31 | * @throws \Stripe\Exception\ApiErrorException if the request fails
32 | *
33 | * @return \Stripe\ExchangeRate
34 | */
35 | public function retrieve($id, $params = null, $opts = null)
36 | {
37 | return $this->request('get', $this->buildPath('/v1/exchange_rates/%s', $id), $params, $opts);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/Service/TokenService.php:
--------------------------------------------------------------------------------
1 | Custom
11 | * account.
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\Token
19 | */
20 | public function create($params = null, $opts = null)
21 | {
22 | return $this->request('post', '/v1/tokens', $params, $opts);
23 | }
24 |
25 | /**
26 | * Retrieves the token with the given ID.
27 | *
28 | * @param string $id
29 | * @param null|array $params
30 | * @param null|array|\Stripe\Util\RequestOptions $opts
31 | *
32 | * @throws \Stripe\Exception\ApiErrorException if the request fails
33 | *
34 | * @return \Stripe\Token
35 | */
36 | public function retrieve($id, $params = null, $opts = null)
37 | {
38 | return $this->request('get', $this->buildPath('/v1/tokens/%s', $id), $params, $opts);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/.php_cs.dist:
--------------------------------------------------------------------------------
1 | setRiskyAllowed(true)
5 | ->setRules([
6 | // Rulesets
7 | '@PSR2' => true,
8 | '@PhpCsFixer' => true,
9 | '@PhpCsFixer:risky' => true,
10 | '@PHP56Migration:risky' => true,
11 | '@PHPUnit57Migration:risky' => true,
12 |
13 | // Additional rules
14 | 'fopen_flags' => true,
15 | 'linebreak_after_opening_tag' => true,
16 | 'native_function_invocation' => true,
17 |
18 | // --- Diffs from @PhpCsFixer / @PhpCsFixer:risky ---
19 |
20 | // This is just prettier / easier to read.
21 | 'concat_space' => ['spacing' => 'one'],
22 |
23 | // This causes strange ordering with codegen'd classes. We might be
24 | // able to enable this if we update codegen to output class elements
25 | // in the correct order.
26 | 'ordered_class_elements' => false,
27 |
28 | // Keep this disabled to avoid unnecessary diffs in PHPDoc comments of
29 | // codegen'd classes.
30 | 'phpdoc_align' => false,
31 |
32 | // This is a "risky" rule that causes a bug in our codebase.
33 | // Specifically, in `StripeObject.updateAttributes` we construct new
34 | // `StripeObject`s for metadata. We can't use `self` there because it
35 | // needs to be a raw `StripeObject`.
36 | 'self_accessor' => false,
37 | ])
38 | ;
39 |
--------------------------------------------------------------------------------
/lib/Service/EphemeralKeyService.php:
--------------------------------------------------------------------------------
1 | request('delete', $this->buildPath('/v1/ephemeral_keys/%s', $id), $params, $opts);
21 | }
22 |
23 | /**
24 | * Creates a short-lived API key for a given resource.
25 | *
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\EphemeralKey
32 | */
33 | public function create($params = null, $opts = null)
34 | {
35 | if (!$opts || !isset($opts['stripe_version'])) {
36 | throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
37 | }
38 |
39 | return $this->request('post', '/v1/ephemeral_keys', $params, $opts);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/Service/Reporting/ReportTypeService.php:
--------------------------------------------------------------------------------
1 | live-mode API key.).
10 | *
11 | * @param null|array $params
12 | * @param null|array|\Stripe\Util\RequestOptions $opts
13 | *
14 | * @throws \Stripe\Exception\ApiErrorException if the request fails
15 | *
16 | * @return \Stripe\Collection
17 | */
18 | public function all($params = null, $opts = null)
19 | {
20 | return $this->requestCollection('get', '/v1/reporting/report_types', $params, $opts);
21 | }
22 |
23 | /**
24 | * Retrieves the details of a Report Type. (Requires a live-mode API key.).
26 | *
27 | * @param string $id
28 | * @param null|array $params
29 | * @param null|array|\Stripe\Util\RequestOptions $opts
30 | *
31 | * @throws \Stripe\Exception\ApiErrorException if the request fails
32 | *
33 | * @return \Stripe\Reporting\ReportType
34 | */
35 | public function retrieve($id, $params = null, $opts = null)
36 | {
37 | return $this->request('get', $this->buildPath('/v1/reporting/report_types/%s', $id), $params, $opts);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/Service/Radar/EarlyFraudWarningService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/radar/early_fraud_warnings', $params, $opts);
20 | }
21 |
22 | /**
23 | * Retrieves the details of an early fraud warning that has previously been
24 | * created.
25 | *
26 | * Please refer to the early fraud
27 | * warning object reference for more details.
28 | *
29 | * @param string $id
30 | * @param null|array $params
31 | * @param null|array|\Stripe\Util\RequestOptions $opts
32 | *
33 | * @throws \Stripe\Exception\ApiErrorException if the request fails
34 | *
35 | * @return \Stripe\Radar\EarlyFraudWarning
36 | */
37 | public function retrieve($id, $params = null, $opts = null)
38 | {
39 | return $this->request('get', $this->buildPath('/v1/radar/early_fraud_warnings/%s', $id), $params, $opts);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/Service/OrderReturnService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/order_returns', $params, $opts);
21 | }
22 |
23 | /**
24 | * Retrieves the details of an existing order return. Supply the unique order ID
25 | * from either an order return creation request or the order return list, and
26 | * Stripe will return the corresponding order information.
27 | *
28 | * @param string $id
29 | * @param null|array $params
30 | * @param null|array|\Stripe\Util\RequestOptions $opts
31 | *
32 | * @throws \Stripe\Exception\ApiErrorException if the request fails
33 | *
34 | * @return \Stripe\OrderReturn
35 | */
36 | public function retrieve($id, $params = null, $opts = null)
37 | {
38 | return $this->request('get', $this->buildPath('/v1/order_returns/%s', $id), $params, $opts);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/ExchangeRate.php:
--------------------------------------------------------------------------------
1 | Exchange Rate objects allow you to determine the rates that Stripe
7 | * is currently using to convert from one currency to another. Since this number is
8 | * variable throughout the day, there are various reasons why you might want to
9 | * know the current rate (for example, to dynamically price an item for a user with
10 | * a default payment in a foreign currency).
11 | *
12 | * If you want a guarantee that the charge is made with a certain exchange rate you
13 | * expect is current, you can pass in exchange_rate to charges
14 | * endpoints. If the value is no longer up to date, the charge won't go through.
15 | * Please refer to our Exchange
16 | * Rates API guide for more details.
17 | *
18 | * @property string $id Unique identifier for the object. Represented as the three-letter ISO currency code in lowercase.
19 | * @property string $object String representing the object's type. Objects of the same type share the same value.
20 | * @property \Stripe\StripeObject $rates Hash where the keys are supported currencies and the values are the exchange rate at which the base id currency converts to the key currency.
21 | */
22 | class ExchangeRate extends ApiResource
23 | {
24 | const OBJECT_NAME = 'exchange_rate';
25 |
26 | use ApiOperations\All;
27 | use ApiOperations\Retrieve;
28 | }
29 |
--------------------------------------------------------------------------------
/lib/FileLink.php:
--------------------------------------------------------------------------------
1 | File object with non-Stripe users, you
7 | * can create a FileLink. FileLinks contain a URL that
8 | * can be used to retrieve the contents of the file without authentication.
9 | *
10 | * @property string $id Unique identifier for the object.
11 | * @property string $object String representing the object's type. Objects of the same type share the same value.
12 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
13 | * @property bool $expired Whether this link is already expired.
14 | * @property null|int $expires_at Time at which the link expires.
15 | * @property string|\Stripe\File $file The file object this link points to.
16 | * @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.
17 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
18 | * @property null|string $url The publicly accessible URL to download the file.
19 | */
20 | class FileLink extends ApiResource
21 | {
22 | const OBJECT_NAME = 'file_link';
23 |
24 | use ApiOperations\All;
25 | use ApiOperations\Create;
26 | use ApiOperations\Retrieve;
27 | use ApiOperations\Update;
28 | }
29 |
--------------------------------------------------------------------------------
/lib/Service/EventService.php:
--------------------------------------------------------------------------------
1 | event object api_version
11 | * attribute (not according to your current Stripe API version or
12 | * Stripe-Version header).
13 | *
14 | * @param null|array $params
15 | * @param null|array|\Stripe\Util\RequestOptions $opts
16 | *
17 | * @throws \Stripe\Exception\ApiErrorException if the request fails
18 | *
19 | * @return \Stripe\Collection
20 | */
21 | public function all($params = null, $opts = null)
22 | {
23 | return $this->requestCollection('get', '/v1/events', $params, $opts);
24 | }
25 |
26 | /**
27 | * Retrieves the details of an event. Supply the unique identifier of the event,
28 | * which you might have received in a webhook.
29 | *
30 | * @param string $id
31 | * @param null|array $params
32 | * @param null|array|\Stripe\Util\RequestOptions $opts
33 | *
34 | * @throws \Stripe\Exception\ApiErrorException if the request fails
35 | *
36 | * @return \Stripe\Event
37 | */
38 | public function retrieve($id, $params = null, $opts = null)
39 | {
40 | return $this->request('get', $this->buildPath('/v1/events/%s', $id), $params, $opts);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/BillingPortal/Session.php:
--------------------------------------------------------------------------------
1 | Billing
15 | * customer portal.
16 | *
17 | * @property string $id Unique identifier for the object.
18 | * @property string $object String representing the object's type. Objects of the same type share the same value.
19 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20 | * @property string $customer The ID of the customer for this session.
21 | * @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.
22 | * @property string $return_url The URL to which Stripe should send customers when they click on the link to return to your website.
23 | * @property string $url The short-lived URL of the session giving customers access to the customer portal.
24 | */
25 | class Session extends \Stripe\ApiResource
26 | {
27 | const OBJECT_NAME = 'billing_portal.session';
28 |
29 | use \Stripe\ApiOperations\Create;
30 | }
31 |
--------------------------------------------------------------------------------
/lib/ApiOperations/Update.php:
--------------------------------------------------------------------------------
1 | json, $opts);
29 | $obj->setLastResponse($response);
30 |
31 | return $obj;
32 | }
33 |
34 | /**
35 | * @param null|array|string $opts
36 | *
37 | * @throws \Stripe\Exception\ApiErrorException if the request fails
38 | *
39 | * @return static the saved resource
40 | */
41 | public function save($opts = null)
42 | {
43 | $params = $this->serializeParameters();
44 | if (\count($params) > 0) {
45 | $url = $this->instanceUrl();
46 | list($response, $opts) = $this->_request('post', $url, $params, $opts);
47 | $this->refreshFrom($response, $opts);
48 | }
49 |
50 | return $this;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib/Webhook.php:
--------------------------------------------------------------------------------
1 | true if the object exists in live mode or the value false if the object exists in test mode.
11 | * @property string $secret The key's secret. You can use this value to make authorized requests to the Stripe API.
12 | * @property array $associated_objects
13 | */
14 | class EphemeralKey extends ApiResource
15 | {
16 | const OBJECT_NAME = 'ephemeral_key';
17 |
18 | use ApiOperations\Delete;
19 |
20 | use ApiOperations\Create {
21 | create as protected _create;
22 | }
23 |
24 | /**
25 | * @param null|array $params
26 | * @param null|array|string $opts
27 | *
28 | * @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\EphemeralKey the created key
32 | */
33 | public static function create($params = null, $opts = null)
34 | {
35 | if (!$opts || !isset($opts['stripe_version'])) {
36 | throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
37 | }
38 |
39 | return self::_create($params, $opts);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/Service/BalanceTransactionService.php:
--------------------------------------------------------------------------------
1 | /v1/balance/history.
14 | *
15 | * @param null|array $params
16 | * @param null|array|\Stripe\Util\RequestOptions $opts
17 | *
18 | * @throws \Stripe\Exception\ApiErrorException if the request fails
19 | *
20 | * @return \Stripe\Collection
21 | */
22 | public function all($params = null, $opts = null)
23 | {
24 | return $this->requestCollection('get', '/v1/balance_transactions', $params, $opts);
25 | }
26 |
27 | /**
28 | * Retrieves the balance transaction with the given ID.
29 | *
30 | * Note that this endpoint previously used the path
31 | * /v1/balance/history/:id.
32 | *
33 | * @param string $id
34 | * @param null|array $params
35 | * @param null|array|\Stripe\Util\RequestOptions $opts
36 | *
37 | * @throws \Stripe\Exception\ApiErrorException if the request fails
38 | *
39 | * @return \Stripe\BalanceTransaction
40 | */
41 | public function retrieve($id, $params = null, $opts = null)
42 | {
43 | return $this->request('get', $this->buildPath('/v1/balance_transactions/%s', $id), $params, $opts);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/Service/AbstractServiceFactory.php:
--------------------------------------------------------------------------------
1 | */
21 | private $services;
22 |
23 | /**
24 | * @param \Stripe\StripeClientInterface $client
25 | */
26 | public function __construct($client)
27 | {
28 | $this->client = $client;
29 | $this->services = [];
30 | }
31 |
32 | /**
33 | * @param string $name
34 | *
35 | * @return null|string
36 | */
37 | abstract protected function getServiceClass($name);
38 |
39 | /**
40 | * @param string $name
41 | *
42 | * @return null|AbstractService|AbstractServiceFactory
43 | */
44 | public function __get($name)
45 | {
46 | $serviceClass = $this->getServiceClass($name);
47 | if (null !== $serviceClass) {
48 | if (!\array_key_exists($name, $this->services)) {
49 | $this->services[$name] = new $serviceClass($this->client);
50 | }
51 |
52 | return $this->services[$name];
53 | }
54 |
55 | \trigger_error('Undefined property: ' . static::class . '::$' . $name);
56 |
57 | return null;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/lib/OrderReturn.php:
--------------------------------------------------------------------------------
1 | order items. Returns always
8 | * belong to an order, and may optionally contain a refund.
9 | *
10 | * Related guide: Handling
12 | * Returns.
13 | *
14 | * @property string $id Unique identifier for the object.
15 | * @property string $object String representing the object's type. Objects of the same type share the same value.
16 | * @property int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the returned line item.
17 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18 | * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
19 | * @property \Stripe\OrderItem[] $items The items included in this order return.
20 | * @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.
21 | * @property null|string|\Stripe\Order $order The order that this return includes items from.
22 | * @property null|string|\Stripe\Refund $refund The ID of the refund issued for this return.
23 | */
24 | class OrderReturn extends ApiResource
25 | {
26 | const OBJECT_NAME = 'order_return';
27 |
28 | use ApiOperations\All;
29 | use ApiOperations\Retrieve;
30 | }
31 |
--------------------------------------------------------------------------------
/lib/Terminal/Reader.php:
--------------------------------------------------------------------------------
1 | Connecting to a
10 | * Reader.
11 | *
12 | * @property string $id Unique identifier for the object.
13 | * @property string $object String representing the object's type. Objects of the same type share the same value.
14 | * @property null|string $device_sw_version The current software version of the reader.
15 | * @property string $device_type Type of reader, one of bbpos_chipper2x or verifone_P400.
16 | * @property null|string $ip_address The local IP address of the reader.
17 | * @property string $label Custom label given to the reader for easier identification.
18 | * @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.
19 | * @property null|string $location The location identifier of the reader.
20 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
21 | * @property string $serial_number Serial number of the reader.
22 | * @property null|string $status The networking status of the reader.
23 | */
24 | class Reader extends \Stripe\ApiResource
25 | {
26 | const OBJECT_NAME = 'terminal.reader';
27 |
28 | use \Stripe\ApiOperations\All;
29 | use \Stripe\ApiOperations\Create;
30 | use \Stripe\ApiOperations\Delete;
31 | use \Stripe\ApiOperations\Retrieve;
32 | use \Stripe\ApiOperations\Update;
33 | }
34 |
--------------------------------------------------------------------------------
/lib/CountrySpec.php:
--------------------------------------------------------------------------------
1 | an online guide.
12 | *
13 | * @property string $id Unique identifier for the object. Represented as the ISO country code for this country.
14 | * @property string $object String representing the object's type. Objects of the same type share the same value.
15 | * @property string $default_currency The default currency for this country. This applies to both payment methods and bank accounts.
16 | * @property \Stripe\StripeObject $supported_bank_account_currencies Currencies that can be accepted in the specific country (for transfers).
17 | * @property string[] $supported_payment_currencies Currencies that can be accepted in the specified country (for payments).
18 | * @property string[] $supported_payment_methods Payment methods available in the specified country. You may need to enable some payment methods (e.g., ACH) on your account before they appear in this list. The stripe payment method refers to charging through your platform.
19 | * @property string[] $supported_transfer_countries Countries that can accept transfers from the specified country.
20 | * @property \Stripe\StripeObject $verification_fields
21 | */
22 | class CountrySpec extends ApiResource
23 | {
24 | const OBJECT_NAME = 'country_spec';
25 |
26 | use ApiOperations\All;
27 | use ApiOperations\Retrieve;
28 | }
29 |
--------------------------------------------------------------------------------
/lib/CreditNoteLineItem.php:
--------------------------------------------------------------------------------
1 | %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
9 | * @property null|string $description Description of the item being credited.
10 | * @property int $discount_amount The integer amount in %s representing the discount being credited for this line item.
11 | * @property string $invoice_line_item ID of the invoice line item being credited
12 | * @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.
13 | * @property null|int $quantity The number of units of product being credited.
14 | * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
15 | * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
16 | * @property string $type The type of the credit note line item, one of invoice_line_item or custom_line_item. When the type is invoice_line_item there is an additional invoice_line_item property on the resource the value of which is the id of the credited line item on the invoice.
17 | * @property null|int $unit_amount The cost of each unit of product being credited.
18 | * @property null|string $unit_amount_decimal Same as unit_amount, but contains a decimal value with at most 12 decimal places.
19 | */
20 | class CreditNoteLineItem extends ApiResource
21 | {
22 | const OBJECT_NAME = 'credit_note_line_item';
23 | }
24 |
--------------------------------------------------------------------------------
/lib/Sigma/ScheduledQueryRun.php:
--------------------------------------------------------------------------------
1 | scheduled
7 | * a Sigma query, you'll receive a
8 | * sigma.scheduled_query_run.created webhook each time the query runs.
9 | * The webhook contains a ScheduledQueryRun object, which you can use
10 | * to retrieve the query results.
11 | *
12 | * @property string $id Unique identifier for the object.
13 | * @property string $object String representing the object's type. Objects of the same type share the same value.
14 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15 | * @property int $data_load_time When the query was run, Sigma contained a snapshot of your Stripe data at this time.
16 | * @property \Stripe\StripeObject $error
17 | * @property null|\Stripe\File $file The file object representing the results of the query.
18 | * @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.
19 | * @property int $result_available_until Time at which the result expires and is no longer available for download.
20 | * @property string $sql SQL for the query.
21 | * @property string $status The query's execution status, which will be completed for successful runs, and canceled, failed, or timed_out otherwise.
22 | * @property string $title Title of the query.
23 | */
24 | class ScheduledQueryRun extends \Stripe\ApiResource
25 | {
26 | const OBJECT_NAME = 'scheduled_query_run';
27 |
28 | use \Stripe\ApiOperations\All;
29 | use \Stripe\ApiOperations\Retrieve;
30 |
31 | public static function classUrl()
32 | {
33 | return '/v1/sigma/scheduled_query_runs';
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/Exception/InvalidRequestException.php:
--------------------------------------------------------------------------------
1 | setStripeParam($stripeParam);
37 |
38 | return $instance;
39 | }
40 |
41 | /**
42 | * Gets the parameter related to the error.
43 | *
44 | * @return null|string
45 | */
46 | public function getStripeParam()
47 | {
48 | return $this->stripeParam;
49 | }
50 |
51 | /**
52 | * Sets the parameter related to the error.
53 | *
54 | * @param null|string $stripeParam
55 | */
56 | public function setStripeParam($stripeParam)
57 | {
58 | $this->stripeParam = $stripeParam;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/lib/Radar/ValueList.php:
--------------------------------------------------------------------------------
1 | Default Stripe
11 | * Lists.
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 string $alias The name of the value list for use in rules.
16 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17 | * @property string $created_by The name or email address of the user who created this value list.
18 | * @property string $item_type The type of items in the value list. One of card_fingerprint, card_bin, email, ip_address, country, string, or case_sensitive_string.
19 | * @property \Stripe\Collection $list_items List of items contained within this value list.
20 | * @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.
21 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
22 | * @property string $name The name of the value list.
23 | */
24 | class ValueList extends \Stripe\ApiResource
25 | {
26 | const OBJECT_NAME = 'radar.value_list';
27 |
28 | use \Stripe\ApiOperations\All;
29 | use \Stripe\ApiOperations\Create;
30 | use \Stripe\ApiOperations\Delete;
31 | use \Stripe\ApiOperations\Retrieve;
32 | use \Stripe\ApiOperations\Update;
33 | }
34 |
--------------------------------------------------------------------------------
/lib/Service/ReviewService.php:
--------------------------------------------------------------------------------
1 | Review objects that have open set to
9 | * true. The objects are sorted in descending order by creation date,
10 | * with the most recently created object appearing first.
11 | *
12 | * @param null|array $params
13 | * @param null|array|\Stripe\Util\RequestOptions $opts
14 | *
15 | * @throws \Stripe\Exception\ApiErrorException if the request fails
16 | *
17 | * @return \Stripe\Collection
18 | */
19 | public function all($params = null, $opts = null)
20 | {
21 | return $this->requestCollection('get', '/v1/reviews', $params, $opts);
22 | }
23 |
24 | /**
25 | * Approves a Review object, closing it and removing it from the list
26 | * of reviews.
27 | *
28 | * @param string $id
29 | * @param null|array $params
30 | * @param null|array|\Stripe\Util\RequestOptions $opts
31 | *
32 | * @throws \Stripe\Exception\ApiErrorException if the request fails
33 | *
34 | * @return \Stripe\Review
35 | */
36 | public function approve($id, $params = null, $opts = null)
37 | {
38 | return $this->request('post', $this->buildPath('/v1/reviews/%s/approve', $id), $params, $opts);
39 | }
40 |
41 | /**
42 | * Retrieves a Review object.
43 | *
44 | * @param string $id
45 | * @param null|array $params
46 | * @param null|array|\Stripe\Util\RequestOptions $opts
47 | *
48 | * @throws \Stripe\Exception\ApiErrorException if the request fails
49 | *
50 | * @return \Stripe\Review
51 | */
52 | public function retrieve($id, $params = null, $opts = null)
53 | {
54 | return $this->request('get', $this->buildPath('/v1/reviews/%s', $id), $params, $opts);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/lib/TaxRate.php:
--------------------------------------------------------------------------------
1 | Tax
9 | * Rates.
10 | *
11 | * @property string $id Unique identifier for the object.
12 | * @property string $object String representing the object's type. Objects of the same type share the same value.
13 | * @property bool $active Defaults to true. When set to false, this tax rate cannot be applied to objects in the API, but will still be applied to subscriptions and invoices that already have it set.
14 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15 | * @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
16 | * @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.
17 | * @property bool $inclusive This specifies if the tax rate is inclusive or exclusive.
18 | * @property null|string $jurisdiction The jurisdiction for the tax rate.
19 | * @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.
20 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
21 | * @property float $percentage This represents the tax rate percent out of 100.
22 | */
23 | class TaxRate extends ApiResource
24 | {
25 | const OBJECT_NAME = 'tax_rate';
26 |
27 | use ApiOperations\All;
28 | use ApiOperations\Create;
29 | use ApiOperations\Retrieve;
30 | use ApiOperations\Update;
31 | }
32 |
--------------------------------------------------------------------------------
/lib/Exception/SignatureVerificationException.php:
--------------------------------------------------------------------------------
1 | setHttpBody($httpBody);
30 | $instance->setSigHeader($sigHeader);
31 |
32 | return $instance;
33 | }
34 |
35 | /**
36 | * Gets the HTTP body as a string.
37 | *
38 | * @return null|string
39 | */
40 | public function getHttpBody()
41 | {
42 | return $this->httpBody;
43 | }
44 |
45 | /**
46 | * Sets the HTTP body as a string.
47 | *
48 | * @param null|string $httpBody
49 | */
50 | public function setHttpBody($httpBody)
51 | {
52 | $this->httpBody = $httpBody;
53 | }
54 |
55 | /**
56 | * Gets the `Stripe-Signature` HTTP header.
57 | *
58 | * @return null|string
59 | */
60 | public function getSigHeader()
61 | {
62 | return $this->sigHeader;
63 | }
64 |
65 | /**
66 | * Sets the `Stripe-Signature` HTTP header.
67 | *
68 | * @param null|string $sigHeader
69 | */
70 | public function setSigHeader($sigHeader)
71 | {
72 | $this->sigHeader = $sigHeader;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/LineItem.php:
--------------------------------------------------------------------------------
1 | ISO currency code, in lowercase. Must be a supported currency.
13 | * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name.
14 | * @property \Stripe\Price $price
Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.
For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
Related guides: Set up a subscription, create an invoice, and more about products and prices.
15 | * @property null|int $quantity The quantity of products being purchased. 16 | * @property \Stripe\StripeObject[] $taxes The taxes applied to the line item. 17 | */ 18 | class LineItem extends ApiResource 19 | { 20 | const OBJECT_NAME = 'item'; 21 | 22 | use ApiOperations\All; 23 | } 24 | -------------------------------------------------------------------------------- /lib/Service/Reporting/ReportRunService.php: -------------------------------------------------------------------------------- 1 | live-mode API key.). 10 | * 11 | * @param null|array $params 12 | * @param null|array|\Stripe\Util\RequestOptions $opts 13 | * 14 | * @throws \Stripe\Exception\ApiErrorException if the request fails 15 | * 16 | * @return \Stripe\Collection 17 | */ 18 | public function all($params = null, $opts = null) 19 | { 20 | return $this->requestCollection('get', '/v1/reporting/report_runs', $params, $opts); 21 | } 22 | 23 | /** 24 | * Creates a new object and begin running the report. (Requires a live-mode API key.). 26 | * 27 | * @param null|array $params 28 | * @param null|array|\Stripe\Util\RequestOptions $opts 29 | * 30 | * @throws \Stripe\Exception\ApiErrorException if the request fails 31 | * 32 | * @return \Stripe\Reporting\ReportRun 33 | */ 34 | public function create($params = null, $opts = null) 35 | { 36 | return $this->request('post', '/v1/reporting/report_runs', $params, $opts); 37 | } 38 | 39 | /** 40 | * Retrieves the details of an existing Report Run. (Requires a live-mode API key.). 42 | * 43 | * @param string $id 44 | * @param null|array $params 45 | * @param null|array|\Stripe\Util\RequestOptions $opts 46 | * 47 | * @throws \Stripe\Exception\ApiErrorException if the request fails 48 | * 49 | * @return \Stripe\Reporting\ReportRun 50 | */ 51 | public function retrieve($id, $params = null, $opts = null) 52 | { 53 | return $this->request('get', $this->buildPath('/v1/reporting/report_runs/%s', $id), $params, $opts); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Service/Issuing/TransactionService.php: -------------------------------------------------------------------------------- 1 | Transaction objects. The objects are 9 | * sorted in descending order by creation date, with the most recently created 10 | * object appearing first. 11 | * 12 | * @param null|array $params 13 | * @param null|array|\Stripe\Util\RequestOptions $opts 14 | * 15 | * @throws \Stripe\Exception\ApiErrorException if the request fails 16 | * 17 | * @return \Stripe\Collection 18 | */ 19 | public function all($params = null, $opts = null) 20 | { 21 | return $this->requestCollection('get', '/v1/issuing/transactions', $params, $opts); 22 | } 23 | 24 | /** 25 | * Retrieves an IssuingTransaction object.
26 | *
27 | * @param string $id
28 | * @param null|array $params
29 | * @param null|array|\Stripe\Util\RequestOptions $opts
30 | *
31 | * @throws \Stripe\Exception\ApiErrorException if the request fails
32 | *
33 | * @return \Stripe\Issuing\Transaction
34 | */
35 | public function retrieve($id, $params = null, $opts = null)
36 | {
37 | return $this->request('get', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts);
38 | }
39 |
40 | /**
41 | * Updates the specified Issuing Transaction object by setting the
42 | * values of the parameters passed. Any parameters not provided will be left
43 | * unchanged.
44 | *
45 | * @param string $id
46 | * @param null|array $params
47 | * @param null|array|\Stripe\Util\RequestOptions $opts
48 | *
49 | * @throws \Stripe\Exception\ApiErrorException if the request fails
50 | *
51 | * @return \Stripe\Issuing\Transaction
52 | */
53 | public function update($id, $params = null, $opts = null)
54 | {
55 | return $this->request('post', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/lib/Reporting/ReportType.php:
--------------------------------------------------------------------------------
1 | API Access to Reports
10 | * documentation for those Report Type IDs, along with required and optional
11 | * parameters.
12 | *
13 | * Note that reports can only be run based on your live-mode data (not test-mode
14 | * data), and thus related requests must be made with a live-mode API key.
16 | *
17 | * @property string $id The ID of the Report Type, such as balance.summary.1.
18 | * @property string $object String representing the object's type. Objects of the same type share the same value.
19 | * @property int $data_available_end Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch.
20 | * @property int $data_available_start Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch.
21 | * @property null|string[] $default_columns List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the columns parameter, this will be null.)
22 | * @property string $name Human-readable name of the Report Type
23 | * @property int $updated When this Report Type was latest updated. Measured in seconds since the Unix epoch.
24 | * @property int $version Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas.
25 | */
26 | class ReportType extends \Stripe\ApiResource
27 | {
28 | const OBJECT_NAME = 'reporting.report_type';
29 |
30 | use \Stripe\ApiOperations\All;
31 | use \Stripe\ApiOperations\Retrieve;
32 | }
33 |
--------------------------------------------------------------------------------
/lib/Util/CaseInsensitiveArray.php:
--------------------------------------------------------------------------------
1 | container = \array_change_key_case($initial_array, \CASE_LOWER);
22 | }
23 |
24 | public function count()
25 | {
26 | return \count($this->container);
27 | }
28 |
29 | public function getIterator()
30 | {
31 | return new \ArrayIterator($this->container);
32 | }
33 |
34 | public function offsetSet($offset, $value)
35 | {
36 | $offset = static::maybeLowercase($offset);
37 | if (null === $offset) {
38 | $this->container[] = $value;
39 | } else {
40 | $this->container[$offset] = $value;
41 | }
42 | }
43 |
44 | public function offsetExists($offset)
45 | {
46 | $offset = static::maybeLowercase($offset);
47 |
48 | return isset($this->container[$offset]);
49 | }
50 |
51 | public function offsetUnset($offset)
52 | {
53 | $offset = static::maybeLowercase($offset);
54 | unset($this->container[$offset]);
55 | }
56 |
57 | public function offsetGet($offset)
58 | {
59 | $offset = static::maybeLowercase($offset);
60 |
61 | return isset($this->container[$offset]) ? $this->container[$offset] : null;
62 | }
63 |
64 | private static function maybeLowercase($v)
65 | {
66 | if (\is_string($v)) {
67 | return \strtolower($v);
68 | }
69 |
70 | return $v;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/Radar/EarlyFraudWarning.php:
--------------------------------------------------------------------------------
1 | Early
11 | * Fraud Warnings.
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 $actionable An EFW is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute later.
16 | * @property string|\Stripe\Charge $charge ID of the charge this early fraud warning is for, optionally expanded.
17 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18 | * @property string $fraud_type The type of fraud labelled by the issuer. One of card_never_received, fraudulent_card_application, made_with_counterfeit_card, made_with_lost_card, made_with_stolen_card, misc, unauthorized_use_of_card.
19 | * @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.
20 | */
21 | class EarlyFraudWarning extends \Stripe\ApiResource
22 | {
23 | const OBJECT_NAME = 'radar.early_fraud_warning';
24 |
25 | use \Stripe\ApiOperations\All;
26 | use \Stripe\ApiOperations\Retrieve;
27 |
28 | const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received';
29 | const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application';
30 | const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card';
31 | const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card';
32 | const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card';
33 | const FRAUD_TYPE_MISC = 'misc';
34 | const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card';
35 | }
36 |
--------------------------------------------------------------------------------
/lib/Service/ApplePayDomainService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/apple_pay/domains', $params, $opts);
20 | }
21 |
22 | /**
23 | * Create an apple pay domain.
24 | *
25 | * @param null|array $params
26 | * @param null|array|\Stripe\Util\RequestOptions $opts
27 | *
28 | * @throws \Stripe\Exception\ApiErrorException if the request fails
29 | *
30 | * @return \Stripe\ApplePayDomain
31 | */
32 | public function create($params = null, $opts = null)
33 | {
34 | return $this->request('post', '/v1/apple_pay/domains', $params, $opts);
35 | }
36 |
37 | /**
38 | * Delete an apple pay domain.
39 | *
40 | * @param string $id
41 | * @param null|array $params
42 | * @param null|array|\Stripe\Util\RequestOptions $opts
43 | *
44 | * @throws \Stripe\Exception\ApiErrorException if the request fails
45 | *
46 | * @return \Stripe\ApplePayDomain
47 | */
48 | public function delete($id, $params = null, $opts = null)
49 | {
50 | return $this->request('delete', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts);
51 | }
52 |
53 | /**
54 | * Retrieve an apple pay domain.
55 | *
56 | * @param string $id
57 | * @param null|array $params
58 | * @param null|array|\Stripe\Util\RequestOptions $opts
59 | *
60 | * @throws \Stripe\Exception\ApiErrorException if the request fails
61 | *
62 | * @return \Stripe\ApplePayDomain
63 | */
64 | public function retrieve($id, $params = null, $opts = null)
65 | {
66 | return $this->request('get', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/Service/FileLinkService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/file_links', $params, $opts);
20 | }
21 |
22 | /**
23 | * Creates a new file link object.
24 | *
25 | * @param null|array $params
26 | * @param null|array|\Stripe\Util\RequestOptions $opts
27 | *
28 | * @throws \Stripe\Exception\ApiErrorException if the request fails
29 | *
30 | * @return \Stripe\FileLink
31 | */
32 | public function create($params = null, $opts = null)
33 | {
34 | return $this->request('post', '/v1/file_links', $params, $opts);
35 | }
36 |
37 | /**
38 | * Retrieves the file link with the given ID.
39 | *
40 | * @param string $id
41 | * @param null|array $params
42 | * @param null|array|\Stripe\Util\RequestOptions $opts
43 | *
44 | * @throws \Stripe\Exception\ApiErrorException if the request fails
45 | *
46 | * @return \Stripe\FileLink
47 | */
48 | public function retrieve($id, $params = null, $opts = null)
49 | {
50 | return $this->request('get', $this->buildPath('/v1/file_links/%s', $id), $params, $opts);
51 | }
52 |
53 | /**
54 | * Updates an existing file link object. Expired links can no longer be updated.
55 | *
56 | * @param string $id
57 | * @param null|array $params
58 | * @param null|array|\Stripe\Util\RequestOptions $opts
59 | *
60 | * @throws \Stripe\Exception\ApiErrorException if the request fails
61 | *
62 | * @return \Stripe\FileLink
63 | */
64 | public function update($id, $params = null, $opts = null)
65 | {
66 | return $this->request('post', $this->buildPath('/v1/file_links/%s', $id), $params, $opts);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/Service/TaxRateService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/tax_rates', $params, $opts);
21 | }
22 |
23 | /**
24 | * Creates a new tax rate.
25 | *
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\TaxRate
32 | */
33 | public function create($params = null, $opts = null)
34 | {
35 | return $this->request('post', '/v1/tax_rates', $params, $opts);
36 | }
37 |
38 | /**
39 | * Retrieves a tax rate with the given ID.
40 | *
41 | * @param string $id
42 | * @param null|array $params
43 | * @param null|array|\Stripe\Util\RequestOptions $opts
44 | *
45 | * @throws \Stripe\Exception\ApiErrorException if the request fails
46 | *
47 | * @return \Stripe\TaxRate
48 | */
49 | public function retrieve($id, $params = null, $opts = null)
50 | {
51 | return $this->request('get', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts);
52 | }
53 |
54 | /**
55 | * Updates an existing tax rate.
56 | *
57 | * @param string $id
58 | * @param null|array $params
59 | * @param null|array|\Stripe\Util\RequestOptions $opts
60 | *
61 | * @throws \Stripe\Exception\ApiErrorException if the request fails
62 | *
63 | * @return \Stripe\TaxRate
64 | */
65 | public function update($id, $params = null, $opts = null)
66 | {
67 | return $this->request('post', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/lib/Service/FileService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/files', $params, $opts);
22 | }
23 |
24 | /**
25 | * Retrieves the details of an existing file object. Supply the unique file ID from
26 | * a file, and Stripe will return the corresponding file object. To access file
27 | * contents, see the File Upload
28 | * Guide.
29 | *
30 | * @param string $id
31 | * @param null|array $params
32 | * @param null|array|\Stripe\Util\RequestOptions $opts
33 | *
34 | * @throws \Stripe\Exception\ApiErrorException if the request fails
35 | *
36 | * @return \Stripe\File
37 | */
38 | public function retrieve($id, $params = null, $opts = null)
39 | {
40 | return $this->request('get', $this->buildPath('/v1/files/%s', $id), $params, $opts);
41 | }
42 |
43 | /**
44 | * Create a file.
45 | *
46 | * @param null|array $params
47 | * @param null|array|\Stripe\Util\RequestOptions $opts
48 | *
49 | * @return \Stripe\File
50 | */
51 | public function create($params = null, $opts = null)
52 | {
53 | $opts = \Stripe\Util\RequestOptions::parse($opts);
54 | if (!isset($opts->apiBase)) {
55 | $opts->apiBase = $this->getClient()->getFilesBase();
56 | }
57 |
58 | // Manually flatten params, otherwise curl's multipart encoder will
59 | // choke on nested null|arrays.
60 | $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
61 |
62 | return $this->request('post', '/v1/files', $flatParams, $opts);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/lib/Service/PriceService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/prices', $params, $opts);
20 | }
21 |
22 | /**
23 | * Creates a new price for an existing product. The price can be recurring or
24 | * one-time.
25 | *
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\Price
32 | */
33 | public function create($params = null, $opts = null)
34 | {
35 | return $this->request('post', '/v1/prices', $params, $opts);
36 | }
37 |
38 | /**
39 | * Retrieves the price with the given ID.
40 | *
41 | * @param string $id
42 | * @param null|array $params
43 | * @param null|array|\Stripe\Util\RequestOptions $opts
44 | *
45 | * @throws \Stripe\Exception\ApiErrorException if the request fails
46 | *
47 | * @return \Stripe\Price
48 | */
49 | public function retrieve($id, $params = null, $opts = null)
50 | {
51 | return $this->request('get', $this->buildPath('/v1/prices/%s', $id), $params, $opts);
52 | }
53 |
54 | /**
55 | * Updates the specified price by setting the values of the parameters passed. Any
56 | * parameters not provided are left unchanged.
57 | *
58 | * @param string $id
59 | * @param null|array $params
60 | * @param null|array|\Stripe\Util\RequestOptions $opts
61 | *
62 | * @throws \Stripe\Exception\ApiErrorException if the request fails
63 | *
64 | * @return \Stripe\Price
65 | */
66 | public function update($id, $params = null, $opts = null)
67 | {
68 | return $this->request('post', $this->buildPath('/v1/prices/%s', $id), $params, $opts);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/lib/Service/AbstractService.php:
--------------------------------------------------------------------------------
1 | client = $client;
23 | }
24 |
25 | /**
26 | * Gets the client used by this service to send requests.
27 | *
28 | * @return \Stripe\StripeClientInterface
29 | */
30 | public function getClient()
31 | {
32 | return $this->client;
33 | }
34 |
35 | /**
36 | * Translate null values to empty strings. For service methods,
37 | * we interpret null as a request to unset the field, which
38 | * corresponds to sending an empty string for the field to the
39 | * API.
40 | *
41 | * @param null|array $params
42 | */
43 | private static function formatParams($params)
44 | {
45 | if (null === $params) {
46 | return null;
47 | }
48 | \array_walk_recursive($params, function (&$value, $key) {
49 | if (null === $value) {
50 | $value = '';
51 | }
52 | });
53 |
54 | return $params;
55 | }
56 |
57 | protected function request($method, $path, $params, $opts)
58 | {
59 | return $this->getClient()->request($method, $path, static::formatParams($params), $opts);
60 | }
61 |
62 | protected function requestCollection($method, $path, $params, $opts)
63 | {
64 | return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts);
65 | }
66 |
67 | protected function buildPath($basePath, ...$ids)
68 | {
69 | foreach ($ids as $id) {
70 | if (null === $id || '' === \trim($id)) {
71 | $msg = 'The resource ID cannot be null or whitespace.';
72 |
73 | throw new \Stripe\Exception\InvalidArgumentException($msg);
74 | }
75 | }
76 |
77 | return \sprintf($basePath, ...\array_map('\urlencode', $ids));
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/lib/Balance.php:
--------------------------------------------------------------------------------
1 | transactions
11 | * that contributed to the balance (charges, payouts, and so forth).
12 | *
13 | * The available and pending amounts for each currency are broken down further by
14 | * payment source types.
15 | *
16 | * Related guide: Understanding Connect
18 | * Account Balances.
19 | *
20 | * @property string $object String representing the object's type. Objects of the same type share the same value.
21 | * @property \Stripe\StripeObject[] $available Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the Transfers API or Payouts API. The available balance for each currency and payment type can be found in the source_types property.
22 | * @property \Stripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the source_types property.
23 | * @property \Stripe\StripeObject $issuing
24 | * @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.
25 | * @property \Stripe\StripeObject[] $pending Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the source_types property.
26 | */
27 | class Balance extends SingletonApiResource
28 | {
29 | const OBJECT_NAME = 'balance';
30 |
31 | /**
32 | * @param null|array|string $opts
33 | *
34 | * @throws \Stripe\Exception\ApiErrorException if the request fails
35 | *
36 | * @return \Stripe\Balance
37 | */
38 | public static function retrieve($opts = null)
39 | {
40 | return self::_singletonRetrieve($opts);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/Issuing/Cardholder.php:
--------------------------------------------------------------------------------
1 | Cardholder object represents an individual or business
7 | * entity who is issued cards.
8 | *
9 | * Related guide: How to create a
11 | * Cardholder
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 \Stripe\StripeObject $billing
16 | * @property null|\Stripe\StripeObject $company Additional information about a company cardholder.
17 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18 | * @property null|string $email The cardholder's email address.
19 | * @property null|\Stripe\StripeObject $individual Additional information about an individual cardholder.
20 | * @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.
21 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
22 | * @property string $name The cardholder's name. This will be printed on cards issued to them.
23 | * @property null|string $phone_number The cardholder's phone number.
24 | * @property \Stripe\StripeObject $requirements
25 | * @property null|\Stripe\StripeObject $spending_controls Spending rules that give you some control over how this cardholder's cards can be used. Refer to our authorizations documentation for more details.
26 | * @property string $status Specifies whether to permit authorizations on this cardholder's cards.
27 | * @property string $type One of individual or company.
28 | */
29 | class Cardholder extends \Stripe\ApiResource
30 | {
31 | const OBJECT_NAME = 'issuing.cardholder';
32 |
33 | use \Stripe\ApiOperations\All;
34 | use \Stripe\ApiOperations\Create;
35 | use \Stripe\ApiOperations\Retrieve;
36 | use \Stripe\ApiOperations\Update;
37 | }
38 |
--------------------------------------------------------------------------------
/lib/WebhookEndpoint.php:
--------------------------------------------------------------------------------
1 | webhook
7 | * endpoints via the API to be notified about events that happen in your Stripe
8 | * account or connected accounts.
9 | *
10 | * Most users configure webhooks from the dashboard, which provides a
12 | * user interface for registering and testing your webhook endpoints.
13 | *
14 | * Related guide: Setting up
15 | * Webhooks.
16 | *
17 | * @property string $id Unique identifier for the object.
18 | * @property string $object String representing the object's type. Objects of the same type share the same value.
19 | * @property null|string $api_version The API version events are rendered as for this webhook endpoint.
20 | * @property null|string $application The ID of the associated Connect application.
21 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
22 | * @property null|string $description An optional description of what the wehbook is used for.
23 | * @property string[] $enabled_events The list of events to enable for this endpoint. ['*'] indicates that all events are enabled, except those that require explicit selection.
24 | * @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.
25 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
26 | * @property string $secret The endpoint's secret, used to generate webhook signatures. Only returned at creation.
27 | * @property string $status The status of the webhook. It can be enabled or disabled.
28 | * @property string $url The URL of the webhook endpoint.
29 | */
30 | class WebhookEndpoint extends ApiResource
31 | {
32 | const OBJECT_NAME = 'webhook_endpoint';
33 |
34 | use ApiOperations\All;
35 | use ApiOperations\Create;
36 | use ApiOperations\Delete;
37 | use ApiOperations\Retrieve;
38 | use ApiOperations\Update;
39 | }
40 |
--------------------------------------------------------------------------------
/lib/Reporting/ReportRun.php:
--------------------------------------------------------------------------------
1 | API Access to
11 | * Reports.
12 | *
13 | * Note that reports can only be run based on your live-mode data (not test-mode
14 | * data), and thus related requests must be made with a live-mode API key.
16 | *
17 | * @property string $id Unique identifier for the object.
18 | * @property string $object String representing the object's type. Objects of the same type share the same value.
19 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20 | * @property null|string $error If something should go wrong during the run, a message about the failure (populated when status=failed).
21 | * @property bool $livemode Always true: reports can only be run on live-mode data.
22 | * @property \Stripe\StripeObject $parameters
23 | * @property string $report_type The ID of the report type to run, such as "balance.summary.1".
24 | * @property null|\Stripe\File $result The file object representing the result of the report run (populated when status=succeeded).
25 | * @property string $status Status of this report run. This will be pending when the run is initially created. When the run finishes, this will be set to succeeded and the result field will be populated. Rarely, we may encounter an error, at which point this will be set to failed and the error field will be populated.
26 | * @property null|int $succeeded_at Timestamp at which this run successfully finished (populated when status=succeeded). Measured in seconds since the Unix epoch.
27 | */
28 | class ReportRun extends \Stripe\ApiResource
29 | {
30 | const OBJECT_NAME = 'reporting.report_run';
31 |
32 | use \Stripe\ApiOperations\All;
33 | use \Stripe\ApiOperations\Create;
34 | use \Stripe\ApiOperations\Retrieve;
35 | }
36 |
--------------------------------------------------------------------------------
/lib/Exception/CardException.php:
--------------------------------------------------------------------------------
1 | setDeclineCode($declineCode);
40 | $instance->setStripeParam($stripeParam);
41 |
42 | return $instance;
43 | }
44 |
45 | /**
46 | * Gets the decline code.
47 | *
48 | * @return null|string
49 | */
50 | public function getDeclineCode()
51 | {
52 | return $this->declineCode;
53 | }
54 |
55 | /**
56 | * Sets the decline code.
57 | *
58 | * @param null|string $declineCode
59 | */
60 | public function setDeclineCode($declineCode)
61 | {
62 | $this->declineCode = $declineCode;
63 | }
64 |
65 | /**
66 | * Gets the parameter related to the error.
67 | *
68 | * @return null|string
69 | */
70 | public function getStripeParam()
71 | {
72 | return $this->stripeParam;
73 | }
74 |
75 | /**
76 | * Sets the parameter related to the error.
77 | *
78 | * @param null|string $stripeParam
79 | */
80 | public function setStripeParam($stripeParam)
81 | {
82 | $this->stripeParam = $stripeParam;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/lib/Service/Checkout/SessionService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/checkout/sessions', $params, $opts);
20 | }
21 |
22 | /**
23 | * When retrieving a Checkout Session, there is an includable
24 | * line_items property containing the first handful of those
25 | * items. There is also a URL where you can retrieve the full (paginated) list of
26 | * line items.
27 | *
28 | * @param string $parentId
29 | * @param null|array $params
30 | * @param null|array|\Stripe\Util\RequestOptions $opts
31 | *
32 | * @throws \Stripe\Exception\ApiErrorException if the request fails
33 | *
34 | * @return \Stripe\Collection
35 | */
36 | public function allLineItems($parentId, $params = null, $opts = null)
37 | {
38 | return $this->requestCollection('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $parentId), $params, $opts);
39 | }
40 |
41 | /**
42 | * Creates a Session object.
43 | *
44 | * @param null|array $params
45 | * @param null|array|\Stripe\Util\RequestOptions $opts
46 | *
47 | * @throws \Stripe\Exception\ApiErrorException if the request fails
48 | *
49 | * @return \Stripe\Checkout\Session
50 | */
51 | public function create($params = null, $opts = null)
52 | {
53 | return $this->request('post', '/v1/checkout/sessions', $params, $opts);
54 | }
55 |
56 | /**
57 | * Retrieves a Session object.
58 | *
59 | * @param string $id
60 | * @param null|array $params
61 | * @param null|array|\Stripe\Util\RequestOptions $opts
62 | *
63 | * @throws \Stripe\Exception\ApiErrorException if the request fails
64 | *
65 | * @return \Stripe\Checkout\Session
66 | */
67 | public function retrieve($id, $params = null, $opts = null)
68 | {
69 | return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s', $id), $params, $opts);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/lib/Service/Issuing/CardService.php:
--------------------------------------------------------------------------------
1 | Card objects. The objects are sorted in
9 | * descending order by creation date, with the most recently created object
10 | * appearing first.
11 | *
12 | * @param null|array $params
13 | * @param null|array|\Stripe\Util\RequestOptions $opts
14 | *
15 | * @throws \Stripe\Exception\ApiErrorException if the request fails
16 | *
17 | * @return \Stripe\Collection
18 | */
19 | public function all($params = null, $opts = null)
20 | {
21 | return $this->requestCollection('get', '/v1/issuing/cards', $params, $opts);
22 | }
23 |
24 | /**
25 | * Creates an Issuing Card object.
26 | *
27 | * @param null|array $params
28 | * @param null|array|\Stripe\Util\RequestOptions $opts
29 | *
30 | * @throws \Stripe\Exception\ApiErrorException if the request fails
31 | *
32 | * @return \Stripe\Issuing\Card
33 | */
34 | public function create($params = null, $opts = null)
35 | {
36 | return $this->request('post', '/v1/issuing/cards', $params, $opts);
37 | }
38 |
39 | /**
40 | * Retrieves an Issuing Card object.
41 | *
42 | * @param string $id
43 | * @param null|array $params
44 | * @param null|array|\Stripe\Util\RequestOptions $opts
45 | *
46 | * @throws \Stripe\Exception\ApiErrorException if the request fails
47 | *
48 | * @return \Stripe\Issuing\Card
49 | */
50 | public function retrieve($id, $params = null, $opts = null)
51 | {
52 | return $this->request('get', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts);
53 | }
54 |
55 | /**
56 | * Updates the specified Issuing Card object by setting the values of
57 | * the parameters passed. Any parameters not provided will be left unchanged.
58 | *
59 | * @param string $id
60 | * @param null|array $params
61 | * @param null|array|\Stripe\Util\RequestOptions $opts
62 | *
63 | * @throws \Stripe\Exception\ApiErrorException if the request fails
64 | *
65 | * @return \Stripe\Issuing\Card
66 | */
67 | public function update($id, $params = null, $opts = null)
68 | {
69 | return $this->request('post', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/lib/Service/Issuing/DisputeService.php:
--------------------------------------------------------------------------------
1 | Dispute objects. The objects are sorted
9 | * in descending order by creation date, with the most recently created object
10 | * appearing first.
11 | *
12 | * @param null|array $params
13 | * @param null|array|\Stripe\Util\RequestOptions $opts
14 | *
15 | * @throws \Stripe\Exception\ApiErrorException if the request fails
16 | *
17 | * @return \Stripe\Collection
18 | */
19 | public function all($params = null, $opts = null)
20 | {
21 | return $this->requestCollection('get', '/v1/issuing/disputes', $params, $opts);
22 | }
23 |
24 | /**
25 | * Creates an Issuing Dispute object.
26 | *
27 | * @param null|array $params
28 | * @param null|array|\Stripe\Util\RequestOptions $opts
29 | *
30 | * @throws \Stripe\Exception\ApiErrorException if the request fails
31 | *
32 | * @return \Stripe\Issuing\Dispute
33 | */
34 | public function create($params = null, $opts = null)
35 | {
36 | return $this->request('post', '/v1/issuing/disputes', $params, $opts);
37 | }
38 |
39 | /**
40 | * Retrieves an Issuing Dispute object.
41 | *
42 | * @param string $id
43 | * @param null|array $params
44 | * @param null|array|\Stripe\Util\RequestOptions $opts
45 | *
46 | * @throws \Stripe\Exception\ApiErrorException if the request fails
47 | *
48 | * @return \Stripe\Issuing\Dispute
49 | */
50 | public function retrieve($id, $params = null, $opts = null)
51 | {
52 | return $this->request('get', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts);
53 | }
54 |
55 | /**
56 | * Updates the specified Issuing Dispute object by setting the values
57 | * of the parameters passed. Any parameters not provided will be left unchanged.
58 | *
59 | * @param string $id
60 | * @param null|array $params
61 | * @param null|array|\Stripe\Util\RequestOptions $opts
62 | *
63 | * @throws \Stripe\Exception\ApiErrorException if the request fails
64 | *
65 | * @return \Stripe\Issuing\Dispute
66 | */
67 | public function update($id, $params = null, $opts = null)
68 | {
69 | return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/lib/Service/RefundService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/refunds', $params, $opts);
23 | }
24 |
25 | /**
26 | * Create a refund.
27 | *
28 | * @param null|array $params
29 | * @param null|array|\Stripe\Util\RequestOptions $opts
30 | *
31 | * @throws \Stripe\Exception\ApiErrorException if the request fails
32 | *
33 | * @return \Stripe\Refund
34 | */
35 | public function create($params = null, $opts = null)
36 | {
37 | return $this->request('post', '/v1/refunds', $params, $opts);
38 | }
39 |
40 | /**
41 | * Retrieves the details of an existing refund.
42 | *
43 | * @param string $id
44 | * @param null|array $params
45 | * @param null|array|\Stripe\Util\RequestOptions $opts
46 | *
47 | * @throws \Stripe\Exception\ApiErrorException if the request fails
48 | *
49 | * @return \Stripe\Refund
50 | */
51 | public function retrieve($id, $params = null, $opts = null)
52 | {
53 | return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
54 | }
55 |
56 | /**
57 | * Updates the specified refund by setting the values of the parameters passed. Any
58 | * parameters not provided will be left unchanged.
59 | *
60 | * This request only accepts metadata as an argument.
61 | *
62 | * @param string $id
63 | * @param null|array $params
64 | * @param null|array|\Stripe\Util\RequestOptions $opts
65 | *
66 | * @throws \Stripe\Exception\ApiErrorException if the request fails
67 | *
68 | * @return \Stripe\Refund
69 | */
70 | public function update($id, $params = null, $opts = null)
71 | {
72 | return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/Service/Radar/ValueListItemService.php:
--------------------------------------------------------------------------------
1 | ValueListItem objects. The objects are sorted in
9 | * descending order by creation date, with the most recently created object
10 | * appearing first.
11 | *
12 | * @param null|array $params
13 | * @param null|array|\Stripe\Util\RequestOptions $opts
14 | *
15 | * @throws \Stripe\Exception\ApiErrorException if the request fails
16 | *
17 | * @return \Stripe\Collection
18 | */
19 | public function all($params = null, $opts = null)
20 | {
21 | return $this->requestCollection('get', '/v1/radar/value_list_items', $params, $opts);
22 | }
23 |
24 | /**
25 | * Creates a new ValueListItem object, which is added to the specified
26 | * parent value list.
27 | *
28 | * @param null|array $params
29 | * @param null|array|\Stripe\Util\RequestOptions $opts
30 | *
31 | * @throws \Stripe\Exception\ApiErrorException if the request fails
32 | *
33 | * @return \Stripe\Radar\ValueListItem
34 | */
35 | public function create($params = null, $opts = null)
36 | {
37 | return $this->request('post', '/v1/radar/value_list_items', $params, $opts);
38 | }
39 |
40 | /**
41 | * Deletes a ValueListItem object, removing it from its parent value
42 | * list.
43 | *
44 | * @param string $id
45 | * @param null|array $params
46 | * @param null|array|\Stripe\Util\RequestOptions $opts
47 | *
48 | * @throws \Stripe\Exception\ApiErrorException if the request fails
49 | *
50 | * @return \Stripe\Radar\ValueListItem
51 | */
52 | public function delete($id, $params = null, $opts = null)
53 | {
54 | return $this->request('delete', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts);
55 | }
56 |
57 | /**
58 | * Retrieves a ValueListItem object.
59 | *
60 | * @param string $id
61 | * @param null|array $params
62 | * @param null|array|\Stripe\Util\RequestOptions $opts
63 | *
64 | * @throws \Stripe\Exception\ApiErrorException if the request fails
65 | *
66 | * @return \Stripe\Radar\ValueListItem
67 | */
68 | public function retrieve($id, $params = null, $opts = null)
69 | {
70 | return $this->request('get', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/Service/Issuing/CardholderService.php:
--------------------------------------------------------------------------------
1 | Cardholder objects. The objects are
9 | * sorted in descending order by creation date, with the most recently created
10 | * object appearing first.
11 | *
12 | * @param null|array $params
13 | * @param null|array|\Stripe\Util\RequestOptions $opts
14 | *
15 | * @throws \Stripe\Exception\ApiErrorException if the request fails
16 | *
17 | * @return \Stripe\Collection
18 | */
19 | public function all($params = null, $opts = null)
20 | {
21 | return $this->requestCollection('get', '/v1/issuing/cardholders', $params, $opts);
22 | }
23 |
24 | /**
25 | * Creates a new Issuing Cardholder object that can be issued cards.
26 | *
27 | * @param null|array $params
28 | * @param null|array|\Stripe\Util\RequestOptions $opts
29 | *
30 | * @throws \Stripe\Exception\ApiErrorException if the request fails
31 | *
32 | * @return \Stripe\Issuing\Cardholder
33 | */
34 | public function create($params = null, $opts = null)
35 | {
36 | return $this->request('post', '/v1/issuing/cardholders', $params, $opts);
37 | }
38 |
39 | /**
40 | * Retrieves an Issuing Cardholder object.
41 | *
42 | * @param string $id
43 | * @param null|array $params
44 | * @param null|array|\Stripe\Util\RequestOptions $opts
45 | *
46 | * @throws \Stripe\Exception\ApiErrorException if the request fails
47 | *
48 | * @return \Stripe\Issuing\Cardholder
49 | */
50 | public function retrieve($id, $params = null, $opts = null)
51 | {
52 | return $this->request('get', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts);
53 | }
54 |
55 | /**
56 | * Updates the specified Issuing Cardholder object by setting the
57 | * values of the parameters passed. Any parameters not provided will be left
58 | * unchanged.
59 | *
60 | * @param string $id
61 | * @param null|array $params
62 | * @param null|array|\Stripe\Util\RequestOptions $opts
63 | *
64 | * @throws \Stripe\Exception\ApiErrorException if the request fails
65 | *
66 | * @return \Stripe\Issuing\Cardholder
67 | */
68 | public function update($id, $params = null, $opts = null)
69 | {
70 | return $this->request('post', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/ThreeDSecure.php:
--------------------------------------------------------------------------------
1 | 3D
7 | * Secure object. Once the object has been created, you can use it to
8 | * authenticate the cardholder and create a charge.
9 | *
10 | * @property string $id Unique identifier for the object.
11 | * @property string $object String representing the object's type. Objects of the same type share the same value.
12 | * @property int $amount Amount of the charge that you will create when authentication completes.
13 | * @property bool $authenticated True if the cardholder went through the authentication flow and their bank indicated that authentication succeeded.
14 | * @property \Stripe\Card $card You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.
Related guide: Card Payments with Sources.
15 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. 16 | * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. 17 | * @property bool $livemode Has the valuetrue if the object exists in live mode or the value false if the object exists in test mode.
18 | * @property null|string $redirect_url If present, this is the URL that you should send the cardholder to for authentication. If you are going to use Stripe.js to display the authentication page in an iframe, you should use the value "_callback".
19 | * @property string $status Possible values are redirect_pending, succeeded, or failed. When the cardholder can be authenticated, the object starts with status redirect_pending. When liability will be shifted to the cardholder's bank (either because the cardholder was successfully authenticated, or because the bank has not implemented 3D Secure, the object wlil be in status succeeded. failed indicates that authentication was attempted unsuccessfully.
20 | */
21 | class ThreeDSecure extends ApiResource
22 | {
23 | const OBJECT_NAME = 'three_d_secure';
24 |
25 | use ApiOperations\Create;
26 | use ApiOperations\Retrieve;
27 |
28 | /**
29 | * @return string the endpoint URL for the given class
30 | */
31 | public static function classUrl()
32 | {
33 | return '/v1/3d_secure';
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/AlipayAccount.php:
--------------------------------------------------------------------------------
1 | Application Fee Refund objects allow you to refund an application
7 | * fee that has previously been created but not yet refunded. Funds will be
8 | * refunded to the Stripe account from which the fee was originally collected.
9 | *
10 | * Related guide: Refunding
12 | * Application Fees.
13 | *
14 | * @property string $id Unique identifier for the object.
15 | * @property string $object String representing the object's type. Objects of the same type share the same value.
16 | * @property int $amount Amount, in %s.
17 | * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
18 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
19 | * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
20 | * @property string|\Stripe\ApplicationFee $fee ID of the application fee that was refunded.
21 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
22 | */
23 | class ApplicationFeeRefund extends ApiResource
24 | {
25 | const OBJECT_NAME = 'fee_refund';
26 |
27 | use ApiOperations\Update {
28 | save as protected _save;
29 | }
30 |
31 | /**
32 | * @return string the API URL for this Stripe refund
33 | */
34 | public function instanceUrl()
35 | {
36 | $id = $this['id'];
37 | $fee = $this['fee'];
38 | if (!$id) {
39 | throw new Exception\UnexpectedValueException(
40 | 'Could not determine which URL to request: ' .
41 | "class instance has invalid ID: {$id}",
42 | null
43 | );
44 | }
45 | $id = Util\Util::utf8($id);
46 | $fee = Util\Util::utf8($fee);
47 |
48 | $base = ApplicationFee::classUrl();
49 | $feeExtn = \urlencode($fee);
50 | $extn = \urlencode($id);
51 |
52 | return "{$base}/{$feeExtn}/refunds/{$extn}";
53 | }
54 |
55 | /**
56 | * @param null|array|string $opts
57 | *
58 | * @return ApplicationFeeRefund the saved refund
59 | */
60 | public function save($opts = null)
61 | {
62 | return $this->_save($opts);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/lib/ApiOperations/Request.php:
--------------------------------------------------------------------------------
1 | 100, "
23 | . "'currency' => 'usd', 'source' => 'tok_1234'])\")";
24 |
25 | throw new \Stripe\Exception\InvalidArgumentException($message);
26 | }
27 | }
28 |
29 | /**
30 | * @param string $method HTTP method ('get', 'post', etc.)
31 | * @param string $url URL for the request
32 | * @param array $params list of parameters for the request
33 | * @param null|array|string $options
34 | *
35 | * @throws \Stripe\Exception\ApiErrorException if the request fails
36 | *
37 | * @return array tuple containing (the JSON response, $options)
38 | */
39 | protected function _request($method, $url, $params = [], $options = null)
40 | {
41 | $opts = $this->_opts->merge($options);
42 | list($resp, $options) = static::_staticRequest($method, $url, $params, $opts);
43 | $this->setLastResponse($resp);
44 |
45 | return [$resp->json, $options];
46 | }
47 |
48 | /**
49 | * @param string $method HTTP method ('get', 'post', etc.)
50 | * @param string $url URL for the request
51 | * @param array $params list of parameters for the request
52 | * @param null|array|string $options
53 | *
54 | * @throws \Stripe\Exception\ApiErrorException if the request fails
55 | *
56 | * @return array tuple containing (the JSON response, $options)
57 | */
58 | protected static function _staticRequest($method, $url, $params, $options)
59 | {
60 | $opts = \Stripe\Util\RequestOptions::parse($options);
61 | $baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl();
62 | $requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
63 | list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
64 | $opts->discardNonPersistentHeaders();
65 |
66 | return [$response, $opts];
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/InvoiceLineItem.php:
--------------------------------------------------------------------------------
1 | ISO currency code, in lowercase. Must be a supported currency.
10 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
11 | * @property bool $discountable If true, discounts will apply to this line item. Always false for prorations.
12 | * @property string $invoice_item The ID of the invoice item associated with this line item if any.
13 | * @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.
14 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with type=subscription this will reflect the metadata of the subscription that caused the line item to be created.
15 | * @property \Stripe\StripeObject $period
16 | * @property null|\Stripe\Plan $plan The plan of the subscription, if the line item is a subscription or a proration.
17 | * @property null|\Stripe\Price $price The price of the line item.
18 | * @property bool $proration Whether this is a proration.
19 | * @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration.
20 | * @property null|string $subscription The subscription that the invoice item pertains to, if any.
21 | * @property string $subscription_item The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription.
22 | * @property null|\Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
23 | * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
24 | * @property string $type A string identifying the type of the source of this line item, either an invoiceitem or a subscription.
25 | * @property bool $unified_proration For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item.
26 | */
27 | class InvoiceLineItem extends ApiResource
28 | {
29 | const OBJECT_NAME = 'line_item';
30 | }
31 |
--------------------------------------------------------------------------------
/lib/Service/Terminal/ReaderService.php:
--------------------------------------------------------------------------------
1 | Reader objects.
9 | *
10 | * @param null|array $params
11 | * @param null|array|\Stripe\Util\RequestOptions $opts
12 | *
13 | * @throws \Stripe\Exception\ApiErrorException if the request fails
14 | *
15 | * @return \Stripe\Collection
16 | */
17 | public function all($params = null, $opts = null)
18 | {
19 | return $this->requestCollection('get', '/v1/terminal/readers', $params, $opts);
20 | }
21 |
22 | /**
23 | * Creates a new Reader object.
24 | *
25 | * @param null|array $params
26 | * @param null|array|\Stripe\Util\RequestOptions $opts
27 | *
28 | * @throws \Stripe\Exception\ApiErrorException if the request fails
29 | *
30 | * @return \Stripe\Terminal\Reader
31 | */
32 | public function create($params = null, $opts = null)
33 | {
34 | return $this->request('post', '/v1/terminal/readers', $params, $opts);
35 | }
36 |
37 | /**
38 | * Deletes a Reader object.
39 | *
40 | * @param string $id
41 | * @param null|array $params
42 | * @param null|array|\Stripe\Util\RequestOptions $opts
43 | *
44 | * @throws \Stripe\Exception\ApiErrorException if the request fails
45 | *
46 | * @return \Stripe\Terminal\Reader
47 | */
48 | public function delete($id, $params = null, $opts = null)
49 | {
50 | return $this->request('delete', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts);
51 | }
52 |
53 | /**
54 | * Retrieves a Reader object.
55 | *
56 | * @param string $id
57 | * @param null|array $params
58 | * @param null|array|\Stripe\Util\RequestOptions $opts
59 | *
60 | * @throws \Stripe\Exception\ApiErrorException if the request fails
61 | *
62 | * @return \Stripe\Terminal\Reader
63 | */
64 | public function retrieve($id, $params = null, $opts = null)
65 | {
66 | return $this->request('get', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts);
67 | }
68 |
69 | /**
70 | * Updates a Reader object by setting the values of the parameters
71 | * passed. Any parameters not provided will be left unchanged.
72 | *
73 | * @param string $id
74 | * @param null|array $params
75 | * @param null|array|\Stripe\Util\RequestOptions $opts
76 | *
77 | * @throws \Stripe\Exception\ApiErrorException if the request fails
78 | *
79 | * @return \Stripe\Terminal\Reader
80 | */
81 | public function update($id, $params = null, $opts = null)
82 | {
83 | return $this->request('post', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/lib/Service/TopupService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/topups', $params, $opts);
20 | }
21 |
22 | /**
23 | * Cancels a top-up. Only pending top-ups can be canceled.
24 | *
25 | * @param string $id
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\Topup
32 | */
33 | public function cancel($id, $params = null, $opts = null)
34 | {
35 | return $this->request('post', $this->buildPath('/v1/topups/%s/cancel', $id), $params, $opts);
36 | }
37 |
38 | /**
39 | * Top up the balance of an account.
40 | *
41 | * @param null|array $params
42 | * @param null|array|\Stripe\Util\RequestOptions $opts
43 | *
44 | * @throws \Stripe\Exception\ApiErrorException if the request fails
45 | *
46 | * @return \Stripe\Topup
47 | */
48 | public function create($params = null, $opts = null)
49 | {
50 | return $this->request('post', '/v1/topups', $params, $opts);
51 | }
52 |
53 | /**
54 | * Retrieves the details of a top-up that has previously been created. Supply the
55 | * unique top-up ID that was returned from your previous request, and Stripe will
56 | * return the corresponding top-up information.
57 | *
58 | * @param string $id
59 | * @param null|array $params
60 | * @param null|array|\Stripe\Util\RequestOptions $opts
61 | *
62 | * @throws \Stripe\Exception\ApiErrorException if the request fails
63 | *
64 | * @return \Stripe\Topup
65 | */
66 | public function retrieve($id, $params = null, $opts = null)
67 | {
68 | return $this->request('get', $this->buildPath('/v1/topups/%s', $id), $params, $opts);
69 | }
70 |
71 | /**
72 | * Updates the metadata of a top-up. Other top-up details are not editable by
73 | * design.
74 | *
75 | * @param string $id
76 | * @param null|array $params
77 | * @param null|array|\Stripe\Util\RequestOptions $opts
78 | *
79 | * @throws \Stripe\Exception\ApiErrorException if the request fails
80 | *
81 | * @return \Stripe\Topup
82 | */
83 | public function update($id, $params = null, $opts = null)
84 | {
85 | return $this->request('post', $this->buildPath('/v1/topups/%s', $id), $params, $opts);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/lib/SKU.php:
--------------------------------------------------------------------------------
1 | stock keeping units.
8 | * SKUs describe specific product variations, taking into account any combination
9 | * of: attributes, currency, and cost. For example, a product may be a T-shirt,
10 | * whereas a specific SKU represents the size: large, color:
11 | * red version of that shirt.
12 | *
13 | * Can also be used to manage inventory.
14 | *
15 | * Related guide: Tax, Shipping, and
16 | * Inventory.
17 | *
18 | * @property string $id Unique identifier for the object.
19 | * @property string $object String representing the object's type. Objects of the same type share the same value.
20 | * @property bool $active Whether the SKU is available for purchase.
21 | * @property \Stripe\StripeObject $attributes A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are ["size", "gender"], a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}.
22 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
23 | * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
24 | * @property null|string $image The URL of an image for this SKU, meant to be displayable to the customer.
25 | * @property \Stripe\StripeObject $inventory
26 | * @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.
27 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
28 | * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this SKU for shipping purposes.
29 | * @property int $price The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency).
30 | * @property string|\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active.
31 | * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
32 | */
33 | class SKU extends ApiResource
34 | {
35 | const OBJECT_NAME = 'sku';
36 |
37 | use ApiOperations\All;
38 | use ApiOperations\Create;
39 | use ApiOperations\Delete;
40 | use ApiOperations\Retrieve;
41 | use ApiOperations\Update;
42 | }
43 |
--------------------------------------------------------------------------------
/lib/Service/Terminal/LocationService.php:
--------------------------------------------------------------------------------
1 | Location objects.
9 | *
10 | * @param null|array $params
11 | * @param null|array|\Stripe\Util\RequestOptions $opts
12 | *
13 | * @throws \Stripe\Exception\ApiErrorException if the request fails
14 | *
15 | * @return \Stripe\Collection
16 | */
17 | public function all($params = null, $opts = null)
18 | {
19 | return $this->requestCollection('get', '/v1/terminal/locations', $params, $opts);
20 | }
21 |
22 | /**
23 | * Creates a new Location object.
24 | *
25 | * @param null|array $params
26 | * @param null|array|\Stripe\Util\RequestOptions $opts
27 | *
28 | * @throws \Stripe\Exception\ApiErrorException if the request fails
29 | *
30 | * @return \Stripe\Terminal\Location
31 | */
32 | public function create($params = null, $opts = null)
33 | {
34 | return $this->request('post', '/v1/terminal/locations', $params, $opts);
35 | }
36 |
37 | /**
38 | * Deletes a Location object.
39 | *
40 | * @param string $id
41 | * @param null|array $params
42 | * @param null|array|\Stripe\Util\RequestOptions $opts
43 | *
44 | * @throws \Stripe\Exception\ApiErrorException if the request fails
45 | *
46 | * @return \Stripe\Terminal\Location
47 | */
48 | public function delete($id, $params = null, $opts = null)
49 | {
50 | return $this->request('delete', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
51 | }
52 |
53 | /**
54 | * Retrieves a Location object.
55 | *
56 | * @param string $id
57 | * @param null|array $params
58 | * @param null|array|\Stripe\Util\RequestOptions $opts
59 | *
60 | * @throws \Stripe\Exception\ApiErrorException if the request fails
61 | *
62 | * @return \Stripe\Terminal\Location
63 | */
64 | public function retrieve($id, $params = null, $opts = null)
65 | {
66 | return $this->request('get', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
67 | }
68 |
69 | /**
70 | * Updates a Location object by setting the values of the parameters
71 | * passed. Any parameters not provided will be left unchanged.
72 | *
73 | * @param string $id
74 | * @param null|array $params
75 | * @param null|array|\Stripe\Util\RequestOptions $opts
76 | *
77 | * @throws \Stripe\Exception\ApiErrorException if the request fails
78 | *
79 | * @return \Stripe\Terminal\Location
80 | */
81 | public function update($id, $params = null, $opts = null)
82 | {
83 | return $this->request('post', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/lib/Coupon.php:
--------------------------------------------------------------------------------
1 | invoices or orders. Coupons do
10 | * not work with conventional one-off charges.
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 null|int $amount_off Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
16 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17 | * @property null|string $currency If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.
18 | * @property string $duration One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.
19 | * @property null|int $duration_in_months If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
20 | * @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.
21 | * @property null|int $max_redemptions Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
22 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
23 | * @property null|string $name Name of the coupon displayed to customers on for instance invoices or receipts.
24 | * @property null|float $percent_off Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead.
25 | * @property null|int $redeem_by Date after which the coupon can no longer be redeemed.
26 | * @property int $times_redeemed Number of times this coupon has been applied to a customer.
27 | * @property bool $valid Taking account of the above properties, whether this coupon can still be applied to a customer.
28 | */
29 | class Coupon extends ApiResource
30 | {
31 | const OBJECT_NAME = 'coupon';
32 |
33 | use ApiOperations\All;
34 | use ApiOperations\Create;
35 | use ApiOperations\Delete;
36 | use ApiOperations\Retrieve;
37 | use ApiOperations\Update;
38 | }
39 |
--------------------------------------------------------------------------------
/lib/Service/PlanService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/plans', $params, $opts);
20 | }
21 |
22 | /**
23 | * You can create plans using the API, or in the Stripe Dashboard.
25 | *
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\Plan
32 | */
33 | public function create($params = null, $opts = null)
34 | {
35 | return $this->request('post', '/v1/plans', $params, $opts);
36 | }
37 |
38 | /**
39 | * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t
40 | * affected.
41 | *
42 | * @param string $id
43 | * @param null|array $params
44 | * @param null|array|\Stripe\Util\RequestOptions $opts
45 | *
46 | * @throws \Stripe\Exception\ApiErrorException if the request fails
47 | *
48 | * @return \Stripe\Plan
49 | */
50 | public function delete($id, $params = null, $opts = null)
51 | {
52 | return $this->request('delete', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
53 | }
54 |
55 | /**
56 | * Retrieves the plan with the given ID.
57 | *
58 | * @param string $id
59 | * @param null|array $params
60 | * @param null|array|\Stripe\Util\RequestOptions $opts
61 | *
62 | * @throws \Stripe\Exception\ApiErrorException if the request fails
63 | *
64 | * @return \Stripe\Plan
65 | */
66 | public function retrieve($id, $params = null, $opts = null)
67 | {
68 | return $this->request('get', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
69 | }
70 |
71 | /**
72 | * Updates the specified plan by setting the values of the parameters passed. Any
73 | * parameters not provided are left unchanged. By design, you cannot change a
74 | * plan’s ID, amount, currency, or billing cycle.
75 | *
76 | * @param string $id
77 | * @param null|array $params
78 | * @param null|array|\Stripe\Util\RequestOptions $opts
79 | *
80 | * @throws \Stripe\Exception\ApiErrorException if the request fails
81 | *
82 | * @return \Stripe\Plan
83 | */
84 | public function update($id, $params = null, $opts = null)
85 | {
86 | return $this->request('post', $this->buildPath('/v1/plans/%s', $id), $params, $opts);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/lib/Recipient.php:
--------------------------------------------------------------------------------
1 | Recipient objects, you can transfer money from your Stripe
7 | * account to a third-party bank account or debit card. The API allows you to
8 | * create, delete, and update your recipients. You can retrieve individual
9 | * recipients as well as a list of all your recipients.
10 | *
11 | * Recipient objects have been deprecated in favor of Connect, specifically Connect's much
13 | * more powerful Account objects.
14 | * Stripe accounts that don't already use recipients can no longer begin doing so.
15 | * Please use Account objects instead. If you are already using
16 | * recipients, please see our migration
18 | * guide for more information.
19 | *
20 | * @property string $id Unique identifier for the object.
21 | * @property string $object String representing the object's type. Objects of the same type share the same value.
22 | * @property null|\Stripe\BankAccount $active_account Hash describing the current account on the recipient, if there is one.
23 | * @property null|\Stripe\Collection $cards
24 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
25 | * @property null|string|\Stripe\Card $default_card The default card to use for creating transfers to this recipient.
26 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
27 | * @property null|string $email
28 | * @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.
29 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
30 | * @property null|string|\Stripe\Account $migrated_to The ID of the Custom account this recipient was migrated to. If set, the recipient can no longer be updated, nor can transfers be made to it: use the Custom account instead.
31 | * @property null|string $name Full, legal name of the recipient.
32 | * @property string|\Stripe\Account $rolled_back_from
33 | * @property string $type Type of the recipient, one of individual or corporation.
34 | * @property bool $verified Whether the recipient has been verified. This field is non-standard, and maybe removed in the future
35 | */
36 | class Recipient extends ApiResource
37 | {
38 | const OBJECT_NAME = 'recipient';
39 |
40 | use ApiOperations\All;
41 | use ApiOperations\Create;
42 | use ApiOperations\Delete;
43 | use ApiOperations\Retrieve;
44 | use ApiOperations\Update;
45 | }
46 |
--------------------------------------------------------------------------------
/lib/Issuing/Transaction.php:
--------------------------------------------------------------------------------
1 | issued card that
7 | * results in funds entering or leaving your Stripe account, such as a completed
8 | * purchase or refund, is represented by an Issuing Transaction
9 | * object.
10 | *
11 | * Related guide: Issued Card
13 | * Transactions.
14 | *
15 | * @property string $id Unique identifier for the object.
16 | * @property string $object String representing the object's type. Objects of the same type share the same value.
17 | * @property int $amount The transaction amount, which will be reflected in your balance. This amount is in your currency and in the smallest currency unit.
18 | * @property null|string|\Stripe\Issuing\Authorization $authorization The Authorization object that led to this transaction.
19 | * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction associated with this transaction.
20 | * @property string|\Stripe\Issuing\Card $card The card used to make this transaction.
21 | * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this transaction belongs.
22 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
23 | * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
24 | * @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.
25 | * @property int $merchant_amount The amount that the merchant will receive, denominated in merchant_currency and in the smallest currency unit. It will be different from amount if the merchant is taking payment in a different currency.
26 | * @property string $merchant_currency The currency with which the merchant is taking payment.
27 | * @property \Stripe\StripeObject $merchant_data
28 | * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
29 | * @property null|\Stripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant.
30 | * @property string $type The nature of the transaction.
31 | */
32 | class Transaction extends \Stripe\ApiResource
33 | {
34 | const OBJECT_NAME = 'issuing.transaction';
35 |
36 | use \Stripe\ApiOperations\All;
37 | use \Stripe\ApiOperations\Retrieve;
38 | use \Stripe\ApiOperations\Update;
39 | }
40 |
--------------------------------------------------------------------------------
/lib/Service/DisputeService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/disputes', $params, $opts);
20 | }
21 |
22 | /**
23 | * Closing the dispute for a charge indicates that you do not have any evidence to
24 | * submit and are essentially dismissing the dispute, acknowledging it as lost.
25 | *
26 | * The status of the dispute will change from needs_response to
27 | * lost. Closing a dispute is irreversible.
28 | *
29 | * @param string $id
30 | * @param null|array $params
31 | * @param null|array|\Stripe\Util\RequestOptions $opts
32 | *
33 | * @throws \Stripe\Exception\ApiErrorException if the request fails
34 | *
35 | * @return \Stripe\Dispute
36 | */
37 | public function close($id, $params = null, $opts = null)
38 | {
39 | return $this->request('post', $this->buildPath('/v1/disputes/%s/close', $id), $params, $opts);
40 | }
41 |
42 | /**
43 | * Retrieves the dispute with the given ID.
44 | *
45 | * @param string $id
46 | * @param null|array $params
47 | * @param null|array|\Stripe\Util\RequestOptions $opts
48 | *
49 | * @throws \Stripe\Exception\ApiErrorException if the request fails
50 | *
51 | * @return \Stripe\Dispute
52 | */
53 | public function retrieve($id, $params = null, $opts = null)
54 | {
55 | return $this->request('get', $this->buildPath('/v1/disputes/%s', $id), $params, $opts);
56 | }
57 |
58 | /**
59 | * When you get a dispute, contacting your customer is always the best first step.
60 | * If that doesn’t work, you can submit evidence to help us resolve the dispute in
61 | * your favor. You can do this in your dashboard, but if you prefer,
63 | * you can use the API to submit evidence programmatically.
64 | *
65 | * Depending on your dispute type, different evidence fields will give you a better
66 | * chance of winning your dispute. To figure out which evidence fields to provide,
67 | * see our guide to dispute types.
68 | *
69 | * @param string $id
70 | * @param null|array $params
71 | * @param null|array|\Stripe\Util\RequestOptions $opts
72 | *
73 | * @throws \Stripe\Exception\ApiErrorException if the request fails
74 | *
75 | * @return \Stripe\Dispute
76 | */
77 | public function update($id, $params = null, $opts = null)
78 | {
79 | return $this->request('post', $this->buildPath('/v1/disputes/%s', $id), $params, $opts);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/Capability.php:
--------------------------------------------------------------------------------
1 | Account
10 | * capabilities.
11 | *
12 | * @property string $id The identifier for the capability.
13 | * @property string $object String representing the object's type. Objects of the same type share the same value.
14 | * @property string|\Stripe\Account $account The account for which the capability enables functionality.
15 | * @property bool $requested Whether the capability has been requested.
16 | * @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch.
17 | * @property \Stripe\StripeObject $requirements
18 | * @property string $status The status of the capability. Can be active, inactive, pending, or unrequested.
19 | */
20 | class Capability extends ApiResource
21 | {
22 | const OBJECT_NAME = 'capability';
23 |
24 | use ApiOperations\Update;
25 |
26 | const STATUS_ACTIVE = 'active';
27 | const STATUS_INACTIVE = 'inactive';
28 | const STATUS_PENDING = 'pending';
29 | const STATUS_UNREQUESTED = 'unrequested';
30 |
31 | /**
32 | * @return string the API URL for this Stripe account reversal
33 | */
34 | public function instanceUrl()
35 | {
36 | $id = $this['id'];
37 | $account = $this['account'];
38 | if (!$id) {
39 | throw new Exception\UnexpectedValueException(
40 | 'Could not determine which URL to request: ' .
41 | "class instance has invalid ID: {$id}",
42 | null
43 | );
44 | }
45 | $id = Util\Util::utf8($id);
46 | $account = Util\Util::utf8($account);
47 |
48 | $base = Account::classUrl();
49 | $accountExtn = \urlencode($account);
50 | $extn = \urlencode($id);
51 |
52 | return "{$base}/{$accountExtn}/capabilities/{$extn}";
53 | }
54 |
55 | /**
56 | * @param array|string $_id
57 | * @param null|array|string $_opts
58 | *
59 | * @throws \Stripe\Exception\BadMethodCallException
60 | */
61 | public static function retrieve($_id, $_opts = null)
62 | {
63 | $msg = 'Capabilities cannot be retrieved without an account ID. ' .
64 | 'Retrieve a capability using `Account::retrieveCapability(' .
65 | "'account_id', 'capability_id')`.";
66 |
67 | throw new Exception\BadMethodCallException($msg);
68 | }
69 |
70 | /**
71 | * @param string $_id
72 | * @param null|array $_params
73 | * @param null|array|string $_options
74 | *
75 | * @throws \Stripe\Exception\BadMethodCallException
76 | */
77 | public static function update($_id, $_params = null, $_options = null)
78 | {
79 | $msg = 'Capabilities cannot be updated without an account ID. ' .
80 | 'Update a capability using `Account::updateCapability(' .
81 | "'account_id', 'capability_id', \$updateParams)`.";
82 |
83 | throw new Exception\BadMethodCallException($msg);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/lib/Service/ProductService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/products', $params, $opts);
21 | }
22 |
23 | /**
24 | * Creates a new product object.
25 | *
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\Product
32 | */
33 | public function create($params = null, $opts = null)
34 | {
35 | return $this->request('post', '/v1/products', $params, $opts);
36 | }
37 |
38 | /**
39 | * Delete a product. Deleting a product is only possible if it has no prices
40 | * associated with it. Additionally, deleting a product with type=good
41 | * is only possible if it has no SKUs associated with it.
42 | *
43 | * @param string $id
44 | * @param null|array $params
45 | * @param null|array|\Stripe\Util\RequestOptions $opts
46 | *
47 | * @throws \Stripe\Exception\ApiErrorException if the request fails
48 | *
49 | * @return \Stripe\Product
50 | */
51 | public function delete($id, $params = null, $opts = null)
52 | {
53 | return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts);
54 | }
55 |
56 | /**
57 | * Retrieves the details of an existing product. Supply the unique product ID from
58 | * either a product creation request or the product list, and Stripe will return
59 | * the corresponding product information.
60 | *
61 | * @param string $id
62 | * @param null|array $params
63 | * @param null|array|\Stripe\Util\RequestOptions $opts
64 | *
65 | * @throws \Stripe\Exception\ApiErrorException if the request fails
66 | *
67 | * @return \Stripe\Product
68 | */
69 | public function retrieve($id, $params = null, $opts = null)
70 | {
71 | return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts);
72 | }
73 |
74 | /**
75 | * Updates the specific product by setting the values of the parameters passed. Any
76 | * parameters not provided will be left unchanged.
77 | *
78 | * @param string $id
79 | * @param null|array $params
80 | * @param null|array|\Stripe\Util\RequestOptions $opts
81 | *
82 | * @throws \Stripe\Exception\ApiErrorException if the request fails
83 | *
84 | * @return \Stripe\Product
85 | */
86 | public function update($id, $params = null, $opts = null)
87 | {
88 | return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/Service/InvoiceItemService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/invoiceitems', $params, $opts);
21 | }
22 |
23 | /**
24 | * Creates an item to be added to a draft invoice. If no invoice is specified, the
25 | * item will be on the next invoice created for the customer specified.
26 | *
27 | * @param null|array $params
28 | * @param null|array|\Stripe\Util\RequestOptions $opts
29 | *
30 | * @throws \Stripe\Exception\ApiErrorException if the request fails
31 | *
32 | * @return \Stripe\InvoiceItem
33 | */
34 | public function create($params = null, $opts = null)
35 | {
36 | return $this->request('post', '/v1/invoiceitems', $params, $opts);
37 | }
38 |
39 | /**
40 | * Deletes an invoice item, removing it from an invoice. Deleting invoice items is
41 | * only possible when they’re not attached to invoices, or if it’s attached to a
42 | * draft invoice.
43 | *
44 | * @param string $id
45 | * @param null|array $params
46 | * @param null|array|\Stripe\Util\RequestOptions $opts
47 | *
48 | * @throws \Stripe\Exception\ApiErrorException if the request fails
49 | *
50 | * @return \Stripe\InvoiceItem
51 | */
52 | public function delete($id, $params = null, $opts = null)
53 | {
54 | return $this->request('delete', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
55 | }
56 |
57 | /**
58 | * Retrieves the invoice item with the given ID.
59 | *
60 | * @param string $id
61 | * @param null|array $params
62 | * @param null|array|\Stripe\Util\RequestOptions $opts
63 | *
64 | * @throws \Stripe\Exception\ApiErrorException if the request fails
65 | *
66 | * @return \Stripe\InvoiceItem
67 | */
68 | public function retrieve($id, $params = null, $opts = null)
69 | {
70 | return $this->request('get', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
71 | }
72 |
73 | /**
74 | * Updates the amount or description of an invoice item on an upcoming invoice.
75 | * Updating an invoice item is only possible before the invoice it’s attached to is
76 | * closed.
77 | *
78 | * @param string $id
79 | * @param null|array $params
80 | * @param null|array|\Stripe\Util\RequestOptions $opts
81 | *
82 | * @throws \Stripe\Exception\ApiErrorException if the request fails
83 | *
84 | * @return \Stripe\InvoiceItem
85 | */
86 | public function update($id, $params = null, $opts = null)
87 | {
88 | return $this->request('post', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/Service/SkuService.php:
--------------------------------------------------------------------------------
1 | requestCollection('get', '/v1/skus', $params, $opts);
21 | }
22 |
23 | /**
24 | * Creates a new SKU associated with a product.
25 | *
26 | * @param null|array $params
27 | * @param null|array|\Stripe\Util\RequestOptions $opts
28 | *
29 | * @throws \Stripe\Exception\ApiErrorException if the request fails
30 | *
31 | * @return \Stripe\SKU
32 | */
33 | public function create($params = null, $opts = null)
34 | {
35 | return $this->request('post', '/v1/skus', $params, $opts);
36 | }
37 |
38 | /**
39 | * Delete a SKU. Deleting a SKU is only possible until it has been used in an
40 | * order.
41 | *
42 | * @param string $id
43 | * @param null|array $params
44 | * @param null|array|\Stripe\Util\RequestOptions $opts
45 | *
46 | * @throws \Stripe\Exception\ApiErrorException if the request fails
47 | *
48 | * @return \Stripe\SKU
49 | */
50 | public function delete($id, $params = null, $opts = null)
51 | {
52 | return $this->request('delete', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
53 | }
54 |
55 | /**
56 | * Retrieves the details of an existing SKU. Supply the unique SKU identifier from
57 | * either a SKU creation request or from the product, and Stripe will return the
58 | * corresponding SKU information.
59 | *
60 | * @param string $id
61 | * @param null|array $params
62 | * @param null|array|\Stripe\Util\RequestOptions $opts
63 | *
64 | * @throws \Stripe\Exception\ApiErrorException if the request fails
65 | *
66 | * @return \Stripe\SKU
67 | */
68 | public function retrieve($id, $params = null, $opts = null)
69 | {
70 | return $this->request('get', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
71 | }
72 |
73 | /**
74 | * Updates the specific SKU by setting the values of the parameters passed. Any
75 | * parameters not provided will be left unchanged.
76 | *
77 | * Note that a SKU’s attributes are not editable. Instead, you would
78 | * need to deactivate the existing SKU and create a new one with the new attribute
79 | * values.
80 | *
81 | * @param string $id
82 | * @param null|array $params
83 | * @param null|array|\Stripe\Util\RequestOptions $opts
84 | *
85 | * @throws \Stripe\Exception\ApiErrorException if the request fails
86 | *
87 | * @return \Stripe\SKU
88 | */
89 | public function update($id, $params = null, $opts = null)
90 | {
91 | return $this->request('post', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/lib/Service/Radar/ValueListService.php:
--------------------------------------------------------------------------------
1 | ValueList objects. The objects are sorted in
9 | * descending order by creation date, with the most recently created object
10 | * appearing first.
11 | *
12 | * @param null|array $params
13 | * @param null|array|\Stripe\Util\RequestOptions $opts
14 | *
15 | * @throws \Stripe\Exception\ApiErrorException if the request fails
16 | *
17 | * @return \Stripe\Collection
18 | */
19 | public function all($params = null, $opts = null)
20 | {
21 | return $this->requestCollection('get', '/v1/radar/value_lists', $params, $opts);
22 | }
23 |
24 | /**
25 | * Creates a new ValueList object, which can then be referenced in
26 | * rules.
27 | *
28 | * @param null|array $params
29 | * @param null|array|\Stripe\Util\RequestOptions $opts
30 | *
31 | * @throws \Stripe\Exception\ApiErrorException if the request fails
32 | *
33 | * @return \Stripe\Radar\ValueList
34 | */
35 | public function create($params = null, $opts = null)
36 | {
37 | return $this->request('post', '/v1/radar/value_lists', $params, $opts);
38 | }
39 |
40 | /**
41 | * Deletes a ValueList object, also deleting any items contained
42 | * within the value list. To be deleted, a value list must not be referenced in any
43 | * rules.
44 | *
45 | * @param string $id
46 | * @param null|array $params
47 | * @param null|array|\Stripe\Util\RequestOptions $opts
48 | *
49 | * @throws \Stripe\Exception\ApiErrorException if the request fails
50 | *
51 | * @return \Stripe\Radar\ValueList
52 | */
53 | public function delete($id, $params = null, $opts = null)
54 | {
55 | return $this->request('delete', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
56 | }
57 |
58 | /**
59 | * Retrieves a ValueList object.
60 | *
61 | * @param string $id
62 | * @param null|array $params
63 | * @param null|array|\Stripe\Util\RequestOptions $opts
64 | *
65 | * @throws \Stripe\Exception\ApiErrorException if the request fails
66 | *
67 | * @return \Stripe\Radar\ValueList
68 | */
69 | public function retrieve($id, $params = null, $opts = null)
70 | {
71 | return $this->request('get', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
72 | }
73 |
74 | /**
75 | * Updates a ValueList object by setting the values of the parameters
76 | * passed. Any parameters not provided will be left unchanged. Note that
77 | * item_type is immutable.
78 | *
79 | * @param string $id
80 | * @param null|array $params
81 | * @param null|array|\Stripe\Util\RequestOptions $opts
82 | *
83 | * @throws \Stripe\Exception\ApiErrorException if the request fails
84 | *
85 | * @return \Stripe\Radar\ValueList
86 | */
87 | public function update($id, $params = null, $opts = null)
88 | {
89 | return $this->request('post', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts);
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/lib/File.php:
--------------------------------------------------------------------------------
1 | create file request (for
9 | * example, when uploading dispute evidence) or it may have been created by Stripe
10 | * (for example, the results of a Sigma scheduled
11 | * query).
12 | *
13 | * Related guide: File Upload
14 | * Guide.
15 | *
16 | * @property string $id Unique identifier for the object.
17 | * @property string $object String representing the object's type. Objects of the same type share the same value.
18 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
19 | * @property null|string $filename A filename for the file, suitable for saving to a filesystem.
20 | * @property null|\Stripe\Collection $links A list of file links that point at this file.
21 | * @property string $purpose The purpose of the file. Possible values are additional_verification, business_icon, business_logo, customer_signature, dispute_evidence, finance_report_run, identity_document, pci_document, sigma_scheduled_query, or tax_document_user_upload.
22 | * @property int $size The size in bytes of the file object.
23 | * @property null|string $title A user friendly title for the document.
24 | * @property null|string $type The type of the file returned (e.g., csv, pdf, jpg, or png).
25 | * @property null|string $url The URL from which the file can be downloaded using your live secret API key.
26 | */
27 | class File extends ApiResource
28 | {
29 | const OBJECT_NAME = 'file';
30 |
31 | use ApiOperations\All;
32 | use ApiOperations\Retrieve;
33 |
34 | // This resource can have two different object names. In latter API
35 | // versions, only `file` is used, but since stripe-php may be used with
36 | // any API version, we need to support deserializing the older
37 | // `file_upload` object into the same class.
38 | const OBJECT_NAME_ALT = 'file_upload';
39 |
40 | use ApiOperations\Create {
41 | create as protected _create;
42 | }
43 |
44 | public static function classUrl()
45 | {
46 | return '/v1/files';
47 | }
48 |
49 | /**
50 | * @param null|array $params
51 | * @param null|array|string $opts
52 | *
53 | * @throws \Stripe\Exception\ApiErrorException if the request fails
54 | *
55 | * @return \Stripe\File the created file
56 | */
57 | public static function create($params = null, $opts = null)
58 | {
59 | $opts = \Stripe\Util\RequestOptions::parse($opts);
60 | if (null === $opts->apiBase) {
61 | $opts->apiBase = Stripe::$apiUploadBase;
62 | }
63 | // Manually flatten params, otherwise curl's multipart encoder will
64 | // choke on nested arrays.
65 | $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
66 |
67 | return static::_create($flatParams, $opts);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/lib/Review.php:
--------------------------------------------------------------------------------
1 | Radar and reviewing payments here.
11 | *
12 | * @property string $id Unique identifier for the object.
13 | * @property string $object String representing the object's type. Objects of the same type share the same value.
14 | * @property null|string $billing_zip The ZIP or postal code of the card used, if applicable.
15 | * @property null|string|\Stripe\Charge $charge The charge associated with this review.
16 | * @property null|string $closed_reason The reason the review was closed, or null if it has not yet been closed. One of approved, refunded, refunded_as_fraud, or disputed.
17 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18 | * @property null|string $ip_address The IP address where the payment originated.
19 | * @property null|\Stripe\StripeObject $ip_address_location Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address.
20 | * @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.
21 | * @property bool $open If true, the review needs action.
22 | * @property string $opened_reason The reason the review was opened. One of rule or manual.
23 | * @property string|\Stripe\PaymentIntent $payment_intent The PaymentIntent ID associated with this review, if one exists.
24 | * @property string $reason The reason the review is currently open or closed. One of rule, manual, approved, refunded, refunded_as_fraud, or disputed.
25 | * @property null|\Stripe\StripeObject $session Information related to the browsing session of the user who initiated the payment.
26 | */
27 | class Review extends ApiResource
28 | {
29 | const OBJECT_NAME = 'review';
30 |
31 | use ApiOperations\All;
32 | use ApiOperations\Retrieve;
33 |
34 | /**
35 | * Possible string representations of the current, the opening or the closure reason of the review.
36 | * Not all of these enumeration apply to all of the ´reason´ fields. Please consult the Review object to
37 | * determine where these are apply.
38 | *
39 | * @see https://stripe.com/docs/api/radar/reviews/object
40 | */
41 | const REASON_APPROVED = 'approved';
42 | const REASON_DISPUTED = 'disputed';
43 | const REASON_MANUAL = 'manual';
44 | const REASON_REFUNDED = 'refunded';
45 | const REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud';
46 | const REASON_RULE = 'rule';
47 |
48 | /**
49 | * @param null|array $params
50 | * @param null|array|string $opts
51 | *
52 | * @throws \Stripe\Exception\ApiErrorException if the request fails
53 | *
54 | * @return Review the approved review
55 | */
56 | public function approve($params = null, $opts = null)
57 | {
58 | $url = $this->instanceUrl() . '/approve';
59 | list($response, $opts) = $this->_request('post', $url, $params, $opts);
60 | $this->refreshFrom($response, $opts);
61 |
62 | return $this;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------