1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

composer update

This commit is contained in:
Daniel Neto 2025-04-08 13:21:00 -03:00
parent c9091acd31
commit b39ea09b7a
326 changed files with 4576 additions and 4467 deletions

2
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b796d698ec634bf301a3ec925a25578d",
"content-hash": "348408bc2c335c1ef2037d8523a92269",
"packages": [
{
"name": "abraham/twitteroauth",

View file

@ -6557,17 +6557,17 @@
},
{
"name": "stripe/stripe-php",
"version": "v16.6.0",
"version_normalized": "16.6.0.0",
"version": "v17.1.1",
"version_normalized": "17.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "d6de0a536f00b5c5c74f36b8f4d0d93b035499ff"
"reference": "01ca9b5fdd899b8e4b69f83b85e09d96f6240220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/d6de0a536f00b5c5c74f36b8f4d0d93b035499ff",
"reference": "d6de0a536f00b5c5c74f36b8f4d0d93b035499ff",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/01ca9b5fdd899b8e4b69f83b85e09d96f6240220",
"reference": "01ca9b5fdd899b8e4b69f83b85e09d96f6240220",
"shasum": ""
},
"require": {
@ -6577,11 +6577,11 @@
"php": ">=5.6.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.5.0",
"friendsofphp/php-cs-fixer": "3.72.0",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^5.7 || ^9.0"
},
"time": "2025-02-24T22:35:29+00:00",
"time": "2025-04-05T00:09:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -6613,7 +6613,7 @@
],
"support": {
"issues": "https://github.com/stripe/stripe-php/issues",
"source": "https://github.com/stripe/stripe-php/tree/v16.6.0"
"source": "https://github.com/stripe/stripe-php/tree/v17.1.1"
},
"install-path": "../stripe/stripe-php"
},

View file

@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a573e1543cc1190a160807669d4044da00ada2d3',
'reference' => 'c9091acd31f2cda1b5ce3fdd3c634dbcac28cdbf',
'name' => 'wwbn/avideo',
'dev' => true,
),
@ -948,12 +948,12 @@
'dev_requirement' => false,
),
'stripe/stripe-php' => array(
'pretty_version' => 'v16.6.0',
'version' => '16.6.0.0',
'pretty_version' => 'v17.1.1',
'version' => '17.1.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../stripe/stripe-php',
'aliases' => array(),
'reference' => 'd6de0a536f00b5c5c74f36b8f4d0d93b035499ff',
'reference' => '01ca9b5fdd899b8e4b69f83b85e09d96f6240220',
'dev_requirement' => false,
),
'symfony/console' => array(
@ -1214,7 +1214,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'a573e1543cc1190a160807669d4044da00ada2d3',
'reference' => 'c9091acd31f2cda1b5ce3fdd3c634dbcac28cdbf',
'dev_requirement' => false,
),
'zircote/swagger-php' => array(

View file

@ -1,5 +1,88 @@
# Changelog
## 17.1.1 - 2025-04-04
* [#1847](https://github.com/stripe/stripe-php/pull/1847) Remove stdClass from object shapes
* Remove intersection with `stdClass` in resource properties and fixed `instanceof` checks.
## 17.1.0 - 2025-04-02
* [#1843](https://github.com/stripe/stripe-php/pull/1843) Add null type in resource fields to non required objects
* Fixes nullable resource properties that were incorrectly set as required in PHPDocs
## 17.0.0 - 2025-04-01
* [#1837](https://github.com/stripe/stripe-php/pull/1837) Better type hints in your editor!!
* Added type hints for method parameters
* <img width="417" alt="PHPStorm IDE with array type hints" src="https://github.com/user-attachments/assets/e914dcda-354f-4df2-b82e-217ad931e71d">
* Improved type hints for resource properties that are not primitive types. Take for example, the invoice settings in Customer resource. Previously, you could not reference inner fields like `custom_fields` on `customer->invoice_settings` without PHPStan complaining. This is now fixed.
* [#1818](https://github.com/stripe/stripe-php/pull/1818) Support for APIs in the new API version 2025-03-31.basil
This release changes the pinned API version to `2025-03-31.basil`.
### ⚠️ Breaking changes due to changes in the Stripe API
Please review details for the breaking changes and alternatives in the [Stripe API changelog](https://docs.stripe.com/changelog/acacia) before upgrading.
* Remove support for resources `UsageRecordSummary` and `UsageRecord`
* Remove support for `create` method on resource `UsageRecord`
* Remove support for `all` method on resource `UsageRecordSummary`
* Remove support for `upcomingLines` and `upcoming` methods on resource `Invoice`
* Remove support for `invoice` on `Charge` and `PaymentIntent`
* Remove support for `shipping_details` on `Checkout.Session`
* Remove support for `refund` on `CreditNote`
* Remove support for `tax_amounts` on `CreditNoteLineItem`, `CreditNote`, and `InvoiceLineItem`
* Remove support for `amount_excluding_tax` and `unit_amount_excluding_tax` on `CreditNoteLineItem` and `InvoiceLineItem`
* Remove support for `application_fee_amount`, `charge`, `paid_out_of_band`, `paid`, `payment_intent`, `quote`, `subscription`, `subscription_details`, `subscription_proration_date`, `tax`, `total_tax_amounts`, and `transfer_data` on `Invoice`
* Remove support for `discount` on `Invoice` and `Subscription`
* Remove support for `invoice_item`, `proration_details`, `proration`, `tax_rates`, and `type` on `InvoiceLineItem`
* Remove support for `plan`, `price`, and `subscription_item` on `InvoiceItem` and `InvoiceLineItem`
* Remove support for `subscription`, `unit_amount_decimal`, and `unit_amount` on `InvoiceItem`
* Remove support for `aggregate_usage` on `Plan`
* Remove support for `billing_thresholds` on `SubscriptionItem` and `Subscription`
* Remove support for `current_period_end` and `current_period_start` on `Subscription`
### ⚠️ Other Breaking changes in the SDK
* [#1826](https://github.com/stripe/stripe-php/pull/1826) configure max_nextwork_retries at the client level
* Allow setting `maxNetworkRetries` at the `StripeClient` level via a new argument to the `RequestOptions` constructor
* ⚠️ (potentially breaking) a client's configuration for `maxNetworkRetries` is set during client initialization. Subsequent calls to `Stripe::setMaxNetworkRetries()` after client creation **won't** affect that client.
* Allow setting `maxNetworkRetries` per-request via the `max_network_retries` config argument. This works for both the service and resource based patterns. In both cases, an explicitly passed value takes precedence over the global (or client) value.
* [#1835](https://github.com/stripe/stripe-php/pull/1835) Removed the protected method _searchResource as it is no longer used
* ⚠️ Removed `_searchResource` method and `Search` trait. Use the public `search` method on `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription` resource.
* [#1832](https://github.com/stripe/stripe-php/pull/1832) Added requestCollection and requestSearchResult to StripeClientInterface
* ⚠️ Added `requestSearchResult`, `requestCollection` to `StripeClientInterface`. Developers building custom StripeClient will now have to implement these new methods.
* Refer to our implementation in [BaseStripeClient](https://github.com/stripe/stripe-php/blob/f65c497d0bc175aaa04538602fd49645f44f9384/lib/BaseStripeClient.php#L259-L315) for guidance.
### Additions
* Add support for new resource `InvoicePayment`
* Add support for `all` and `retrieve` methods on resource `InvoicePayment`
* Add support for new values `forwarding_api_retryable_upstream_error` and `setup_intent_mobile_wallet_unsupported` on enums `Invoice.last_finalization_error.code`, `PaymentIntent.last_payment_error.code`, `SetupAttempt.setup_error.code`, `SetupIntent.last_setup_error.code`, and `StripeError.code`
* Add support for new values `stripe_balance_payment_debit_reversal` and `stripe_balance_payment_debit` on enum `BalanceTransaction.type`
* Add support for new value `last` on enum `Billing.Meter.default_aggregation.formula`
* Add support for `presentment_details` on `Charge`, `Checkout.Session`, `PaymentIntent`, and `Refund`
* Add support for `optional_items` on `Checkout.Session` and `PaymentLink`
* Add support for `permissions` on `Checkout.Session`
* Add support for new value `custom` on enum `Checkout.Session.ui_mode`
* Add support for new values `billie`, `nz_bank_account`, and `satispay` on enums `ConfirmationToken.payment_method_preview.type` and `PaymentMethod.type`
* Add support for `refunds` on `CreditNote`
* Add support for `total_taxes` on `CreditNote` and `Invoice`
* Add support for `taxes` on `CreditNoteLineItem` and `InvoiceLineItem`
* Add support for `checkout_session` on `CustomerBalanceTransaction`
* Add support for new values `checkout_session_subscription_payment_canceled` and `checkout_session_subscription_payment` on enum `CustomerBalanceTransaction.type`
* Add support for new value `invoice.overpaid` on enum `Event.type`
* Add support for `amount_overpaid`, `confirmation_secret`, and `payments` on `Invoice`
* Add support for `parent` on `InvoiceItem`, `InvoiceLineItem`, and `Invoice`
* Add support for new values `klarna` and `nz_bank_account` on enums `Invoice.payment_settings.payment_method_types` and `Subscription.payment_settings.payment_method_types`
* Add support for `pricing` on `InvoiceItem` and `InvoiceLineItem`
* Add support for new value `network_fallback` on enum `Issuing.Authorization.request_history[].reason`
* Add support for new value `expired` on enum `Issuing.Authorization.status`
* Add support for new value `expired` on enum `PaymentIntent.cancellation_reason`
* Add support for new values `billie` and `satispay` on enum `PaymentLink.payment_method_types`
* Add support for `billie`, `nz_bank_account`, and `satispay` on `PaymentMethodConfiguration` and `PaymentMethod`
* Add support for new value `canceled` on enum `Review.closed_reason`
* Add support for `current_period_end` and `current_period_start` on `SubscriptionItem`
* Add support for `wifi` on `Terminal.Configuration`
## 16.6.0 - 2025-02-24
* [#1809](https://github.com/stripe/stripe-php/pull/1809) Update generated code
* Add support for `priority` on `Billing.CreditGrant`
@ -13,7 +96,6 @@
## 16.5.0 - 2025-01-27
* [#1804](https://github.com/stripe/stripe-php/pull/1804) Update generated code
* Add support for `close` method on resource `Treasury.FinancialAccount`
* Add support for `advice_code` on `StripeError`
* Add support for `discounts` on `Checkout.Session`
* Add support for new value `pay_by_bank` on enum `PaymentLink.payment_method_types[]`
* Add support for `pay_by_bank` on `PaymentMethodConfiguration` and `PaymentMethod`
@ -28,7 +110,6 @@
## 16.4.0 - 2024-12-18
* [#1793](https://github.com/stripe/stripe-php/pull/1793) This release changes the pinned API version to `2024-12-18.acacia`.
* Add support for `network_advice_code` and `network_decline_code` on `StripeError`
* Add support for new values `payout_minimum_balance_hold` and `payout_minimum_balance_release` on enum `BalanceTransaction.type`
* Add support for `allow_redisplay` on `Card` and `Source`
* Add support for `regulated_status` on `Card`

View file

@ -1 +1 @@
v1505
v1642

View file

@ -1 +1 @@
16.6.0
17.1.1

View file

@ -22,7 +22,7 @@
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^9.0",
"friendsofphp/php-cs-fixer": "3.5.0",
"friendsofphp/php-cs-fixer": "3.72.0",
"phpstan/phpstan": "^1.2"
},
"autoload": {

View file

@ -55,7 +55,6 @@ require __DIR__ . '/lib/ApiOperations/Delete.php';
require __DIR__ . '/lib/ApiOperations/NestedResource.php';
require __DIR__ . '/lib/ApiOperations/Request.php';
require __DIR__ . '/lib/ApiOperations/Retrieve.php';
require __DIR__ . '/lib/ApiOperations/Search.php';
require __DIR__ . '/lib/ApiOperations/SingletonRetrieve.php';
require __DIR__ . '/lib/ApiOperations/Update.php';
@ -154,6 +153,7 @@ require __DIR__ . '/lib/Identity/VerificationSession.php';
require __DIR__ . '/lib/Invoice.php';
require __DIR__ . '/lib/InvoiceItem.php';
require __DIR__ . '/lib/InvoiceLineItem.php';
require __DIR__ . '/lib/InvoicePayment.php';
require __DIR__ . '/lib/InvoiceRenderingTemplate.php';
require __DIR__ . '/lib/Issuing/Authorization.php';
require __DIR__ . '/lib/Issuing/Card.php';
@ -240,6 +240,7 @@ require __DIR__ . '/lib/Service/Identity/IdentityServiceFactory.php';
require __DIR__ . '/lib/Service/Identity/VerificationReportService.php';
require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php';
require __DIR__ . '/lib/Service/InvoiceItemService.php';
require __DIR__ . '/lib/Service/InvoicePaymentService.php';
require __DIR__ . '/lib/Service/InvoiceRenderingTemplateService.php';
require __DIR__ . '/lib/Service/InvoiceService.php';
require __DIR__ . '/lib/Service/Issuing/AuthorizationService.php';
@ -376,8 +377,6 @@ require __DIR__ . '/lib/Treasury/ReceivedCredit.php';
require __DIR__ . '/lib/Treasury/ReceivedDebit.php';
require __DIR__ . '/lib/Treasury/Transaction.php';
require __DIR__ . '/lib/Treasury/TransactionEntry.php';
require __DIR__ . '/lib/UsageRecord.php';
require __DIR__ . '/lib/UsageRecordSummary.php';
require __DIR__ . '/lib/V2/Billing/MeterEvent.php';
require __DIR__ . '/lib/V2/Billing/MeterEventAdjustment.php';
require __DIR__ . '/lib/V2/Billing/MeterEventSession.php';

File diff suppressed because one or more lines are too long

View file

@ -24,12 +24,12 @@ class AccountLink extends ApiResource
* platform can redirect their user to in order to take them through the Connect
* Onboarding flow.
*
* @param null|array $params
* @param null|array{account: string, collect?: string, collection_options?: array{fields?: string, future_requirements?: string}, expand?: string[], refresh_url?: string, return_url?: string, type: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return AccountLink the created resource
*
* @return \Stripe\AccountLink the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -37,7 +37,7 @@ class AccountLink extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;

View file

@ -16,7 +16,7 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $account The ID of the account the AccountSession was created for
* @property string $client_secret <p>The client secret of this AccountSession. Used on the client to set up secure access to the given <code>account</code>.</p><p>The client secret can be used to provide access to <code>account</code> from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs to <a href="https://stripe.com/docs/connect/get-started-connect-embedded-components">setup Connect embedded components</a> and learn about how <code>client_secret</code> should be handled.</p>
* @property \Stripe\StripeObject $components
* @property (object{account_management: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool}&StripeObject)}&StripeObject), account_onboarding: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool}&StripeObject)}&StripeObject), balances: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, edit_payout_schedule: bool, external_account_collection: bool, instant_payouts: bool, standard_payouts: bool}&StripeObject)}&StripeObject), documents: (object{enabled: bool, features: (object{}&StripeObject)}&StripeObject), financial_account: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool, send_money: bool, transfer_balance: bool}&StripeObject)}&StripeObject), financial_account_transactions: (object{enabled: bool, features: (object{card_spend_dispute_management: bool}&StripeObject)}&StripeObject), issuing_card: (object{enabled: bool, features: (object{card_management: bool, card_spend_dispute_management: bool, cardholder_management: bool, spend_control_management: bool}&StripeObject)}&StripeObject), issuing_cards_list: (object{enabled: bool, features: (object{card_management: bool, card_spend_dispute_management: bool, cardholder_management: bool, disable_stripe_user_authentication: bool, spend_control_management: bool}&StripeObject)}&StripeObject), notification_banner: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, external_account_collection: bool}&StripeObject)}&StripeObject), payment_details: (object{enabled: bool, features: (object{capture_payments: bool, destination_on_behalf_of_charge_management: bool, dispute_management: bool, refund_management: bool}&StripeObject)}&StripeObject), payments: (object{enabled: bool, features: (object{capture_payments: bool, destination_on_behalf_of_charge_management: bool, dispute_management: bool, refund_management: bool}&StripeObject)}&StripeObject), payouts: (object{enabled: bool, features: (object{disable_stripe_user_authentication: bool, edit_payout_schedule: bool, external_account_collection: bool, instant_payouts: bool, standard_payouts: bool}&StripeObject)}&StripeObject), payouts_list: (object{enabled: bool, features: (object{}&StripeObject)}&StripeObject), tax_registrations: (object{enabled: bool, features: (object{}&StripeObject)}&StripeObject), tax_settings: (object{enabled: bool, features: (object{}&StripeObject)}&StripeObject)}&StripeObject) $components
* @property int $expires_at The timestamp at which this AccountSession will expire.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
@ -28,12 +28,12 @@ class AccountSession extends ApiResource
* Creates a AccountSession object that includes a single-use token that the
* platform can use on their front-end to grant client-side API access.
*
* @param null|array $params
* @param null|array{account: string, components: array{account_management?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, account_onboarding?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, balances?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, edit_payout_schedule?: bool, external_account_collection?: bool, instant_payouts?: bool, standard_payouts?: bool}}, documents?: array{enabled: bool, features?: array{}}, financial_account?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool, send_money?: bool, transfer_balance?: bool}}, financial_account_transactions?: array{enabled: bool, features?: array{card_spend_dispute_management?: bool}}, issuing_card?: array{enabled: bool, features?: array{card_management?: bool, card_spend_dispute_management?: bool, cardholder_management?: bool, spend_control_management?: bool}}, issuing_cards_list?: array{enabled: bool, features?: array{card_management?: bool, card_spend_dispute_management?: bool, cardholder_management?: bool, disable_stripe_user_authentication?: bool, spend_control_management?: bool}}, notification_banner?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, external_account_collection?: bool}}, payment_details?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payments?: array{enabled: bool, features?: array{capture_payments?: bool, destination_on_behalf_of_charge_management?: bool, dispute_management?: bool, refund_management?: bool}}, payouts?: array{enabled: bool, features?: array{disable_stripe_user_authentication?: bool, edit_payout_schedule?: bool, external_account_collection?: bool, instant_payouts?: bool, standard_payouts?: bool}}, payouts_list?: array{enabled: bool, features?: array{}}, tax_registrations?: array{enabled: bool, features?: array{}}, tax_settings?: array{enabled: bool, features?: array{}}}, expand?: string[]} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return AccountSession the created resource
*
* @return \Stripe\AccountSession the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -41,7 +41,7 @@ class AccountSession extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;

View file

@ -13,9 +13,9 @@ trait All
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection of ApiResources
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{

View file

@ -13,9 +13,9 @@ trait Create
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the created resource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{

View file

@ -13,9 +13,9 @@ trait Delete
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the deleted resource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{

View file

@ -51,9 +51,9 @@ trait NestedResource
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\StripeObject
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
{
@ -69,9 +69,9 @@ trait NestedResource
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\StripeObject
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
{
@ -87,9 +87,9 @@ trait NestedResource
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\StripeObject
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
{
@ -105,9 +105,9 @@ trait NestedResource
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\StripeObject
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
{
@ -122,9 +122,9 @@ trait NestedResource
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\StripeObject
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
{

View file

@ -34,9 +34,9 @@ trait Request
* @param string[] $usage names of tracked behaviors associated with this request
* @param 'v1'|'v2' $apiMode
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return array tuple containing (the JSON response, $options)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected function _request($method, $url, $params = [], $options = null, $usage = [], $apiMode = 'v1')
{
@ -49,14 +49,14 @@ trait Request
/**
* @param string $url URL for the request
* @param class-string< \Stripe\SearchResult|\Stripe\Collection > $resultClass indicating what type of paginated result is returned
* @param class-string< \Stripe\Collection|\Stripe\SearchResult > $resultClass indicating what type of paginated result is returned
* @param null|array $params list of parameters for the request
* @param null|array|string $options
* @param string[] $usage names of tracked behaviors associated with this request
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection|\Stripe\SearchResult
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _requestPage($url, $resultClass, $params = null, $options = null, $usage = [])
{
@ -64,7 +64,7 @@ trait Request
list($response, $opts) = static::_staticRequest('get', $url, $params, $options, $usage);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof $resultClass)) {
if (!$obj instanceof $resultClass) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . $resultClass . ', got "' . \get_class($obj) . '" instead.'
);
@ -99,9 +99,9 @@ trait Request
* @param string[] $usage names of tracked behaviors associated with this request
* @param 'v1'|'v2' $apiMode
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return array tuple containing (the JSON response, $options)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _staticRequest($method, $url, $params, $options, $usage = [], $apiMode = 'v1')
{

View file

@ -15,9 +15,9 @@ trait Retrieve
* or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -1,25 +0,0 @@
<?php
namespace Stripe\ApiOperations;
/**
* Trait for searchable resources.
*
* This trait should only be applied to classes that derive from StripeObject.
*/
trait Search
{
/**
* @param string $searchUrl
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult of ApiResources
*/
protected static function _searchResource($searchUrl, $params = null, $opts = null)
{
return static::_requestPage($searchUrl, \Stripe\SearchResult::class, $params, $opts);
}
}

View file

@ -14,9 +14,9 @@ trait SingletonRetrieve
* @param null|array|string $opts the ID of the API resource to retrieve,
* or an options array containing an `id` key
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($opts = null)
{

View file

@ -15,9 +15,9 @@ trait Update
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the updated resource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -34,10 +34,10 @@ trait Update
/**
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the saved resource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @deprecated The `save` method is deprecated and will be removed in a
* future major version of the library. Use the static method `update`
* on the resource instead.

View file

@ -122,17 +122,18 @@ class ApiRequestor
* @param null|array $headers
* @param 'v1'|'v2' $apiMode
* @param string[] $usage
*
* @throws Exception\ApiErrorException
* @param null|int $maxNetworkRetries
*
* @return array tuple containing (ApiReponse, API key)
*
* @throws Exception\ApiErrorException
*/
public function request($method, $url, $params = null, $headers = null, $apiMode = 'v1', $usage = [])
public function request($method, $url, $params = null, $headers = null, $apiMode = 'v1', $usage = [], $maxNetworkRetries = null)
{
$params = $params ?: [];
$headers = $headers ?: [];
list($rbody, $rcode, $rheaders, $myApiKey) =
$this->_requestRaw($method, $url, $params, $headers, $apiMode, $usage);
list($rbody, $rcode, $rheaders, $myApiKey)
= $this->_requestRaw($method, $url, $params, $headers, $apiMode, $usage, $maxNetworkRetries);
$json = $this->_interpretResponse($rbody, $rcode, $rheaders, $apiMode);
$resp = new ApiResponse($rbody, $rcode, $rheaders, $json);
@ -147,15 +148,16 @@ class ApiRequestor
* @param null|array $headers
* @param 'v1'|'v2' $apiMode
* @param string[] $usage
* @param null|int $maxNetworkRetries
*
* @throws Exception\ApiErrorException
*/
public function requestStream($method, $url, $readBodyChunkCallable, $params = null, $headers = null, $apiMode = 'v1', $usage = [])
public function requestStream($method, $url, $readBodyChunkCallable, $params = null, $headers = null, $apiMode = 'v1', $usage = [], $maxNetworkRetries = null)
{
$params = $params ?: [];
$headers = $headers ?: [];
list($rbody, $rcode, $rheaders, $myApiKey) =
$this->_requestRawStreaming($method, $url, $params, $headers, $apiMode, $usage, $readBodyChunkCallable);
list($rbody, $rcode, $rheaders, $myApiKey)
= $this->_requestRawStreaming($method, $url, $params, $headers, $apiMode, $usage, $readBodyChunkCallable, $maxNetworkRetries);
if ($rcode >= 300) {
$this->_interpretResponse($rbody, $rcode, $rheaders, $apiMode);
}
@ -266,6 +268,7 @@ class ApiRequestor
switch ($type) {
case 'idempotency_error':
return Exception\IdempotencyException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
// The beginning of the section generated from our OpenAPI spec
case 'temporary_session_expired':
return Exception\TemporarySessionExpiredException::factory(
@ -443,7 +446,7 @@ class ApiRequestor
if ($params && \is_array($params)) {
$optionKeysInParams = \array_filter(
self::$OPTIONS_KEYS,
function ($key) use ($params) {
static function ($key) use ($params) {
return \array_key_exists($key, $params);
}
);
@ -506,13 +509,14 @@ class ApiRequestor
* @param array $headers
* @param 'v1'|'v2' $apiMode
* @param string[] $usage
* @param null|int $maxNetworkRetries
*
* @return array
*
* @throws Exception\AuthenticationException
* @throws Exception\ApiConnectionException
*
* @return array
*/
private function _requestRaw($method, $url, $params, $headers, $apiMode, $usage)
private function _requestRaw($method, $url, $params, $headers, $apiMode, $usage, $maxNetworkRetries)
{
list($absUrl, $rawHeaders, $params, $hasFile, $myApiKey) = $this->_prepareRequest($method, $url, $params, $headers, $apiMode);
@ -530,7 +534,8 @@ class ApiRequestor
$rawHeaders,
$params,
$hasFile,
$apiMode
$apiMode,
$maxNetworkRetries
);
if (
@ -556,13 +561,14 @@ class ApiRequestor
* @param string[] $usage
* @param callable $readBodyChunkCallable
* @param 'v1'|'v2' $apiMode
* @param int $maxNetworkRetries
*
* @return array
*
* @throws Exception\AuthenticationException
* @throws Exception\ApiConnectionException
*
* @return array
*/
private function _requestRawStreaming($method, $url, $params, $headers, $apiMode, $usage, $readBodyChunkCallable)
private function _requestRawStreaming($method, $url, $params, $headers, $apiMode, $usage, $readBodyChunkCallable, $maxNetworkRetries)
{
list($absUrl, $rawHeaders, $params, $hasFile, $myApiKey) = $this->_prepareRequest($method, $url, $params, $headers, $apiMode);
@ -574,7 +580,8 @@ class ApiRequestor
$rawHeaders,
$params,
$hasFile,
$readBodyChunkCallable
$readBodyChunkCallable,
$maxNetworkRetries
);
if (
@ -594,9 +601,9 @@ class ApiRequestor
/**
* @param resource $resource
*
* @throws Exception\InvalidArgumentException
*
* @return \CURLFile|string
*
* @throws Exception\InvalidArgumentException
*/
private function _processResourceParam($resource)
{
@ -623,10 +630,10 @@ class ApiRequestor
* @param array $rheaders
* @param 'v1'|'v2' $apiMode
*
* @return array
*
* @throws Exception\UnexpectedValueException
* @throws Exception\ApiErrorException
*
* @return array
*/
private function _interpretResponse($rbody, $rcode, $rheaders, $apiMode)
{

View file

@ -11,7 +11,7 @@ abstract class ApiResource extends StripeObject
use ApiOperations\Request;
/**
* @return \Stripe\Util\Set A list of fields that can be their own type of
* @return Util\Set A list of fields that can be their own type of
* API resource (say a nested card under an account for example), and if
* that resource is set, it should be transmitted to the API on a create or
* update. Doing so is not the default behavior because API resources
@ -40,16 +40,16 @@ abstract class ApiResource extends StripeObject
{
parent::__set($k, $v);
$v = $this->{$k};
if ((static::getSavedNestedResources()->includes($k))
if (static::getSavedNestedResources()->includes($k)
&& ($v instanceof ApiResource)) {
$v->saveWithParent = true;
}
}
/**
* @throws Exception\ApiErrorException
*
* @return ApiResource the refreshed resource
*
* @throws Exception\ApiErrorException
*/
public function refresh()
{
@ -93,9 +93,9 @@ abstract class ApiResource extends StripeObject
/**
* @param null|string $id the ID of the resource
*
* @throws Exception\UnexpectedValueException if $id is null
*
* @return string the instance endpoint URL for the given class
*
* @throws Exception\UnexpectedValueException if $id is null
*/
public static function resourceUrl($id)
{

View file

@ -18,12 +18,12 @@ class ApplePayDomain extends ApiResource
/**
* Create an apple pay domain.
*
* @param null|array $params
* @param null|array{domain_name: string, expand?: string[]} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplePayDomain the created resource
*
* @return \Stripe\ApplePayDomain the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -31,7 +31,7 @@ class ApplePayDomain extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -43,9 +43,9 @@ class ApplePayDomain extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplePayDomain the deleted resource
*
* @return \Stripe\ApplePayDomain the deleted resource
* @throws Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{
@ -61,18 +61,18 @@ class ApplePayDomain extends ApiResource
/**
* List apple pay domains.
*
* @param null|array $params
* @param null|array{domain_name?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<ApplePayDomain> of ApiResources
*
* @return \Stripe\Collection<\Stripe\ApplePayDomain> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -81,13 +81,13 @@ class ApplePayDomain extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplePayDomain
*
* @return \Stripe\ApplePayDomain
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();

View file

@ -7,19 +7,19 @@ namespace Stripe;
/**
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string|\Stripe\Account $account ID of the Stripe account this fee was taken from.
* @property Account|string $account ID of the Stripe account this fee was taken from.
* @property int $amount Amount earned, in cents (or local equivalent).
* @property int $amount_refunded Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the fee if a partial refund was issued)
* @property string|\Stripe\Application $application ID of the Connect application that earned the fee.
* @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
* @property string|\Stripe\Charge $charge ID of the charge that the application fee was taken from.
* @property Application|string $application ID of the Connect application that earned the fee.
* @property null|BalanceTransaction|string $balance_transaction Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
* @property Charge|string $charge ID of the charge that the application fee was taken from.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|\Stripe\StripeObject $fee_source Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
* @property null|(object{charge?: string, payout?: string, type: string}&StripeObject) $fee_source Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string|\Stripe\Charge $originating_transaction ID of the corresponding charge on the platform account, if this fee was the result of a charge using the <code>destination</code> parameter.
* @property null|Charge|string $originating_transaction ID of the corresponding charge on the platform account, if this fee was the result of a charge using the <code>destination</code> parameter.
* @property bool $refunded Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
* @property \Stripe\Collection<\Stripe\ApplicationFeeRefund> $refunds A list of refunds that have been applied to the fee.
* @property Collection<ApplicationFeeRefund> $refunds A list of refunds that have been applied to the fee.
*/
class ApplicationFee extends ApiResource
{
@ -31,18 +31,18 @@ class ApplicationFee extends ApiResource
* Returns a list of application fees youve previously collected. The application
* fees are returned in sorted order, with the most recent fees appearing first.
*
* @param null|array $params
* @param null|array{charge?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<ApplicationFee> of ApiResources
*
* @return \Stripe\Collection<\Stripe\ApplicationFee> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -52,13 +52,13 @@ class ApplicationFee extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplicationFee
*
* @return \Stripe\ApplicationFee
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -72,9 +72,9 @@ class ApplicationFee extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<ApplicationFeeRefund> the list of application fee refunds
*
* @return \Stripe\Collection<\Stripe\ApplicationFeeRefund> the list of application fee refunds
* @throws Exception\ApiErrorException if the request fails
*/
public static function allRefunds($id, $params = null, $opts = null)
{
@ -86,9 +86,9 @@ class ApplicationFee extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplicationFeeRefund
*
* @return \Stripe\ApplicationFeeRefund
* @throws Exception\ApiErrorException if the request fails
*/
public static function createRefund($id, $params = null, $opts = null)
{
@ -101,9 +101,9 @@ class ApplicationFee extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplicationFeeRefund
*
* @return \Stripe\ApplicationFeeRefund
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieveRefund($id, $refundId, $params = null, $opts = null)
{
@ -116,9 +116,9 @@ class ApplicationFee extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ApplicationFeeRefund
*
* @return \Stripe\ApplicationFeeRefund
* @throws Exception\ApiErrorException if the request fails
*/
public static function updateRefund($id, $refundId, $params = null, $opts = null)
{

View file

@ -14,11 +14,11 @@ namespace Stripe;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Amount, in cents (or local equivalent).
* @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance.
* @property null|BalanceTransaction|string $balance_transaction Balance transaction that describes the impact on your account balance.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string|\Stripe\ApplicationFee $fee ID of the application fee that was refunded.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property ApplicationFee|string $fee ID of the application fee that was refunded.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
*/
class ApplicationFeeRefund extends ApiResource
{
@ -37,8 +37,8 @@ class ApplicationFeeRefund extends ApiResource
$fee = $this['fee'];
if (!$id) {
throw new Exception\UnexpectedValueException(
'Could not determine which URL to request: ' .
"class instance has invalid ID: {$id}",
'Could not determine which URL to request: '
. "class instance has invalid ID: {$id}",
null
);
}

View file

@ -23,7 +23,7 @@ namespace Stripe\Apps;
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $name A name for the secret that's unique within the scope.
* @property null|string $payload The plaintext secret value to be stored.
* @property \Stripe\StripeObject $scope
* @property (object{type: string, user?: string}&\Stripe\StripeObject) $scope
*/
class Secret extends \Stripe\ApiResource
{
@ -32,12 +32,12 @@ class Secret extends \Stripe\ApiResource
/**
* Create or replace a secret in the secret store.
*
* @param null|array $params
* @param null|array{expand?: string[], expires_at?: int, name: string, payload: string, scope: array{type: string, user?: string}} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Secret the created resource
*
* @return \Stripe\Apps\Secret the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -54,12 +54,12 @@ class Secret extends \Stripe\ApiResource
/**
* List all secrets stored on the given scope.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, scope: array{type: string, user?: string}, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Secret> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Apps\Secret> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -72,9 +72,9 @@ class Secret extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Secret the deleted secret
*
* @return \Stripe\Apps\Secret the deleted secret
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function deleteWhere($params = null, $opts = null)
{
@ -90,9 +90,9 @@ class Secret extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Secret the finded secret
*
* @return \Stripe\Apps\Secret the finded secret
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function find($params = null, $opts = null)
{

View file

@ -18,12 +18,12 @@ namespace Stripe;
* Related guide: <a href="https://stripe.com/docs/connect/account-balances">Understanding Connect account balances</a>
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject[] $available Available funds that you can transfer or pay out automatically by Stripe or explicitly through the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. You can find the available balance for each currency and payment type in the <code>source_types</code> property.
* @property null|\Stripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">account.controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the <code>source_types</code> property.
* @property null|\Stripe\StripeObject[] $instant_available Funds that you can pay out using Instant Payouts.
* @property null|\Stripe\StripeObject $issuing
* @property (object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&StripeObject)}&StripeObject)[] $available Available funds that you can transfer or pay out automatically by Stripe or explicitly through the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. You can find the available balance for each currency and payment type in the <code>source_types</code> property.
* @property null|(object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&StripeObject)}&StripeObject)[] $connect_reserved Funds held due to negative balances on connected accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">account.controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the <code>source_types</code> property.
* @property null|(object{amount: int, currency: string, net_available?: (object{amount: int, destination: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&StripeObject)}&StripeObject)[], source_types?: (object{bank_account?: int, card?: int, fpx?: int}&StripeObject)}&StripeObject)[] $instant_available Funds that you can pay out using Instant Payouts.
* @property null|(object{available: (object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&StripeObject)}&StripeObject)[]}&StripeObject) $issuing
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject[] $pending Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the <code>source_types</code> property.
* @property (object{amount: int, currency: string, source_types?: (object{bank_account?: int, card?: int, fpx?: int}&StripeObject)}&StripeObject)[] $pending Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the <code>source_types</code> property.
*/
class Balance extends SingletonApiResource
{
@ -37,13 +37,13 @@ class Balance extends SingletonApiResource
*
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Balance
*
* @return \Stripe\Balance
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static(null, $opts);
$instance->refresh();

View file

@ -19,12 +19,12 @@ namespace Stripe;
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|float $exchange_rate If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the <code>amount</code> in currency A, multipled by the <code>exchange_rate</code>, equals the <code>amount</code> in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntent's <code>amount</code> is <code>1000</code> and <code>currency</code> is <code>eur</code>. If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's <code>amount</code> is <code>1234</code>, its <code>currency</code> is <code>usd</code>, and the <code>exchange_rate</code> is <code>1.234</code>.
* @property int $fee Fees (in cents (or local equivalent)) paid for this transaction. Represented as a positive integer when assessed.
* @property \Stripe\StripeObject[] $fee_details Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
* @property ((object{amount: int, application: null|string, currency: string, description: null|string, type: string}&StripeObject))[] $fee_details Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
* @property int $net Net impact to a Stripe balance (in cents (or local equivalent)). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by <code>amount</code> - <code>fee</code>
* @property string $reporting_category Learn more about how <a href="https://stripe.com/docs/reports/reporting-categories">reporting categories</a> can help you understand balance transactions from an accounting perspective.
* @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\ConnectCollectionTransfer|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\Refund|\Stripe\ReserveTransaction|\Stripe\TaxDeductedAtSource|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object.
* @property null|ApplicationFee|ApplicationFeeRefund|Charge|ConnectCollectionTransfer|CustomerCashBalanceTransaction|Dispute|Issuing\Authorization|Issuing\Dispute|Issuing\Transaction|Payout|Refund|ReserveTransaction|string|TaxDeductedAtSource|Topup|Transfer|TransferReversal $source This transaction relates to the Stripe object.
* @property string $status The transaction's net funds status in the Stripe balance, which are either <code>available</code> or <code>pending</code>.
* @property string $type Transaction type: <code>adjustment</code>, <code>advance</code>, <code>advance_funding</code>, <code>anticipation_repayment</code>, <code>application_fee</code>, <code>application_fee_refund</code>, <code>charge</code>, <code>climate_order_purchase</code>, <code>climate_order_refund</code>, <code>connect_collection_transfer</code>, <code>contribution</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>obligation_outbound</code>, <code>obligation_reversal_inbound</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_network_reserve_hold</code>, <code>payment_network_reserve_release</code>, <code>payment_refund</code>, <code>payment_reversal</code>, <code>payment_unreconciled</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</code>, <code>payout_minimum_balance_hold</code>, <code>payout_minimum_balance_release</code>, <code>refund</code>, <code>refund_failure</code>, <code>reserve_transaction</code>, <code>reserved_funds</code>, <code>stripe_fee</code>, <code>stripe_fx_fee</code>, <code>tax_fee</code>, <code>topup</code>, <code>topup_reversal</code>, <code>transfer</code>, <code>transfer_cancel</code>, <code>transfer_failure</code>, or <code>transfer_refund</code>. Learn more about <a href="https://stripe.com/docs/reports/balance-transaction-types">balance transaction types and what they represent</a>. To classify transactions for accounting purposes, consider <code>reporting_category</code> instead.
* @property string $type Transaction type: <code>adjustment</code>, <code>advance</code>, <code>advance_funding</code>, <code>anticipation_repayment</code>, <code>application_fee</code>, <code>application_fee_refund</code>, <code>charge</code>, <code>climate_order_purchase</code>, <code>climate_order_refund</code>, <code>connect_collection_transfer</code>, <code>contribution</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>obligation_outbound</code>, <code>obligation_reversal_inbound</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_network_reserve_hold</code>, <code>payment_network_reserve_release</code>, <code>payment_refund</code>, <code>payment_reversal</code>, <code>payment_unreconciled</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</code>, <code>payout_minimum_balance_hold</code>, <code>payout_minimum_balance_release</code>, <code>refund</code>, <code>refund_failure</code>, <code>reserve_transaction</code>, <code>reserved_funds</code>, <code>stripe_fee</code>, <code>stripe_fx_fee</code>, <code>stripe_balance_payment_debit</code>, <code>stripe_balance_payment_debit_reversal</code>, <code>tax_fee</code>, <code>topup</code>, <code>topup_reversal</code>, <code>transfer</code>, <code>transfer_cancel</code>, <code>transfer_failure</code>, or <code>transfer_refund</code>. Learn more about <a href="https://stripe.com/docs/reports/balance-transaction-types">balance transaction types and what they represent</a>. To classify transactions for accounting purposes, consider <code>reporting_category</code> instead.
*/
class BalanceTransaction extends ApiResource
{
@ -63,6 +63,8 @@ class BalanceTransaction extends ApiResource
const TYPE_REFUND_FAILURE = 'refund_failure';
const TYPE_RESERVED_FUNDS = 'reserved_funds';
const TYPE_RESERVE_TRANSACTION = 'reserve_transaction';
const TYPE_STRIPE_BALANCE_PAYMENT_DEBIT = 'stripe_balance_payment_debit';
const TYPE_STRIPE_BALANCE_PAYMENT_DEBIT_REVERSAL = 'stripe_balance_payment_debit_reversal';
const TYPE_STRIPE_FEE = 'stripe_fee';
const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee';
const TYPE_TAX_FEE = 'tax_fee';
@ -81,18 +83,18 @@ class BalanceTransaction extends ApiResource
* Note that this endpoint was previously called “Balance history” and used the
* path <code>/v1/balance/history</code>.
*
* @param null|array $params
* @param null|array{created?: array|int, currency?: string, ending_before?: string, expand?: string[], limit?: int, payout?: string, source?: string, starting_after?: string, type?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<BalanceTransaction> of ApiResources
*
* @return \Stripe\Collection<\Stripe\BalanceTransaction> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -104,13 +106,13 @@ class BalanceTransaction extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return BalanceTransaction
*
* @return \Stripe\BalanceTransaction
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();

View file

@ -15,7 +15,7 @@ namespace Stripe;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|string|\Stripe\Account $account The ID of the account that the bank account is associated with.
* @property null|Account|string $account The account this bank account belongs to. Only applicable on Accounts (not customers or recipients) This property is only available when returned as an <a href="/api/external_account_bank_accounts/object">External Account</a> where <a href="/api/accounts/object#account_object-controller-is_controller">controller.is_controller</a> is <code>true</code>.
* @property null|string $account_holder_name The name of the person or business that owns the bank account.
* @property null|string $account_holder_type The type of entity that holds the account. This can be either <code>individual</code> or <code>company</code>.
* @property null|string $account_type The bank account type. This can only be <code>checking</code> or <code>savings</code> in most countries. In Japan, this can only be <code>futsu</code> or <code>toza</code>.
@ -23,13 +23,13 @@ namespace Stripe;
* @property null|string $bank_name Name of the bank associated with the routing number (e.g., <code>WELLS FARGO</code>).
* @property string $country Two-letter ISO code representing the country the bank account is located in.
* @property string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for the currency</a> paid out to the bank account.
* @property null|string|\Stripe\Customer $customer The ID of the customer that the bank account is associated with.
* @property null|Customer|string $customer The ID of the customer that the bank account is associated with.
* @property null|bool $default_for_currency Whether this bank account is the default external account for its currency.
* @property null|string $fingerprint Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
* @property null|\Stripe\StripeObject $future_requirements Information about the <a href="https://stripe.com/docs/connect/custom-accounts/future-requirements">upcoming new requirements for the bank account</a>, including what information needs to be collected, and by when.
* @property null|(object{currently_due: null|string[], errors: null|(object{code: string, reason: string, requirement: string}&StripeObject)[], past_due: null|string[], pending_verification: null|string[]}&StripeObject) $future_requirements Information about the <a href="https://stripe.com/docs/connect/custom-accounts/future-requirements">upcoming new requirements for the bank account</a>, including what information needs to be collected, and by when.
* @property string $last4 The last four digits of the bank account number.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|\Stripe\StripeObject $requirements Information about the requirements for the bank account, including what information needs to be collected.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|(object{currently_due: null|string[], errors: null|(object{code: string, reason: string, requirement: string}&StripeObject)[], past_due: null|string[], pending_verification: null|string[]}&StripeObject) $requirements Information about the requirements for the bank account, including what information needs to be collected.
* @property null|string $routing_number The routing transit number for the bank account.
* @property string $status <p>For bank accounts, possible values are <code>new</code>, <code>validated</code>, <code>verified</code>, <code>verification_failed</code>, or <code>errored</code>. A bank account that hasn't had any activity or validation performed is <code>new</code>. If Stripe can determine that the bank account exists, its status will be <code>validated</code>. Note that there often isnt enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be <code>verified</code>. If the verification failed for any reason, such as microdeposit failure, the status will be <code>verification_failed</code>. If a payout sent to this bank account fails, we'll set the status to <code>errored</code> and will not continue to send <a href="https://stripe.com/docs/payouts#payout-schedule">scheduled payouts</a> until the bank details are updated.</p><p>For external accounts, possible values are <code>new</code>, <code>errored</code> and <code>verification_failed</code>. If a payout fails, the status is set to <code>errored</code> and scheduled payouts are stopped until account details are updated. In the US and India, if we can't <a href="https://support.stripe.com/questions/bank-account-ownership-verification">verify the owner of the bank account</a>, we'll set the status to <code>verification_failed</code>. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.</p>
*/
@ -43,9 +43,9 @@ class BankAccount extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return BankAccount the deleted resource
*
* @return \Stripe\BankAccount the deleted resource
* @throws Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{
@ -98,15 +98,15 @@ class BankAccount extends ApiResource
* @param array|string $_id
* @param null|array|string $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = 'Bank accounts cannot be retrieved without a customer ID or ' .
'an account ID. Retrieve a bank account using ' .
"`Customer::retrieveSource('customer_id', " .
"'bank_account_id')` or `Account::retrieveExternalAccount(" .
"'account_id', 'bank_account_id')`.";
$msg = 'Bank accounts cannot be retrieved without a customer ID or '
. 'an account ID. Retrieve a bank account using '
. "`Customer::retrieveSource('customer_id', "
. "'bank_account_id')` or `Account::retrieveExternalAccount("
. "'account_id', 'bank_account_id')`.";
throw new Exception\BadMethodCallException($msg);
}
@ -116,15 +116,15 @@ class BankAccount extends ApiResource
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = 'Bank accounts cannot be updated without a customer ID or an ' .
'account ID. Update a bank account using ' .
"`Customer::updateSource('customer_id', 'bank_account_id', " .
'$updateParams)` or `Account::updateExternalAccount(' .
"'account_id', 'bank_account_id', \$updateParams)`.";
$msg = 'Bank accounts cannot be updated without a customer ID or an '
. 'account ID. Update a bank account using '
. "`Customer::updateSource('customer_id', 'bank_account_id', "
. '$updateParams)` or `Account::updateExternalAccount('
. "'account_id', 'bank_account_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
}
@ -132,10 +132,10 @@ class BankAccount extends ApiResource
/**
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the saved resource
*
* @throws Exception\ApiErrorException if the request fails
*
* @deprecated The `save` method is deprecated and will be removed in a
* future major version of the library. Use the static method `update`
* on the resource instead.
@ -156,9 +156,9 @@ class BankAccount extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return BankAccount the verified bank account
*
* @throws Exception\ApiErrorException if the request fails
*/
public function verify($params = null, $opts = null)
{

View file

@ -18,7 +18,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
/** @var string default base URL for Stripe's Meter Events API */
const DEFAULT_METER_EVENTS_BASE = 'https://meter-events.stripe.com';
/** @var array<string, null|string> */
/** @var array<string, null|int|string> */
const DEFAULT_CONFIG = [
'api_key' => null,
'app_info' => null,
@ -30,6 +30,8 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
'connect_base' => self::DEFAULT_CONNECT_BASE,
'files_base' => self::DEFAULT_FILES_BASE,
'meter_events_base' => self::DEFAULT_METER_EVENTS_BASE,
// inherit from global
'max_network_retries' => null,
];
/** @var array<string, mixed> */
@ -56,6 +58,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* will automatically use the {@code Stripe-Context} header with that ID.
* - stripe_version (null|string): a Stripe API version. If set, all requests sent by the client
* will include the {@code Stripe-Version} header with that API version.
* - max_network_retries (null|int): the number of times this client should retry API failures; defaults to 0.
*
* The following configuration settings are also available, though setting these should rarely be necessary
* (only useful if you want to send requests to a mock server like stripe-mock):
@ -77,7 +80,12 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
if (\is_string($config)) {
$config = ['api_key' => $config];
} elseif (!\is_array($config)) {
throw new \Stripe\Exception\InvalidArgumentException('$config must be a string or an array');
throw new Exception\InvalidArgumentException('$config must be a string or an array');
}
if (!\array_key_exists('max_network_retries', $config)) {
// if no value is passed, inherit the global value at the time of client creation
$config['max_network_retries'] = Stripe::getMaxNetworkRetries();
}
$config = \array_merge(self::DEFAULT_CONFIG, $config);
@ -89,6 +97,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
'stripe_account' => $config['stripe_account'],
'stripe_context' => $config['stripe_context'],
'stripe_version' => $config['stripe_version'],
'max_network_retries' => $config['max_network_retries'],
]);
}
@ -152,6 +161,16 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
return $this->config['meter_events_base'];
}
/**
* Gets the configured number of retries.
*
* @return int the number of times this client will retry failed requests
*/
public function getMaxNetworkRetries()
{
return $this->config['max_network_retries'];
}
/**
* Gets the app info for this client.
*
@ -170,24 +189,24 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* @param array $params the parameters of the request
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
*
* @return \Stripe\StripeObject the object returned by Stripe's API
* @return StripeObject the object returned by Stripe's API
*/
public function request($method, $path, $params, $opts)
{
$defaultRequestOpts = $this->defaultOpts;
$apiMode = \Stripe\Util\Util::getApiMode($path);
$apiMode = Util::getApiMode($path);
$opts = $defaultRequestOpts->merge($opts, true);
$baseUrl = $opts->apiBase ?: $this->getApiBase();
$requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl, $this->getAppInfo());
list($response, $opts->apiKey) = $requestor->request($method, $path, $params, $opts->headers, $apiMode, ['stripe_client']);
$requestor = new ApiRequestor($this->apiKeyForRequest($opts), $baseUrl, $this->getAppInfo());
list($response, $opts->apiKey) = $requestor->request($method, $path, $params, $opts->headers, $apiMode, ['stripe_client'], $opts->maxNetworkRetries);
$opts->discardNonPersistentHeaders();
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts, $apiMode);
$obj = Util::convertToStripeObject($response->json, $opts, $apiMode);
if (\is_array($obj)) {
// Edge case for v2 endpoints that return empty/void response
// Example: client->v2->billing->meterEventStream->create
$obj = new \Stripe\StripeObject();
$obj = new StripeObject();
}
$obj->setLastResponse($response);
@ -203,15 +222,16 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* @param string $path the path of the request
* @param null|array $params the parameters of the request
* @param array $opts the special modifiers of the request
* @param null|int $maxNetworkRetries
*
* @return \Stripe\ApiResponse
* @return ApiResponse
*/
public function rawRequest($method, $path, $params = null, $opts = [])
public function rawRequest($method, $path, $params = null, $opts = [], $maxNetworkRetries = null)
{
if ('post' !== $method && null !== $params) {
throw new Exception\InvalidArgumentException('Error: rawRequest only supports $params on post requests. Please pass null and add your parameters to $path');
}
$apiMode = \Stripe\Util\Util::getApiMode($path);
$apiMode = Util::getApiMode($path);
$headers = [];
if (\is_array($opts) && \array_key_exists('headers', $opts)) {
$headers = $opts['headers'] ?: [];
@ -229,8 +249,8 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
// Concatenate $headers to $opts->headers, removing duplicates.
$opts->headers = \array_merge($opts->headers, $headers);
$baseUrl = $opts->apiBase ?: $this->getApiBase();
$requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl);
list($response) = $requestor->request($method, $path, $params, $opts->headers, $apiMode, ['raw_request']);
$requestor = new ApiRequestor($this->apiKeyForRequest($opts), $baseUrl);
list($response) = $requestor->request($method, $path, $params, $opts->headers, $apiMode, ['raw_request'], $maxNetworkRetries);
return $response;
}
@ -251,8 +271,8 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
{
$opts = $this->defaultOpts->merge($opts, true);
$baseUrl = $opts->apiBase ?: $this->getApiBase();
$requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl, $this->getAppInfo());
$apiMode = \Stripe\Util\Util::getApiMode($path);
$requestor = new ApiRequestor($this->apiKeyForRequest($opts), $baseUrl, $this->getAppInfo());
$apiMode = Util::getApiMode($path);
list($response, $opts->apiKey) = $requestor->requestStream($method, $path, $readBodyChunkCallable, $params, $opts->headers, $apiMode, ['stripe_client']);
}
@ -264,26 +284,26 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* @param array $params the parameters of the request
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
*
* @return \Stripe\Collection|\Stripe\V2\Collection of ApiResources
* @return Collection|V2\Collection of ApiResources
*/
public function requestCollection($method, $path, $params, $opts)
{
$obj = $this->request($method, $path, $params, $opts);
$apiMode = \Stripe\Util\Util::getApiMode($path);
$apiMode = Util::getApiMode($path);
if ('v1' === $apiMode) {
if (!($obj instanceof \Stripe\Collection)) {
if (!$obj instanceof Collection) {
$received_class = \get_class($obj);
$msg = "Expected to receive `Stripe\\Collection` object from Stripe API. Instead received `{$received_class}`.";
throw new \Stripe\Exception\UnexpectedValueException($msg);
throw new Exception\UnexpectedValueException($msg);
}
$obj->setFilters($params);
} else {
if (!($obj instanceof \Stripe\V2\Collection)) {
if (!$obj instanceof V2\Collection) {
$received_class = \get_class($obj);
$msg = "Expected to receive `Stripe\\V2\\Collection` object from Stripe API. Instead received `{$received_class}`.";
throw new \Stripe\Exception\UnexpectedValueException($msg);
throw new Exception\UnexpectedValueException($msg);
}
}
@ -298,16 +318,16 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* @param array $params the parameters of the request
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
*
* @return \Stripe\SearchResult of ApiResources
* @return SearchResult of ApiResources
*/
public function requestSearchResult($method, $path, $params, $opts)
{
$obj = $this->request($method, $path, $params, $opts);
if (!($obj instanceof \Stripe\SearchResult)) {
if (!$obj instanceof SearchResult) {
$received_class = \get_class($obj);
$msg = "Expected to receive `Stripe\\SearchResult` object from Stripe API. Instead received `{$received_class}`.";
throw new \Stripe\Exception\UnexpectedValueException($msg);
throw new Exception\UnexpectedValueException($msg);
}
$obj->setFilters($params);
@ -317,9 +337,9 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
/**
* @param \Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\AuthenticationException
*
* @return string
*
* @throws Exception\AuthenticationException
*/
private function apiKeyForRequest($opts)
{
@ -330,7 +350,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
. 'StripeClient instance, or provide it on a per-request basis '
. 'using the `api_key` key in the $opts argument.';
throw new \Stripe\Exception\AuthenticationException($msg);
throw new Exception\AuthenticationException($msg);
}
return $apiKey;
@ -339,72 +359,77 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
/**
* @param array<string, mixed> $config
*
* @throws \Stripe\Exception\InvalidArgumentException
* @throws Exception\InvalidArgumentException
*/
private function validateConfig($config)
{
// api_key
if (null !== $config['api_key'] && !\is_string($config['api_key'])) {
throw new \Stripe\Exception\InvalidArgumentException('api_key must be null or a string');
throw new Exception\InvalidArgumentException('api_key must be null or a string');
}
if (null !== $config['api_key'] && ('' === $config['api_key'])) {
$msg = 'api_key cannot be the empty string';
throw new \Stripe\Exception\InvalidArgumentException($msg);
throw new Exception\InvalidArgumentException($msg);
}
if (null !== $config['api_key'] && (\preg_match('/\s/', $config['api_key']))) {
if (null !== $config['api_key'] && \preg_match('/\s/', $config['api_key'])) {
$msg = 'api_key cannot contain whitespace';
throw new \Stripe\Exception\InvalidArgumentException($msg);
throw new Exception\InvalidArgumentException($msg);
}
// client_id
if (null !== $config['client_id'] && !\is_string($config['client_id'])) {
throw new \Stripe\Exception\InvalidArgumentException('client_id must be null or a string');
throw new Exception\InvalidArgumentException('client_id must be null or a string');
}
// stripe_account
if (null !== $config['stripe_account'] && !\is_string($config['stripe_account'])) {
throw new \Stripe\Exception\InvalidArgumentException('stripe_account must be null or a string');
throw new Exception\InvalidArgumentException('stripe_account must be null or a string');
}
// stripe_context
if (null !== $config['stripe_context'] && !\is_string($config['stripe_context'])) {
throw new \Stripe\Exception\InvalidArgumentException('stripe_context must be null or a string');
throw new Exception\InvalidArgumentException('stripe_context must be null or a string');
}
// stripe_version
if (null !== $config['stripe_version'] && !\is_string($config['stripe_version'])) {
throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be null or a string');
throw new Exception\InvalidArgumentException('stripe_version must be null or a string');
}
// api_base
if (!\is_string($config['api_base'])) {
throw new \Stripe\Exception\InvalidArgumentException('api_base must be a string');
throw new Exception\InvalidArgumentException('api_base must be a string');
}
// connect_base
if (!\is_string($config['connect_base'])) {
throw new \Stripe\Exception\InvalidArgumentException('connect_base must be a string');
throw new Exception\InvalidArgumentException('connect_base must be a string');
}
// files_base
if (!\is_string($config['files_base'])) {
throw new \Stripe\Exception\InvalidArgumentException('files_base must be a string');
throw new Exception\InvalidArgumentException('files_base must be a string');
}
// app info
if (null !== $config['app_info'] && !\is_array($config['app_info'])) {
throw new \Stripe\Exception\InvalidArgumentException('app_info must be an array');
throw new Exception\InvalidArgumentException('app_info must be an array');
}
// max_network_retries
if (!\is_int($config['max_network_retries'])) {
throw new Exception\InvalidArgumentException('max_network_retries must an int');
}
$appInfoKeys = ['name', 'version', 'url', 'partner_id'];
if (null !== $config['app_info'] && array_diff_key($config['app_info'], array_flip($appInfoKeys))) {
$msg = 'app_info must be of type array{name: string, version?: string, url?: string, partner_id?: string}';
throw new \Stripe\Exception\InvalidArgumentException($msg);
throw new Exception\InvalidArgumentException($msg);
}
// check absence of extra keys
@ -413,7 +438,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
// Wrap in single quote to more easily catch trailing spaces errors
$invalidKeys = "'" . \implode("', '", $extraConfigKeys) . "'";
throw new \Stripe\Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . $invalidKeys);
throw new Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . $invalidKeys);
}
}
@ -423,11 +448,11 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* @param string $json
* @param 'v1'|'v2' $apiMode
*
* @return \Stripe\StripeObject
* @return StripeObject
* */
public function deserialize($json, $apiMode = 'v1')
{
return \Stripe\Util\Util::convertToStripeObject(\json_decode($json, true), [], $apiMode);
return Util::convertToStripeObject(\json_decode($json, true), [], $apiMode);
}
/**
@ -443,10 +468,10 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
* @param int $tolerance maximum difference allowed between the header's
* timestamp and the current time. Defaults to 300 seconds (5 min)
*
* @return ThinEvent
*
* @throws Exception\SignatureVerificationException if the verification fails
* @throws Exception\UnexpectedValueException if the payload is not valid JSON,
*
* @return \Stripe\ThinEvent
*/
public function parseThinEvent($payload, $sigHeader, $secret, $tolerance = Webhook::DEFAULT_TOLERANCE)
{
@ -460,7 +485,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
);
} catch (\ReflectionException $e) {
// Fail gracefully
return new \Stripe\ThinEvent();
return new ThinEvent();
}
}
}

View file

@ -13,7 +13,7 @@ namespace Stripe\Billing;
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string $status Status of the alert. This can be active, inactive or archived.
* @property string $title Title of the alert.
* @property null|\Stripe\StripeObject $usage_threshold Encapsulates configuration of the alert to monitor usage on a specific <a href="https://stripe.com/docs/api/billing/meter">Billing Meter</a>.
* @property null|(object{filters: null|((object{customer: null|string|\Stripe\Customer, type: string}&\Stripe\StripeObject))[], gte: int, meter: Meter|string, recurrence: string}&\Stripe\StripeObject) $usage_threshold Encapsulates configuration of the alert to monitor usage on a specific <a href="https://stripe.com/docs/api/billing/meter">Billing Meter</a>.
*/
class Alert extends \Stripe\ApiResource
{
@ -26,12 +26,12 @@ class Alert extends \Stripe\ApiResource
/**
* Creates a billing alert.
*
* @param null|array $params
* @param null|array{alert_type: string, expand?: string[], title: string, usage_threshold?: array{filters?: array{customer?: string, type: string}[], gte: int, meter?: string, recurrence: string}} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Alert the created resource
*
* @return \Stripe\Billing\Alert the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -48,12 +48,12 @@ class Alert extends \Stripe\ApiResource
/**
* Lists billing active and inactive alerts.
*
* @param null|array $params
* @param null|array{alert_type?: string, ending_before?: string, expand?: string[], limit?: int, meter?: string, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Alert> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Billing\Alert> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -68,9 +68,9 @@ class Alert extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Alert
*
* @return \Stripe\Billing\Alert
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -85,9 +85,9 @@ class Alert extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Alert the activated alert
*
* @return \Stripe\Billing\Alert the activated alert
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function activate($params = null, $opts = null)
{
@ -102,9 +102,9 @@ class Alert extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Alert the archived alert
*
* @return \Stripe\Billing\Alert the archived alert
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function archive($params = null, $opts = null)
{
@ -119,9 +119,9 @@ class Alert extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Alert the deactivated alert
*
* @return \Stripe\Billing\Alert the deactivated alert
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deactivate($params = null, $opts = null)
{

View file

@ -6,7 +6,7 @@ namespace Stripe\Billing;
/**
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\Billing\Alert $alert A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
* @property Alert $alert A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $customer ID of customer for which the alert triggered
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.

View file

@ -8,7 +8,7 @@ namespace Stripe\Billing;
* Indicates the billing credit balance for billing credits granted to a customer.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject[] $balances The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
* @property ((object{available_balance: (object{monetary: null|(object{currency: string, value: int}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), ledger_balance: (object{monetary: null|(object{currency: string, value: int}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject)}&\Stripe\StripeObject))[] $balances The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
* @property string|\Stripe\Customer $customer The customer the balance is for.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
@ -21,9 +21,9 @@ class CreditBalanceSummary extends \Stripe\SingletonApiResource
*
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditBalanceSummary
*
* @return \Stripe\Billing\CreditBalanceSummary
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($opts = null)
{

View file

@ -10,9 +10,9 @@ namespace Stripe\Billing;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|\Stripe\StripeObject $credit Credit details for this credit balance transaction. Only present if type is <code>credit</code>.
* @property string|\Stripe\Billing\CreditGrant $credit_grant The credit grant associated with this credit balance transaction.
* @property null|\Stripe\StripeObject $debit Debit details for this credit balance transaction. Only present if type is <code>debit</code>.
* @property null|(object{amount: (object{monetary: null|(object{currency: string, value: int}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), credits_application_invoice_voided: null|(object{invoice: string|\Stripe\Invoice, invoice_line_item: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject) $credit Credit details for this credit balance transaction. Only present if type is <code>credit</code>.
* @property CreditGrant|string $credit_grant The credit grant associated with this credit balance transaction.
* @property null|(object{amount: (object{monetary: null|(object{currency: string, value: int}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), credits_applied: null|(object{invoice: string|\Stripe\Invoice, invoice_line_item: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject) $debit Debit details for this credit balance transaction. Only present if type is <code>debit</code>.
* @property int $effective_at The effective time of this credit balance transaction.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this credit balance transaction belongs to.
@ -28,12 +28,12 @@ class CreditBalanceTransaction extends \Stripe\ApiResource
/**
* Retrieve a list of credit balance transactions.
*
* @param null|array $params
* @param null|array{credit_grant?: string, customer: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<CreditBalanceTransaction> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Billing\CreditBalanceTransaction> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -48,9 +48,9 @@ class CreditBalanceTransaction extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditBalanceTransaction
*
* @return \Stripe\Billing\CreditBalanceTransaction
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -11,8 +11,8 @@ namespace Stripe\Billing;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $amount
* @property \Stripe\StripeObject $applicability_config
* @property (object{monetary: null|(object{currency: string, value: int}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject) $amount
* @property (object{scope: (object{price_type?: string, prices?: ((object{id: null|string}&\Stripe\StripeObject))[]}&\Stripe\StripeObject)}&\Stripe\StripeObject) $applicability_config
* @property string $category The category of this credit grant. This is for tracking purposes and isn't displayed to the customer.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string|\Stripe\Customer $customer ID of the customer receiving the billing credits.
@ -38,12 +38,12 @@ class CreditGrant extends \Stripe\ApiResource
/**
* Creates a credit grant.
*
* @param null|array $params
* @param null|array{amount: array{monetary?: array{currency: string, value: int}, type: string}, applicability_config: array{scope: array{price_type?: string, prices?: array{id: string}[]}}, category: string, customer: string, effective_at?: int, expand?: string[], expires_at?: int, metadata?: \Stripe\StripeObject, name?: string, priority?: int} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditGrant the created resource
*
* @return \Stripe\Billing\CreditGrant the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -60,12 +60,12 @@ class CreditGrant extends \Stripe\ApiResource
/**
* Retrieve a list of credit grants.
*
* @param null|array $params
* @param null|array{customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<CreditGrant> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Billing\CreditGrant> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -80,9 +80,9 @@ class CreditGrant extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditGrant
*
* @return \Stripe\Billing\CreditGrant
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -97,12 +97,12 @@ class CreditGrant extends \Stripe\ApiResource
* Updates a credit grant.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{expand?: string[], expires_at?: null|int, metadata?: \Stripe\StripeObject} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditGrant the updated resource
*
* @return \Stripe\Billing\CreditGrant the updated resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -120,9 +120,9 @@ class CreditGrant extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditGrant the expired credit grant
*
* @return \Stripe\Billing\CreditGrant the expired credit grant
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function expire($params = null, $opts = null)
{
@ -137,9 +137,9 @@ class CreditGrant extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditGrant the voided credit grant
*
* @return \Stripe\Billing\CreditGrant the voided credit grant
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function voidGrant($params = null, $opts = null)
{

View file

@ -12,16 +12,16 @@ namespace Stripe\Billing;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject $customer_mapping
* @property \Stripe\StripeObject $default_aggregation
* @property (object{event_payload_key: string, type: string}&\Stripe\StripeObject) $customer_mapping
* @property (object{formula: string}&\Stripe\StripeObject) $default_aggregation
* @property string $display_name The meter's name.
* @property string $event_name The name of the meter event to record usage for. Corresponds with the <code>event_name</code> field on meter events.
* @property null|string $event_time_window The time window to pre-aggregate meter events for, if any.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $status The meter's status.
* @property \Stripe\StripeObject $status_transitions
* @property (object{deactivated_at: null|int}&\Stripe\StripeObject) $status_transitions
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject $value_settings
* @property (object{event_payload_key: string}&\Stripe\StripeObject) $value_settings
*/
class Meter extends \Stripe\ApiResource
{
@ -39,12 +39,12 @@ class Meter extends \Stripe\ApiResource
/**
* Creates a billing meter.
*
* @param null|array $params
* @param null|array{customer_mapping?: array{event_payload_key: string, type: string}, default_aggregation: array{formula: string}, display_name: string, event_name: string, event_time_window?: string, expand?: string[], value_settings?: array{event_payload_key: string}} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Meter the created resource
*
* @return \Stripe\Billing\Meter the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -61,12 +61,12 @@ class Meter extends \Stripe\ApiResource
/**
* Retrieve a list of billing meters.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Meter> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Billing\Meter> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -81,9 +81,9 @@ class Meter extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Meter
*
* @return \Stripe\Billing\Meter
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -98,12 +98,12 @@ class Meter extends \Stripe\ApiResource
* Updates a billing meter.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{display_name?: string, expand?: string[]} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Meter the updated resource
*
* @return \Stripe\Billing\Meter the updated resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -121,9 +121,9 @@ class Meter extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Meter the deactivated meter
*
* @return \Stripe\Billing\Meter the deactivated meter
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function deactivate($params = null, $opts = null)
{
@ -138,9 +138,9 @@ class Meter extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Meter the reactivated meter
*
* @return \Stripe\Billing\Meter the reactivated meter
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function reactivate($params = null, $opts = null)
{
@ -158,9 +158,9 @@ class Meter extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<MeterEventSummary> the list of meter event summaries
*
* @return \Stripe\Collection<\Stripe\Billing\MeterEventSummary> the list of meter event summaries
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function allEventSummaries($id, $params = null, $opts = null)
{

View file

@ -22,12 +22,12 @@ class MeterEvent extends \Stripe\ApiResource
/**
* Creates a billing meter event.
*
* @param null|array $params
* @param null|array{event_name: string, expand?: string[], identifier?: string, payload: \Stripe\StripeObject, timestamp?: int} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return MeterEvent the created resource
*
* @return \Stripe\Billing\MeterEvent the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{

View file

@ -8,7 +8,7 @@ namespace Stripe\Billing;
* A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $cancel Specifies which event to cancel.
* @property null|(object{identifier: null|string}&\Stripe\StripeObject) $cancel Specifies which event to cancel.
* @property string $event_name The name of the meter event. Corresponds with the <code>event_name</code> field on a meter.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $status The meter event adjustment's status.
@ -24,12 +24,12 @@ class MeterEventAdjustment extends \Stripe\ApiResource
/**
* Creates a billing meter event adjustment.
*
* @param null|array $params
* @param null|array{cancel?: array{identifier?: string}, event_name: string, expand?: string[], type: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return MeterEventAdjustment the created resource
*
* @return \Stripe\Billing\MeterEventAdjustment the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{

View file

@ -11,13 +11,13 @@ namespace Stripe\BillingPortal;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property bool $active Whether the configuration is active and can be used to create portal sessions.
* @property null|string|\Stripe\Application $application ID of the Connect Application that created the configuration.
* @property \Stripe\StripeObject $business_profile
* @property (object{headline: null|string, privacy_policy_url: null|string, terms_of_service_url: null|string}&\Stripe\StripeObject) $business_profile
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $default_return_url The default URL to redirect customers to when they click on the portal's link to return to your website. This can be <a href="https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url">overriden</a> when creating the session.
* @property \Stripe\StripeObject $features
* @property (object{customer_update: (object{allowed_updates: string[], enabled: bool}&\Stripe\StripeObject), invoice_history: (object{enabled: bool}&\Stripe\StripeObject), payment_method_update: (object{enabled: bool}&\Stripe\StripeObject), subscription_cancel: (object{cancellation_reason: (object{enabled: bool, options: string[]}&\Stripe\StripeObject), enabled: bool, mode: string, proration_behavior: string}&\Stripe\StripeObject), subscription_update: (object{default_allowed_updates: string[], enabled: bool, products?: null|(object{prices: string[], product: string}&\Stripe\StripeObject)[], proration_behavior: string, schedule_at_period_end: (object{conditions: (object{type: string}&\Stripe\StripeObject)[]}&\Stripe\StripeObject)}&\Stripe\StripeObject)}&\Stripe\StripeObject) $features
* @property bool $is_default Whether the configuration is the default. If <code>true</code>, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $login_page
* @property (object{enabled: bool, url: null|string}&\Stripe\StripeObject) $login_page
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
*/
@ -31,12 +31,12 @@ class Configuration extends \Stripe\ApiResource
* Creates a configuration that describes the functionality and behavior of a
* PortalSession.
*
* @param null|array $params
* @param null|array{business_profile?: array{headline?: null|string, privacy_policy_url?: string, terms_of_service_url?: string}, default_return_url?: null|string, expand?: string[], features: array{customer_update?: array{allowed_updates?: null|string[], enabled: bool}, invoice_history?: array{enabled: bool}, payment_method_update?: array{enabled: bool}, subscription_cancel?: array{cancellation_reason?: array{enabled: bool, options: null|string[]}, enabled: bool, mode?: string, proration_behavior?: string}, subscription_update?: array{default_allowed_updates?: null|string[], enabled: bool, products?: null|array{prices: string[], product: string}[], proration_behavior?: string, schedule_at_period_end?: array{conditions?: array{type: string}[]}}}, login_page?: array{enabled: bool}, metadata?: \Stripe\StripeObject} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Configuration the created resource
*
* @return \Stripe\BillingPortal\Configuration the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -54,12 +54,12 @@ class Configuration extends \Stripe\ApiResource
* Returns a list of configurations that describe the functionality of the customer
* portal.
*
* @param null|array $params
* @param null|array{active?: bool, ending_before?: string, expand?: string[], is_default?: bool, limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Configuration> of ApiResources
*
* @return \Stripe\Collection<\Stripe\BillingPortal\Configuration> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -75,9 +75,9 @@ class Configuration extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Configuration
*
* @return \Stripe\BillingPortal\Configuration
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -92,12 +92,12 @@ class Configuration extends \Stripe\ApiResource
* Updates a configuration that describes the functionality of the customer portal.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{active?: bool, business_profile?: array{headline?: null|string, privacy_policy_url?: null|string, terms_of_service_url?: null|string}, default_return_url?: null|string, expand?: string[], features?: array{customer_update?: array{allowed_updates?: null|string[], enabled?: bool}, invoice_history?: array{enabled: bool}, payment_method_update?: array{enabled: bool}, subscription_cancel?: array{cancellation_reason?: array{enabled: bool, options?: null|string[]}, enabled?: bool, mode?: string, proration_behavior?: string}, subscription_update?: array{default_allowed_updates?: null|string[], enabled?: bool, products?: null|array{prices: string[], product: string}[], proration_behavior?: string, schedule_at_period_end?: array{conditions?: null|array{type: string}[]}}}, login_page?: array{enabled: bool}, metadata?: null|\Stripe\StripeObject} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Configuration the updated resource
*
* @return \Stripe\BillingPortal\Configuration the updated resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{

View file

@ -22,10 +22,10 @@ namespace Stripe\BillingPortal;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string|\Stripe\BillingPortal\Configuration $configuration The configuration used by this session, describing the features available.
* @property Configuration|string $configuration The configuration used by this session, describing the features available.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $customer The ID of the customer for this session.
* @property null|\Stripe\StripeObject $flow Information about a specific flow for the customer to go through. See the <a href="https://stripe.com/docs/customer-management/portal-deep-links">docs</a> to learn more about using customer portal deep links and flows.
* @property null|(object{after_completion: (object{hosted_confirmation: null|(object{custom_message: null|string}&\Stripe\StripeObject), redirect: null|(object{return_url: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), subscription_cancel: null|(object{retention: null|(object{coupon_offer: null|(object{coupon: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), subscription: string}&\Stripe\StripeObject), subscription_update: null|(object{subscription: string}&\Stripe\StripeObject), subscription_update_confirm: null|(object{discounts: null|((object{coupon: null|string, promotion_code: null|string}&\Stripe\StripeObject))[], items: ((object{id: null|string, price: null|string, quantity?: int}&\Stripe\StripeObject))[], subscription: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject) $flow Information about a specific flow for the customer to go through. See the <a href="https://stripe.com/docs/customer-management/portal-deep-links">docs</a> to learn more about using customer portal deep links and flows.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string $locale The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customers <code>preferred_locales</code> or browsers locale is used.
* @property null|string $on_behalf_of The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this <code>on_behalf_of</code> account appear in the portal. For more information, see the <a href="https://stripe.com/docs/connect/separate-charges-and-transfers#settlement-merchant">docs</a>. Use the <a href="https://stripe.com/docs/api/accounts/object#account_object-settings-branding">Accounts API</a> to modify the <code>on_behalf_of</code> account's branding settings, which the portal displays.
@ -39,12 +39,12 @@ class Session extends \Stripe\ApiResource
/**
* Creates a session of the customer portal.
*
* @param null|array $params
* @param null|array{configuration?: string, customer: string, expand?: string[], flow_data?: array{after_completion?: array{hosted_confirmation?: array{custom_message?: string}, redirect?: array{return_url: string}, type: string}, subscription_cancel?: array{retention?: array{coupon_offer: array{coupon: string}, type: string}, subscription: string}, subscription_update?: array{subscription: string}, subscription_update_confirm?: array{discounts?: array{coupon?: string, promotion_code?: string}[], items: array{id: string, price?: string, quantity?: int}[], subscription: string}, type: string}, locale?: string, on_behalf_of?: string, return_url?: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Session the created resource
*
* @return \Stripe\BillingPortal\Session the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{

View file

@ -11,11 +11,11 @@ namespace Stripe;
*
* @property string $id The identifier for the capability.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string|\Stripe\Account $account The account for which the capability enables functionality.
* @property null|\Stripe\StripeObject $future_requirements
* @property Account|string $account The account for which the capability enables functionality.
* @property null|(object{alternatives: null|(object{alternative_fields_due: string[], original_fields_due: string[]}&StripeObject)[], current_deadline: null|int, currently_due: string[], disabled_reason: null|string, errors: (object{code: string, reason: string, requirement: string}&StripeObject)[], eventually_due: string[], past_due: string[], pending_verification: string[]}&StripeObject) $future_requirements
* @property bool $requested Whether the capability has been requested.
* @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch.
* @property null|\Stripe\StripeObject $requirements
* @property null|(object{alternatives: null|(object{alternative_fields_due: string[], original_fields_due: string[]}&StripeObject)[], current_deadline: null|int, currently_due: string[], disabled_reason: null|string, errors: (object{code: string, reason: string, requirement: string}&StripeObject)[], eventually_due: string[], past_due: string[], pending_verification: string[]}&StripeObject) $requirements
* @property string $status The status of the capability.
*/
class Capability extends ApiResource
@ -36,8 +36,8 @@ class Capability extends ApiResource
$account = $this['account'];
if (!$id) {
throw new Exception\UnexpectedValueException(
'Could not determine which URL to request: ' .
"class instance has invalid ID: {$id}",
'Could not determine which URL to request: '
. "class instance has invalid ID: {$id}",
null
);
}
@ -55,13 +55,13 @@ class Capability extends ApiResource
* @param array|string $_id
* @param null|array|string $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = 'Capabilities cannot be retrieved without an account ID. ' .
'Retrieve a capability using `Account::retrieveCapability(' .
"'account_id', 'capability_id')`.";
$msg = 'Capabilities cannot be retrieved without an account ID. '
. 'Retrieve a capability using `Account::retrieveCapability('
. "'account_id', 'capability_id')`.";
throw new Exception\BadMethodCallException($msg);
}
@ -71,13 +71,13 @@ class Capability extends ApiResource
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = 'Capabilities cannot be updated without an account ID. ' .
'Update a capability using `Account::updateCapability(' .
"'account_id', 'capability_id', \$updateParams)`.";
$msg = 'Capabilities cannot be updated without an account ID. '
. 'Update a capability using `Account::updateCapability('
. "'account_id', 'capability_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
}
@ -85,10 +85,10 @@ class Capability extends ApiResource
/**
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the saved resource
*
* @throws Exception\ApiErrorException if the request fails
*
* @deprecated The `save` method is deprecated and will be removed in a
* future major version of the library. Use the static method `update`
* on the resource instead.

View file

@ -13,7 +13,7 @@ namespace Stripe;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|string|\Stripe\Account $account The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. This property is only available for accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts.
* @property null|Account|string $account
* @property null|string $address_city City/District/Suburb/Town/Village.
* @property null|string $address_country Billing address country, if provided when creating card.
* @property null|string $address_line1 Address line 1 (Street address/PO Box/Company name).
@ -26,8 +26,8 @@ namespace Stripe;
* @property null|string[] $available_payout_methods A set of available payout methods for this card. Only values from this set should be passed as the <code>method</code> when creating a payout.
* @property string $brand Card brand. Can be <code>American Express</code>, <code>Diners Club</code>, <code>Discover</code>, <code>Eftpos Australia</code>, <code>Girocard</code>, <code>JCB</code>, <code>MasterCard</code>, <code>UnionPay</code>, <code>Visa</code>, or <code>Unknown</code>.
* @property null|string $country Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
* @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO code for currency</a> in lowercase. Must be a <a href="https://docs.stripe.com/currencies">supported currency</a>. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available for accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts.
* @property null|string|\Stripe\Customer $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
* @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO code for currency</a> in lowercase. Must be a <a href="https://docs.stripe.com/currencies">supported currency</a>. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available when returned as an <a href="/api/external_account_cards/object">External Account</a> where <a href="/api/accounts/object#account_object-controller-is_controller">controller.is_controller</a> is <code>true</code>.
* @property null|Customer|string $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
* @property null|string $cvc_check If a CVC was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see <a href="https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge">Check if a card is valid without a charge</a>.
* @property null|bool $default_for_currency Whether this card is the default external account for its currency. This property is only available for accounts where <a href="/api/accounts/object#account_object-controller-requirement_collection">controller.requirement_collection</a> is <code>application</code>, which includes Custom accounts.
* @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number.
@ -36,9 +36,9 @@ namespace Stripe;
* @property null|string $fingerprint <p>Uniquely identifies this particular card number. You can use this attribute to check whether two customers whove signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.</p><p><em>As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.</em></p>
* @property string $funding Card funding type. Can be <code>credit</code>, <code>debit</code>, <code>prepaid</code>, or <code>unknown</code>.
* @property string $last4 The last four digits of the card.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $name Cardholder name.
* @property null|\Stripe\StripeObject $networks
* @property null|(object{preferred: null|string}&StripeObject) $networks
* @property null|string $regulated_status Status of a card based on the card issuer.
* @property null|string $status For external accounts that are cards, possible values are <code>new</code> and <code>errored</code>. If a payout fails, the status is set to <code>errored</code> and <a href="https://stripe.com/docs/payouts#payout-schedule">scheduled payouts</a> are stopped until account details are updated.
* @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be <code>android_pay</code> (includes Google Pay), <code>apple_pay</code>, <code>masterpass</code>, <code>visa_checkout</code>, or null.
@ -60,9 +60,9 @@ class Card extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Card the deleted resource
*
* @return \Stripe\Card the deleted resource
* @throws Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{
@ -133,14 +133,14 @@ class Card extends ApiResource
* @param array|string $_id
* @param null|array|string $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = 'Cards cannot be retrieved without a customer ID or an ' .
'account ID. Retrieve a card using ' .
"`Customer::retrieveSource('customer_id', 'card_id')` or " .
"`Account::retrieveExternalAccount('account_id', 'card_id')`.";
$msg = 'Cards cannot be retrieved without a customer ID or an '
. 'account ID. Retrieve a card using '
. "`Customer::retrieveSource('customer_id', 'card_id')` or "
. "`Account::retrieveExternalAccount('account_id', 'card_id')`.";
throw new Exception\BadMethodCallException($msg);
}
@ -150,15 +150,15 @@ class Card extends ApiResource
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = 'Cards cannot be updated without a customer ID or an ' .
'account ID. Update a card using ' .
"`Customer::updateSource('customer_id', 'card_id', " .
'$updateParams)` or `Account::updateExternalAccount(' .
"'account_id', 'card_id', \$updateParams)`.";
$msg = 'Cards cannot be updated without a customer ID or an '
. 'account ID. Update a card using '
. "`Customer::updateSource('customer_id', 'card_id', "
. '$updateParams)` or `Account::updateExternalAccount('
. "'account_id', 'card_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
}
@ -166,10 +166,10 @@ class Card extends ApiResource
/**
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the saved resource
*
* @throws Exception\ApiErrorException if the request fails
*
* @deprecated The `save` method is deprecated and will be removed in a
* future major version of the library. Use the static method `update`
* on the resource instead.

View file

@ -8,10 +8,10 @@ namespace Stripe;
* A customer's <code>Cash balance</code> represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $available A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property null|StripeObject $available A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property string $customer The ID of the customer whose cash balance this object represents.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $settings
* @property (object{reconciliation_mode: string, using_merchant_default: bool}&StripeObject) $settings
*/
class CashBalance extends ApiResource
{
@ -35,13 +35,13 @@ class CashBalance extends ApiResource
* @param array|string $_id
* @param null|array|string $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = 'Customer Cash Balance cannot be retrieved without a ' .
'customer ID. Retrieve a Customer Cash Balance using ' .
"`Customer::retrieveCashBalance('customer_id')`.";
$msg = 'Customer Cash Balance cannot be retrieved without a '
. 'customer ID. Retrieve a Customer Cash Balance using '
. "`Customer::retrieveCashBalance('customer_id')`.";
throw new Exception\BadMethodCallException($msg);
}
@ -51,13 +51,13 @@ class CashBalance extends ApiResource
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = 'Customer Cash Balance cannot be updated without a ' .
'customer ID. Retrieve a Customer Cash Balance using ' .
"`Customer::updateCashBalance('customer_id')`.";
$msg = 'Customer Cash Balance cannot be updated without a '
. 'customer ID. Retrieve a Customer Cash Balance using '
. "`Customer::updateCashBalance('customer_id')`.";
throw new Exception\BadMethodCallException($msg);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -13,7 +13,7 @@ namespace Stripe\Climate;
* @property int $amount_fees Total amount of <a href="https://frontierclimate.com/">Frontier</a>'s service fees in the currency's smallest unit.
* @property int $amount_subtotal Total amount of the carbon removal in the currency's smallest unit.
* @property int $amount_total Total amount of the order including fees in the currency's smallest unit.
* @property null|\Stripe\StripeObject $beneficiary
* @property null|(object{public_name: string}&\Stripe\StripeObject) $beneficiary
* @property null|int $canceled_at Time at which the order was canceled. Measured in seconds since the Unix epoch.
* @property null|string $cancellation_reason Reason for the cancellation of this order.
* @property null|string $certificate For delivered orders, a URL to a delivery certificate for the order.
@ -22,12 +22,12 @@ namespace Stripe\Climate;
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase, representing the currency for this order.
* @property null|int $delayed_at Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
* @property null|int $delivered_at Time at which the order was delivered. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject[] $delivery_details Details about the delivery of carbon removal for this order.
* @property ((object{delivered_at: int, location: null|(object{city: null|string, country: string, latitude: null|float, longitude: null|float, region: null|string}&\Stripe\StripeObject), metric_tons: string, registry_url: null|string, supplier: Supplier}&\Stripe\StripeObject))[] $delivery_details Details about the delivery of carbon removal for this order.
* @property int $expected_delivery_year The year this order is expected to be delivered.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $metric_tons Quantity of carbon removal that is included in this order.
* @property string|\Stripe\Climate\Product $product Unique ID for the Climate <code>Product</code> this order is purchasing.
* @property Product|string $product Unique ID for the Climate <code>Product</code> this order is purchasing.
* @property null|int $product_substituted_at Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
* @property string $status The current status of this order.
*/
@ -52,12 +52,12 @@ class Order extends \Stripe\ApiResource
* processed immediately after creation and payment will be deducted your Stripe
* balance.
*
* @param null|array $params
* @param null|array{amount?: int, beneficiary?: array{public_name: string}, currency?: string, expand?: string[], metadata?: \Stripe\StripeObject, metric_tons?: string, product: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Order the created resource
*
* @return \Stripe\Climate\Order the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -75,12 +75,12 @@ class Order extends \Stripe\ApiResource
* Lists all Climate order objects. The orders are returned sorted by creation
* date, with the most recently created orders appearing first.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Order> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Climate\Order> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -95,9 +95,9 @@ class Order extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Order
*
* @return \Stripe\Climate\Order
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -112,12 +112,12 @@ class Order extends \Stripe\ApiResource
* Updates the specified order by setting the values of the parameters passed.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{beneficiary?: null|array{public_name: null|string}, expand?: string[], metadata?: \Stripe\StripeObject} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Order the updated resource
*
* @return \Stripe\Climate\Order the updated resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -135,9 +135,9 @@ class Order extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Order the canceled order
*
* @return \Stripe\Climate\Order the canceled order
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function cancel($params = null, $opts = null)
{

View file

@ -16,7 +16,7 @@ namespace Stripe\Climate;
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $metric_tons_available The quantity of metric tons available for reservation.
* @property string $name The Climate product's name.
* @property \Stripe\Climate\Supplier[] $suppliers The carbon removal suppliers that fulfill orders for this Climate product.
* @property Supplier[] $suppliers The carbon removal suppliers that fulfill orders for this Climate product.
*/
class Product extends \Stripe\ApiResource
{
@ -25,12 +25,12 @@ class Product extends \Stripe\ApiResource
/**
* Lists all available Climate product objects.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Product> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Climate\Product> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -45,9 +45,9 @@ class Product extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Product
*
* @return \Stripe\Climate\Product
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -11,7 +11,7 @@ namespace Stripe\Climate;
* @property string $object String representing the objects type. Objects of the same type share the same value.
* @property string $info_url Link to a webpage to learn more about the supplier.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject[] $locations The locations in which this supplier operates.
* @property ((object{city: null|string, country: string, latitude: null|float, longitude: null|float, region: null|string}&\Stripe\StripeObject))[] $locations The locations in which this supplier operates.
* @property string $name Name of this carbon removal supplier.
* @property string $removal_pathway The scientific pathway used for carbon removal.
*/
@ -26,12 +26,12 @@ class Supplier extends \Stripe\ApiResource
/**
* Lists all available Climate supplier objects.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Supplier> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Climate\Supplier> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -46,9 +46,9 @@ class Supplier extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Supplier
*
* @return \Stripe\Climate\Supplier
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -6,6 +6,7 @@ namespace Stripe;
* Class Collection.
*
* @template TStripeObject of StripeObject
*
* @template-implements \IteratorAggregate<TStripeObject>
*
* @property string $object
@ -59,10 +60,10 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
if (\is_string($k)) {
return parent::offsetGet($k);
}
$msg = "You tried to access the {$k} index, but Collection " .
'types only support string keys. (HINT: List calls ' .
'return an object with a `data` (which is the data ' .
"array). You likely want to call ->data[{$k}])";
$msg = "You tried to access the {$k} index, but Collection "
. 'types only support string keys. (HINT: List calls '
. 'return an object with a `data` (which is the data '
. "array). You likely want to call ->data[{$k}])";
throw new Exception\InvalidArgumentException($msg);
}
@ -71,9 +72,9 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return Collection<TStripeObject>
*
* @throws Exception\ApiErrorException
*/
public function all($params = null, $opts = null)
{
@ -82,9 +83,9 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response, $opts);
if (!($obj instanceof \Stripe\Collection)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
if (!$obj instanceof Collection) {
throw new Exception\UnexpectedValueException(
'Expected type ' . Collection::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setFilters($params);
@ -96,9 +97,9 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return TStripeObject
*
* @throws Exception\ApiErrorException
*/
public function create($params = null, $opts = null)
{
@ -115,9 +116,9 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return TStripeObject
*
* @throws Exception\ApiErrorException
*/
public function retrieve($id, $params = null, $opts = null)
{
@ -165,12 +166,12 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
}
/**
* @throws Exception\ApiErrorException
*
* @return \Generator|TStripeObject[] A generator that can be used to
* iterate across all objects across all pages. As page boundaries are
* encountered, the next page will be fetched automatically for
* continued iteration.
*
* @throws Exception\ApiErrorException
*/
public function autoPagingIterator()
{
@ -230,9 +231,9 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return Collection<TStripeObject>
*
* @throws Exception\ApiErrorException
*/
public function nextPage($params = null, $opts = null)
{
@ -260,9 +261,9 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return Collection<TStripeObject>
*
* @throws Exception\ApiErrorException
*/
public function previousPage($params = null, $opts = null)
{

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Amount transferred, in cents (or local equivalent).
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string|\Stripe\Account $destination ID of the account that funds are being collected for.
* @property Account|string $destination ID of the account that funds are being collected for.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
class ConnectCollectionTransfer extends ApiResource

View file

@ -15,11 +15,11 @@ namespace Stripe;
* @property string $id Unique identifier for the object. Represented as the ISO country code for this country.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $default_currency The default currency for this country. This applies to both payment methods and bank accounts.
* @property \Stripe\StripeObject $supported_bank_account_currencies Currencies that can be accepted in the specific country (for transfers).
* @property StripeObject $supported_bank_account_currencies Currencies that can be accepted in the specific country (for transfers).
* @property string[] $supported_payment_currencies Currencies that can be accepted in the specified country (for payments).
* @property string[] $supported_payment_methods Payment methods available in the specified country. You may need to enable some payment methods (e.g., <a href="https://stripe.com/docs/ach">ACH</a>) on your account before they appear in this list. The <code>stripe</code> payment method refers to <a href="https://stripe.com/docs/connect/destination-charges">charging through your platform</a>.
* @property string[] $supported_transfer_countries Countries that can accept transfers from the specified country.
* @property \Stripe\StripeObject $verification_fields
* @property (object{company: (object{additional: string[], minimum: string[]}&StripeObject), individual: (object{additional: string[], minimum: string[]}&StripeObject)}&StripeObject) $verification_fields
*/
class CountrySpec extends ApiResource
{
@ -28,18 +28,18 @@ class CountrySpec extends ApiResource
/**
* Lists all Country Spec objects available in the API.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<CountrySpec> of ApiResources
*
* @return \Stripe\Collection<\Stripe\CountrySpec> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -48,13 +48,13 @@ class CountrySpec extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CountrySpec
*
* @return \Stripe\CountrySpec
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();

View file

@ -12,15 +12,15 @@ namespace Stripe;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|int $amount_off Amount (in the <code>currency</code> specified) that will be taken off the subtotal of any invoices for this customer.
* @property null|\Stripe\StripeObject $applies_to
* @property null|(object{products: string[]}&StripeObject) $applies_to
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $currency If <code>amount_off</code> has been set, the three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> of the amount to take off.
* @property null|\Stripe\StripeObject $currency_options Coupons defined in each available currency option. Each key must be a three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> and a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|StripeObject $currency_options Coupons defined in each available currency option. Each key must be a three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> and a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string $duration One of <code>forever</code>, <code>once</code>, and <code>repeating</code>. Describes how long a customer who applies this coupon will get the discount.
* @property null|int $duration_in_months If <code>duration</code> is <code>repeating</code>, the number of months the coupon applies. Null if coupon <code>duration</code> is <code>forever</code> or <code>once</code>.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @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.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $name Name of the coupon displayed to customers on for instance invoices or receipts.
* @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 $ (or local equivalent)100 invoice $ (or local equivalent)50 instead.
* @property null|int $redeem_by Date after which the coupon can no longer be redeemed.
@ -53,12 +53,12 @@ class Coupon extends ApiResource
* a coupon with an <code>amount_off</code> of <amount>200</amount> is applied to
* it.
*
* @param null|array $params
* @param null|array{amount_off?: int, applies_to?: array{products?: string[]}, currency?: string, currency_options?: StripeObject, duration?: string, duration_in_months?: int, expand?: string[], id?: string, max_redemptions?: int, metadata?: null|StripeObject, name?: string, percent_off?: float, redeem_by?: int} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Coupon the created resource
*
* @return \Stripe\Coupon the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -66,7 +66,7 @@ class Coupon extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -82,9 +82,9 @@ class Coupon extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Coupon the deleted resource
*
* @return \Stripe\Coupon the deleted resource
* @throws Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{
@ -100,18 +100,18 @@ class Coupon extends ApiResource
/**
* Returns a list of your coupons.
*
* @param null|array $params
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<Coupon> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Coupon> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -120,13 +120,13 @@ class Coupon extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Coupon
*
* @return \Stripe\Coupon
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -138,12 +138,12 @@ class Coupon extends ApiResource
* amount_off) are, by design, not editable.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{currency_options?: StripeObject, expand?: string[], metadata?: null|StripeObject, name?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Coupon the updated resource
*
* @return \Stripe\Coupon the updated resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -151,7 +151,7 @@ class Coupon extends ApiResource
$url = static::resourceUrl($id);
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;

View file

@ -15,29 +15,29 @@ namespace Stripe;
* @property int $amount_shipping This is the sum of all the shipping amounts.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string|\Stripe\Customer $customer ID of the customer.
* @property null|string|\Stripe\CustomerBalanceTransaction $customer_balance_transaction Customer balance transaction related to this credit note.
* @property Customer|string $customer ID of the customer.
* @property null|CustomerBalanceTransaction|string $customer_balance_transaction Customer balance transaction related to this credit note.
* @property int $discount_amount The integer amount in cents (or local equivalent) representing the total amount of discount that was credited.
* @property \Stripe\StripeObject[] $discount_amounts The aggregate amounts calculated per discount for all line items.
* @property ((object{amount: int, discount: Discount|string}&StripeObject))[] $discount_amounts The aggregate amounts calculated per discount for all line items.
* @property null|int $effective_at The date when this credit note is in effect. Same as <code>created</code> unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
* @property string|\Stripe\Invoice $invoice ID of the invoice.
* @property \Stripe\Collection<\Stripe\CreditNoteLineItem> $lines Line items that make up the credit note
* @property Invoice|string $invoice ID of the invoice.
* @property Collection<CreditNoteLineItem> $lines Line items that make up the credit note
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string $memo Customer-facing text that appears on the credit note PDF.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $number A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
* @property null|int $out_of_band_amount Amount that was credited outside of Stripe.
* @property string $pdf The link to download the PDF of the credit note.
* @property \Stripe\StripeObject[] $pretax_credit_amounts The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
* @property ((object{amount: int, credit_balance_transaction?: Billing\CreditBalanceTransaction|string, discount?: Discount|string, type: string}&StripeObject))[] $pretax_credit_amounts The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
* @property null|string $reason Reason for issuing this credit note, one of <code>duplicate</code>, <code>fraudulent</code>, <code>order_change</code>, or <code>product_unsatisfactory</code>
* @property null|string|\Stripe\Refund $refund Refund related to this credit note.
* @property null|\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied to the invoice.
* @property ((object{amount_refunded: int, refund: Refund|string}&StripeObject))[] $refunds Refunds related to this credit note.
* @property null|(object{amount_subtotal: int, amount_tax: int, amount_total: int, shipping_rate: null|ShippingRate|string, taxes?: ((object{amount: int, rate: TaxRate, taxability_reason: null|string, taxable_amount: null|int}&StripeObject))[]}&StripeObject) $shipping_cost The details of the cost of shipping, including the ShippingRate applied to the invoice.
* @property string $status Status of this credit note, one of <code>issued</code> or <code>void</code>. Learn more about <a href="https://stripe.com/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>.
* @property int $subtotal The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
* @property null|int $subtotal_excluding_tax The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts.
* @property \Stripe\StripeObject[] $tax_amounts The aggregate amounts calculated per tax rate for all line items.
* @property int $total The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax and all discount.
* @property null|int $total_excluding_tax The integer amount in cents (or local equivalent) representing the total amount of the credit note, excluding tax, but including discounts.
* @property null|((object{amount: int, tax_behavior: string, tax_rate_details: null|(object{tax_rate: string}&StripeObject), taxability_reason: string, taxable_amount: null|int, type: string}&StripeObject))[] $total_taxes The aggregate tax information for all line items.
* @property string $type Type of this credit note, one of <code>pre_payment</code> or <code>post_payment</code>. A <code>pre_payment</code> credit note means it was issued when the invoice was open. A <code>post_payment</code> credit note means it was issued when the invoice was paid.
* @property null|int $voided_at The time that the credit note was voided.
*/
@ -64,7 +64,7 @@ class CreditNote extends ApiResource
* <code>status=open</code> invoice, a credit note reduces its
* <code>amount_due</code>. For a <code>status=paid</code> invoice, a credit note
* does not affect its <code>amount_due</code>. Instead, it can result in any
* combination of the following:.
* combination of the following:
*
* <ul> <li>Refund: create a new refund (using <code>refund_amount</code>) or link
* an existing refund (using <code>refund</code>).</li> <li>Customer balance
@ -81,12 +81,12 @@ class CreditNote extends ApiResource
* <code>post_payment_credit_notes_amount</code> depending on its
* <code>status</code> at the time of credit note creation.
*
* @param null|array $params
* @param null|array{amount?: int, credit_amount?: int, effective_at?: int, email_type?: string, expand?: string[], invoice: string, lines?: (array{amount?: int, description?: string, invoice_line_item?: string, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate: string, taxable_amount: int}[], tax_rates?: null|string[], type: string, unit_amount?: int, unit_amount_decimal?: string})[], memo?: string, metadata?: StripeObject, out_of_band_amount?: int, reason?: string, refund_amount?: int, refunds?: array{amount_refunded?: int, refund?: string}[], shipping_cost?: array{shipping_rate?: string}} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditNote the created resource
*
* @return \Stripe\CreditNote the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -94,7 +94,7 @@ class CreditNote extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -103,18 +103,18 @@ class CreditNote extends ApiResource
/**
* Returns a list of credit notes.
*
* @param null|array $params
* @param null|array{created?: array|int, customer?: string, ending_before?: string, expand?: string[], invoice?: string, limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<CreditNote> of ApiResources
*
* @return \Stripe\Collection<\Stripe\CreditNote> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -123,13 +123,13 @@ class CreditNote extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditNote
*
* @return \Stripe\CreditNote
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -140,12 +140,12 @@ class CreditNote extends ApiResource
* Updates an existing credit note.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{expand?: string[], memo?: string, metadata?: StripeObject} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditNote the updated resource
*
* @return \Stripe\CreditNote the updated resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -153,7 +153,7 @@ class CreditNote extends ApiResource
$url = static::resourceUrl($id);
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -163,15 +163,15 @@ class CreditNote extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditNote the previewed credit note
*
* @return \Stripe\CreditNote the previewed credit note
* @throws Exception\ApiErrorException if the request fails
*/
public static function preview($params = null, $opts = null)
{
$url = static::classUrl() . '/preview';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -181,15 +181,15 @@ class CreditNote extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<CreditNoteLineItem> list of credit note line items
*
* @return \Stripe\Collection<\Stripe\CreditNoteLineItem> list of credit note line items
* @throws Exception\ApiErrorException if the request fails
*/
public static function previewLines($params = null, $opts = null)
{
$url = static::classUrl() . '/preview/lines';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -199,9 +199,9 @@ class CreditNote extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CreditNote the voided credit note
*
* @return \Stripe\CreditNote the voided credit note
* @throws Exception\ApiErrorException if the request fails
*/
public function voidCreditNote($params = null, $opts = null)
{
@ -219,9 +219,9 @@ class CreditNote extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<CreditNoteLineItem> the list of credit note line items
*
* @return \Stripe\Collection<\Stripe\CreditNoteLineItem> the list of credit note line items
* @throws Exception\ApiErrorException if the request fails
*/
public static function allLines($id, $params = null, $opts = null)
{

View file

@ -10,20 +10,18 @@ namespace Stripe;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount The integer amount in cents (or local equivalent) representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
* @property null|int $amount_excluding_tax The integer amount in cents (or local equivalent) representing the amount being credited for this line item, excluding all tax and discounts.
* @property null|string $description Description of the item being credited.
* @property int $discount_amount The integer amount in cents (or local equivalent) representing the discount being credited for this line item.
* @property \Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item
* @property ((object{amount: int, discount: Discount|string}&StripeObject))[] $discount_amounts The amount of discount calculated per discount for this line item
* @property null|string $invoice_line_item ID of the invoice line item being credited
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject[] $pretax_credit_amounts The pretax credit amounts (ex: discount, credit grants, etc) for this line item.
* @property ((object{amount: int, credit_balance_transaction?: Billing\CreditBalanceTransaction|string, discount?: Discount|string, type: string}&StripeObject))[] $pretax_credit_amounts The pretax credit amounts (ex: discount, credit grants, etc) for this line item.
* @property null|int $quantity The number of units of product being credited.
* @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
* @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
* @property TaxRate[] $tax_rates The tax rates which apply to the line item.
* @property null|((object{amount: int, tax_behavior: string, tax_rate_details: null|(object{tax_rate: string}&StripeObject), taxability_reason: string, taxable_amount: null|int, type: string}&StripeObject))[] $taxes The tax information of the line item.
* @property string $type The type of the credit note line item, one of <code>invoice_line_item</code> or <code>custom_line_item</code>. When the type is <code>invoice_line_item</code> there is an additional <code>invoice_line_item</code> property on the resource the value of which is the id of the credited line item on the invoice.
* @property null|int $unit_amount The cost of each unit of product being credited.
* @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
* @property null|string $unit_amount_excluding_tax The amount in cents (or local equivalent) representing the unit amount being credited for this line item, excluding all tax and discounts.
*/
class CreditNoteLineItem extends ApiResource
{

View file

@ -10,32 +10,32 @@ namespace Stripe;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $address The customer's address.
* @property null|(object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject) $address The customer's address.
* @property null|int $balance The current balance, if any, that's stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that's added to their next invoice. The balance only considers amounts that Stripe hasn't successfully applied to any invoice. It doesn't reflect unpaid invoices. This balance is only taken into account after invoices finalize.
* @property null|\Stripe\CashBalance $cash_balance The current funds being held by Stripe on behalf of the customer. You can apply these funds towards payment intents when the source is &quot;cash_balance&quot;. The <code>settings[reconciliation_mode]</code> field describes if these funds apply to these payment intents manually or automatically.
* @property null|CashBalance $cash_balance The current funds being held by Stripe on behalf of the customer. You can apply these funds towards payment intents when the source is &quot;cash_balance&quot;. The <code>settings[reconciliation_mode]</code> field describes if these funds apply to these payment intents manually or automatically.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $currency Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> the customer can be charged in for recurring billing purposes.
* @property null|string|\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source $default_source <p>ID of the default payment source for the customer.</p><p>If you use payment methods created through the PaymentMethods API, see the <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> field instead.</p>
* @property null|Account|BankAccount|Card|Source|string $default_source <p>ID of the default payment source for the customer.</p><p>If you use payment methods created through the PaymentMethods API, see the <a href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a> field instead.</p>
* @property null|bool $delinquent <p>Tracks the most recent state change on any invoice belonging to the customer. Paying an invoice or marking it uncollectible via the API will set this field to false. An automatic payment failure or passing the <code>invoice.due_date</code> will set this field to <code>true</code>.</p><p>If an invoice becomes uncollectible by <a href="https://stripe.com/docs/billing/automatic-collection">dunning</a>, <code>delinquent</code> doesn't reset to <code>false</code>.</p><p>If you care whether the customer has paid their most recent subscription invoice, use <code>subscription.status</code> instead. Paying or marking uncollectible any customer invoice regardless of whether it is the latest invoice for a subscription will always set this field to <code>false</code>.</p>
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|\Stripe\Discount $discount Describes the current discount active on the customer, if there is one.
* @property null|Discount $discount Describes the current discount active on the customer, if there is one.
* @property null|string $email The customer's email address.
* @property null|\Stripe\StripeObject $invoice_credit_balance The current multi-currency balances, if any, that's stored on the customer. If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency. If negative, the customer has an amount owed that's added to their next invoice denominated in that currency. These balances don't apply to unpaid invoices. They solely track amounts that Stripe hasn't successfully applied to any invoice. Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
* @property null|StripeObject $invoice_credit_balance The current multi-currency balances, if any, that's stored on the customer. If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency. If negative, the customer has an amount owed that's added to their next invoice denominated in that currency. These balances don't apply to unpaid invoices. They solely track amounts that Stripe hasn't successfully applied to any invoice. Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
* @property null|string $invoice_prefix The prefix for the customer used to generate unique invoice numbers.
* @property null|\Stripe\StripeObject $invoice_settings
* @property null|(object{custom_fields: null|(object{name: string, value: string}&StripeObject)[], default_payment_method: null|PaymentMethod|string, footer: null|string, rendering_options: null|(object{amount_tax_display: null|string, template: null|string}&StripeObject)}&StripeObject) $invoice_settings
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $name The customer's full name or business name.
* @property null|int $next_invoice_sequence The suffix of the customer's next invoice number (for example, 0001). When the account uses account level sequencing, this parameter is ignored in API requests and the field omitted in API responses.
* @property null|string $phone The customer's phone number.
* @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference.
* @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
* @property null|\Stripe\Collection<\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source> $sources The customer's payment sources, if any.
* @property null|\Stripe\Collection<\Stripe\Subscription> $subscriptions The customer's current subscriptions, if any.
* @property null|\Stripe\StripeObject $tax
* @property null|(object{address?: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), carrier?: null|string, name?: string, phone?: null|string, tracking_number?: null|string}&StripeObject) $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
* @property null|Collection<Account|BankAccount|Card|Source> $sources The customer's payment sources, if any.
* @property null|Collection<Subscription> $subscriptions The customer's current subscriptions, if any.
* @property null|(object{automatic_tax: string, ip_address: null|string, location: null|(object{country: string, source: string, state: null|string}&StripeObject)}&StripeObject) $tax
* @property null|string $tax_exempt Describes the customer's tax exemption status, which is <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the following text: <strong>&quot;Reverse charge&quot;</strong>.
* @property null|\Stripe\Collection<\Stripe\TaxId> $tax_ids The customer's tax IDs.
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock that this customer belongs to.
* @property null|Collection<TaxId> $tax_ids The customer's tax IDs.
* @property null|string|TestHelpers\TestClock $test_clock ID of the test clock that this customer belongs to.
*/
class Customer extends ApiResource
{
@ -51,12 +51,12 @@ class Customer extends ApiResource
/**
* Creates a new customer object.
*
* @param null|array $params
* @param null|array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, balance?: int, cash_balance?: array{settings?: array{reconciliation_mode?: string}}, description?: string, email?: string, expand?: string[], invoice_prefix?: string, invoice_settings?: array{custom_fields?: null|array{name: string, value: string}[], default_payment_method?: string, footer?: string, rendering_options?: null|array{amount_tax_display?: null|string, template?: string}}, metadata?: null|StripeObject, name?: string, next_invoice_sequence?: int, payment_method?: string, phone?: string, preferred_locales?: string[], shipping?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: string}, source?: string, tax?: array{ip_address?: null|string, validate_location?: string}, tax_exempt?: null|string, tax_id_data?: array{type: string, value: string}[], test_clock?: string, validate?: bool} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Customer the created resource
*
* @return \Stripe\Customer the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -64,7 +64,7 @@ class Customer extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -77,9 +77,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Customer the deleted resource
*
* @return \Stripe\Customer the deleted resource
* @throws Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{
@ -96,18 +96,18 @@ class Customer extends ApiResource
* Returns a list of your customers. The customers are returned sorted by creation
* date, with the most recent customers appearing first.
*
* @param null|array $params
* @param null|array{created?: array|int, email?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, test_clock?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<Customer> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Customer> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -116,13 +116,13 @@ class Customer extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Customer
*
* @return \Stripe\Customer
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -145,12 +145,12 @@ class Customer extends ApiResource
* This request accepts mostly the same arguments as the customer creation call.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, balance?: int, cash_balance?: array{settings?: array{reconciliation_mode?: string}}, default_source?: string, description?: string, email?: string, expand?: string[], invoice_prefix?: string, invoice_settings?: array{custom_fields?: null|array{name: string, value: string}[], default_payment_method?: string, footer?: string, rendering_options?: null|array{amount_tax_display?: null|string, template?: string}}, metadata?: null|StripeObject, name?: string, next_invoice_sequence?: int, phone?: string, preferred_locales?: string[], shipping?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: string}, source?: string, tax?: array{ip_address?: null|string, validate_location?: string}, tax_exempt?: null|string, validate?: bool} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Customer the updated resource
*
* @return \Stripe\Customer the updated resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -158,7 +158,7 @@ class Customer extends ApiResource
$url = static::resourceUrl($id);
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -180,7 +180,7 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @return \Stripe\Customer the updated customer
* @return Customer the updated customer
*/
public function deleteDiscount($params = null, $opts = null)
{
@ -196,15 +196,15 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<PaymentMethod> list of payment methods
*
* @return \Stripe\Collection<\Stripe\PaymentMethod> list of payment methods
* @throws Exception\ApiErrorException if the request fails
*/
public static function allPaymentMethods($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/payment_methods';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -215,15 +215,15 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return PaymentMethod the retrieved payment method
*
* @return \Stripe\PaymentMethod the retrieved payment method
* @throws Exception\ApiErrorException if the request fails
*/
public function retrievePaymentMethod($payment_method, $params = null, $opts = null)
{
$url = $this->instanceUrl() . '/payment_methods/' . $payment_method;
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
@ -233,15 +233,15 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return SearchResult<Customer> the customer search results
*
* @return \Stripe\SearchResult<\Stripe\Customer> the customer search results
* @throws Exception\ApiErrorException if the request fails
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/customers/search';
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
return static::_requestPage($url, SearchResult::class, $params, $opts);
}
const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
@ -251,9 +251,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<CustomerBalanceTransaction> the list of customer balance transactions
*
* @return \Stripe\Collection<\Stripe\CustomerBalanceTransaction> the list of customer balance transactions
* @throws Exception\ApiErrorException if the request fails
*/
public static function allBalanceTransactions($id, $params = null, $opts = null)
{
@ -265,9 +265,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CustomerBalanceTransaction
*
* @return \Stripe\CustomerBalanceTransaction
* @throws Exception\ApiErrorException if the request fails
*/
public static function createBalanceTransaction($id, $params = null, $opts = null)
{
@ -280,9 +280,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CustomerBalanceTransaction
*
* @return \Stripe\CustomerBalanceTransaction
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
{
@ -295,9 +295,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CustomerBalanceTransaction
*
* @return \Stripe\CustomerBalanceTransaction
* @throws Exception\ApiErrorException if the request fails
*/
public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
{
@ -310,9 +310,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<CustomerCashBalanceTransaction> the list of customer cash balance transactions
*
* @return \Stripe\Collection<\Stripe\CustomerCashBalanceTransaction> the list of customer cash balance transactions
* @throws Exception\ApiErrorException if the request fails
*/
public static function allCashBalanceTransactions($id, $params = null, $opts = null)
{
@ -325,9 +325,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CustomerCashBalanceTransaction
*
* @return \Stripe\CustomerCashBalanceTransaction
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieveCashBalanceTransaction($id, $cashBalanceTransactionId, $params = null, $opts = null)
{
@ -340,9 +340,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<BankAccount|Card|Source> the list of payment sources (BankAccount, Card or Source)
*
* @return \Stripe\Collection<\Stripe\BankAccount|\Stripe\Card|\Stripe\Source> the list of payment sources (BankAccount, Card or Source)
* @throws Exception\ApiErrorException if the request fails
*/
public static function allSources($id, $params = null, $opts = null)
{
@ -354,9 +354,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return BankAccount|Card|Source
*
* @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
* @throws Exception\ApiErrorException if the request fails
*/
public static function createSource($id, $params = null, $opts = null)
{
@ -369,9 +369,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return BankAccount|Card|Source
*
* @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
* @throws Exception\ApiErrorException if the request fails
*/
public static function deleteSource($id, $sourceId, $params = null, $opts = null)
{
@ -384,9 +384,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return BankAccount|Card|Source
*
* @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
{
@ -399,9 +399,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return BankAccount|Card|Source
*
* @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source
* @throws Exception\ApiErrorException if the request fails
*/
public static function updateSource($id, $sourceId, $params = null, $opts = null)
{
@ -415,9 +415,9 @@ class Customer extends ApiResource
* @param null|array|string $opts
* @param mixed $cashBalanceId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CashBalance
*
* @return \Stripe\CashBalance
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieveCashBalance($id, $cashBalanceId, $params = null, $opts = null)
{
@ -430,9 +430,9 @@ class Customer extends ApiResource
* @param null|array|string $opts
* @param mixed $cashBalanceId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CashBalance
*
* @return \Stripe\CashBalance
* @throws Exception\ApiErrorException if the request fails
*/
public static function updateCashBalance($id, $cashBalanceId, $params = null, $opts = null)
{
@ -445,9 +445,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<TaxId> the list of tax ids
*
* @return \Stripe\Collection<\Stripe\TaxId> the list of tax ids
* @throws Exception\ApiErrorException if the request fails
*/
public static function allTaxIds($id, $params = null, $opts = null)
{
@ -459,9 +459,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return TaxId
*
* @return \Stripe\TaxId
* @throws Exception\ApiErrorException if the request fails
*/
public static function createTaxId($id, $params = null, $opts = null)
{
@ -474,9 +474,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return TaxId
*
* @return \Stripe\TaxId
* @throws Exception\ApiErrorException if the request fails
*/
public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
{
@ -489,9 +489,9 @@ class Customer extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return TaxId
*
* @return \Stripe\TaxId
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
{

View file

@ -15,16 +15,17 @@ namespace Stripe;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's <code>balance</code>.
* @property null|Checkout\Session|string $checkout_session The ID of the checkout session (if any) that created the transaction.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\Stripe\CreditNote $credit_note The ID of the credit note (if any) related to the transaction.
* @property null|CreditNote|string $credit_note The ID of the credit note (if any) related to the transaction.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string|\Stripe\Customer $customer The ID of the customer the transaction belongs to.
* @property Customer|string $customer The ID of the customer the transaction belongs to.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property int $ending_balance The customer's <code>balance</code> after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice.
* @property null|string|\Stripe\Invoice $invoice The ID of the invoice (if any) related to the transaction.
* @property null|Invoice|string $invoice The ID of the invoice (if any) related to the transaction.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $type Transaction type: <code>adjustment</code>, <code>applied_to_invoice</code>, <code>credit_note</code>, <code>initial</code>, <code>invoice_overpaid</code>, <code>invoice_too_large</code>, <code>invoice_too_small</code>, <code>unspent_receiver_credit</code>, or <code>unapplied_from_invoice</code>. See the <a href="https://stripe.com/docs/billing/customer/balance#types">Customer Balance page</a> to learn more about transaction types.
* @property null|StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $type Transaction type: <code>adjustment</code>, <code>applied_to_invoice</code>, <code>credit_note</code>, <code>initial</code>, <code>invoice_overpaid</code>, <code>invoice_too_large</code>, <code>invoice_too_small</code>, <code>unspent_receiver_credit</code>, <code>unapplied_from_invoice</code>, <code>checkout_session_subscription_payment</code>, or <code>checkout_session_subscription_payment_canceled</code>. See the <a href="https://stripe.com/docs/billing/customer/balance#types">Customer Balance page</a> to learn more about transaction types.
*/
class CustomerBalanceTransaction extends ApiResource
{
@ -32,6 +33,8 @@ class CustomerBalanceTransaction extends ApiResource
const TYPE_ADJUSTMENT = 'adjustment';
const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
const TYPE_CHECKOUT_SESSION_SUBSCRIPTION_PAYMENT = 'checkout_session_subscription_payment';
const TYPE_CHECKOUT_SESSION_SUBSCRIPTION_PAYMENT_CANCELED = 'checkout_session_subscription_payment_canceled';
const TYPE_CREDIT_NOTE = 'credit_note';
const TYPE_INITIAL = 'initial';
const TYPE_INVOICE_OVERPAID = 'invoice_overpaid';
@ -68,14 +71,14 @@ class CustomerBalanceTransaction extends ApiResource
* @param array|string $_id
* @param null|array|string $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = 'Customer Balance Transactions cannot be retrieved without a ' .
'customer ID. Retrieve a Customer Balance Transaction using ' .
"`Customer::retrieveBalanceTransaction('customer_id', " .
"'balance_transaction_id')`.";
$msg = 'Customer Balance Transactions cannot be retrieved without a '
. 'customer ID. Retrieve a Customer Balance Transaction using '
. "`Customer::retrieveBalanceTransaction('customer_id', "
. "'balance_transaction_id')`.";
throw new Exception\BadMethodCallException($msg);
}
@ -85,14 +88,14 @@ class CustomerBalanceTransaction extends ApiResource
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\Exception\BadMethodCallException
* @throws Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = 'Customer Balance Transactions cannot be updated without a ' .
'customer ID. Update a Customer Balance Transaction using ' .
"`Customer::updateBalanceTransaction('customer_id', " .
"'balance_transaction_id', \$updateParams)`.";
$msg = 'Customer Balance Transactions cannot be updated without a '
. 'customer ID. Update a Customer Balance Transaction using '
. "`Customer::updateBalanceTransaction('customer_id', "
. "'balance_transaction_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
}

View file

@ -12,19 +12,19 @@ namespace Stripe;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $adjusted_for_overdraft
* @property null|\Stripe\StripeObject $applied_to_payment
* @property null|(object{balance_transaction: BalanceTransaction|string, linked_transaction: CustomerCashBalanceTransaction|string}&StripeObject) $adjusted_for_overdraft
* @property null|(object{payment_intent: PaymentIntent|string}&StripeObject) $applied_to_payment
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string|\Stripe\Customer $customer The customer whose available cash balance changed as a result of this transaction.
* @property Customer|string $customer The customer whose available cash balance changed as a result of this transaction.
* @property int $ending_balance The total available cash balance for the specified currency after this transaction was applied. Represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property null|\Stripe\StripeObject $funded
* @property null|(object{bank_transfer: (object{eu_bank_transfer?: (object{bic: null|string, iban_last4: null|string, sender_name: null|string}&StripeObject), gb_bank_transfer?: (object{account_number_last4: null|string, sender_name: null|string, sort_code: null|string}&StripeObject), jp_bank_transfer?: (object{sender_bank: null|string, sender_branch: null|string, sender_name: null|string}&StripeObject), reference: null|string, type: string, us_bank_transfer?: (object{network?: string, sender_name: null|string}&StripeObject)}&StripeObject)}&StripeObject) $funded
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property int $net_amount The amount by which the cash balance changed, represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance.
* @property null|\Stripe\StripeObject $refunded_from_payment
* @property null|\Stripe\StripeObject $transferred_to_balance
* @property null|(object{refund: Refund|string}&StripeObject) $refunded_from_payment
* @property null|(object{balance_transaction: BalanceTransaction|string}&StripeObject) $transferred_to_balance
* @property string $type The type of the cash balance transaction. New types may be added in future. See <a href="https://stripe.com/docs/payments/customer-balance#types">Customer Balance</a> to learn more about these types.
* @property null|\Stripe\StripeObject $unapplied_from_payment
* @property null|(object{payment_intent: PaymentIntent|string}&StripeObject) $unapplied_from_payment
*/
class CustomerCashBalanceTransaction extends ApiResource
{

View file

@ -14,9 +14,9 @@ namespace Stripe;
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $client_secret <p>The client secret of this Customer Session. Used on the client to set up secure access to the given <code>customer</code>.</p><p>The client secret can be used to provide access to <code>customer</code> from your frontend. It should not be stored, logged, or exposed to anyone other than the relevant customer. Make sure that you have TLS enabled on any page that includes the client secret.</p>
* @property null|\Stripe\StripeObject $components Configuration for the components supported by this Customer Session.
* @property null|(object{buy_button: (object{enabled: bool}&StripeObject), payment_element: (object{enabled: bool, features: null|(object{payment_method_allow_redisplay_filters: string[], payment_method_redisplay: string, payment_method_redisplay_limit: null|int, payment_method_remove: string, payment_method_save: string, payment_method_save_usage: null|string}&StripeObject)}&StripeObject), pricing_table: (object{enabled: bool}&StripeObject)}&StripeObject) $components Configuration for the components supported by this Customer Session.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string|\Stripe\Customer $customer The Customer the Customer Session was created for.
* @property Customer|string $customer The Customer the Customer Session was created for.
* @property int $expires_at The timestamp at which this Customer Session will expire.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
@ -29,12 +29,12 @@ class CustomerSession extends ApiResource
* you can use on your front-end to grant client-side API access for certain
* customer resources.
*
* @param null|array $params
* @param null|array{components: array{buy_button?: array{enabled: bool}, payment_element?: array{enabled: bool, features?: array{payment_method_allow_redisplay_filters?: string[], payment_method_redisplay?: string, payment_method_redisplay_limit?: int, payment_method_remove?: string, payment_method_save?: string, payment_method_save_usage?: string}}, pricing_table?: array{enabled: bool}}, customer: string, expand?: string[]} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return CustomerSession the created resource
*
* @return \Stripe\CustomerSession the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -42,7 +42,7 @@ class CustomerSession extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;

View file

@ -13,12 +13,12 @@ namespace Stripe;
* @property string $id The ID of the discount object. Discounts cannot be fetched by ID. Use <code>expand[]=discounts</code> in API calls to expand discount IDs in an array.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|string $checkout_session The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
* @property \Stripe\Coupon $coupon A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to <a href="https://stripe.com/docs/api#subscriptions">subscriptions</a>, <a href="https://stripe.com/docs/api#invoices">invoices</a>, <a href="https://stripe.com/docs/api/checkout/sessions">checkout sessions</a>, <a href="https://stripe.com/docs/api#quotes">quotes</a>, and more. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a> or <a href="https://stripe.com/docs/api/payment_intents">payment intents</a>.
* @property null|string|\Stripe\Customer $customer The ID of the customer associated with this discount.
* @property Coupon $coupon A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to <a href="https://stripe.com/docs/api#subscriptions">subscriptions</a>, <a href="https://stripe.com/docs/api#invoices">invoices</a>, <a href="https://stripe.com/docs/api/checkout/sessions">checkout sessions</a>, <a href="https://stripe.com/docs/api#quotes">quotes</a>, and more. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a> or <a href="https://stripe.com/docs/api/payment_intents">payment intents</a>.
* @property null|Customer|string $customer The ID of the customer associated with this discount.
* @property null|int $end If the coupon has a duration of <code>repeating</code>, the date that this discount will end. If the coupon has a duration of <code>once</code> or <code>forever</code>, this attribute will be null.
* @property null|string $invoice The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
* @property null|string $invoice_item The invoice item <code>id</code> (or invoice line item <code>id</code> for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
* @property null|string|\Stripe\PromotionCode $promotion_code The promotion code applied to create this discount.
* @property null|PromotionCode|string $promotion_code The promotion code applied to create this discount.
* @property int $start Date that the coupon was applied.
* @property null|string $subscription The subscription that this coupon is applied to, if it is applied to a particular subscription.
* @property null|string $subscription_item The subscription item that this coupon is applied to, if it is applied to a particular subscription item.

View file

@ -14,19 +14,19 @@ namespace Stripe;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Disputed amount. Usually the amount of the charge, but it can differ (usually because of currency fluctuation or because only part of the order is disputed).
* @property \Stripe\BalanceTransaction[] $balance_transactions List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.
* @property string|\Stripe\Charge $charge ID of the charge that's disputed.
* @property BalanceTransaction[] $balance_transactions List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.
* @property Charge|string $charge ID of the charge that's disputed.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string[] $enhanced_eligibility_types List of eligibility types that are included in <code>enhanced_evidence</code>.
* @property \Stripe\StripeObject $evidence
* @property \Stripe\StripeObject $evidence_details
* @property (object{access_activity_log: null|string, billing_address: null|string, cancellation_policy: null|File|string, cancellation_policy_disclosure: null|string, cancellation_rebuttal: null|string, customer_communication: null|File|string, customer_email_address: null|string, customer_name: null|string, customer_purchase_ip: null|string, customer_signature: null|File|string, duplicate_charge_documentation: null|File|string, duplicate_charge_explanation: null|string, duplicate_charge_id: null|string, enhanced_evidence: (object{visa_compelling_evidence_3?: (object{disputed_transaction: null|(object{customer_account_id: null|string, customer_device_fingerprint: null|string, customer_device_id: null|string, customer_email_address: null|string, customer_purchase_ip: null|string, merchandise_or_services: null|string, product_description: null|string, shipping_address: null|(object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject)}&StripeObject), prior_undisputed_transactions: ((object{charge: string, customer_account_id: null|string, customer_device_fingerprint: null|string, customer_device_id: null|string, customer_email_address: null|string, customer_purchase_ip: null|string, product_description: null|string, shipping_address: null|(object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject)}&StripeObject))[]}&StripeObject), visa_compliance?: (object{fee_acknowledged: bool}&StripeObject)}&StripeObject), product_description: null|string, receipt: null|File|string, refund_policy: null|File|string, refund_policy_disclosure: null|string, refund_refusal_explanation: null|string, service_date: null|string, service_documentation: null|File|string, shipping_address: null|string, shipping_carrier: null|string, shipping_date: null|string, shipping_documentation: null|File|string, shipping_tracking_number: null|string, uncategorized_file: null|File|string, uncategorized_text: null|string}&StripeObject) $evidence
* @property (object{due_by: null|int, enhanced_eligibility: (object{visa_compelling_evidence_3?: (object{required_actions: string[], status: string}&StripeObject), visa_compliance?: (object{status: string}&StripeObject)}&StripeObject), has_evidence: bool, past_due: bool, submission_count: int}&StripeObject) $evidence_details
* @property bool $is_charge_refundable If true, it's still possible to refund the disputed payment. After the payment has been fully refunded, no further funds are withdrawn from your Stripe account as a result of this dispute.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $network_reason_code Network-dependent reason code for the dispute.
* @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that's disputed.
* @property null|\Stripe\StripeObject $payment_method_details
* @property null|PaymentIntent|string $payment_intent ID of the PaymentIntent that's disputed.
* @property null|(object{amazon_pay?: (object{dispute_type: null|string}&StripeObject), card?: (object{brand: string, case_type: string, network_reason_code: null|string}&StripeObject), klarna?: (object{reason_code: null|string}&StripeObject), paypal?: (object{case_id: null|string, reason_code: null|string}&StripeObject), type: string}&StripeObject) $payment_method_details
* @property string $reason Reason given by cardholder for dispute. Possible values are <code>bank_cannot_process</code>, <code>check_returned</code>, <code>credit_not_processed</code>, <code>customer_initiated</code>, <code>debit_not_authorized</code>, <code>duplicate</code>, <code>fraudulent</code>, <code>general</code>, <code>incorrect_account_details</code>, <code>insufficient_funds</code>, <code>product_not_received</code>, <code>product_unacceptable</code>, <code>subscription_canceled</code>, or <code>unrecognized</code>. Learn more about <a href="https://stripe.com/docs/disputes/categories">dispute reasons</a>.
* @property string $status Current status of dispute. Possible values are <code>warning_needs_response</code>, <code>warning_under_review</code>, <code>warning_closed</code>, <code>needs_response</code>, <code>under_review</code>, <code>won</code>, or <code>lost</code>.
*/
@ -62,18 +62,18 @@ class Dispute extends ApiResource
/**
* Returns a list of your disputes.
*
* @param null|array $params
* @param null|array{charge?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, payment_intent?: string, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<Dispute> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Dispute> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -82,13 +82,13 @@ class Dispute extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Dispute
*
* @return \Stripe\Dispute
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -107,12 +107,12 @@ class Dispute extends ApiResource
* see our <a href="/docs/disputes/categories">guide to dispute types</a>.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{evidence?: array{access_activity_log?: string, billing_address?: string, cancellation_policy?: string, cancellation_policy_disclosure?: string, cancellation_rebuttal?: string, customer_communication?: string, customer_email_address?: string, customer_name?: string, customer_purchase_ip?: string, customer_signature?: string, duplicate_charge_documentation?: string, duplicate_charge_explanation?: string, duplicate_charge_id?: string, enhanced_evidence?: null|array{visa_compelling_evidence_3?: array{disputed_transaction?: array{customer_account_id?: null|string, customer_device_fingerprint?: null|string, customer_device_id?: null|string, customer_email_address?: null|string, customer_purchase_ip?: null|string, merchandise_or_services?: string, product_description?: null|string, shipping_address?: array{city?: null|string, country?: null|string, line1?: null|string, line2?: null|string, postal_code?: null|string, state?: null|string}}, prior_undisputed_transactions?: (array{charge: string, customer_account_id?: null|string, customer_device_fingerprint?: null|string, customer_device_id?: null|string, customer_email_address?: null|string, customer_purchase_ip?: null|string, product_description?: null|string, shipping_address?: array{city?: null|string, country?: null|string, line1?: null|string, line2?: null|string, postal_code?: null|string, state?: null|string}})[]}, visa_compliance?: array{fee_acknowledged?: bool}}, product_description?: string, receipt?: string, refund_policy?: string, refund_policy_disclosure?: string, refund_refusal_explanation?: string, service_date?: string, service_documentation?: string, shipping_address?: string, shipping_carrier?: string, shipping_date?: string, shipping_documentation?: string, shipping_tracking_number?: string, uncategorized_file?: string, uncategorized_text?: string}, expand?: string[], metadata?: null|StripeObject, submit?: bool} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Dispute the updated resource
*
* @return \Stripe\Dispute the updated resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -120,7 +120,7 @@ class Dispute extends ApiResource
$url = static::resourceUrl($id);
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -130,9 +130,9 @@ class Dispute extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Dispute the closed dispute
*
* @return \Stripe\Dispute the closed dispute
* @throws Exception\ApiErrorException if the request fails
*/
public function close($params = null, $opts = null)
{

View file

@ -9,7 +9,7 @@ namespace Stripe\Entitlements;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string|\Stripe\Entitlements\Feature $feature The <a href="https://stripe.com/docs/api/entitlements/feature">Feature</a> that the customer is entitled to.
* @property Feature|string $feature The <a href="https://stripe.com/docs/api/entitlements/feature">Feature</a> that the customer is entitled to.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $lookup_key A unique key you provide as your own system identifier. This may be up to 80 characters.
*/
@ -20,12 +20,12 @@ class ActiveEntitlement extends \Stripe\ApiResource
/**
* Retrieve a list of active entitlements for a customer.
*
* @param null|array $params
* @param null|array{customer: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<ActiveEntitlement> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Entitlements\ActiveEntitlement> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -40,9 +40,9 @@ class ActiveEntitlement extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ActiveEntitlement
*
* @return \Stripe\Entitlements\ActiveEntitlement
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -9,7 +9,7 @@ namespace Stripe\Entitlements;
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $customer The customer that is entitled to this feature.
* @property \Stripe\Collection<\Stripe\Entitlements\ActiveEntitlement> $entitlements The list of entitlements this customer has.
* @property \Stripe\Collection<ActiveEntitlement> $entitlements The list of entitlements this customer has.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
class ActiveEntitlementSummary extends \Stripe\ApiResource

View file

@ -25,12 +25,12 @@ class Feature extends \Stripe\ApiResource
/**
* Creates a feature.
*
* @param null|array $params
* @param null|array{expand?: string[], lookup_key: string, metadata?: \Stripe\StripeObject, name: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Feature the created resource
*
* @return \Stripe\Entitlements\Feature the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -47,12 +47,12 @@ class Feature extends \Stripe\ApiResource
/**
* Retrieve a list of features.
*
* @param null|array $params
* @param null|array{archived?: bool, ending_before?: string, expand?: string[], limit?: int, lookup_key?: string, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Feature> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Entitlements\Feature> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -67,9 +67,9 @@ class Feature extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Feature
*
* @return \Stripe\Entitlements\Feature
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -84,12 +84,12 @@ class Feature extends \Stripe\ApiResource
* Update a features metadata or permanently deactivate it.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{active?: bool, expand?: string[], metadata?: null|\Stripe\StripeObject, name?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Feature the updated resource
*
* @return \Stripe\Entitlements\Feature the updated resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{

View file

@ -19,12 +19,12 @@ class EphemeralKey extends ApiResource
/**
* Invalidates a short-lived API key for a given resource.
*
* @param null|array $params
* @param null|array{expand?: string[]} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return EphemeralKey the deleted resource
*
* @return \Stripe\EphemeralKey the deleted resource
* @throws Exception\ApiErrorException if the request fails
*/
public function delete($params = null, $opts = null)
{
@ -45,10 +45,10 @@ class EphemeralKey extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return EphemeralKey the created key
*
* @return \Stripe\EphemeralKey the created key
* @throws Exception\InvalidArgumentException if stripe_version is missing
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $opts = null)
{

View file

@ -94,6 +94,7 @@ class ErrorObject extends StripeObject
const CODE_FINANCIAL_CONNECTIONS_NO_SUCCESSFUL_TRANSACTION_REFRESH = 'financial_connections_no_successful_transaction_refresh';
const CODE_FORWARDING_API_INACTIVE = 'forwarding_api_inactive';
const CODE_FORWARDING_API_INVALID_PARAMETER = 'forwarding_api_invalid_parameter';
const CODE_FORWARDING_API_RETRYABLE_UPSTREAM_ERROR = 'forwarding_api_retryable_upstream_error';
const CODE_FORWARDING_API_UPSTREAM_CONNECTION_ERROR = 'forwarding_api_upstream_connection_error';
const CODE_FORWARDING_API_UPSTREAM_CONNECTION_TIMEOUT = 'forwarding_api_upstream_connection_timeout';
const CODE_IDEMPOTENCY_KEY_IN_USE = 'idempotency_key_in_use';
@ -190,6 +191,7 @@ class ErrorObject extends StripeObject
const CODE_SETUP_INTENT_AUTHENTICATION_FAILURE = 'setup_intent_authentication_failure';
const CODE_SETUP_INTENT_INVALID_PARAMETER = 'setup_intent_invalid_parameter';
const CODE_SETUP_INTENT_MANDATE_INVALID = 'setup_intent_mandate_invalid';
const CODE_SETUP_INTENT_MOBILE_WALLET_UNSUPPORTED = 'setup_intent_mobile_wallet_unsupported';
const CODE_SETUP_INTENT_SETUP_ATTEMPT_EXPIRED = 'setup_intent_setup_attempt_expired';
const CODE_SETUP_INTENT_UNEXPECTED_STATE = 'setup_intent_unexpected_state';
const CODE_SHIPPING_ADDRESS_INVALID = 'shipping_address_invalid';

View file

@ -44,10 +44,10 @@ namespace Stripe;
* @property null|string $account The connected account that originates the event.
* @property null|string $api_version The Stripe API version used to render <code>data</code>. This property is populated only for events on or after October 31, 2014.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject $data
* @property (object{object: StripeObject, previous_attributes?: StripeObject}&StripeObject) $data
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property int $pending_webhooks Number of webhooks that haven't been successfully delivered (for example, to return a 20x response) to the URLs you specify.
* @property null|\Stripe\StripeObject $request Information on the API request that triggers the event.
* @property null|(object{id: null|string, idempotency_key: null|string}&StripeObject) $request Information on the API request that triggers the event.
* @property string $type Description of the event (for example, <code>invoice.created</code> or <code>charge.refunded</code>).
*/
class Event extends ApiResource
@ -65,6 +65,13 @@ class Event extends ApiResource
const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
const BALANCE_AVAILABLE = 'balance.available';
const BILLING_ALERT_TRIGGERED = 'billing.alert.triggered';
const BILLING_CREDIT_BALANCE_TRANSACTION_CREATED = 'billing.credit_balance_transaction.created';
const BILLING_CREDIT_GRANT_CREATED = 'billing.credit_grant.created';
const BILLING_CREDIT_GRANT_UPDATED = 'billing.credit_grant.updated';
const BILLING_METER_CREATED = 'billing.meter.created';
const BILLING_METER_DEACTIVATED = 'billing.meter.deactivated';
const BILLING_METER_REACTIVATED = 'billing.meter.reactivated';
const BILLING_METER_UPDATED = 'billing.meter.updated';
const BILLING_PORTAL_CONFIGURATION_CREATED = 'billing_portal.configuration.created';
const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated';
const BILLING_PORTAL_SESSION_CREATED = 'billing_portal.session.created';
@ -145,6 +152,7 @@ class Event extends ApiResource
const INVOICE_FINALIZED = 'invoice.finalized';
const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
const INVOICE_OVERDUE = 'invoice.overdue';
const INVOICE_OVERPAID = 'invoice.overpaid';
const INVOICE_PAID = 'invoice.paid';
const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required';
const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
@ -305,6 +313,13 @@ class Event extends ApiResource
const TYPE_APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
const TYPE_BALANCE_AVAILABLE = 'balance.available';
const TYPE_BILLING_ALERT_TRIGGERED = 'billing.alert.triggered';
const TYPE_BILLING_CREDIT_BALANCE_TRANSACTION_CREATED = 'billing.credit_balance_transaction.created';
const TYPE_BILLING_CREDIT_GRANT_CREATED = 'billing.credit_grant.created';
const TYPE_BILLING_CREDIT_GRANT_UPDATED = 'billing.credit_grant.updated';
const TYPE_BILLING_METER_CREATED = 'billing.meter.created';
const TYPE_BILLING_METER_DEACTIVATED = 'billing.meter.deactivated';
const TYPE_BILLING_METER_REACTIVATED = 'billing.meter.reactivated';
const TYPE_BILLING_METER_UPDATED = 'billing.meter.updated';
const TYPE_BILLING_PORTAL_CONFIGURATION_CREATED = 'billing_portal.configuration.created';
const TYPE_BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated';
const TYPE_BILLING_PORTAL_SESSION_CREATED = 'billing_portal.session.created';
@ -385,6 +400,7 @@ class Event extends ApiResource
const TYPE_INVOICE_FINALIZED = 'invoice.finalized';
const TYPE_INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
const TYPE_INVOICE_OVERDUE = 'invoice.overdue';
const TYPE_INVOICE_OVERPAID = 'invoice.overpaid';
const TYPE_INVOICE_PAID = 'invoice.paid';
const TYPE_INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required';
const TYPE_INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
@ -541,18 +557,18 @@ class Event extends ApiResource
* <code>api_version</code> attribute (not according to your current Stripe API
* version or <code>Stripe-Version</code> header).
*
* @param null|array $params
* @param null|array{created?: array|int, delivery_success?: bool, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, type?: string, types?: string[]} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<Event> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Event> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -562,13 +578,13 @@ class Event extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Event
*
* @return \Stripe\Event
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();

View file

@ -6,10 +6,8 @@ namespace Stripe\EventData;
/**
* @property string $developer_message_summary Extra field included in the event's <code>data</code> when fetched from /v2/events.
* @property \Stripe\StripeObject $reason This contains information about why meter error happens.
* @property (object{error_count: int, error_types: (object{code: string, error_count: int, sample_errors: (object{error_message: string, request: (object{identifier: string}&\Stripe\StripeObject)}&\Stripe\StripeObject)[]}&\Stripe\StripeObject)[]}&\Stripe\StripeObject) $reason This contains information about why meter error happens.
* @property int $validation_end The end of the window that is encapsulated by this summary.
* @property int $validation_start The start of the window that is encapsulated by this summary.
*/
class V1BillingMeterErrorReportTriggeredEventData extends \Stripe\StripeObject
{
}
class V1BillingMeterErrorReportTriggeredEventData extends \Stripe\StripeObject {}

View file

@ -6,10 +6,8 @@ namespace Stripe\EventData;
/**
* @property string $developer_message_summary Extra field included in the event's <code>data</code> when fetched from /v2/events.
* @property \Stripe\StripeObject $reason This contains information about why meter error happens.
* @property (object{error_count: int, error_types: (object{code: string, error_count: int, sample_errors: (object{error_message: string, request: (object{identifier: string}&\Stripe\StripeObject)}&\Stripe\StripeObject)[]}&\Stripe\StripeObject)[]}&\Stripe\StripeObject) $reason This contains information about why meter error happens.
* @property int $validation_end The end of the window that is encapsulated by this summary.
* @property int $validation_start The start of the window that is encapsulated by this summary.
*/
class V1BillingMeterNoMeterFoundEventData extends \Stripe\StripeObject
{
}
class V1BillingMeterNoMeterFoundEventData extends \Stripe\StripeObject {}

View file

@ -15,9 +15,9 @@ class V1BillingMeterErrorReportTriggeredEvent extends \Stripe\V2\Event
/**
* Retrieves the related object from the API. Make an API request on every call.
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Billing\Meter
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function fetchRelatedObject()
{

View file

@ -7,6 +7,4 @@ namespace Stripe\Exception;
* servers. That can be for a variety of different reasons from a downed
* network to a bad TLS certificate.
*/
class ApiConnectionException extends ApiErrorException
{
}
class ApiConnectionException extends ApiErrorException {}

View file

@ -6,6 +6,4 @@ namespace Stripe\Exception;
* AuthenticationException is thrown when invalid credentials are used to
* connect to Stripe's servers.
*/
class AuthenticationException extends ApiErrorException
{
}
class AuthenticationException extends ApiErrorException {}

View file

@ -2,6 +2,4 @@
namespace Stripe\Exception;
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
{
}
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface {}

View file

@ -7,16 +7,12 @@ if (\interface_exists(\Throwable::class, false)) {
/**
* The base interface for all Stripe exceptions.
*/
interface ExceptionInterface extends \Throwable
{
}
interface ExceptionInterface extends \Throwable {}
} else {
/**
* The base interface for all Stripe exceptions.
*/
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
interface ExceptionInterface
{
}
interface ExceptionInterface {}
// phpcs:enable
}

View file

@ -6,6 +6,4 @@ namespace Stripe\Exception;
* IdempotencyException is thrown in cases where an idempotency key was used
* improperly.
*/
class IdempotencyException extends ApiErrorException
{
}
class IdempotencyException extends ApiErrorException {}

View file

@ -2,6 +2,4 @@
namespace Stripe\Exception;
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface {}

View file

@ -5,6 +5,4 @@ namespace Stripe\Exception\OAuth;
/**
* The base interface for all Stripe OAuth exceptions.
*/
interface ExceptionInterface extends \Stripe\Exception\ExceptionInterface
{
}
interface ExceptionInterface extends \Stripe\Exception\ExceptionInterface {}

View file

@ -7,6 +7,4 @@ namespace Stripe\Exception\OAuth;
* the stripe_user_id does not exist or is not connected to your application,
* or the API key mode (live or test mode) does not match the client_id mode.
*/
class InvalidClientException extends OAuthErrorException
{
}
class InvalidClientException extends OAuthErrorException {}

View file

@ -8,6 +8,4 @@ namespace Stripe\Exception\OAuth;
* exist, or doesn't belong to you; or if an API key's mode (live or test)
* doesn't match the mode of a code or refresh token.
*/
class InvalidGrantException extends OAuthErrorException
{
}
class InvalidGrantException extends OAuthErrorException {}

View file

@ -6,6 +6,4 @@ namespace Stripe\Exception\OAuth;
* InvalidRequestException is thrown when a code, refresh token, or grant
* type parameter is not provided, but was required.
*/
class InvalidRequestException extends OAuthErrorException
{
}
class InvalidRequestException extends OAuthErrorException {}

View file

@ -5,6 +5,4 @@ namespace Stripe\Exception\OAuth;
/**
* InvalidScopeException is thrown when an invalid scope parameter is provided.
*/
class InvalidScopeException extends OAuthErrorException
{
}
class InvalidScopeException extends OAuthErrorException {}

View file

@ -7,6 +7,4 @@ namespace Stripe\Exception\OAuth;
* error from the OAuth API it doesn't know about. Receiving this error usually
* means that your client library is outdated and should be upgraded.
*/
class UnknownOAuthErrorException extends OAuthErrorException
{
}
class UnknownOAuthErrorException extends OAuthErrorException {}

View file

@ -6,6 +6,4 @@ namespace Stripe\Exception\OAuth;
* UnsupportedGrantTypeException is thrown when an unuspported grant type
* parameter is specified.
*/
class UnsupportedGrantTypeException extends OAuthErrorException
{
}
class UnsupportedGrantTypeException extends OAuthErrorException {}

View file

@ -6,6 +6,4 @@ namespace Stripe\Exception\OAuth;
* UnsupportedResponseTypeException is thrown when an unsupported response type
* parameter is specified.
*/
class UnsupportedResponseTypeException extends OAuthErrorException
{
}
class UnsupportedResponseTypeException extends OAuthErrorException {}

View file

@ -6,6 +6,4 @@ namespace Stripe\Exception;
* PermissionException is thrown in cases where access was attempted on a
* resource that wasn't allowed.
*/
class PermissionException extends ApiErrorException
{
}
class PermissionException extends ApiErrorException {}

View file

@ -7,6 +7,4 @@ namespace Stripe\Exception;
* load on Stripe's API servers (usually by performing too many requests).
* Please back off on request rate.
*/
class RateLimitException extends InvalidRequestException
{
}
class RateLimitException extends InvalidRequestException {}

View file

@ -4,6 +4,4 @@
namespace Stripe\Exception;
class TemporarySessionExpiredException extends ApiErrorException
{
}
class TemporarySessionExpiredException extends ApiErrorException {}

View file

@ -2,6 +2,4 @@
namespace Stripe\Exception;
class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface
{
}
class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface {}

View file

@ -7,6 +7,4 @@ namespace Stripe\Exception;
* error from the API it doesn't know about. Receiving this error usually
* means that your client library is outdated and should be upgraded.
*/
class UnknownApiErrorException extends ApiErrorException
{
}
class UnknownApiErrorException extends ApiErrorException {}

View file

@ -34,7 +34,7 @@ namespace Stripe;
*
* @property string $id Unique identifier for the object. Represented as the three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a> in lowercase.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @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.
* @property 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.
*/
class ExchangeRate extends ApiResource
{
@ -44,18 +44,18 @@ class ExchangeRate extends ApiResource
* Returns a list of objects that contain the rates at which foreign currencies are
* converted to one another. Only shows the currencies for which Stripe supports.
*
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<ExchangeRate> of ApiResources
*
* @return \Stripe\Collection<\Stripe\ExchangeRate> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -65,13 +65,13 @@ class ExchangeRate extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return ExchangeRate
*
* @return \Stripe\ExchangeRate
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();

View file

@ -18,7 +18,7 @@ namespace Stripe;
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|int $expires_at The file expires and isn't available at this time in epoch seconds.
* @property null|string $filename The suitable name for saving the file to a filesystem.
* @property null|\Stripe\Collection<\Stripe\FileLink> $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
* @property null|Collection<FileLink> $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
* @property string $purpose The <a href="https://stripe.com/docs/file-upload#uploading-a-file">purpose</a> of the uploaded file.
* @property int $size The size of the file object in bytes.
* @property null|string $title A suitable title for the document.
@ -52,18 +52,18 @@ class File extends ApiResource
* returns the files by their creation dates, placing the most recently created
* files at the top.
*
* @param null|array $params
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], limit?: int, purpose?: string, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<File> of ApiResources
*
* @return \Stripe\Collection<\Stripe\File> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -74,13 +74,13 @@ class File extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return File
*
* @return \Stripe\File
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -101,19 +101,19 @@ class File extends ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return File the created file
*
* @return \Stripe\File the created file
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
if (null === $opts->apiBase) {
$opts->apiBase = Stripe::$apiUploadBase;
}
// Manually flatten params, otherwise curl's multipart encoder will
// choke on nested arrays.
$flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
$flatParams = \array_column(Util\Util::flattenParams($params), 1, 0);
return static::_create($flatParams, $opts);
}

View file

@ -14,9 +14,9 @@ namespace Stripe;
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property bool $expired Returns if the link is already expired.
* @property null|int $expires_at Time that the link expires.
* @property string|\Stripe\File $file The file object this link points to.
* @property File|string $file The file object this link points to.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $url The publicly accessible URL to download the file.
*/
class FileLink extends ApiResource
@ -28,12 +28,12 @@ class FileLink extends ApiResource
/**
* Creates a new file link object.
*
* @param null|array $params
* @param null|array{expand?: string[], expires_at?: int, file: string, metadata?: null|StripeObject} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return FileLink the created resource
*
* @return \Stripe\FileLink the created resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -41,7 +41,7 @@ class FileLink extends ApiResource
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -50,18 +50,18 @@ class FileLink extends ApiResource
/**
* Returns a list of file links.
*
* @param null|array $params
* @param null|array{created?: array|int, ending_before?: string, expand?: string[], expired?: bool, file?: string, limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Collection<FileLink> of ApiResources
*
* @return \Stripe\Collection<\Stripe\FileLink> of ApiResources
* @throws Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
return static::_requestPage($url, Collection::class, $params, $opts);
}
/**
@ -70,13 +70,13 @@ class FileLink extends ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return FileLink
*
* @return \Stripe\FileLink
* @throws Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$opts = Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
@ -87,12 +87,12 @@ class FileLink extends ApiResource
* Updates an existing file link object. Expired links can no longer be updated.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array{expand?: string[], expires_at?: null|array|int|string, metadata?: null|StripeObject} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return FileLink the updated resource
*
* @return \Stripe\FileLink the updated resource
* @throws Exception\ApiErrorException if the request fails
*/
public static function update($id, $params = null, $opts = null)
{
@ -100,7 +100,7 @@ class FileLink extends ApiResource
$url = static::resourceUrl($id);
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;

View file

@ -9,23 +9,23 @@ namespace Stripe\FinancialConnections;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $account_holder The account holder that this account belongs to.
* @property null|\Stripe\StripeObject $balance The most recent information about the account's balance.
* @property null|\Stripe\StripeObject $balance_refresh The state of the most recent attempt to refresh the account balance.
* @property null|(object{account?: string|\Stripe\Account, customer?: string|\Stripe\Customer, type: string}&\Stripe\StripeObject) $account_holder The account holder that this account belongs to.
* @property null|(object{as_of: int, cash?: (object{available: null|\Stripe\StripeObject}&\Stripe\StripeObject), credit?: (object{used: null|\Stripe\StripeObject}&\Stripe\StripeObject), current: \Stripe\StripeObject, type: string}&\Stripe\StripeObject) $balance The most recent information about the account's balance.
* @property null|(object{last_attempted_at: int, next_refresh_available_at: null|int, status: string}&\Stripe\StripeObject) $balance_refresh The state of the most recent attempt to refresh the account balance.
* @property string $category The type of the account. Account category is further divided in <code>subcategory</code>.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $display_name A human-readable name that has been assigned to this account, either by the account holder or by the institution.
* @property string $institution_name The name of the institution that holds this account.
* @property null|string $last4 The last 4 digits of the account number. If present, this will be 4 numeric characters.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|string|\Stripe\FinancialConnections\AccountOwnership $ownership The most recent information about the account's owners.
* @property null|\Stripe\StripeObject $ownership_refresh The state of the most recent attempt to refresh the account owners.
* @property null|AccountOwnership|string $ownership The most recent information about the account's owners.
* @property null|(object{last_attempted_at: int, next_refresh_available_at: null|int, status: string}&\Stripe\StripeObject) $ownership_refresh The state of the most recent attempt to refresh the account owners.
* @property null|string[] $permissions The list of permissions granted by this account.
* @property string $status The status of the link to the account.
* @property string $subcategory <p>If <code>category</code> is <code>cash</code>, one of:</p><p>- <code>checking</code> - <code>savings</code> - <code>other</code></p><p>If <code>category</code> is <code>credit</code>, one of:</p><p>- <code>mortgage</code> - <code>line_of_credit</code> - <code>credit_card</code> - <code>other</code></p><p>If <code>category</code> is <code>investment</code> or <code>other</code>, this will be <code>other</code>.</p>
* @property null|string[] $subscriptions The list of data refresh subscriptions requested on this account.
* @property string[] $supported_payment_method_types The <a href="https://stripe.com/docs/api/payment_methods/object#payment_method_object-type">PaymentMethod type</a>(s) that can be created from this account.
* @property null|\Stripe\StripeObject $transaction_refresh The state of the most recent attempt to refresh the account transactions.
* @property null|(object{id: string, last_attempted_at: int, next_refresh_available_at: null|int, status: string}&\Stripe\StripeObject) $transaction_refresh The state of the most recent attempt to refresh the account transactions.
*/
class Account extends \Stripe\ApiResource
{
@ -50,12 +50,12 @@ class Account extends \Stripe\ApiResource
/**
* Returns a list of Financial Connections <code>Account</code> objects.
*
* @param null|array $params
* @param null|array{account_holder?: array{account?: string, customer?: string}, ending_before?: string, expand?: string[], limit?: int, session?: string, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Account> of ApiResources
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\Account> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -70,9 +70,9 @@ class Account extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Account
*
* @return \Stripe\FinancialConnections\Account
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{
@ -87,9 +87,9 @@ class Account extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Account the disconnected account
*
* @return \Stripe\FinancialConnections\Account the disconnected account
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function disconnect($params = null, $opts = null)
{
@ -105,9 +105,9 @@ class Account extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<AccountOwner> list of account owners
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\AccountOwner> list of account owners
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function allOwners($id, $params = null, $opts = null)
{
@ -123,9 +123,9 @@ class Account extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Account the refreshed account
*
* @return \Stripe\FinancialConnections\Account the refreshed account
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function refreshAccount($params = null, $opts = null)
{
@ -140,9 +140,9 @@ class Account extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Account the subscribed account
*
* @return \Stripe\FinancialConnections\Account the subscribed account
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function subscribe($params = null, $opts = null)
{
@ -157,9 +157,9 @@ class Account extends \Stripe\ApiResource
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Account the unsubscribed account
*
* @return \Stripe\FinancialConnections\Account the unsubscribed account
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function unsubscribe($params = null, $opts = null)
{

View file

@ -10,7 +10,7 @@ namespace Stripe\FinancialConnections;
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\Collection<\Stripe\FinancialConnections\AccountOwner> $owners A paginated list of owners for this account.
* @property \Stripe\Collection<AccountOwner> $owners A paginated list of owners for this account.
*/
class AccountOwnership extends \Stripe\ApiResource
{

View file

@ -9,10 +9,10 @@ namespace Stripe\FinancialConnections;
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $account_holder The account holder for whom accounts are collected in this session.
* @property \Stripe\Collection<\Stripe\FinancialConnections\Account> $accounts The accounts that were collected as part of this Session.
* @property null|(object{account?: string|\Stripe\Account, customer?: string|\Stripe\Customer, type: string}&\Stripe\StripeObject) $account_holder The account holder for whom accounts are collected in this session.
* @property \Stripe\Collection<Account> $accounts The accounts that were collected as part of this Session.
* @property string $client_secret A value that will be passed to the client to launch the authentication flow.
* @property null|\Stripe\StripeObject $filters
* @property null|(object{account_subcategories: null|string[], countries: null|string[]}&\Stripe\StripeObject) $filters
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string[] $permissions Permissions requested for accounts collected during this session.
* @property null|string[] $prefetch Data features requested to be retrieved upon account creation.
@ -27,12 +27,12 @@ class Session extends \Stripe\ApiResource
* <code>Session</code>. The sessions <code>client_secret</code> can be used to
* launch the flow using Stripe.js.
*
* @param null|array $params
* @param null|array{account_holder: array{account?: string, customer?: string, type: string}, expand?: string[], filters?: array{account_subcategories?: string[], countries?: string[]}, permissions: string[], prefetch?: string[], return_url?: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Session the created resource
*
* @return \Stripe\FinancialConnections\Session the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -52,9 +52,9 @@ class Session extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Session
*
* @return \Stripe\FinancialConnections\Session
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -15,7 +15,7 @@ namespace Stripe\FinancialConnections;
* @property string $description The description of this transaction.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $status The status of the transaction.
* @property \Stripe\StripeObject $status_transitions
* @property (object{posted_at: null|int, void_at: null|int}&\Stripe\StripeObject) $status_transitions
* @property int $transacted_at Time at which the transaction was transacted. Measured in seconds since the Unix epoch.
* @property string $transaction_refresh The token of the transaction refresh that last updated or created this transaction.
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
@ -31,12 +31,12 @@ class Transaction extends \Stripe\ApiResource
/**
* Returns a list of Financial Connections <code>Transaction</code> objects.
*
* @param null|array $params
* @param null|array{account: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, transacted_at?: array|int, transaction_refresh?: array{after: string}} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Transaction> of ApiResources
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\Transaction> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -51,9 +51,9 @@ class Transaction extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Transaction
*
* @return \Stripe\FinancialConnections\Transaction
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -29,9 +29,9 @@ namespace Stripe\Forwarding;
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $payment_method The PaymentMethod to insert into the forwarded request. Forwarding previously consumed PaymentMethods is allowed.
* @property string[] $replacements The field kinds to be replaced in the forwarded request.
* @property null|\Stripe\StripeObject $request_context Context about the request from Stripe's servers to the destination endpoint.
* @property null|\Stripe\StripeObject $request_details The request that was sent to the destination endpoint. We redact any sensitive fields.
* @property null|\Stripe\StripeObject $response_details The response that the destination endpoint returned to us. We redact any sensitive fields.
* @property null|(object{destination_duration: int, destination_ip_address: string}&\Stripe\StripeObject) $request_context Context about the request from Stripe's servers to the destination endpoint.
* @property null|(object{body: string, headers: (object{name: string, value: string}&\Stripe\StripeObject)[], http_method: string}&\Stripe\StripeObject) $request_details The request that was sent to the destination endpoint. We redact any sensitive fields.
* @property null|(object{body: string, headers: (object{name: string, value: string}&\Stripe\StripeObject)[], status: int}&\Stripe\StripeObject) $response_details The response that the destination endpoint returned to us. We redact any sensitive fields.
* @property null|string $url The destination URL for the forwarded request. Must be supported by the config.
*/
class Request extends \Stripe\ApiResource
@ -41,12 +41,12 @@ class Request extends \Stripe\ApiResource
/**
* Creates a ForwardingRequest object.
*
* @param null|array $params
* @param null|array{expand?: string[], metadata?: \Stripe\StripeObject, payment_method: string, replacements: string[], request: array{body?: string, headers?: array{name: string, value: string}[]}, url: string} $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Request the created resource
*
* @return \Stripe\Forwarding\Request the created resource
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
@ -63,12 +63,12 @@ class Request extends \Stripe\ApiResource
/**
* Lists all ForwardingRequest objects.
*
* @param null|array $params
* @param null|array{created?: array{gt?: int, gte?: int, lt?: int, lte?: int}, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return \Stripe\Collection<Request> of ApiResources
*
* @return \Stripe\Collection<\Stripe\Forwarding\Request> of ApiResources
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function all($params = null, $opts = null)
{
@ -83,9 +83,9 @@ class Request extends \Stripe\ApiResource
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
* @return Request
*
* @return \Stripe\Forwarding\Request
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function retrieve($id, $opts = null)
{

View file

@ -12,7 +12,7 @@ namespace Stripe;
* Related guide: <a href="https://stripe.com/docs/payments/customer-balance/funding-instructions">Customer balance funding instructions</a>.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $bank_transfer
* @property (object{country: string, financial_addresses: ((object{aba?: (object{account_holder_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), account_holder_name: string, account_number: string, account_type: string, bank_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), bank_name: string, routing_number: string}&StripeObject), iban?: (object{account_holder_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), account_holder_name: string, bank_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), bic: string, country: string, iban: string}&StripeObject), sort_code?: (object{account_holder_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), account_holder_name: string, account_number: string, bank_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), sort_code: string}&StripeObject), spei?: (object{account_holder_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), account_holder_name: string, bank_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), bank_code: string, bank_name: string, clabe: string}&StripeObject), supported_networks?: string[], swift?: (object{account_holder_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), account_holder_name: string, account_number: string, account_type: string, bank_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), bank_name: string, swift_code: string}&StripeObject), type: string, zengin?: (object{account_holder_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), account_holder_name: null|string, account_number: null|string, account_type: null|string, bank_address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&StripeObject), bank_code: null|string, bank_name: null|string, branch_code: null|string, branch_name: null|string}&StripeObject)}&StripeObject))[], type: string}&StripeObject) $bank_transfer
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string $funding_type The <code>funding_type</code> of the returned instructions
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.

View file

@ -12,12 +12,13 @@ interface ClientInterface
* @param bool $hasFile Whether or not $params references a file (via an @ prefix or
* CURLFile)
* @param 'v1'|'v2' $apiMode Specifies if this is a v1 or v2 request
*
* @throws \Stripe\Exception\ApiConnectionException
* @throws \Stripe\Exception\UnexpectedValueException
* @param null|int $maxNetworkRetries
*
* @return array an array whose first element is raw request body, second
* element is HTTP status code and third array of HTTP headers
*
* @throws \Stripe\Exception\ApiConnectionException
* @throws \Stripe\Exception\UnexpectedValueException
*/
public function request($method, $absUrl, $headers, $params, $hasFile, $apiMode = 'v1');
public function request($method, $absUrl, $headers, $params, $hasFile, $apiMode = 'v1', $maxNetworkRetries = null);
}

View file

@ -39,7 +39,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
protected $defaultOptions;
/** @var \Stripe\Util\RandomGenerator */
/** @var Util\RandomGenerator */
protected $randomGenerator;
protected $userAgentInfo;
@ -64,7 +64,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
* throw an exception if $defaultOptions returns a non-array value.
*
* @param null|array|callable $defaultOptions
* @param null|\Stripe\Util\RandomGenerator $randomGenerator
* @param null|Util\RandomGenerator $randomGenerator
*/
public function __construct($defaultOptions = null, $randomGenerator = null)
{
@ -340,11 +340,12 @@ class CurlClient implements ClientInterface, StreamingClientInterface
* @param array $params
* @param bool $hasFile
* @param 'v1'|'v2' $apiMode
* @param null|int $maxNetworkRetries
*/
public function request($method, $absUrl, $headers, $params, $hasFile, $apiMode = 'v1')
public function request($method, $absUrl, $headers, $params, $hasFile, $apiMode = 'v1', $maxNetworkRetries = null)
{
list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile, $apiMode);
list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl);
list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl, $maxNetworkRetries);
return [$rbody, $rcode, $rheaders];
}
@ -357,12 +358,13 @@ class CurlClient implements ClientInterface, StreamingClientInterface
* @param bool $hasFile
* @param callable $readBodyChunk
* @param 'v1'|'v2' $apiMode
* @param null|int $maxNetworkRetries
*/
public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk, $apiMode = 'v1')
public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk, $apiMode = 'v1', $maxNetworkRetries = null)
{
list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile, $apiMode);
$opts[\CURLOPT_RETURNTRANSFER] = false;
list($rbody, $rcode, $rheaders) = $this->executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk);
list($rbody, $rcode, $rheaders) = $this->executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk, $maxNetworkRetries);
return [$rbody, $rcode, $rheaders];
}
@ -388,12 +390,12 @@ class CurlClient implements ClientInterface, StreamingClientInterface
private function useHeadersToDetermineWriteCallback($opts, $determineWriteCallback)
{
$rheaders = new Util\CaseInsensitiveArray();
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
$headerCallback = static function ($curl, $header_line) use (&$rheaders) {
return self::parseLineIntoHeaderArray($header_line, $rheaders);
};
$writeCallback = null;
$writeCallbackWrapper = function ($curl, $data) use (&$writeCallback, &$rheaders, &$determineWriteCallback) {
$writeCallbackWrapper = static function ($curl, $data) use (&$writeCallback, &$rheaders, &$determineWriteCallback) {
if (null === $writeCallback) {
$writeCallback = \call_user_func_array($determineWriteCallback, [$rheaders]);
}
@ -426,10 +428,11 @@ class CurlClient implements ClientInterface, StreamingClientInterface
* @param array $opts cURL options
* @param string $absUrl
* @param callable $readBodyChunk
* @param null|int $maxNetworkRetries
*
* @return array
*/
public function executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk)
public function executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk, $maxNetworkRetries = null)
{
/** @var bool */
$shouldRetry = false;
@ -452,7 +455,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
$errno = null;
$message = null;
$determineWriteCallback = function ($rheaders) use (&$readBodyChunk, &$shouldRetry, &$rbody, &$numRetries, &$rcode, &$lastRHeaders, &$errno) {
$determineWriteCallback = function ($rheaders) use (&$readBodyChunk, &$shouldRetry, &$rbody, &$numRetries, &$rcode, &$lastRHeaders, &$errno, &$maxNetworkRetries) {
$lastRHeaders = $rheaders;
$errno = \curl_errno($this->curlHandle);
@ -462,7 +465,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
if ($rcode < 300) {
$rbody = null;
return function ($curl, $data) use (&$readBodyChunk) {
return static function ($curl, $data) use (&$readBodyChunk) {
// Don't expose the $curl handle to the user, and don't require them to
// return the length of $data.
\call_user_func_array($readBodyChunk, [$data]);
@ -471,11 +474,11 @@ class CurlClient implements ClientInterface, StreamingClientInterface
};
}
$shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries);
$shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries, $maxNetworkRetries);
// Discard the body from an unsuccessful request that should be retried.
if ($shouldRetry) {
return function ($curl, $data) {
return static function ($curl, $data) {
return \strlen($data);
};
} else {
@ -483,7 +486,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
// which exception to throw to the user.
$rbody = '';
return function ($curl, $data) use (&$rbody) {
return static function ($curl, $data) use (&$rbody) {
$rbody .= $data;
return \strlen($data);
@ -535,8 +538,9 @@ class CurlClient implements ClientInterface, StreamingClientInterface
/**
* @param array $opts cURL options
* @param string $absUrl
* @param null|int $maxNetworkRetries
*/
public function executeRequestWithRetries($opts, $absUrl)
public function executeRequestWithRetries($opts, $absUrl, $maxNetworkRetries = null)
{
$numRetries = 0;
@ -547,7 +551,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
// Create a callback to capture HTTP headers for the response
$rheaders = new Util\CaseInsensitiveArray();
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
$headerCallback = static function ($curl, $header_line) use (&$rheaders) {
return CurlClient::parseLineIntoHeaderArray($header_line, $rheaders);
};
$opts[\CURLOPT_HEADERFUNCTION] = $headerCallback;
@ -566,7 +570,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
$this->closeCurlHandle();
}
$shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries);
$shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries, $maxNetworkRetries);
if (\is_callable($this->getRequestStatusCallback())) {
\call_user_func_array(
@ -643,14 +647,20 @@ class CurlClient implements ClientInterface, StreamingClientInterface
*
* @param int $errno
* @param int $rcode
* @param array|\Stripe\Util\CaseInsensitiveArray $rheaders
* @param array|Util\CaseInsensitiveArray $rheaders
* @param int $numRetries
* @param null|int $maxNetworkRetries
*
* @return bool
*/
private function shouldRetry($errno, $rcode, $rheaders, $numRetries)
private function shouldRetry($errno, $rcode, $rheaders, $numRetries, $maxNetworkRetries)
{
if ($numRetries >= Stripe::getMaxNetworkRetries()) {
if (null === $maxNetworkRetries) {
// all calls from a StripeClient have a number here, so we only see `null` (and use the global configuration) if coming from a non-client call.
$maxNetworkRetries = Stripe::getMaxNetworkRetries();
}
if ($numRetries >= $maxNetworkRetries) {
return false;
}
@ -698,7 +708,7 @@ class CurlClient implements ClientInterface, StreamingClientInterface
* Provides the number of seconds to wait before retrying a request.
*
* @param int $numRetries
* @param array|\Stripe\Util\CaseInsensitiveArray $rheaders
* @param array|Util\CaseInsensitiveArray $rheaders
*
* @return int
*/

Some files were not shown because too many files have changed in this diff Show more