updated plugin Easy Digital Downloads version 3.1.1.2

This commit is contained in:
2023-03-17 22:34:04 +00:00
committed by Gitium
parent e8a66564bd
commit 19e086d1c4
647 changed files with 20986 additions and 27305 deletions

View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInita1abe13511edc0d0d2f910910593934f::getLoader();
return ComposerAutoloaderInit52360df2f3d60779e5a0ff48f14462b7::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita1abe13511edc0d0d2f910910593934f
class ComposerAutoloaderInit52360df2f3d60779e5a0ff48f14462b7
{
private static $loader;
@ -22,12 +22,12 @@ class ComposerAutoloaderInita1abe13511edc0d0d2f910910593934f
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInita1abe13511edc0d0d2f910910593934f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit52360df2f3d60779e5a0ff48f14462b7', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInita1abe13511edc0d0d2f910910593934f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit52360df2f3d60779e5a0ff48f14462b7', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInita1abe13511edc0d0d2f910910593934f::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit52360df2f3d60779e5a0ff48f14462b7::getInitializer($loader));
$loader->register(true);

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInita1abe13511edc0d0d2f910910593934f
class ComposerStaticInit52360df2f3d60779e5a0ff48f14462b7
{
public static $prefixLengthsPsr4 = array (
'S' =>
@ -27,9 +27,9 @@ class ComposerStaticInita1abe13511edc0d0d2f910910593934f
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita1abe13511edc0d0d2f910910593934f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita1abe13511edc0d0d2f910910593934f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita1abe13511edc0d0d2f910910593934f::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit52360df2f3d60779e5a0ff48f14462b7::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit52360df2f3d60779e5a0ff48f14462b7::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit52360df2f3d60779e5a0ff48f14462b7::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2,17 +2,17 @@
"packages": [
{
"name": "stripe/stripe-php",
"version": "v7.47.0",
"version_normalized": "7.47.0.0",
"version": "v7.128.0",
"version_normalized": "7.128.0.0",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "b51656cb398d081fcee53a76f6edb8fd5c1a5306"
"reference": "c704949c49b72985c76cc61063aa26fefbd2724e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/b51656cb398d081fcee53a76f6edb8fd5c1a5306",
"reference": "b51656cb398d081fcee53a76f6edb8fd5c1a5306",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/c704949c49b72985c76cc61063aa26fefbd2724e",
"reference": "c704949c49b72985c76cc61063aa26fefbd2724e",
"shasum": ""
},
"require": {
@ -22,13 +22,12 @@
"php": ">=5.6.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.16.1",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4"
"friendsofphp/php-cs-fixer": "3.5.0",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^5.7 || ^9.0",
"squizlabs/php_codesniffer": "^3.3"
},
"time": "2020-08-13T22:35:56+00:00",
"time": "2022-05-05T17:18:02+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -60,7 +59,7 @@
],
"support": {
"issues": "https://github.com/stripe/stripe-php/issues",
"source": "https://github.com/stripe/stripe-php/tree/v7.47.0"
"source": "https://github.com/stripe/stripe-php/tree/v7.128.0"
},
"install-path": "../stripe/stripe-php"
}

View File

@ -3,7 +3,7 @@
'name' => 'easy-digital-downloads/edd-stripe',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '24964d034941e0d3d07390ecc39570bfc64e7369',
'reference' => 'a63eec57c1f5da47c09cc9cd8cf4162f8c65652a',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -13,16 +13,16 @@
'easy-digital-downloads/edd-stripe' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '24964d034941e0d3d07390ecc39570bfc64e7369',
'reference' => 'a63eec57c1f5da47c09cc9cd8cf4162f8c65652a',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'stripe/stripe-php' => array(
'pretty_version' => 'v7.47.0',
'version' => '7.47.0.0',
'reference' => 'b51656cb398d081fcee53a76f6edb8fd5c1a5306',
'pretty_version' => 'v7.128.0',
'version' => '7.128.0.0',
'reference' => 'c704949c49b72985c76cc61063aa26fefbd2724e',
'type' => 'library',
'install_path' => __DIR__ . '/../stripe/stripe-php',
'aliases' => array(),

View File

@ -1,5 +1,410 @@
# Changelog
## 7.128.0 - 2022-05-05
* [#1282](https://github.com/stripe/stripe-php/pull/1282) API Updates
* Add support for `default_price` on `Product`
* Add support for `instructions_email` on `Refund`
## 7.127.0 - 2022-05-05
* [#1281](https://github.com/stripe/stripe-php/pull/1281) API Updates
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
* [#1278](https://github.com/stripe/stripe-php/pull/1278) Pin setup-php action version.
* [#1277](https://github.com/stripe/stripe-php/pull/1277) API Updates
* Add support for `registered_address` on `Person`
## 7.126.0 - 2022-05-03
* [#1276](https://github.com/stripe/stripe-php/pull/1276) API Updates
* Add support for new resource `CashBalance`
* Change type of `BillingPortal.Configuration.application` from `$Application` to `deletable($Application)`
* Add support for `cash_balance` on `Customer`
* Add support for `application` on `Invoice`, `Quote`, `SubscriptionSchedule`, and `Subscription`
* Add support for new value `eu_oss_vat` on enum `TaxId.type`
* [#1274](https://github.com/stripe/stripe-php/pull/1274) Fix PHPDoc on Discount for nullable properties
* [#1272](https://github.com/stripe/stripe-php/pull/1272) Allow users to pass a custom IPRESOLVE cURL option.
## 7.125.0 - 2022-04-21
* [#1270](https://github.com/stripe/stripe-php/pull/1270) API Updates
* Add support for `expire` test helper method on resource `Refund`
## 7.124.0 - 2022-04-18
* [#1265](https://github.com/stripe/stripe-php/pull/1265) API Updates
* Add support for new resources `FundingInstructions` and `Terminal.Configuration`
* Add support for `create_funding_instructions` method on resource `Customer`
* Add support for `amount_details` on `PaymentIntent`
* Add support for `customer_balance` on `PaymentMethod`
* Add support for new value `customer_balance` on enum `PaymentMethod.type`
* Add support for `configuration_overrides` on `Terminal.Location`
## 7.123.0 - 2022-04-13
* [#1263](https://github.com/stripe/stripe-php/pull/1263) API Updates
* Add support for `increment_authorization` method on resource `PaymentIntent`
* [#1262](https://github.com/stripe/stripe-php/pull/1262) Add support for updating the version of the repo
* [#1230](https://github.com/stripe/stripe-php/pull/1230) Add PHPDoc return types
* [#1242](https://github.com/stripe/stripe-php/pull/1242) Fix some PHPDoc in tests
## 7.122.0 - 2022-04-08
* [#1261](https://github.com/stripe/stripe-php/pull/1261) API Updates
* Add support for `apply_customer_balance` method on resource `PaymentIntent`
* [#1259](https://github.com/stripe/stripe-php/pull/1259) API Updates
* Add `payment_intent.partially_funded`, `terminal.reader.action_failed`, and `terminal.reader.action_succeeded` events.
## 7.121.0 - 2022-03-30
* [#1258](https://github.com/stripe/stripe-php/pull/1258) API Updates
* Add support for `cancel_action`, `process_payment_intent`, `process_setup_intent`, and `set_reader_display` methods on resource `Terminal.Reader`
* Add support for `action` on `Terminal.Reader`
## 7.120.0 - 2022-03-29
* [#1257](https://github.com/stripe/stripe-php/pull/1257) API Updates
* Add support for Search API
* Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
## 7.119.0 - 2022-03-25
* [#1256](https://github.com/stripe/stripe-php/pull/1256) API Updates
* Add support for PayNow and US Bank Accounts Debits payments
* Add support for `paynow` and `us_bank_account` on `PaymentMethod`
* Add support for new values `paynow` and `us_bank_account` on enum `PaymentMethod.type`
* Add support for `failure_balance_transaction` on `Charge`
## 7.118.0 - 2022-03-23
* [#1255](https://github.com/stripe/stripe-php/pull/1255) API Updates
* Add support for `cancel` method on resource `Refund`
* Add support for new values `bg_uic`, `hu_tin`, and `si_tin` on enum `TaxId.type`
* Add `test_helpers.test_clock.advancing`, `test_helpers.test_clock.created`, `test_helpers.test_clock.deleted`, `test_helpers.test_clock.internal_failure`, and `test_helpers.test_clock.ready` events.
## 7.117.0 - 2022-03-18
* [#1254](https://github.com/stripe/stripe-php/pull/1254) API Updates
* Add support for `status` on `Card`
* [#1251](https://github.com/stripe/stripe-php/pull/1251) Add support for SearchResult objects.
* [#1249](https://github.com/stripe/stripe-php/pull/1249) Add missing constant for payment_behavior
## 7.116.0 - 2022-03-02
* [#1248](https://github.com/stripe/stripe-php/pull/1248) API Updates
* Add support for `proration_details` on `InvoiceLineItem`
## 7.115.0 - 2022-03-01
* [#1245](https://github.com/stripe/stripe-php/pull/1245) [#1247](https://github.com/stripe/stripe-php/pull/1247) API Updates
* Add support for new resource `TestHelpers.TestClock`
* Add support for `test_clock` on `Customer`, `Invoice`, `InvoiceItem`, `Quote`, `Subscription`, and `SubscriptionSchedule`
* Add support for `next_action` on `Refund`
* Add support for `konbini` on `PaymentMethod`
* [#1244](https://github.com/stripe/stripe-php/pull/1244) API Updates
* Add support for new values `bbpos_wisepad3` and `stripe_m2` on enum `Terminal.Reader.device_type`
## 7.114.0 - 2022-02-15
* [#1243](https://github.com/stripe/stripe-php/pull/1243) Add test
* [#1240](https://github.com/stripe/stripe-php/pull/1240) API Updates
* Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent`
* [#1241](https://github.com/stripe/stripe-php/pull/1241) Add generic parameter to \Stripe\Collection usages
## 7.113.0 - 2022-02-03
* [#1239](https://github.com/stripe/stripe-php/pull/1239) API Updates
* Add `REASON_EXPIRED_UNCAPTURED_CHARGE` enum value on `Refund`.
## 7.112.0 - 2022-01-25
* [#1235](https://github.com/stripe/stripe-php/pull/1235) API Updates
* Add support for `phone_number_collection` on `PaymentLink`
* Add support for new value `is_vat` on enum `TaxId.type`
## 7.111.0 - 2022-01-20
* [#1233](https://github.com/stripe/stripe-php/pull/1233) API Updates
* Add support for new resource `PaymentLink`
* Add support for `payment_link` on `Checkout.Session`
## 7.110.0 - 2022-01-13
* [#1232](https://github.com/stripe/stripe-php/pull/1232) API Updates
* Add support for `paid_out_of_band` on `Invoice`
## 7.109.0 - 2022-01-12
* [#1231](https://github.com/stripe/stripe-php/pull/1231) API Updates
* Add support for `customer_creation` on `Checkout.Session`
* [#1227](https://github.com/stripe/stripe-php/pull/1227) Update docs URLs
## 7.108.0 - 2021-12-22
* [#1226](https://github.com/stripe/stripe-php/pull/1226) Upgrade php-cs-fixer to 3.4.0.
* [#1222](https://github.com/stripe/stripe-php/pull/1222) API Updates
* Add support for `processing` on `PaymentIntent`
* [#1220](https://github.com/stripe/stripe-php/pull/1220) API Updates
## 7.107.0 - 2021-12-09
* [#1219](https://github.com/stripe/stripe-php/pull/1219) API Updates
* Add support for `metadata` on `BillingPortal.Configuration`
* Add support for `wallets` on `Issuing.Card`
## 7.106.0 - 2021-12-09
* [#1218](https://github.com/stripe/stripe-php/pull/1218) API Updates
* Add support for new values `ge_vat` and `ua_vat` on enum `TaxId.type`
* [#1216](https://github.com/stripe/stripe-php/pull/1216) Fix namespaced classes in @return PHPDoc.
* [#1214](https://github.com/stripe/stripe-php/pull/1214) Announce PHP8 support in CHANGELOG.md
## 7.105.0 - 2021-12-06
* [#1213](https://github.com/stripe/stripe-php/pull/1213) PHP 8.1 missing ReturnTypeWillChange annotations.
* As of this version, PHP 8.1 is officially supported.
## 7.104.0 - 2021-12-01
* [#1211](https://github.com/stripe/stripe-php/pull/1211) PHPStan compatibility with PHP8.x
* [#1209](https://github.com/stripe/stripe-php/pull/1209) PHPUnit compatibility with PHP 8.x
## 7.103.0 - 2021-11-19
* [#1206](https://github.com/stripe/stripe-php/pull/1206) API Updates
* Add support for new value `jct` on enum `TaxRate.tax_type`
## 7.102.0 - 2021-11-17
* [#1205](https://github.com/stripe/stripe-php/pull/1205) API Updates
* Add support for `automatic_payment_methods` on `PaymentIntent`
## 7.101.0 - 2021-11-16
* [#1203](https://github.com/stripe/stripe-php/pull/1203) API Updates
* Add support for new resource `ShippingRate`
* Add support for `shipping_options` and `shipping_rate` on `Checkout.Session`
* Add support for `expire` method on resource `Checkout.Session`
* Add support for `status` on `Checkout.Session`
## 7.100.0 - 2021-10-11
* [#1190](https://github.com/stripe/stripe-php/pull/1190) API Updates
* Add support for `klarna` on `PaymentMethod`.
## 7.99.0 - 2021-10-11
* [#1188](https://github.com/stripe/stripe-php/pull/1188) API Updates
* Add support for `list_payment_methods` method on resource `Customer`
## 7.98.0 - 2021-10-07
* [#1187](https://github.com/stripe/stripe-php/pull/1187) API Updates
* Add support for `phone_number_collection` on `Checkout.Session`
* Add support for new value `customer_id` on enum `Radar.ValueList.item_type`
* Add support for new value `bbpos_wisepos_e` on enum `Terminal.Reader.device_type`
## 7.97.0 - 2021-09-16
* [#1181](https://github.com/stripe/stripe-php/pull/1181) API Updates
* Add support for `full_name_aliases` on `Person`
## 7.96.0 - 2021-09-15
* [#1178](https://github.com/stripe/stripe-php/pull/1178) API Updates
* Add support for livemode on Reporting.ReportType
* Add support for new value `rst` on enum `TaxRate.tax_type`
## 7.95.0 - 2021-09-01
* [#1177](https://github.com/stripe/stripe-php/pull/1177) API Updates
* Add support for `future_requirements` on `Account`, `Capability`, and `Person`
* Add support for `after_expiration`, `consent`, `consent_collection`, `expires_at`, and `recovered_from` on `Checkout.Session`
## 7.94.0 - 2021-08-19
* [#1173](https://github.com/stripe/stripe-php/pull/1173) API Updates
* Add support for new value `fil` on enum `Checkout.Session.locale`
* Add support for new value `au_arn` on enum `TaxId.type`
## 7.93.0 - 2021-08-11
* [#1172](https://github.com/stripe/stripe-php/pull/1172) API Updates
* Add support for `locale` on `BillingPortal.Session`
* [#1171](https://github.com/stripe/stripe-php/pull/1171) Fix typo in docblock `CurlClient::executeStreamingRequestWithRetries`
## 7.92.0 - 2021-07-28
* [#1167](https://github.com/stripe/stripe-php/pull/1167) API Updates
* Add support for `account_type` on `BankAccount`
* Add support for new value `redacted` on enum `Review.closed_reason`
## 7.91.0 - 2021-07-22
* [#1164](https://github.com/stripe/stripe-php/pull/1164) API Updates
* Add support for new values `hr`, `ko`, and `vi` on enum `Checkout.Session.locale`
* Add support for `payment_settings` on `Subscription`
## 7.90.0 - 2021-07-20
* [#1163](https://github.com/stripe/stripe-php/pull/1163) API Updates
* Add support for `wallet` on `Issuing.Transaction`
* [#1160](https://github.com/stripe/stripe-php/pull/1160) Remove unused API error types from docs.
## 7.89.0 - 2021-07-14
* [#1158](https://github.com/stripe/stripe-php/pull/1158) API Updates
* Add support for `list_computed_upfront_line_items` method on resource `Quote`
* [#1157](https://github.com/stripe/stripe-php/pull/1157) Improve readme for old PHP versions
## 7.88.0 - 2021-07-09
* [#1152](https://github.com/stripe/stripe-php/pull/1152) API Updates
* Add support for new resource `Quote`
* Add support for `quote` on `Invoice`
* Add support for new value `quote_accept` on enum `Invoice.billing_reason`
* [#1155](https://github.com/stripe/stripe-php/pull/1155) Add streaming methods to Service infra
* Add support for `setStreamingHttpClient` and `streamingHttpClient` to `ApiRequestor`
* Add support for `getStreamingClient` and `requestStream` to `AbstractService`
* Add support for `requestStream` to `BaseStripeClient`
* `\Stripe\RequestOptions::parse` now clones its input if it is already a `RequestOptions` object, to prevent accidental mutation.
* [#1151](https://github.com/stripe/stripe-php/pull/1151) Add `mode` constants into Checkout\Session
## 7.87.0 - 2021-06-30
* [#1149](https://github.com/stripe/stripe-php/pull/1149) API Updates
* Add support for `wechat_pay` on `PaymentMethod`
* [#1143](https://github.com/stripe/stripe-php/pull/1143) Streaming requests
* [#1138](https://github.com/stripe/stripe-php/pull/1138) Deprecate travis
## 7.86.0 - 2021-06-25
* [#1145](https://github.com/stripe/stripe-php/pull/1145) API Updates
* Add support for `boleto` on `PaymentMethod`.
* Add support for `il_vat` as a member of the `TaxID.Type` enum.
## 7.85.0 - 2021-06-18
* [#1142](https://github.com/stripe/stripe-php/pull/1142) API Updates
* Add support for new TaxId types: `ca_pst_mb`, `ca_pst_bc`, `ca_gst_hst`, and `ca_pst_sk`.
## 7.84.0 - 2021-06-16
* [#1141](https://github.com/stripe/stripe-php/pull/1141) Update PHPDocs
* Add support for `url` on `Checkout\Session`
## 7.83.0 - 2021-06-07
* [#1140](https://github.com/stripe/stripe-php/pull/1140) API Updates
* Added support for `tax_id_collection` on `Checkout\Session` and `Checkout\Session#create`
* Update `Location` to be expandable on `Terminal\Reader`
## 7.82.0 - 2021-06-04
* [#1136](https://github.com/stripe/stripe-php/pull/1136) Update PHPDocs
* Add support for `controller` on `Account`.
## 7.81.0 - 2021-06-04
* [#1135](https://github.com/stripe/stripe-php/pull/1135) API Updates
* Add support for new resource `TaxCode`
* Add support for `automatic_tax` `Invoice` and`Checkout.Session`.
* Add support for `tax_behavior` on `Price`
* Add support for `tax_code` on `Product`
* Add support for `tax` on `Customer`
* Add support for `tax_type` enum on `TaxRate`
## 7.80.0 - 2021-05-26
* [#1130](https://github.com/stripe/stripe-php/pull/1130) Update PHPDocs
## 7.79.0 - 2021-05-19
* [#1126](https://github.com/stripe/stripe-php/pull/1126) API Updates
* Added support for new resource `Identity.VerificationReport`
* Added support for new resource `Identity.VerificationSession`
* `File#list.purpose` and `File.purpose` added new enum members: `identity_document_downloadable` and `selfie`.
## 7.78.0 - 2021-05-05
* [#1120](https://github.com/stripe/stripe-php/pull/1120) Update PHPDocs
* Add support for `Radar.EarlyFraudWarning.payment_intent`
## 7.77.0 - 2021-04-12
* [#1110](https://github.com/stripe/stripe-php/pull/1110) Update PHPDocs
* Add support for `acss_debit` on `PaymentMethod`
* Add support for `payment_method_options` on `Checkout\Session`
* [#1107](https://github.com/stripe/stripe-php/pull/1107) Remove duplicate object phpdoc
## 7.76.0 - 2021-03-22
* [#1100](https://github.com/stripe/stripe-php/pull/1100) Update PHPDocs
* Added support for `amount_shipping` on `Checkout.Session.total_details`
* [#1088](https://github.com/stripe/stripe-php/pull/1088) Make possibility to extend CurlClient
## 7.75.0 - 2021-02-22
* [#1094](https://github.com/stripe/stripe-php/pull/1094) Add support for Billing Portal Configuration API
## 7.74.0 - 2021-02-17
* [#1093](https://github.com/stripe/stripe-php/pull/1093) Update PHPDocs
* Add support for on_behalf_of to Invoice
## 7.73.0 - 2021-02-16
* [#1091](https://github.com/stripe/stripe-php/pull/1091) Update PHPDocs
* Add support for `afterpay_clearpay` on `PaymentMethod`.
## 7.72.0 - 2021-02-08
* [#1089](https://github.com/stripe/stripe-php/pull/1089) Update PHPDocs
* Add support for `afterpay_clearpay_payments` on `Account.capabilities`
* Add support for `payment_settings` on `Invoice`
## 7.71.0 - 2021-02-05
* [#1087](https://github.com/stripe/stripe-php/pull/1087) Update PHPDocs
* [#1086](https://github.com/stripe/stripe-php/pull/1086) Update CA cert bundle URL
## 7.70.0 - 2021-02-03
* [#1085](https://github.com/stripe/stripe-php/pull/1085) Update PHPDocs
* Add support for `nationality` on `Person`
* Add member `gb_vat` of `TaxID` enum
## 7.69.0 - 2021-01-21
* [#1079](https://github.com/stripe/stripe-php/pull/1079) Update PHPDocs
## 7.68.0 - 2021-01-14
* [#1063](https://github.com/stripe/stripe-php/pull/1063) Multiple API changes
* [#1061](https://github.com/stripe/stripe-php/pull/1061) Bump phpDocumentor to 3.0.0
## 7.67.0 - 2020-12-09
* [#1060](https://github.com/stripe/stripe-php/pull/1060) Improve PHPDocs for `Discount`
* [#1059](https://github.com/stripe/stripe-php/pull/1059) Upgrade PHPStan to 0.12.59
* [#1057](https://github.com/stripe/stripe-php/pull/1057) Bump PHP-CS-Fixer and update code
## 7.66.1 - 2020-12-01
* [#1054](https://github.com/stripe/stripe-php/pull/1054) Improve error message for invalid keys in StripeClient
## 7.66.0 - 2020-11-24
* [#1053](https://github.com/stripe/stripe-php/pull/1053) Update PHPDocs
## 7.65.0 - 2020-11-19
* [#1050](https://github.com/stripe/stripe-php/pull/1050) Added constants for `proration_behavior` on `Subscription`
## 7.64.0 - 2020-11-18
* [#1049](https://github.com/stripe/stripe-php/pull/1049) Update PHPDocs
## 7.63.0 - 2020-11-17
* [#1048](https://github.com/stripe/stripe-php/pull/1048) Update PHPDocs
* [#1046](https://github.com/stripe/stripe-php/pull/1046) Force IPv4 resolving
## 7.62.0 - 2020-11-09
* [#1041](https://github.com/stripe/stripe-php/pull/1041) Add missing constants on `Event`
* [#1038](https://github.com/stripe/stripe-php/pull/1038) Update PHPDocs
## 7.61.0 - 2020-10-20
* [#1030](https://github.com/stripe/stripe-php/pull/1030) Add support for `jp_rn` and `ru_kpp` as a `type` on `TaxId`
## 7.60.0 - 2020-10-15
* [#1027](https://github.com/stripe/stripe-php/pull/1027) Warn if opts are in params
## 7.58.0 - 2020-10-14
* [#1026](https://github.com/stripe/stripe-php/pull/1026) Add support for the Payout Reverse API
## 7.57.0 - 2020-09-29
* [#1020](https://github.com/stripe/stripe-php/pull/1020) Add support for the `SetupAttempt` resource and List API
## 7.56.0 - 2020-09-25
* [#1019](https://github.com/stripe/stripe-php/pull/1019) Update PHPDocs
## 7.55.0 - 2020-09-24
* [#1018](https://github.com/stripe/stripe-php/pull/1018) Multiple API changes
* Updated PHPDocs
* Added `TYPE_CONTRIBUTION` as a constant on `BalanceTransaction`
## 7.54.0 - 2020-09-23
* [#1017](https://github.com/stripe/stripe-php/pull/1017) Updated PHPDoc
## 7.53.1 - 2020-09-22
* [#1015](https://github.com/stripe/stripe-php/pull/1015) Bugfix: don't error on systems with php_uname in disablefunctions with whitespace
## 7.53.0 - 2020-09-21
* [#1016](https://github.com/stripe/stripe-php/pull/1016) Updated PHPDocs
## 7.52.0 - 2020-09-08
* [#1010](https://github.com/stripe/stripe-php/pull/1010) Update PHPDocs
## 7.51.0 - 2020-09-02
* [#1007](https://github.com/stripe/stripe-php/pull/1007) Multiple API changes
* Add support for the Issuing Dispute Submit API
* Add constants for `payment_status` on Checkout `Session`
* [#1003](https://github.com/stripe/stripe-php/pull/1003) Add trim to getSignatures to allow for leading whitespace.
## 7.50.0 - 2020-08-28
* [#1005](https://github.com/stripe/stripe-php/pull/1005) Updated PHPDocs
## 7.49.0 - 2020-08-19
* [#998](https://github.com/stripe/stripe-php/pull/998) PHPDocs updated
## 7.48.0 - 2020-08-17
* [#997](https://github.com/stripe/stripe-php/pull/997) PHPDocs updated
* [#996](https://github.com/stripe/stripe-php/pull/996) Fixing telemetry
## 7.47.0 - 2020-08-13
* [#994](https://github.com/stripe/stripe-php/pull/994) Nullable balance_transactions on issuing disputes
* [#991](https://github.com/stripe/stripe-php/pull/991) Fix invalid return types in OAuthService

View File

@ -1,13 +1,8 @@
export PHPDOCUMENTOR_VERSION := v3.0.0-rc
export PHPSTAN_VERSION := 0.12.18
export PHPDOCUMENTOR_VERSION := v3.0.0
vendor: composer.json
composer install
vendor/bin/phpstan: vendor
curl -sfL https://github.com/phpstan/phpstan/releases/download/$(PHPSTAN_VERSION)/phpstan.phar -o vendor/bin/phpstan
chmod +x vendor/bin/phpstan
vendor/bin/phpdoc: vendor
curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc
chmod +x vendor/bin/phpdoc
@ -27,10 +22,18 @@ fmtcheck: vendor
phpdoc: vendor/bin/phpdoc
vendor/bin/phpdoc
phpstan: vendor/bin/phpstan
phpstan: vendor
php -d memory_limit=512M vendor/bin/phpstan analyse lib tests
.PHONY: phpstan
phpstan-baseline: vendor/bin/phpstan
php -d memory_limit=512M vendor/bin/phpstan analyse lib tests --generate-baseline
.PHONY: phpstan-baseline
update-version:
@echo "$(VERSION)" > VERSION
@perl -pi -e 's|VERSION = '\''[.\d]+'\''|VERSION = '\''$(VERSION)'\''|' lib/Stripe.php
.PHONY: update-version
codegen-format: fmt
.PHONY: codegen-format

View File

@ -4,7 +4,6 @@
[![Latest Stable Version](https://poser.pugx.org/stripe/stripe-php/v/stable.svg)](https://packagist.org/packages/stripe/stripe-php)
[![Total Downloads](https://poser.pugx.org/stripe/stripe-php/downloads.svg)](https://packagist.org/packages/stripe/stripe-php)
[![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php)
[![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master)
The Stripe PHP library provides convenient access to the Stripe API from
applications written in the PHP language. It includes a pre-defined set of
@ -68,21 +67,25 @@ You can continue to use the legacy integration patterns used prior to version [7
## Documentation
See the [PHP API docs](https://stripe.com/docs/api/php#intro).
See the [PHP API docs](https://stripe.com/docs/api/?lang=php#intro).
See [video demonstrations][youtube-playlist] covering how to use the library.
## Legacy Version Support
### PHP 5.4 & 5.5
If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
If you are using PHP 5.4 or 5.5, you should consider upgrading your environment as those versions have been past end of life since September 2015 and July 2016 respectively.
Otherwise, you can still use Stripe by downloading stripe-php v6.43.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.43.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/6.43.1.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will work but might not support recent features we added since the version was released and upgrading PHP is the best course of action.
### PHP 5.3
If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
If you are using PHP 5.3, you should upgrade your environment as this version has been past end of life since August 2014.
Otherwise, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
## Custom Request Timeouts
_NOTE:_ We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.
_NOTE:_ We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/?lang=php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.
To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.
@ -228,7 +231,7 @@ Install dependencies as mentioned above (which will resolve [PHPUnit](http://pac
Or to run an individual test file:
```bash
./vendor/bin/phpunit tests/UtilTest.php
./vendor/bin/phpunit tests/Stripe/UtilTest.php
```
Update bundled CA certificates from the [Mozilla cURL release][curl]:
@ -260,7 +263,8 @@ See the "SSL / TLS compatibility issues" paragraph above for full context. If yo
[composer]: https://getcomposer.org/
[connect]: https://stripe.com/connect
[curl]: http://curl.haxx.se/docs/caextract.html
[idempotency-keys]: https://stripe.com/docs/api/php#idempotent_requests
[idempotency-keys]: https://stripe.com/docs/api/?lang=php#idempotent_requests
[php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[psr3]: http://www.php-fig.org/psr/psr-3/
[stripe-mock]: https://github.com/stripe/stripe-mock
[youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M6cUbiHrfMkXxZ9j9SGBxFE

View File

@ -21,11 +21,10 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5.7 || ^9.0",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4",
"friendsofphp/php-cs-fixer": "2.16.1"
"friendsofphp/php-cs-fixer": "3.5.0",
"phpstan/phpstan": "^1.2"
},
"autoload": {
"psr-4": {

View File

@ -17,6 +17,7 @@ require __DIR__ . '/lib/Util/ObjectTypes.php';
// HttpClient
require __DIR__ . '/lib/HttpClient/ClientInterface.php';
require __DIR__ . '/lib/HttpClient/StreamingClientInterface.php';
require __DIR__ . '/lib/HttpClient/CurlClient.php';
// Exceptions
@ -53,6 +54,7 @@ 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/Update.php';
// Plumbing
@ -66,7 +68,9 @@ require __DIR__ . '/lib/Service/AbstractService.php';
require __DIR__ . '/lib/Service/AbstractServiceFactory.php';
// StripeClient
require __DIR__ . '/lib/BaseStripeClientInterface.php';
require __DIR__ . '/lib/StripeClientInterface.php';
require __DIR__ . '/lib/StripeStreamingClientInterface.php';
require __DIR__ . '/lib/BaseStripeClient.php';
require __DIR__ . '/lib/StripeClient.php';
@ -80,11 +84,13 @@ require __DIR__ . '/lib/ApplicationFeeRefund.php';
require __DIR__ . '/lib/Balance.php';
require __DIR__ . '/lib/BalanceTransaction.php';
require __DIR__ . '/lib/BankAccount.php';
require __DIR__ . '/lib/BillingPortal/Configuration.php';
require __DIR__ . '/lib/BillingPortal/Session.php';
require __DIR__ . '/lib/BitcoinReceiver.php';
require __DIR__ . '/lib/BitcoinTransaction.php';
require __DIR__ . '/lib/Capability.php';
require __DIR__ . '/lib/Card.php';
require __DIR__ . '/lib/CashBalance.php';
require __DIR__ . '/lib/Charge.php';
require __DIR__ . '/lib/Checkout/Session.php';
require __DIR__ . '/lib/Collection.php';
@ -102,6 +108,13 @@ require __DIR__ . '/lib/Event.php';
require __DIR__ . '/lib/ExchangeRate.php';
require __DIR__ . '/lib/File.php';
require __DIR__ . '/lib/FileLink.php';
require __DIR__ . '/lib/FinancialConnections/Account.php';
require __DIR__ . '/lib/FinancialConnections/AccountOwner.php';
require __DIR__ . '/lib/FinancialConnections/AccountOwnership.php';
require __DIR__ . '/lib/FinancialConnections/Session.php';
require __DIR__ . '/lib/FundingInstructions.php';
require __DIR__ . '/lib/Identity/VerificationReport.php';
require __DIR__ . '/lib/Identity/VerificationSession.php';
require __DIR__ . '/lib/Invoice.php';
require __DIR__ . '/lib/InvoiceItem.php';
require __DIR__ . '/lib/InvoiceLineItem.php';
@ -118,6 +131,7 @@ require __DIR__ . '/lib/Order.php';
require __DIR__ . '/lib/OrderItem.php';
require __DIR__ . '/lib/OrderReturn.php';
require __DIR__ . '/lib/PaymentIntent.php';
require __DIR__ . '/lib/PaymentLink.php';
require __DIR__ . '/lib/PaymentMethod.php';
require __DIR__ . '/lib/Payout.php';
require __DIR__ . '/lib/Person.php';
@ -125,6 +139,7 @@ require __DIR__ . '/lib/Plan.php';
require __DIR__ . '/lib/Price.php';
require __DIR__ . '/lib/Product.php';
require __DIR__ . '/lib/PromotionCode.php';
require __DIR__ . '/lib/Quote.php';
require __DIR__ . '/lib/Radar/EarlyFraudWarning.php';
require __DIR__ . '/lib/Radar/ValueList.php';
require __DIR__ . '/lib/Radar/ValueListItem.php';
@ -134,7 +149,10 @@ require __DIR__ . '/lib/Refund.php';
require __DIR__ . '/lib/Reporting/ReportRun.php';
require __DIR__ . '/lib/Reporting/ReportType.php';
require __DIR__ . '/lib/Review.php';
require __DIR__ . '/lib/SearchResult.php';
require __DIR__ . '/lib/SetupAttempt.php';
require __DIR__ . '/lib/SetupIntent.php';
require __DIR__ . '/lib/ShippingRate.php';
require __DIR__ . '/lib/Sigma/ScheduledQueryRun.php';
require __DIR__ . '/lib/SKU.php';
require __DIR__ . '/lib/Source.php';
@ -142,11 +160,14 @@ require __DIR__ . '/lib/SourceTransaction.php';
require __DIR__ . '/lib/Subscription.php';
require __DIR__ . '/lib/SubscriptionItem.php';
require __DIR__ . '/lib/SubscriptionSchedule.php';
require __DIR__ . '/lib/TaxCode.php';
require __DIR__ . '/lib/TaxId.php';
require __DIR__ . '/lib/TaxRate.php';
require __DIR__ . '/lib/Terminal/Configuration.php';
require __DIR__ . '/lib/Terminal/ConnectionToken.php';
require __DIR__ . '/lib/Terminal/Location.php';
require __DIR__ . '/lib/Terminal/Reader.php';
require __DIR__ . '/lib/TestHelpers/TestClock.php';
require __DIR__ . '/lib/ThreeDSecure.php';
require __DIR__ . '/lib/Token.php';
require __DIR__ . '/lib/Topup.php';
@ -163,6 +184,7 @@ require __DIR__ . '/lib/Service/ApplePayDomainService.php';
require __DIR__ . '/lib/Service/ApplicationFeeService.php';
require __DIR__ . '/lib/Service/BalanceService.php';
require __DIR__ . '/lib/Service/BalanceTransactionService.php';
require __DIR__ . '/lib/Service/BillingPortal/ConfigurationService.php';
require __DIR__ . '/lib/Service/BillingPortal/SessionService.php';
require __DIR__ . '/lib/Service/ChargeService.php';
require __DIR__ . '/lib/Service/Checkout/SessionService.php';
@ -176,6 +198,10 @@ require __DIR__ . '/lib/Service/EventService.php';
require __DIR__ . '/lib/Service/ExchangeRateService.php';
require __DIR__ . '/lib/Service/FileService.php';
require __DIR__ . '/lib/Service/FileLinkService.php';
require __DIR__ . '/lib/Service/FinancialConnections/AccountService.php';
require __DIR__ . '/lib/Service/FinancialConnections/SessionService.php';
require __DIR__ . '/lib/Service/Identity/VerificationReportService.php';
require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php';
require __DIR__ . '/lib/Service/InvoiceService.php';
require __DIR__ . '/lib/Service/InvoiceItemService.php';
require __DIR__ . '/lib/Service/Issuing/AuthorizationService.php';
@ -187,12 +213,14 @@ require __DIR__ . '/lib/Service/MandateService.php';
require __DIR__ . '/lib/Service/OrderService.php';
require __DIR__ . '/lib/Service/OrderReturnService.php';
require __DIR__ . '/lib/Service/PaymentIntentService.php';
require __DIR__ . '/lib/Service/PaymentLinkService.php';
require __DIR__ . '/lib/Service/PaymentMethodService.php';
require __DIR__ . '/lib/Service/PayoutService.php';
require __DIR__ . '/lib/Service/PlanService.php';
require __DIR__ . '/lib/Service/PriceService.php';
require __DIR__ . '/lib/Service/ProductService.php';
require __DIR__ . '/lib/Service/PromotionCodeService.php';
require __DIR__ . '/lib/Service/QuoteService.php';
require __DIR__ . '/lib/Service/Radar/EarlyFraudWarningService.php';
require __DIR__ . '/lib/Service/Radar/ValueListService.php';
require __DIR__ . '/lib/Service/Radar/ValueListItemService.php';
@ -200,31 +228,41 @@ require __DIR__ . '/lib/Service/RefundService.php';
require __DIR__ . '/lib/Service/Reporting/ReportRunService.php';
require __DIR__ . '/lib/Service/Reporting/ReportTypeService.php';
require __DIR__ . '/lib/Service/ReviewService.php';
require __DIR__ . '/lib/Service/SetupAttemptService.php';
require __DIR__ . '/lib/Service/SetupIntentService.php';
require __DIR__ . '/lib/Service/ShippingRateService.php';
require __DIR__ . '/lib/Service/Sigma/ScheduledQueryRunService.php';
require __DIR__ . '/lib/Service/SkuService.php';
require __DIR__ . '/lib/Service/SourceService.php';
require __DIR__ . '/lib/Service/SubscriptionService.php';
require __DIR__ . '/lib/Service/SubscriptionItemService.php';
require __DIR__ . '/lib/Service/SubscriptionScheduleService.php';
require __DIR__ . '/lib/Service/TaxCodeService.php';
require __DIR__ . '/lib/Service/TaxRateService.php';
require __DIR__ . '/lib/Service/Terminal/ConfigurationService.php';
require __DIR__ . '/lib/Service/Terminal/ConnectionTokenService.php';
require __DIR__ . '/lib/Service/Terminal/LocationService.php';
require __DIR__ . '/lib/Service/Terminal/ReaderService.php';
require __DIR__ . '/lib/Service/TestHelpers/RefundService.php';
require __DIR__ . '/lib/Service/TestHelpers/Terminal/ReaderService.php';
require __DIR__ . '/lib/Service/TestHelpers/TestClockService.php';
require __DIR__ . '/lib/Service/TokenService.php';
require __DIR__ . '/lib/Service/TopupService.php';
require __DIR__ . '/lib/Service/TransferService.php';
require __DIR__ . '/lib/Service/WebhookEndpointService.php';
// Service factories
require __DIR__ . '/lib/Service/CoreServiceFactory.php';
require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php';
require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php';
require __DIR__ . '/lib/Service/CoreServiceFactory.php';
require __DIR__ . '/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php';
require __DIR__ . '/lib/Service/Identity/IdentityServiceFactory.php';
require __DIR__ . '/lib/Service/Issuing/IssuingServiceFactory.php';
require __DIR__ . '/lib/Service/Radar/RadarServiceFactory.php';
require __DIR__ . '/lib/Service/Reporting/ReportingServiceFactory.php';
require __DIR__ . '/lib/Service/Sigma/SigmaServiceFactory.php';
require __DIR__ . '/lib/Service/Terminal/TerminalServiceFactory.php';
require __DIR__ . '/lib/Service/TestHelpers/TestHelpersServiceFactory.php';
// OAuth
require __DIR__ . '/lib/OAuth.php';

View File

@ -20,13 +20,15 @@ namespace Stripe;
* @property \Stripe\StripeObject $capabilities
* @property bool $charges_enabled Whether the account can create live charges.
* @property \Stripe\StripeObject $company
* @property \Stripe\StripeObject $controller
* @property string $country The account's country.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property int $created Time at which the account was connected. Measured in seconds since the Unix epoch.
* @property string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that <a href="https://stripe.com/docs/payouts">Stripe supports in the account's country</a>.
* @property bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true.
* @property null|string $email The primary user's email address.
* @property \Stripe\Collection $external_accounts External accounts (bank accounts and debit cards) currently attached to this account
* @property \Stripe\Person $individual <p>This is an object representing a person associated with a Stripe account.</p><p>Related guide: <a href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling Identity Verification with the API</a>.</p>
* @property null|string $email An email address associated with the account. You can treat this as metadata: it is not used for authentication or messaging account holders.
* @property \Stripe\Collection<\Stripe\BankAccount|\Stripe\Card> $external_accounts External accounts (bank accounts and debit cards) currently attached to this account
* @property \Stripe\StripeObject $future_requirements
* @property \Stripe\Person $individual <p>This is an object representing a person associated with a Stripe account.</p><p>A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account. See the <a href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a> or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding documentation</a> for information about platform pre-filling and account onboarding steps.</p><p>Related guide: <a href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling Identity Verification with the API</a>.</p>
* @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 bool $payouts_enabled Whether Stripe can send payouts to this account.
* @property \Stripe\StripeObject $requirements
@ -127,10 +129,10 @@ class Account extends ApiResource
foreach ($additionalOwners as $i => $v) {
$update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v;
if ($update !== []) {
if (!$originalValue ||
!\array_key_exists($i, $originalValue) ||
($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
if ([] !== $update) {
if (!$originalValue
|| !\array_key_exists($i, $originalValue)
|| ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
$updateArr[$i] = $update;
}
}
@ -182,7 +184,7 @@ class Account extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of persons
* @return \Stripe\Collection<\Stripe\Person> the list of persons
*/
public function persons($params = null, $opts = null)
{
@ -200,7 +202,7 @@ class Account extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Account the rejected account
* @return \Stripe\Account the rejected account
*/
public function reject($params = null, $opts = null)
{
@ -226,7 +228,7 @@ class Account extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of capabilities
* @return \Stripe\Collection<\Stripe\Capability> the list of capabilities
*/
public static function allCapabilities($id, $params = null, $opts = null)
{
@ -262,7 +264,6 @@ class Account extends ApiResource
{
return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
}
const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
/**
@ -272,7 +273,7 @@ class Account extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of external accounts (BankAccount or Card)
* @return \Stripe\Collection<\Stripe\BankAccount|\Stripe\Card> the list of external accounts (BankAccount or Card)
*/
public static function allExternalAccounts($id, $params = null, $opts = null)
{
@ -337,7 +338,6 @@ class Account extends ApiResource
{
return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
const PATH_LOGIN_LINKS = '/login_links';
/**
@ -353,7 +353,6 @@ class Account extends ApiResource
{
return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
}
const PATH_PERSONS = '/persons';
/**
@ -363,7 +362,7 @@ class Account extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of persons
* @return \Stripe\Collection<\Stripe\Person> the list of persons
*/
public static function allPersons($id, $params = null, $opts = null)
{

View File

@ -45,6 +45,21 @@ trait Request
return [$resp->json, $options];
}
/**
* @param string $method HTTP method ('get', 'post', etc.)
* @param string $url URL for the request
* @param callable $readBodyChunk function that will receive chunks of data from a successful request body
* @param array $params list of parameters for the request
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected function _requestStream($method, $url, $readBodyChunk, $params = [], $options = null)
{
$opts = $this->_opts->merge($options);
static::_staticStreamingRequest($method, $url, $readBodyChunk, $params, $opts);
}
/**
* @param string $method HTTP method ('get', 'post', etc.)
* @param string $url URL for the request
@ -65,4 +80,21 @@ trait Request
return [$response, $opts];
}
/**
* @param string $method HTTP method ('get', 'post', etc.)
* @param string $url URL for the request
* @param callable $readBodyChunk function that will receive chunks of data from a successful request body
* @param array $params list of parameters for the request
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
protected static function _staticStreamingRequest($method, $url, $readBodyChunk, $params, $options)
{
$opts = \Stripe\Util\RequestOptions::parse($options);
$baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl();
$requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
$requestor->requestStream($method, $url, $readBodyChunk, $params, $opts->headers);
}
}

View File

@ -0,0 +1,37 @@
<?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)
{
self::_validateParams($params);
list($response, $opts) = static::_staticRequest('get', $searchUrl, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof \Stripe\SearchResult)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . \Stripe\SearchResult::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);
return $obj;
}
}

View File

@ -21,12 +21,18 @@ class ApiRequestor
* @var HttpClient\ClientInterface
*/
private static $_httpClient;
/**
* @var HttpClient\StreamingClientInterface
*/
private static $_streamingHttpClient;
/**
* @var RequestTelemetry
*/
private static $requestTelemetry;
private static $OPTIONS_KEYS = ['api_key', 'idempotency_key', 'stripe_account', 'stripe_version', 'api_base'];
/**
* ApiRequestor constructor.
*
@ -121,6 +127,26 @@ class ApiRequestor
return [$resp, $myApiKey];
}
/**
* @param string $method
* @param string $url
* @param callable $readBodyChunkCallable
* @param null|array $params
* @param null|array $headers
*
* @throws Exception\ApiErrorException
*/
public function requestStream($method, $url, $readBodyChunkCallable, $params = null, $headers = null)
{
$params = $params ?: [];
$headers = $headers ?: [];
list($rbody, $rcode, $rheaders, $myApiKey) =
$this->_requestRawStreaming($method, $url, $params, $headers, $readBodyChunkCallable);
if ($rcode >= 300) {
$this->_interpretResponse($rbody, $rcode, $rheaders);
}
}
/**
* @param string $rbody a JSON string
* @param int $rcode
@ -185,14 +211,19 @@ class ApiRequestor
// no break
case 404:
return Exception\InvalidRequestException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param);
case 401:
return Exception\AuthenticationException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
case 402:
return Exception\CardException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $declineCode, $param);
case 403:
return Exception\PermissionException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
case 429:
return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param);
default:
return Exception\UnknownApiErrorException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code);
}
@ -216,16 +247,22 @@ class ApiRequestor
switch ($errorCode) {
case 'invalid_client':
return Exception\OAuth\InvalidClientException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
case 'invalid_grant':
return Exception\OAuth\InvalidGrantException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
case 'invalid_request':
return Exception\OAuth\InvalidRequestException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
case 'invalid_scope':
return Exception\OAuth\InvalidScopeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
case 'unsupported_grant_type':
return Exception\OAuth\UnsupportedGrantTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
case 'unsupported_response_type':
return Exception\OAuth\UnsupportedResponseTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
default:
return Exception\OAuth\UnknownOAuthErrorException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode);
}
@ -255,6 +292,27 @@ class ApiRequestor
return null;
}
/**
* @static
*
* @param string $disabledFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions')
* @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled
* @param mixed $disableFunctionsOutput
*
* @return bool
*/
private static function _isDisabled($disableFunctionsOutput, $functionName)
{
$disabledFunctions = \explode(',', $disableFunctionsOutput);
foreach ($disabledFunctions as $disabledFunction) {
if (\trim($disabledFunction) === $functionName) {
return true;
}
}
return false;
}
/**
* @static
*
@ -268,7 +326,7 @@ class ApiRequestor
$uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;
$langVersion = \PHP_VERSION;
$uname_disabled = \in_array('php_uname', \explode(',', \ini_get('disable_functions')), true);
$uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname');
$uname = $uname_disabled ? '(disabled)' : \php_uname();
$appInfo = Stripe::getAppInfo();
@ -294,18 +352,7 @@ class ApiRequestor
];
}
/**
* @param string $method
* @param string $url
* @param array $params
* @param array $headers
*
* @throws Exception\AuthenticationException
* @throws Exception\ApiConnectionException
*
* @return array
*/
private function _requestRaw($method, $url, $params, $headers)
private function _prepareRequest($method, $url, $params, $headers)
{
$myApiKey = $this->_apiKey;
if (!$myApiKey) {
@ -329,6 +376,21 @@ class ApiRequestor
$clientUAInfo = $this->httpClient()->getUserAgentInfo();
}
if ($params && \is_array($params)) {
$optionKeysInParams = \array_filter(
static::$OPTIONS_KEYS,
function ($key) use ($params) {
return \array_key_exists($key, $params);
}
);
if (\count($optionKeysInParams) > 0) {
$message = \sprintf('Options found in $params: %s. Options should '
. 'be passed in their own array after $params. (HINT: pass an '
. 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams));
\trigger_error($message, \E_USER_WARNING);
}
}
$absUrl = $this->_apiBase . $url;
$params = self::_encodeObjects($params);
$defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo);
@ -367,6 +429,24 @@ class ApiRequestor
$rawHeaders[] = $header . ': ' . $value;
}
return [$absUrl, $rawHeaders, $params, $hasFile, $myApiKey];
}
/**
* @param string $method
* @param string $url
* @param array $params
* @param array $headers
*
* @throws Exception\AuthenticationException
* @throws Exception\ApiConnectionException
*
* @return array
*/
private function _requestRaw($method, $url, $params, $headers)
{
list($absUrl, $rawHeaders, $params, $hasFile, $myApiKey) = $this->_prepareRequest($method, $url, $params, $headers);
$requestStartMs = Util\Util::currentTimeMillis();
list($rbody, $rcode, $rheaders) = $this->httpClient()->request(
@ -377,9 +457,51 @@ class ApiRequestor
$hasFile
);
if (isset($rheaders['request-id'], $rheaders['request-id'][0])) {
if (isset($rheaders['request-id'])
&& \is_string($rheaders['request-id'])
&& '' !== $rheaders['request-id']) {
self::$requestTelemetry = new RequestTelemetry(
$rheaders['request-id'][0],
$rheaders['request-id'],
Util\Util::currentTimeMillis() - $requestStartMs
);
}
return [$rbody, $rcode, $rheaders, $myApiKey];
}
/**
* @param string $method
* @param string $url
* @param array $params
* @param array $headers
* @param callable $readBodyChunk
* @param mixed $readBodyChunkCallable
*
* @throws Exception\AuthenticationException
* @throws Exception\ApiConnectionException
*
* @return array
*/
private function _requestRawStreaming($method, $url, $params, $headers, $readBodyChunkCallable)
{
list($absUrl, $rawHeaders, $params, $hasFile, $myApiKey) = $this->_prepareRequest($method, $url, $params, $headers);
$requestStartMs = Util\Util::currentTimeMillis();
list($rbody, $rcode, $rheaders) = $this->streamingHttpClient()->requestStream(
$method,
$absUrl,
$rawHeaders,
$params,
$hasFile,
$readBodyChunkCallable
);
if (isset($rheaders['request-id'])
&& \is_string($rheaders['request-id'])
&& '' !== $rheaders['request-id']) {
self::$requestTelemetry = new RequestTelemetry(
$rheaders['request-id'],
Util\Util::currentTimeMillis() - $requestStartMs
);
}
@ -451,6 +573,16 @@ class ApiRequestor
self::$_httpClient = $client;
}
/**
* @static
*
* @param HttpClient\StreamingClientInterface $client
*/
public static function setStreamingHttpClient($client)
{
self::$_streamingHttpClient = $client;
}
/**
* @static
*
@ -472,4 +604,16 @@ class ApiRequestor
return self::$_httpClient;
}
/**
* @return HttpClient\StreamingClientInterface
*/
private function streamingHttpClient()
{
if (!self::$_streamingHttpClient) {
self::$_streamingHttpClient = HttpClient\CurlClient::instance();
}
return self::$_streamingHttpClient;
}
}

View File

@ -39,8 +39,8 @@ abstract class ApiResource extends StripeObject
{
parent::__set($k, $v);
$v = $this->{$k};
if ((static::getSavedNestedResources()->includes($k)) &&
($v instanceof ApiResource)) {
if ((static::getSavedNestedResources()->includes($k))
&& ($v instanceof ApiResource)) {
$v->saveWithParent = true;
}
}
@ -82,6 +82,8 @@ abstract class ApiResource extends StripeObject
{
// Replace dots with slashes for namespaced resources, e.g. if the object's name is
// "foo.bar", then its URL will be "/v1/foo/bars".
/** @phpstan-ignore-next-line */
$base = \str_replace('.', '/', static::OBJECT_NAME);
return "/v1/{$base}s";

View File

@ -18,7 +18,7 @@ namespace Stripe;
* @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 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 $refunds A list of refunds that have been applied to the fee.
* @property \Stripe\Collection<\Stripe\StripeObject> $refunds A list of refunds that have been applied to the fee.
*/
class ApplicationFee extends ApiResource
{
@ -37,7 +37,7 @@ class ApplicationFee extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of fee refunds
* @return \Stripe\Collection<\Stripe\ApplicationFeeRefund> the list of fee refunds
*/
public static function allRefunds($id, $params = null, $opts = null)
{

View File

@ -20,7 +20,7 @@ namespace Stripe;
* @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 \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 $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
{

View File

@ -22,6 +22,7 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject[] $available Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the <a href="https://stripe.com/docs/api#transfers">Transfers API</a> or <a href="https://stripe.com/docs/api#payouts">Payouts API</a>. The available balance for each currency and payment type can be found in the <code>source_types</code> property.
* @property \Stripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the <code>source_types</code> property.
* @property \Stripe\StripeObject[] $instant_available Funds that can be paid out using Instant Payouts.
* @property \Stripe\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 are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the <code>source_types</code> property.

View File

@ -27,7 +27,7 @@ namespace Stripe;
* @property string $reporting_category <a href="https://stripe.com/docs/reports/reporting-categories">Learn more</a> about how reporting categories can help you understand balance transactions from an accounting perspective.
* @property null|string|\Stripe\StripeObject $source The Stripe object to which this transaction is related.
* @property string $status If the transaction's net funds are available in the Stripe balance yet. 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>connect_collection_transfer</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_refund</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</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>. <a href="https://stripe.com/docs/reports/balance-transaction-types">Learn more</a> about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to 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>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>payment</code>, <code>payment_failure_refund</code>, <code>payment_refund</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</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>. <a href="https://stripe.com/docs/reports/balance-transaction-types">Learn more</a> about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider <code>reporting_category</code> instead.
*/
class BalanceTransaction extends ApiResource
{
@ -44,6 +44,7 @@ class BalanceTransaction extends ApiResource
const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
const TYPE_CHARGE = 'charge';
const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
const TYPE_CONTRIBUTION = 'contribution';
const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release';
const TYPE_ISSUING_DISPUTE = 'issuing_dispute';

View File

@ -23,6 +23,8 @@ namespace Stripe;
* @property null|string|\Stripe\Account $account The ID of the account that the bank account is associated with.
* @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>.
* @property null|string[] $available_payout_methods A set of available payout methods for this bank account. Only values from this set should be passed as the <code>method</code> when creating a payout.
* @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.

View File

@ -2,7 +2,7 @@
namespace Stripe;
class BaseStripeClient implements StripeClientInterface
class BaseStripeClient implements StripeClientInterface, StripeStreamingClientInterface
{
/** @var string default base URL for Stripe's API */
const DEFAULT_API_BASE = 'https://api.stripe.com';
@ -139,6 +139,25 @@ class BaseStripeClient implements StripeClientInterface
return $obj;
}
/**
* Sends a request to Stripe's API, passing chunks of the streamed response
* into a user-provided $readBodyChunkCallable callback.
*
* @param string $method the HTTP method
* @param string $path the path of the request
* @param callable $readBodyChunkCallable a function that will be called
* @param array $params the parameters of the request
* @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request
* with chunks of bytes from the body if the request is successful
*/
public function requestStream($method, $path, $readBodyChunkCallable, $params, $opts)
{
$opts = $this->defaultOpts->merge($opts, true);
$baseUrl = $opts->apiBase ?: $this->getApiBase();
$requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl);
list($response, $opts->apiKey) = $requestor->requestStream($method, $path, $readBodyChunkCallable, $params, $opts->headers);
}
/**
* Sends a request to Stripe's API.
*
@ -163,6 +182,30 @@ class BaseStripeClient implements StripeClientInterface
return $obj;
}
/**
* Sends a request to Stripe's API.
*
* @param string $method the HTTP method
* @param string $path the path of the request
* @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
*/
public function requestSearchResult($method, $path, $params, $opts)
{
$obj = $this->request($method, $path, $params, $opts);
if (!($obj instanceof \Stripe\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);
}
$obj->setFilters($params);
return $obj;
}
/**
* @param \Stripe\Util\RequestOptions $opts
*
@ -260,7 +303,10 @@ class BaseStripeClient implements StripeClientInterface
// check absence of extra keys
$extraConfigKeys = \array_diff(\array_keys($config), \array_keys($this->getDefaultConfig()));
if (!empty($extraConfigKeys)) {
throw new \Stripe\Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . \implode(',', $extraConfigKeys));
// 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);
}
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace Stripe;
/**
* Interface for a Stripe client.
*/
interface BaseStripeClientInterface
{
/**
* Gets the API key used by the client to send requests.
*
* @return null|string the API key used by the client to send requests
*/
public function getApiKey();
/**
* Gets the client ID used by the client in OAuth requests.
*
* @return null|string the client ID used by the client in OAuth requests
*/
public function getClientId();
/**
* Gets the base URL for Stripe's API.
*
* @return string the base URL for Stripe's API
*/
public function getApiBase();
/**
* Gets the base URL for Stripe's OAuth API.
*
* @return string the base URL for Stripe's OAuth API
*/
public function getConnectBase();
/**
* Gets the base URL for Stripe's Files API.
*
* @return string the base URL for Stripe's Files API
*/
public function getFilesBase();
}

View File

@ -0,0 +1,32 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\BillingPortal;
/**
* A portal configuration describes the functionality and behavior of a portal
* session.
*
* @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 bool $active Whether the configuration is active and can be used to create portal sessions.
* @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the configuration.
* @property \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 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 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.
*/
class Configuration extends \Stripe\ApiResource
{
const OBJECT_NAME = 'billing_portal.configuration';
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@ -5,24 +5,33 @@
namespace Stripe\BillingPortal;
/**
* A session describes the instantiation of the customer portal for a particular
* customer. By visiting the session's URL, the customer can manage their
* subscriptions and billing details. For security reasons, sessions are
* The Billing customer portal is a Stripe-hosted UI for subscription and billing
* management.
*
* A portal configuration describes the functionality and features that you want to
* provide to your customers through the portal.
*
* A portal session describes the instantiation of the customer portal for a
* particular customer. By visiting the session's URL, the customer can manage
* their subscriptions and billing details. For security reasons, sessions are
* short-lived and will expire if the customer does not visit the URL. Create
* sessions on-demand when customers intend to manage their subscriptions and
* billing details.
*
* Integration guide: <a
* href="https://stripe.com/docs/billing/subscriptions/integrating-customer-portal">Billing
* customer portal</a>.
* Learn more in the <a
* href="https://stripe.com/docs/billing/subscriptions/integrating-customer-portal">integration
* guide</a>.
*
* @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 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 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 $return_url The URL to which Stripe should send customers when they click on the link to return to your website.
* @property string $url The short-lived URL of the session giving customers access to the customer portal.
* @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/charges-transfers#on-behalf-of">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.
* @property string $return_url The URL to redirect customers to when they click on the portal's link to return to your website.
* @property string $url The short-lived URL of the session that gives customers access to the customer portal.
*/
class Session extends \Stripe\ApiResource
{

View File

@ -24,10 +24,10 @@ namespace Stripe;
* @property bool $filled This flag is initially false and updates to true when the customer sends the <code>bitcoin_amount</code> to this receiver.
* @property string $inbound_address A bitcoin address that is specific to this receiver. The customer can send bitcoin to this address to fill the receiver.
* @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 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|string $payment The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key.
* @property null|string $refund_address The refund address of this bitcoin receiver.
* @property \Stripe\Collection $transactions A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the receiver with a publishable key.
* @property \Stripe\Collection<\Stripe\BitcoinTransaction> $transactions A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the receiver with a publishable key.
* @property bool $uncaptured_funds This receiver contains uncaptured funds that can be used for a payment or refunded.
* @property null|bool $used_for_payment Indicate if this source is used for payment.
*/

View File

@ -14,6 +14,7 @@ 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 \Stripe\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 \Stripe\StripeObject $requirements

View File

@ -23,22 +23,23 @@ namespace Stripe;
* @property null|string $address_state State/County/Province/Region.
* @property null|string $address_zip ZIP or postal code.
* @property null|string $address_zip_check If <code>address_zip</code> was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>.
* @property null|string[] $available_payout_methods A set of available payout methods for this card. Will be either <code>[&quot;standard&quot;]</code> or <code>[&quot;standard&quot;, &quot;instant&quot;]</code>. Only values from this set should be passed as the <code>method</code> when creating a transfer.
* @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>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
* @property null|string $currency Three-letter <a href="https://stripe.com/docs/payouts">ISO code for currency</a>. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency.
* @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 $cvc_check If a CVC was provided, results of the check: <code>pass</code>, <code>fail</code>, <code>unavailable</code>, or <code>unchecked</code>.
* @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.
* @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number.
* @property int $exp_month Two-digit number representing the card's expiration month.
* @property int $exp_year Four-digit number representing the card's expiration year.
* @property null|string $fingerprint 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.
* @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>Starting May 1, 2021, card fingerprint in India for Connect will change 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 \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 $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|string|\Stripe\Recipient $recipient The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead.
* @property null|string $status For external accounts, possible values are <code>new</code> and <code>errored</code>. If a transfer fails, the status is set to <code>errored</code> and transfers 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.
*/
class Card extends ApiResource

View File

@ -0,0 +1,66 @@
<?php
// File generated from our OpenAPI spec
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.
* @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
*/
class CashBalance extends ApiResource
{
const OBJECT_NAME = 'cash_balance';
/**
* @return string the API URL for this balance transaction
*/
public function instanceUrl()
{
$customer = $this['customer'];
$customer = Util\Util::utf8($customer);
$base = Customer::classUrl();
$customerExtn = \urlencode($customer);
return "{$base}/{$customerExtn}/cash_balance";
}
/**
* @param array|string $_id
* @param null|array|string $_opts
*
* @throws \Stripe\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')`.";
throw new Exception\BadMethodCallException($msg);
}
/**
* @param string $_id
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\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')`.";
throw new Exception\BadMethodCallException($msg);
}
}

View File

@ -16,10 +16,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 intended to be collected by this payment. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
* @property int $amount_captured Amount in %s captured (can be less than the amount attribute on the charge if a partial capture was made).
* @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued).
* @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the charge.
* @property null|string|\Stripe\ApplicationFee $application_fee The application fee (if any) for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details.
* @property null|int $application_fee_amount The amount of the application fee (if any) for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details.
* @property null|int $application_fee_amount The amount of the application fee (if any) requested for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details.
* @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes).
* @property \Stripe\StripeObject $billing_details
* @property null|string $calculated_statement_descriptor The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined.
@ -31,6 +32,7 @@ namespace Stripe;
* @property null|string|\Stripe\Account $destination ID of an existing, connected Stripe account to transfer funds to if <code>transfer_data</code> was specified in the charge request.
* @property null|string|\Stripe\Dispute $dispute Details about the dispute if the charge has been disputed.
* @property bool $disputed Whether the charge has been disputed.
* @property null|string|\Stripe\BalanceTransaction $failure_balance_transaction ID of the balance transaction that describes the reversal of the balance on your account due to payment failure.
* @property null|string $failure_code Error code explaining reason for charge failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes).
* @property null|string $failure_message Message to user further explaining reason for charge failure if available.
* @property null|\Stripe\StripeObject $fraud_details Information on fraud assessments for the charge.
@ -48,10 +50,10 @@ namespace Stripe;
* @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this charge. This attribute will be <code>null</code> until a receipt has been sent.
* @property null|string $receipt_url This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt.
* @property bool $refunded Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false.
* @property \Stripe\Collection $refunds A list of refunds that have been applied to the charge.
* @property \Stripe\Collection<\Stripe\Refund> $refunds A list of refunds that have been applied to the charge.
* @property null|string|\Stripe\Review $review ID of the review associated with this charge if one exists.
* @property null|\Stripe\StripeObject $shipping Shipping information for the charge.
* @property null|\Stripe\StripeObject $source This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to <code>payment_method</code> or <code>payment_method_details</code> instead.
* @property null|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to <code>payment_method</code> or <code>payment_method_details</code> instead.
* @property null|string|\Stripe\Transfer $source_transfer The transfer ID which created this charge. Only present if the charge came from another Stripe account. <a href="https://stripe.com/docs/connect/destination-charges">See the Connect documentation</a> for details.
* @property null|string $statement_descriptor For card charges, use <code>statement_descriptor_suffix</code> instead. Otherwise, you can use this value as the complete description of a charge on your customers statements. Must contain at least one letter, maximum 22 characters.
* @property null|string $statement_descriptor_suffix Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor thats set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
@ -67,6 +69,7 @@ class Charge extends ApiResource
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Search;
use ApiOperations\Update;
const STATUS_FAILED = 'failed';
@ -132,7 +135,7 @@ class Charge extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Charge the captured charge
* @return \Stripe\Charge the captured charge
*/
public function capture($params = null, $opts = null)
{
@ -142,4 +145,19 @@ class Charge extends ApiResource
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<Charge> the charge search results
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/charges/search';
return self::_searchResource($url, $params, $opts);
}
}

View File

@ -7,8 +7,9 @@ namespace Stripe\Checkout;
/**
* A Checkout Session represents your customer's session as they pay for one-time
* purchases or subscriptions through <a
* href="https://stripe.com/docs/payments/checkout">Checkout</a>. We recommend
* creating a new Session each time your customer attempts to pay.
* href="https://stripe.com/docs/payments/checkout">Checkout</a> or <a
* href="https://stripe.com/docs/payments/payment-links">Payment Links</a>. We
* recommend creating a new Session each time your customer attempts to pay.
*
* Once payment is successful, the Checkout Session will contain a reference to the
* <a href="https://stripe.com/docs/api/customers">Customer</a>, and either the
@ -24,30 +25,46 @@ namespace Stripe\Checkout;
*
* @property string $id Unique identifier for the object. Used to pass to <code>redirectToCheckout</code> in Stripe.js.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $after_expiration When set, provides configuration for actions to take if this Checkout Session expires.
* @property null|bool $allow_promotion_codes Enables user redeemable promotion codes.
* @property null|int $amount_subtotal Total of all items before discounts or taxes are applied.
* @property null|int $amount_total Total of all items after discounts and taxes are applied.
* @property \Stripe\StripeObject $automatic_tax
* @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address.
* @property string $cancel_url The URL the customer will be directed to if they decide to cancel payment and return to your website.
* @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the session with your internal systems.
* @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.
* @property null|\Stripe\StripeObject $consent Results of <code>consent_collection</code> for this session.
* @property null|\Stripe\StripeObject $consent_collection When set, provides configuration for the Checkout Session to gather active consent from customers.
* @property null|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|string|\Stripe\Customer $customer The ID of the customer for this session. For Checkout Sessions in <code>payment</code> or <code>subscription</code> mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created.
* @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the <code>customer</code> attribute.
* @property \Stripe\StripeObject[] $display_items The line items, plans, or SKUs purchased by the customer. Prefer using <code>line_items</code>.
* @property \Stripe\Collection $line_items The line items purchased by the customer.
* @property null|string|\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in <code>payment</code> or <code>subscription</code> mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.
* @property null|string $customer_creation Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
* @property null|\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in <code>payment</code> or <code>subscription</code> mode.
* @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the <code>customer</code> attribute.
* @property int $expires_at The timestamp at which the Checkout Session will expire.
* @property \Stripe\Collection<\Stripe\LineItem> $line_items The line items purchased by the customer.
* @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 Checkout is displayed in. If blank or <code>auto</code>, the browser's locale is used.
* @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|string $mode The mode of the Checkout Session, one of <code>payment</code>, <code>setup</code>, or <code>subscription</code>.
* @property string $mode The mode of the Checkout Session.
* @property null|string|\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in <code>payment</code> mode.
* @property null|string|\Stripe\PaymentLink $payment_link The ID of the Payment Link that created this Session.
* @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
* @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
* @property string $payment_status The payment status of the Checkout Session, one of <code>paid</code>, <code>unpaid</code>, or <code>no_payment_required</code>. You can use this value to decide when to fulfill your customer's order.
* @property \Stripe\StripeObject $phone_number_collection
* @property null|string $recovered_from The ID of the original expired Checkout Session that triggered the recovery flow.
* @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in <code>setup</code> mode.
* @property null|\Stripe\StripeObject $shipping Shipping information for this Checkout Session.
* @property null|\Stripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer.
* @property \Stripe\StripeObject[] $shipping_options The shipping rate options applied to this Session.
* @property null|string|\Stripe\ShippingRate $shipping_rate The ID of the ShippingRate for Checkout Sessions in <code>payment</code> mode.
* @property null|string $status The status of the Checkout Session, one of <code>open</code>, <code>complete</code>, or <code>expired</code>.
* @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. <code>submit_type</code> can only be specified on Checkout Sessions in <code>payment</code> mode, but not Checkout Sessions in <code>subscription</code> or <code>setup</code> mode.
* @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in <code>subscription</code> mode.
* @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
* @property \Stripe\StripeObject $tax_id_collection
* @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount.
* @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If youre using <a href="https://stripe.com/docs/payments/checkout/custom-domains">Custom Domains</a>, the URL will use your subdomain. Otherwise, itll use <code>checkout.stripe.com.</code>
*/
class Session extends \Stripe\ApiResource
{
@ -61,11 +78,43 @@ class Session extends \Stripe\ApiResource
const BILLING_ADDRESS_COLLECTION_AUTO = 'auto';
const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required';
const CUSTOMER_CREATION_ALWAYS = 'always';
const CUSTOMER_CREATION_IF_REQUIRED = 'if_required';
const MODE_PAYMENT = 'payment';
const MODE_SETUP = 'setup';
const MODE_SUBSCRIPTION = 'subscription';
const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required';
const PAYMENT_STATUS_PAID = 'paid';
const PAYMENT_STATUS_UNPAID = 'unpaid';
const STATUS_COMPLETE = 'complete';
const STATUS_EXPIRED = 'expired';
const STATUS_OPEN = 'open';
const SUBMIT_TYPE_AUTO = 'auto';
const SUBMIT_TYPE_BOOK = 'book';
const SUBMIT_TYPE_DONATE = 'donate';
const SUBMIT_TYPE_PAY = 'pay';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Checkout\Session the expired session
*/
public function expire($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/expire';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
const PATH_LINE_ITEMS = '/line_items';
/**
@ -75,7 +124,7 @@ class Session extends \Stripe\ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of items
* @return \Stripe\Collection<\Stripe\LineItem> the list of items
*/
public static function allLineItems($id, $params = null, $opts = null)
{

View File

@ -5,10 +5,13 @@ namespace Stripe;
/**
* Class Collection.
*
* @template TStripeObject of StripeObject
* @template-implements \IteratorAggregate<TStripeObject>
*
* @property string $object
* @property string $url
* @property bool $has_more
* @property \Stripe\StripeObject[] $data
* @property TStripeObject[] $data
*/
class Collection extends StripeObject implements \Countable, \IteratorAggregate
{
@ -47,6 +50,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
$this->filters = $filters;
}
#[\ReturnTypeWillChange]
public function offsetGet($k)
{
if (\is_string($k)) {
@ -60,6 +64,14 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
throw new Exception\InvalidArgumentException($msg);
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return Collection<TStripeObject>
*/
public function all($params = null, $opts = null)
{
self::_validateParams($params);
@ -77,6 +89,14 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return TStripeObject
*/
public function create($params = null, $opts = null)
{
self::_validateParams($params);
@ -87,6 +107,15 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
return Util\Util::convertToStripeObject($response, $opts);
}
/**
* @param string $id
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return TStripeObject
*/
public function retrieve($id, $params = null, $opts = null)
{
self::_validateParams($params);
@ -107,6 +136,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
/**
* @return int the number of objects in the current page
*/
#[\ReturnTypeWillChange]
public function count()
{
return \count($this->data);
@ -116,6 +146,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @return \ArrayIterator an iterator that can be used to iterate
* across objects in the current page
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->data);
@ -131,7 +162,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
}
/**
* @return \Generator|StripeObject[] A generator that can be used to
* @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.
@ -142,8 +173,8 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
while (true) {
$filters = $this->filters ?: [];
if (\array_key_exists('ending_before', $filters) &&
!\array_key_exists('starting_after', $filters)) {
if (\array_key_exists('ending_before', $filters)
&& !\array_key_exists('starting_after', $filters)) {
foreach ($page->getReverseIterator() as $item) {
yield $item;
}
@ -194,7 +225,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @return Collection
* @return Collection<TStripeObject>
*/
public function nextPage($params = null, $opts = null)
{
@ -222,7 +253,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @return Collection
* @return Collection<TStripeObject>
*/
public function previousPage($params = null, $opts = null)
{
@ -244,7 +275,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
/**
* Gets the first item from the current page. Returns `null` if the current page is empty.
*
* @return null|\Stripe\StripeObject
* @return null|TStripeObject
*/
public function first()
{
@ -254,7 +285,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
/**
* Gets the last item from the current page. Returns `null` if the current page is empty.
*
* @return null|\Stripe\StripeObject
* @return null|TStripeObject
*/
public function last()
{

View File

@ -8,8 +8,8 @@ namespace Stripe;
* 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#invoices">invoices</a> or <a
* href="https://stripe.com/docs/api#create_order-coupon">orders</a>. Coupons do
* not work with conventional one-off <a
* href="https://stripe.com/docs/api#create_order_legacy-coupon">orders</a>.
* Coupons do not work with conventional one-off <a
* href="https://stripe.com/docs/api#create_charge">charges</a>.
*
* @property string $id Unique identifier for the object.
@ -22,7 +22,7 @@ namespace Stripe;
* @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 \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 $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 %s100 invoice %s50 instead.
* @property null|int $redeem_by Date after which the coupon can no longer be redeemed.

View File

@ -13,27 +13,27 @@ 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 <strong>%s</strong> representing the total amount of the credit note, including tax.
* @property int $amount The integer amount in %s representing the total amount of the credit note, including tax.
* @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 int $discount_amount The integer amount in <strong>%s</strong> representing the total amount of discount that was credited.
* @property int $discount_amount The integer amount in %s 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 string|\Stripe\Invoice $invoice ID of the invoice.
* @property \Stripe\Collection $lines Line items that make up the credit note
* @property \Stripe\Collection<\Stripe\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 \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 $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 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 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 <strong>%s</strong> representing the amount of the credit note, excluding tax and invoice level discounts.
* @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding 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 <strong>%s</strong> representing the total amount of the credit note, including tax and all discount.
* @property int $total The integer amount in %s representing the total amount of the credit note, including tax and all discount.
* @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.
*/
@ -70,7 +70,7 @@ class CreditNote extends ApiResource
{
$url = static::classUrl() . '/preview';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
@ -82,7 +82,7 @@ class CreditNote extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return CreditNote the voided credit note
* @return \Stripe\CreditNote the voided credit note
*/
public function voidCreditNote($params = null, $opts = null)
{
@ -102,7 +102,7 @@ class CreditNote extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of credit note line items
* @return \Stripe\Collection<\Stripe\CreditNoteLineItem> the list of credit note line items
*/
public static function allLines($id, $params = null, $opts = null)
{

View File

@ -7,9 +7,9 @@ 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 <strong>%s</strong> representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
* @property int $amount The integer amount in %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
* @property null|string $description Description of the item being credited.
* @property int $discount_amount The integer amount in <strong>%s</strong> representing the discount being credited for this line item.
* @property int $discount_amount The integer amount in %s 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 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.

View File

@ -5,10 +5,8 @@
namespace Stripe;
/**
* <code>Customer</code> objects allow you to perform recurring charges, and to
* track multiple charges, that are associated with the same customer. The API
* allows you to create, delete, and update your customers. You can retrieve
* individual customers as well as a list of all your customers.
* This object represents a customer of your business. It lets you create recurring
* charges and track payments that belong to the same customer.
*
* Related guide: <a
* href="https://stripe.com/docs/payments/save-during-payment">Save a card during
@ -18,10 +16,11 @@ namespace Stripe;
* @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 int $balance Current balance, if any, being 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 will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized.
* @property null|\Stripe\CashBalance $cash_balance The current funds being held by Stripe on behalf of the customer. These funds can be applied towards payment intents with source &quot;cash_balance&quot;.The settings[reconciliation_mode] field describes whether these funds are applied to such 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\StripeObject $default_source <p>ID of the default payment source for the customer.</p><p>If you are using payment methods created via 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 When the customer's latest invoice is billed by charging automatically, delinquent is true if the invoice's latest charge is failed. When the customer's latest invoice is billed by sending an invoice, delinquent is true if the invoice is not paid by its due date.
* @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source <p>ID of the default payment source for the customer.</p><p>If you are using payment methods created via 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>When the customer's latest invoice is billed by charging automatically, <code>delinquent</code> is <code>true</code> if the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice, <code>delinquent</code> is <code>true</code> if the invoice isn't paid by its due date.</p><p>If an invoice is marked uncollectible by <a href="https://stripe.com/docs/billing/automatic-collection">dunning</a>, <code>delinquent</code> doesn't get reset 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|string $email The customer's email address.
@ -34,10 +33,12 @@ namespace Stripe;
* @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 \Stripe\Collection $sources The customer's payment sources, if any.
* @property null|\Stripe\Collection $subscriptions The customer's current subscriptions, if any.
* @property \Stripe\Collection<\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source> $sources The customer's payment sources, if any.
* @property \Stripe\Collection<\Stripe\Subscription> $subscriptions The customer's current subscriptions, if any.
* @property \Stripe\StripeObject $tax
* @property null|string $tax_exempt Describes the customer's tax exemption status. One of <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the text <strong>&quot;Reverse charge&quot;</strong>.
* @property \Stripe\Collection $tax_ids The customer's tax IDs.
* @property \Stripe\Collection<\Stripe\TaxId> $tax_ids The customer's tax IDs.
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this customer belongs to.
*/
class Customer extends ApiResource
{
@ -48,6 +49,7 @@ class Customer extends ApiResource
use ApiOperations\Delete;
use ApiOperations\NestedResource;
use ApiOperations\Retrieve;
use ApiOperations\Search;
use ApiOperations\Update;
const TAX_EXEMPT_EXEMPT = 'exempt';
@ -77,8 +79,75 @@ class Customer extends ApiResource
$url = $this->instanceUrl() . '/discount';
list($response, $opts) = $this->_request('delete', $url, $params, $opts);
$this->refreshFrom(['discount' => null], $opts, true);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Customer> list of PaymentMethods
*/
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->setLastResponse($response);
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<Customer> the customer search results
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/customers/search';
return self::_searchResource($url, $params, $opts);
}
const PATH_CASH_BALANCE = '/cash_balance';
/**
* @param string $id the ID of the customer to which the cash balance belongs
* @param null|array $params
* @param null|array|string $opts
* @param mixed $cashBalanceId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\cash_balance
*/
public static function retrieveCashBalance($id, $cashBalanceId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts);
}
/**
* @param string $id the ID of the customer to which the cash balance belongs
* @param null|array $params
* @param null|array|string $opts
* @param mixed $cashBalanceId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\cash_balance
*/
public static function updateCashBalance($id, $cashBalanceId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts);
}
const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
/**
@ -88,7 +157,7 @@ class Customer extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of customer balance transactions
* @return \Stripe\Collection<\Stripe\CustomerBalanceTransaction> the list of customer balance transactions
*/
public static function allBalanceTransactions($id, $params = null, $opts = null)
{
@ -138,7 +207,6 @@ class Customer extends ApiResource
{
return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
}
const PATH_SOURCES = '/sources';
/**
@ -148,7 +216,7 @@ class Customer extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of payment sources (AlipayAccount, BankAccount, BitcoinReceiver, Card or Source)
* @return \Stripe\Collection<\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source> the list of payment sources (AlipayAccount, BankAccount, BitcoinReceiver, Card or Source)
*/
public static function allSources($id, $params = null, $opts = null)
{
@ -213,7 +281,6 @@ class Customer extends ApiResource
{
return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
}
const PATH_TAX_IDS = '/tax_ids';
/**
@ -223,7 +290,7 @@ class Customer extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of tax ids
* @return \Stripe\Collection<\Stripe\TaxId> the list of tax ids
*/
public static function allTaxIds($id, $params = null, $opts = null)
{

View File

@ -5,12 +5,17 @@ namespace Stripe;
/**
* Class Discount.
*
* @property string $object
* @property Coupon $coupon
* @property string $customer
* @property int $end
* @property int $start
* @property string $subscription
* @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 Hash describing the coupon applied to create this discount.
* @property string|\Stripe\Customer $customer The ID of the customer associated with this discount.
* @property null|int $end If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null.
* @property string $id The ID of the discount object.
* @property null|string $invoice The invoice that the discounts coupon was applied to, if it was applied directly to a particular invoice.
* @property null|string $invoice_item The invoice item id (or invoice line item id for invoice line items of type=subscription) that the discounts coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
* @property string $object String representing the objects type. Objects of the same type share the same value.
* @property null|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.
*/
class Discount extends StripeObject
{

View File

@ -17,12 +17,12 @@ class EphemeralKey extends ApiResource
{
const OBJECT_NAME = 'ephemeral_key';
use ApiOperations\Delete;
use ApiOperations\Create {
create as protected _create;
}
use ApiOperations\Delete;
/**
* @param null|array $params
* @param null|array|string $opts

View File

@ -23,14 +23,15 @@ namespace Stripe;
* returned on a request involving a PaymentIntent.
* @property PaymentMethod $payment_method The PaymentMethod object for errors
* returned on a request involving a PaymentMethod.
* @property string $payment_method_type If the error is specific to the type
* of payment method, the payment method type that had a problem. This
* field is only populated for invoice-related errors.
* @property SetupIntent $setup_intent The SetupIntent object for errors
* returned on a request involving a SetupIntent.
* @property StripeObject $source The source object for errors returned on a
* request involving a source.
* @property string $type The type of error returned. One of
* `api_connection_error`, `api_error`, `authentication_error`,
* `card_error`, `idempotency_error`, `invalid_request_error`, or
* `rate_limit_error`.
* @property string $type The type of error returned. One of `api_error`,
* `card_error`, `idempotency_error`, or `invalid_request_error`.
*/
class ErrorObject extends StripeObject
{

View File

@ -39,6 +39,9 @@ namespace Stripe;
* href="https://stripe.com/docs/api#retrieve_event">Retrieve Event API</a> is
* guaranteed only for 30 days.
*
* This class includes constants for the possible string representations of
* event types. See https://stripe.com/docs/api#event_types for more details.
*
* @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 $account The connected account that originated the event.
@ -57,37 +60,37 @@ class Event extends ApiResource
use ApiOperations\All;
use ApiOperations\Retrieve;
/**
* Possible string representations of event types.
*
* @see https://stripe.com/docs/api#event_types
*/
const ACCOUNT_UPDATED = 'account.updated';
const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized';
const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized';
const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created';
const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted';
const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated';
const ACCOUNT_UPDATED = 'account.updated';
const APPLICATION_FEE_CREATED = 'application_fee.created';
const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
const BALANCE_AVAILABLE = 'balance.available';
const BILLING_PORTAL_CONFIGURATION_CREATED = 'billing_portal.configuration.created';
const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated';
const CAPABILITY_UPDATED = 'capability.updated';
const CASH_BALANCE_FUNDS_AVAILABLE = 'cash_balance.funds_available';
const CHARGE_CAPTURED = 'charge.captured';
const CHARGE_EXPIRED = 'charge.expired';
const CHARGE_FAILED = 'charge.failed';
const CHARGE_PENDING = 'charge.pending';
const CHARGE_REFUNDED = 'charge.refunded';
const CHARGE_SUCCEEDED = 'charge.succeeded';
const CHARGE_UPDATED = 'charge.updated';
const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
const CHARGE_DISPUTE_CREATED = 'charge.dispute.created';
const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated';
const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn';
const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated';
const CHARGE_EXPIRED = 'charge.expired';
const CHARGE_FAILED = 'charge.failed';
const CHARGE_PENDING = 'charge.pending';
const CHARGE_REFUND_UPDATED = 'charge.refund.updated';
const CHARGE_REFUNDED = 'charge.refunded';
const CHARGE_SUCCEEDED = 'charge.succeeded';
const CHARGE_UPDATED = 'charge.updated';
const CHECKOUT_SESSION_ASYNC_PAYMENT_FAILED = 'checkout.session.async_payment_failed';
const CHECKOUT_SESSION_ASYNC_PAYMENT_SUCCEEDED = 'checkout.session.async_payment_succeeded';
const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed';
const CHECKOUT_SESSION_EXPIRED = 'checkout.session.expired';
const COUPON_CREATED = 'coupon.created';
const COUPON_DELETED = 'coupon.deleted';
const COUPON_UPDATED = 'coupon.updated';
@ -96,7 +99,6 @@ class Event extends ApiResource
const CREDIT_NOTE_VOIDED = 'credit_note.voided';
const CUSTOMER_CREATED = 'customer.created';
const CUSTOMER_DELETED = 'customer.deleted';
const CUSTOMER_UPDATED = 'customer.updated';
const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
@ -106,11 +108,24 @@ class Event extends ApiResource
const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_APPLIED = 'customer.subscription.pending_update_applied';
const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_EXPIRED = 'customer.subscription.pending_update_expired';
const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
const CUSTOMER_TAX_ID_CREATED = 'customer.tax_id.created';
const CUSTOMER_TAX_ID_DELETED = 'customer.tax_id.deleted';
const CUSTOMER_TAX_ID_UPDATED = 'customer.tax_id.updated';
const CUSTOMER_UPDATED = 'customer.updated';
const FILE_CREATED = 'file.created';
const IDENTITY_VERIFICATION_SESSION_CANCELED = 'identity.verification_session.canceled';
const IDENTITY_VERIFICATION_SESSION_CREATED = 'identity.verification_session.created';
const IDENTITY_VERIFICATION_SESSION_PROCESSING = 'identity.verification_session.processing';
const IDENTITY_VERIFICATION_SESSION_REDACTED = 'identity.verification_session.redacted';
const IDENTITY_VERIFICATION_SESSION_REQUIRES_INPUT = 'identity.verification_session.requires_input';
const IDENTITY_VERIFICATION_SESSION_VERIFIED = 'identity.verification_session.verified';
const INVOICE_CREATED = 'invoice.created';
const INVOICE_DELETED = 'invoice.deleted';
const INVOICE_FINALIZATION_FAILED = 'invoice.finalization_failed';
const INVOICE_FINALIZED = 'invoice.finalized';
const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
const INVOICE_PAID = 'invoice.paid';
@ -132,11 +147,14 @@ class Event extends ApiResource
const ISSUING_CARD_UPDATED = 'issuing_card.updated';
const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created';
const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated';
const ISSUING_DISPUTE_CLOSED = 'issuing_dispute.closed';
const ISSUING_DISPUTE_CREATED = 'issuing_dispute.created';
const ISSUING_DISPUTE_FUNDS_REINSTATED = 'issuing_dispute.funds_reinstated';
const ISSUING_DISPUTE_SUBMITTED = 'issuing_dispute.submitted';
const ISSUING_DISPUTE_UPDATED = 'issuing_dispute.updated';
const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created';
const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated';
const MANDATE_UPDATED = 'mandate.updated';
const ORDER_CREATED = 'order.created';
const ORDER_PAYMENT_FAILED = 'order.payment_failed';
const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded';
@ -145,9 +163,15 @@ class Event extends ApiResource
const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated';
const PAYMENT_INTENT_CANCELED = 'payment_intent.canceled';
const PAYMENT_INTENT_CREATED = 'payment_intent.created';
const PAYMENT_INTENT_PARTIALLY_FUNDED = 'payment_intent.partially_funded';
const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed';
const PAYMENT_INTENT_PROCESSING = 'payment_intent.processing';
const PAYMENT_INTENT_REQUIRES_ACTION = 'payment_intent.requires_action';
const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded';
const PAYMENT_LINK_CREATED = 'payment_link.created';
const PAYMENT_LINK_UPDATED = 'payment_link.updated';
const PAYMENT_METHOD_ATTACHED = 'payment_method.attached';
const PAYMENT_METHOD_AUTOMATICALLY_UPDATED = 'payment_method.automatically_updated';
const PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED = 'payment_method.card_automatically_updated';
const PAYMENT_METHOD_DETACHED = 'payment_method.detached';
const PAYMENT_METHOD_UPDATED = 'payment_method.updated';
@ -169,6 +193,15 @@ class Event extends ApiResource
const PRODUCT_CREATED = 'product.created';
const PRODUCT_DELETED = 'product.deleted';
const PRODUCT_UPDATED = 'product.updated';
const PROMOTION_CODE_CREATED = 'promotion_code.created';
const PROMOTION_CODE_DELETED = 'promotion_code.deleted';
const PROMOTION_CODE_UPDATED = 'promotion_code.updated';
const QUOTE_ACCEPTED = 'quote.accepted';
const QUOTE_CANCELED = 'quote.canceled';
const QUOTE_CREATED = 'quote.created';
const QUOTE_FINALIZED = 'quote.finalized';
const RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created';
const RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated';
const RECIPIENT_CREATED = 'recipient.created';
const RECIPIENT_DELETED = 'recipient.deleted';
const RECIPIENT_UPDATED = 'recipient.updated';
@ -179,6 +212,7 @@ class Event extends ApiResource
const REVIEW_OPENED = 'review.opened';
const SETUP_INTENT_CANCELED = 'setup_intent.canceled';
const SETUP_INTENT_CREATED = 'setup_intent.created';
const SETUP_INTENT_REQUIRES_ACTION = 'setup_intent.requires_action';
const SETUP_INTENT_SETUP_FAILED = 'setup_intent.setup_failed';
const SETUP_INTENT_SUCCEEDED = 'setup_intent.succeeded';
const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created';
@ -201,12 +235,21 @@ class Event extends ApiResource
const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated';
const TAX_RATE_CREATED = 'tax_rate.created';
const TAX_RATE_UPDATED = 'tax_rate.updated';
const TERMINAL_READER_ACTION_FAILED = 'terminal.reader.action_failed';
const TERMINAL_READER_ACTION_SUCCEEDED = 'terminal.reader.action_succeeded';
const TEST_HELPERS_TEST_CLOCK_ADVANCING = 'test_helpers.test_clock.advancing';
const TEST_HELPERS_TEST_CLOCK_CREATED = 'test_helpers.test_clock.created';
const TEST_HELPERS_TEST_CLOCK_DELETED = 'test_helpers.test_clock.deleted';
const TEST_HELPERS_TEST_CLOCK_INTERNAL_FAILURE = 'test_helpers.test_clock.internal_failure';
const TEST_HELPERS_TEST_CLOCK_READY = 'test_helpers.test_clock.ready';
const TOPUP_CANCELED = 'topup.canceled';
const TOPUP_CREATED = 'topup.created';
const TOPUP_FAILED = 'topup.failed';
const TOPUP_REVERSED = 'topup.reversed';
const TOPUP_SUCCEEDED = 'topup.succeeded';
const TRANSFER_CREATED = 'transfer.created';
const TRANSFER_FAILED = 'transfer.failed';
const TRANSFER_PAID = 'transfer.paid';
const TRANSFER_REVERSED = 'transfer.reversed';
const TRANSFER_UPDATED = 'transfer.updated';
}

View File

@ -18,8 +18,9 @@ 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 $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds.
* @property null|string $filename A filename for the file, suitable for saving to a filesystem.
* @property null|\Stripe\Collection $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
* @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 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 in bytes of the file object.
* @property null|string $title A user friendly title for the document.
@ -33,13 +34,19 @@ class File extends ApiResource
use ApiOperations\All;
use ApiOperations\Retrieve;
const PURPOSE_ACCOUNT_REQUIREMENT = 'account_requirement';
const PURPOSE_ADDITIONAL_VERIFICATION = 'additional_verification';
const PURPOSE_BUSINESS_ICON = 'business_icon';
const PURPOSE_BUSINESS_LOGO = 'business_logo';
const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature';
const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence';
const PURPOSE_DOCUMENT_PROVIDER_IDENTITY_DOCUMENT = 'document_provider_identity_document';
const PURPOSE_FINANCE_REPORT_RUN = 'finance_report_run';
const PURPOSE_IDENTITY_DOCUMENT = 'identity_document';
const PURPOSE_IDENTITY_DOCUMENT_DOWNLOADABLE = 'identity_document_downloadable';
const PURPOSE_PCI_DOCUMENT = 'pci_document';
const PURPOSE_SELFIE = 'selfie';
const PURPOSE_SIGMA_SCHEDULED_QUERY = 'sigma_scheduled_query';
const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload';
// This resource can have two different object names. In latter API

View File

@ -0,0 +1,84 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\FinancialConnections;
/**
* A Financial Connections Account represents an account that exists outside of
* Stripe, to which you have been granted some degree of access.
*
* @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 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|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 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.
*/
class Account extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account';
use \Stripe\ApiOperations\Retrieve;
const CATEGORY_CASH = 'cash';
const CATEGORY_CREDIT = 'credit';
const CATEGORY_INVESTMENT = 'investment';
const CATEGORY_OTHER = 'other';
const STATUS_ACTIVE = 'active';
const STATUS_DISCONNECTED = 'disconnected';
const STATUS_INACTIVE = 'inactive';
const SUBCATEGORY_CHECKING = 'checking';
const SUBCATEGORY_CREDIT_CARD = 'credit_card';
const SUBCATEGORY_LINE_OF_CREDIT = 'line_of_credit';
const SUBCATEGORY_MORTGAGE = 'mortgage';
const SUBCATEGORY_OTHER = 'other';
const SUBCATEGORY_SAVINGS = 'savings';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\FinancialConnections\Account the disconnected account
*/
public function disconnect($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/disconnect';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\FinancialConnections\Account the refreshed account
*/
public function refresh($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/refresh';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@ -0,0 +1,20 @@
<?php
// File generated from our OpenAPI spec
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|string $email The email address of the owner.
* @property string $name The full name of the owner.
* @property string $ownership The ownership object that this owner belongs to.
* @property null|string $phone The raw phone number of the owner.
* @property null|string $raw_address The raw physical address of the owner.
* @property null|int $refreshed_at The timestamp of the refresh that updated this owner.
*/
class AccountOwner extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account_owner';
}

View File

@ -0,0 +1,18 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\FinancialConnections;
/**
* Describes a snapshot of the owners of an account at a particular point in time.
*
* @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.
*/
class AccountOwnership extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account_ownership';
}

View File

@ -0,0 +1,27 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\FinancialConnections;
/**
* A Financial Connections Session is the secure way to programmatically launch the
* client-side Stripe.js modal that lets your users link their accounts.
*
* @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 string $client_secret A value that will be passed to the client to launch the authentication flow.
* @property \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 string $return_url For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
*/
class Session extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.session';
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
}

View File

@ -0,0 +1,28 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe;
/**
* Each customer has a <a
* href="https://stripe.com/docs/api/customers/object#customer_object-balance"><code>balance</code></a>
* that is automatically applied to future invoices and payments using the
* <code>customer_balance</code> payment method. Customers can fund this balance by
* initiating a bank transfer to any account in the
* <code>financial_addresses</code> field. Related guide: <a
* href="https://stripe.com/docs/payments/customer-balance/funding-instructions">Customer
* Balance - Funding Instructions</a> to learn more.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\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.
*/
class FundingInstructions extends ApiResource
{
const OBJECT_NAME = 'funding_instructions';
const FUNDING_TYPE_BANK_TRANSFER = 'bank_transfer';
}

View File

@ -24,17 +24,17 @@ if (!\defined('CURL_HTTP_VERSION_2TLS')) {
\define('CURL_HTTP_VERSION_2TLS', 4);
}
class CurlClient implements ClientInterface
class CurlClient implements ClientInterface, StreamingClientInterface
{
private static $instance;
protected static $instance;
public static function instance()
{
if (!self::$instance) {
self::$instance = new self();
if (!static::$instance) {
static::$instance = new static();
}
return self::$instance;
return static::$instance;
}
protected $defaultOptions;
@ -193,7 +193,7 @@ class CurlClient implements ClientInterface
// END OF USER DEFINED TIMEOUTS
public function request($method, $absUrl, $headers, $params, $hasFile)
private function constructRequest($method, $absUrl, $headers, $params, $hasFile)
{
$method = \strtolower($method);
@ -237,7 +237,7 @@ class CurlClient implements ClientInterface
// add an Idempotency-Key header
if (('post' === $method) && (Stripe::$maxNetworkRetries > 0)) {
if (!$this->hasHeader($headers, 'Idempotency-Key')) {
\array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid());
$headers[] = 'Idempotency-Key: ' . $this->randomGenerator->uuid();
}
}
@ -253,7 +253,7 @@ class CurlClient implements ClientInterface
// we'll error under that condition. To compensate for that problem
// for the time being, override cURL's behavior by simply always
// sending an empty `Expect:` header.
\array_push($headers, 'Expect: ');
$headers[] = 'Expect: ';
$absUrl = Util\Util::utf8($absUrl);
$opts[\CURLOPT_URL] = $absUrl;
@ -271,19 +271,217 @@ class CurlClient implements ClientInterface
$opts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2TLS;
}
// If the user didn't explicitly specify a CURLOPT_IPRESOLVE option, we
// force IPv4 resolving as Stripe's API servers are only accessible over
// IPv4 (see. https://github.com/stripe/stripe-php/issues/1045).
// We let users specify a custom option in case they need to say proxy
// through an IPv6 proxy.
if (!isset($opts[\CURLOPT_IPRESOLVE])) {
$opts[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4;
}
return [$opts, $absUrl];
}
public function request($method, $absUrl, $headers, $params, $hasFile)
{
list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile);
list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl);
return [$rbody, $rcode, $rheaders];
}
public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk)
{
list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile);
$opts[\CURLOPT_RETURNTRANSFER] = false;
list($rbody, $rcode, $rheaders) = $this->executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk);
return [$rbody, $rcode, $rheaders];
}
/**
* Curl permits sending \CURLOPT_HEADERFUNCTION, which is called with lines
* from the header and \CURLOPT_WRITEFUNCTION, which is called with bytes
* from the body. You usually want to handle the body differently depending
* on what was in the header.
*
* This function makes it easier to specify different callbacks depending
* on the contents of the heeder. After the header has been completely read
* and the body begins to stream, it will call $determineWriteCallback with
* the array of headers. $determineWriteCallback should, based on the
* headers it receives, return a "writeCallback" that describes what to do
* with the incoming HTTP response body.
*
* @param array $opts
* @param callable $determineWriteCallback
*
* @return array
*/
private function useHeadersToDetermineWriteCallback($opts, $determineWriteCallback)
{
$rheaders = new Util\CaseInsensitiveArray();
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
return self::parseLineIntoHeaderArray($header_line, $rheaders);
};
$writeCallback = null;
$writeCallbackWrapper = function ($curl, $data) use (&$writeCallback, &$rheaders, &$determineWriteCallback) {
if (null === $writeCallback) {
$writeCallback = \call_user_func_array($determineWriteCallback, [$rheaders]);
}
return \call_user_func_array($writeCallback, [$curl, $data]);
};
return [$headerCallback, $writeCallbackWrapper];
}
private static function parseLineIntoHeaderArray($line, &$headers)
{
if (false === \strpos($line, ':')) {
return \strlen($line);
}
list($key, $value) = \explode(':', \trim($line), 2);
$headers[\trim($key)] = \trim($value);
return \strlen($line);
}
/**
* Like `executeRequestWithRetries` except:
* 1. Does not buffer the body of a successful (status code < 300)
* response into memory -- instead, calls the caller-provided
* $readBodyChunk with each chunk of incoming data.
* 2. Does not retry if a network error occurs while streaming the
* body of a successful response.
*
* @param array $opts cURL options
* @param string $absUrl
* @param callable $readBodyChunk
*
* @return array
*/
public function executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk)
{
/** @var bool */
$shouldRetry = false;
/** @var int */
$numRetries = 0;
// Will contain the bytes of the body of the last request
// if it was not successful and should not be retries
/** @var null|string */
$rbody = null;
// Status code of the last request
/** @var null|bool */
$rcode = null;
// Array of headers from the last request
/** @var null|array */
$lastRHeaders = null;
$errno = null;
$message = null;
$determineWriteCallback = function ($rheaders) use (
&$readBodyChunk,
&$shouldRetry,
&$rbody,
&$numRetries,
&$rcode,
&$lastRHeaders,
&$errno
) {
$lastRHeaders = $rheaders;
$errno = \curl_errno($this->curlHandle);
$rcode = \curl_getinfo($this->curlHandle, \CURLINFO_HTTP_CODE);
// Send the bytes from the body of a successful request to the caller-provided $readBodyChunk.
if ($rcode < 300) {
$rbody = null;
return 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]);
return \strlen($data);
};
}
$shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries);
// Discard the body from an unsuccessful request that should be retried.
if ($shouldRetry) {
return function ($curl, $data) {
return \strlen($data);
};
} else {
// Otherwise, buffer the body into $rbody. It will need to be parsed to determine
// which exception to throw to the user.
$rbody = '';
return function ($curl, $data) use (&$rbody) {
$rbody .= $data;
return \strlen($data);
};
}
};
while (true) {
list($headerCallback, $writeCallback) = $this->useHeadersToDetermineWriteCallback($opts, $determineWriteCallback);
$opts[\CURLOPT_HEADERFUNCTION] = $headerCallback;
$opts[\CURLOPT_WRITEFUNCTION] = $writeCallback;
$shouldRetry = false;
$rbody = null;
$this->resetCurlHandle();
\curl_setopt_array($this->curlHandle, $opts);
$result = \curl_exec($this->curlHandle);
$errno = \curl_errno($this->curlHandle);
if (0 !== $errno) {
$message = \curl_error($this->curlHandle);
}
if (!$this->getEnablePersistentConnections()) {
$this->closeCurlHandle();
}
if (\is_callable($this->getRequestStatusCallback())) {
\call_user_func_array(
$this->getRequestStatusCallback(),
[$rbody, $rcode, $lastRHeaders, $errno, $message, $shouldRetry, $numRetries]
);
}
if ($shouldRetry) {
++$numRetries;
$sleepSeconds = $this->sleepTime($numRetries, $lastRHeaders);
\usleep((int) ($sleepSeconds * 1000000));
} else {
break;
}
}
if (0 !== $errno) {
$this->handleCurlError($absUrl, $errno, $message, $numRetries);
}
return [$rbody, $rcode, $lastRHeaders];
}
/**
* @param array $opts cURL options
* @param string $absUrl
*/
private function executeRequestWithRetries($opts, $absUrl)
public function executeRequestWithRetries($opts, $absUrl)
{
$numRetries = 0;
$isPost = \array_key_exists(\CURLOPT_POST, $opts) && 1 === $opts[\CURLOPT_POST];
while (true) {
$rcode = 0;
@ -293,14 +491,7 @@ class CurlClient implements ClientInterface
// Create a callback to capture HTTP headers for the response
$rheaders = new Util\CaseInsensitiveArray();
$headerCallback = function ($curl, $header_line) use (&$rheaders) {
// Ignore the HTTP request line (HTTP/1.1 200 OK)
if (false === \strpos($header_line, ':')) {
return \strlen($header_line);
}
list($key, $value) = \explode(':', \trim($header_line), 2);
$rheaders[\trim($key)] = \trim($value);
return \strlen($header_line);
return CurlClient::parseLineIntoHeaderArray($header_line, $rheaders);
};
$opts[\CURLOPT_HEADERFUNCTION] = $headerCallback;
@ -363,6 +554,7 @@ class CurlClient implements ClientInterface
. 'https://twitter.com/stripestatus, or';
break;
case \CURLE_SSL_CACERT:
case \CURLE_SSL_PEER_CERTIFICATE:
$msg = "Could not verify Stripe's SSL certificate. Please make sure "
@ -371,6 +563,7 @@ class CurlClient implements ClientInterface
. 'If this problem persists,';
break;
default:
$msg = 'Unexpected error communicating with Stripe. '
. 'If this problem persists,';

View File

@ -0,0 +1,23 @@
<?php
namespace Stripe\HttpClient;
interface StreamingClientInterface
{
/**
* @param string $method The HTTP method being used
* @param string $absUrl The URL being requested, including domain and protocol
* @param array $headers Headers to be used in the request (full strings, not KV pairs)
* @param array $params KV pairs for parameters. Can be nested for arrays and hashes
* @param bool $hasFile Whether or not $params references a file (via an @ prefix or
* CURLFile)
* @param callable $readBodyChunkCallable a function that will be called with chunks of bytes from the body if the request is successful
*
* @throws \Stripe\Exception\ApiConnectionException
* @throws \Stripe\Exception\UnexpectedValueException
*
* @return array an array whose first element is raw request body, second
* element is HTTP status code and third array of HTTP headers
*/
public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunkCallable);
}

View File

@ -0,0 +1,45 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Identity;
/**
* A VerificationReport is the result of an attempt to collect and verify data from
* a user. The collection of verification checks performed is determined from the
* <code>type</code> and <code>options</code> parameters used. You can find the
* result of each verification check performed in the appropriate sub-resource:
* <code>document</code>, <code>id_number</code>, <code>selfie</code>.
*
* Each VerificationReport contains a copy of any data collected by the user as
* well as reference IDs which can be used to access collected images through the
* <a href="https://stripe.com/docs/api/files">FileUpload</a> API. To configure and
* create VerificationReports, use the <a
* href="https://stripe.com/docs/api/identity/verification_sessions">VerificationSession</a>
* API.
*
* Related guides: <a
* href="https://stripe.com/docs/identity/verification-sessions#results">Accessing
* verification results</a>.
*
* @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 $document Result from a document check
* @property \Stripe\StripeObject $id_number Result from an id_number check
* @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 $options
* @property \Stripe\StripeObject $selfie Result from a selfie check
* @property string $type Type of report.
* @property null|string $verification_session ID of the VerificationSession that created this report.
*/
class VerificationReport extends \Stripe\ApiResource
{
const OBJECT_NAME = 'identity.verification_report';
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
const TYPE_DOCUMENT = 'document';
const TYPE_ID_NUMBER = 'id_number';
}

View File

@ -0,0 +1,88 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Identity;
/**
* A VerificationSession guides you through the process of collecting and verifying
* the identities of your users. It contains details about the type of
* verification, such as what <a
* href="/docs/identity/verification-checks">verification check</a> to perform.
* Only create one VerificationSession for each verification in your system.
*
* A VerificationSession transitions through <a
* href="/docs/identity/how-sessions-work">multiple statuses</a> throughout its
* lifetime as it progresses through the verification flow. The VerificationSession
* contains the users verified data after verification checks are complete.
*
* Related guide: <a
* href="https://stripe.com/docs/identity/verification-sessions">The Verification
* Sessions API</a>
*
* @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 $client_secret The short-lived client secret used by Stripe.js to <a href="https://stripe.com/docs/js/identity/modal">show a verification modal</a> inside your app. This client secret expires after 24 hours and can only be used once. Dont store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on <a href="https://stripe.com/docs/identity/verification-sessions#client-secret">passing the client secret to the frontend</a> to learn more.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|\Stripe\StripeObject $last_error If present, this property tells you the last error encountered when processing the verification.
* @property null|string|\Stripe\Identity\VerificationReport $last_verification_report ID of the most recent VerificationReport. <a href="https://stripe.com/docs/identity/verification-sessions#results">Learn more about accessing detailed verification results.</a>
* @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 \Stripe\StripeObject $options
* @property null|\Stripe\StripeObject $redaction Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
* @property string $status Status of this VerificationSession. <a href="https://stripe.com/docs/identity/how-sessions-work">Learn more about the lifecycle of sessions</a>.
* @property string $type The type of <a href="https://stripe.com/docs/identity/verification-checks">verification check</a> to be performed.
* @property null|string $url The short-lived URL that you use to redirect a user to Stripe to submit their identity information. This URL expires after 48 hours and can only be used once. Dont store it, log it, send it in emails or expose it to anyone other than the user. Refer to our docs on <a href="https://stripe.com/docs/identity/verify-identity-documents?platform=web&amp;type=redirect">verifying identity documents</a> to learn how to redirect users to Stripe.
* @property null|\Stripe\StripeObject $verified_outputs The users verified data.
*/
class VerificationSession extends \Stripe\ApiResource
{
const OBJECT_NAME = 'identity.verification_session';
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_INPUT = 'requires_input';
const STATUS_VERIFIED = 'verified';
const TYPE_DOCUMENT = 'document';
const TYPE_ID_NUMBER = 'id_number';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Identity\VerificationSession the canceled verification session
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Identity\VerificationSession the redacted verification session
*/
public function redact($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/redact';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@ -23,7 +23,7 @@ namespace Stripe;
* to finalize the invoice.
*
* If your invoice is configured to be billed by sending an email, then based on
* your <a href="https://dashboard.stripe.com/account/billing/automatic'">email
* your <a href="https://dashboard.stripe.com/account/billing/automatic">email
* settings</a>, Stripe will email the invoice to your customer and await payment.
* These emails can contain a link to a hosted page to pay the invoice.
*
@ -32,11 +32,11 @@ namespace Stripe;
* amount due for the invoice is less than Stripe's <a
* href="/docs/currencies#minimum-and-maximum-charge-amounts">minimum allowed
* charge per currency</a>, the invoice is automatically marked paid, and we add
* the amount due to the customer's running account balance which is applied to the
* next invoice.
* the amount due to the customer's credit balance which is applied to the next
* invoice.
*
* More details on the customer's account balance are <a
* href="https://stripe.com/docs/api/customers/object#customer_object-account_balance">here</a>.
* More details on the customer's credit balance are <a
* href="https://stripe.com/docs/billing/customer/balance">here</a>.
*
* Related guide: <a href="https://stripe.com/docs/billing/invoices/sending">Send
* Invoices to Customers</a>.
@ -45,20 +45,23 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|string $account_country The country of the business associated with this invoice, most often the business creating the invoice.
* @property null|string $account_name The public name of the business associated with this invoice, most often the business creating the invoice.
* @property null|(string|\Stripe\TaxId)[] $account_tax_ids The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
* @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the <code>amount_due</code> may be 0. If there is a positive <code>starting_balance</code> for the invoice (the customer owes money), the <code>amount_due</code> will also take that into account. The charge that gets generated for the invoice will be for the amount specified in <code>amount_due</code>.
* @property int $amount_paid The amount, in %s, that was paid.
* @property int $amount_remaining The amount remaining, in %s, that is due.
* @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the invoice.
* @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.
* @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule.
* @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the <code>invoice.created</code> webhook, for example, so you might not want to display that invoice as unpaid to your users.
* @property bool $auto_advance Controls whether Stripe will perform <a href="https://stripe.com/docs/billing/invoices/workflow/#auto_advance">automatic collection</a> of the invoice. When <code>false</code>, the invoice's state will not automatically advance without an explicit action.
* @property \Stripe\StripeObject $automatic_tax
* @property null|string $billing_reason Indicates the reason why the invoice was created. <code>subscription_cycle</code> indicates an invoice created by a subscription advancing into a new period. <code>subscription_create</code> indicates an invoice created due to creating a subscription. <code>subscription_update</code> indicates an invoice created due to updating a subscription. <code>subscription</code> is set for all old invoices to indicate either a change to a subscription or a period advancement. <code>manual</code> is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The <code>upcoming</code> value is reserved for simulated invoices per the upcoming invoice endpoint. <code>subscription_threshold</code> indicates an invoice created due to a billing threshold being reached.
* @property null|string|\Stripe\Charge $charge ID of the latest charge generated for this invoice, if any.
* @property null|string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
* @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
* @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[] $custom_fields Custom fields displayed on the invoice.
* @property string|\Stripe\Customer $customer The ID of the customer who will be billed.
* @property null|string|\Stripe\Customer $customer The ID of the customer who will be billed.
* @property null|\Stripe\StripeObject $customer_address The customer's address. Until the invoice is finalized, this field will equal <code>customer.address</code>. Once the invoice is finalized, this field will no longer be updated.
* @property null|string $customer_email The customer's email. Until the invoice is finalized, this field will equal <code>customer.email</code>. Once the invoice is finalized, this field will no longer be updated.
* @property null|string $customer_name The customer's name. Until the invoice is finalized, this field will equal <code>customer.name</code>. Once the invoice is finalized, this field will no longer be updated.
@ -67,27 +70,32 @@ namespace Stripe;
* @property null|string $customer_tax_exempt The customer's tax exempt status. Until the invoice is finalized, this field will equal <code>customer.tax_exempt</code>. Once the invoice is finalized, this field will no longer be updated.
* @property null|\Stripe\StripeObject[] $customer_tax_ids The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as <code>customer.tax_ids</code>. Once the invoice is finalized, this field will no longer be updated.
* @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.
* @property null|string|\Stripe\StripeObject $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
* @property null|\Stripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any.
* @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
* @property \Stripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.
* @property null|\Stripe\Discount $discount Describes the current discount applied to this invoice, if there is one.
* @property null|\Stripe\Discount $discount Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts.
* @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount.
* @property null|int $due_date The date on which payment for this invoice is due. This value will be <code>null</code> for invoices where <code>collection_method=charge_automatically</code>.
* @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
* @property null|string $footer Footer displayed on the invoice.
* @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
* @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
* @property \Stripe\Collection $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any.
* @property null|\Stripe\ErrorObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
* @property \Stripe\Collection<\Stripe\InvoiceLineItem> $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: invoice items in reverse chronological order, followed by the subscription, 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 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|int $next_payment_attempt The time at which payment will next be attempted. This value will be <code>null</code> for invoices where <code>collection_method=send_invoice</code>.
* @property null|string $number A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified.
* @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a> documentation for details.
* @property bool $paid Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance.
* @property bool $paid_out_of_band Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe.
* @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.
* @property \Stripe\StripeObject $payment_settings
* @property int $period_end End of the usage period during which invoice items were added to this invoice.
* @property int $period_start Start of the usage period during which invoice items were added to this invoice.
* @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice.
* @property int $pre_payment_credit_notes_amount Total amount of all pre-payment credit notes issued for this invoice.
* @property null|string|\Stripe\Quote $quote The quote this invoice was generated from.
* @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice.
* @property int $starting_balance Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance.
* @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement.
@ -97,11 +105,11 @@ namespace Stripe;
* @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
* @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
* @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
* @property null|float $tax_percent This percentage of the subtotal has been added to the total amount of the invoice, including invoice line items and discounts. This field is inherited from the subscription's <code>tax_percent</code> field, but can be changed before the invoice is paid. This field defaults to null.
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice belongs to.
* @property \Stripe\StripeObject $threshold_reason
* @property int $total Total after discounts and taxes.
* @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items.
* @property null|\Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items.
* @property \Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items.
* @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have <a href="https://stripe.com/docs/billing/webhooks#understand">been exhausted</a>. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
*/
class Invoice extends ApiResource
@ -112,12 +120,14 @@ class Invoice extends ApiResource
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Search;
use ApiOperations\Update;
const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
const BILLING_SEND_INVOICE = 'send_invoice';
const BILLING_REASON_MANUAL = 'manual';
const BILLING_REASON_QUOTE_ACCEPT = 'quote_accept';
const BILLING_REASON_SUBSCRIPTION = 'subscription';
const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
@ -139,24 +149,6 @@ class Invoice extends ApiResource
const PATH_LINES = '/lines';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice the upcoming invoice
*/
public static function upcoming($params = null, $opts = null)
{
$url = static::classUrl() . '/upcoming';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param string $id the ID of the invoice on which to retrieve the lines
* @param null|array $params
@ -164,7 +156,7 @@ class Invoice extends ApiResource
*
* @throws StripeExceptionApiErrorException if the request fails
*
* @return \Stripe\Collection the list of lines (InvoiceLineItem)
* @return \Stripe\Collection<\Stripe\InvoiceLineItem> the list of lines (InvoiceLineItem)
*/
public static function allLines($id, $params = null, $opts = null)
{
@ -177,7 +169,7 @@ class Invoice extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice the finalized invoice
* @return \Stripe\Invoice the finalized invoice
*/
public function finalizeInvoice($params = null, $opts = null)
{
@ -194,7 +186,7 @@ class Invoice extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice the uncollectible invoice
* @return \Stripe\Invoice the uncollectible invoice
*/
public function markUncollectible($params = null, $opts = null)
{
@ -211,7 +203,7 @@ class Invoice extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice the paid invoice
* @return \Stripe\Invoice the paid invoice
*/
public function pay($params = null, $opts = null)
{
@ -228,7 +220,7 @@ class Invoice extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice the sent invoice
* @return \Stripe\Invoice the sent invoice
*/
public function sendInvoice($params = null, $opts = null)
{
@ -245,7 +237,25 @@ class Invoice extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice the voided invoice
* @return \Stripe\Invoice the upcoming invoice
*/
public static function upcoming($params = null, $opts = null)
{
$url = static::classUrl() . '/upcoming';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice the voided invoice
*/
public function voidInvoice($params = null, $opts = null)
{
@ -255,4 +265,19 @@ class Invoice extends ApiResource
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<Invoice> the invoice search results
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/invoices/search';
return self::_searchResource($url, $params, $opts);
}
}

View File

@ -25,7 +25,7 @@ namespace Stripe;
* @property null|(string|\Stripe\Discount)[] $discounts The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount.
* @property null|string|\Stripe\Invoice $invoice The ID of the invoice this invoice item belongs 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 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 \Stripe\StripeObject $period
* @property null|\Stripe\Plan $plan If the invoice item is a proration, the plan of the subscription that the proration was computed for.
* @property null|\Stripe\Price $price The price of the invoice item.
@ -34,8 +34,8 @@ namespace Stripe;
* @property null|string|\Stripe\Subscription $subscription The subscription that this invoice item has been created for, if any.
* @property string $subscription_item The subscription item that this invoice item has been created for, if any.
* @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the <code>default_tax_rates</code> on the invoice do not apply to this invoice item.
* @property bool $unified_proration For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item.
* @property null|int $unit_amount Unit Amount (in the <code>currency</code> specified) of the invoice item.
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice item belongs to.
* @property null|int $unit_amount Unit amount (in the <code>currency</code> specified) of the invoice item.
* @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
*/
class InvoiceItem extends ApiResource

View File

@ -20,13 +20,13 @@ namespace Stripe;
* @property null|\Stripe\Plan $plan The plan of the subscription, if the line item is a subscription or a proration.
* @property null|\Stripe\Price $price The price of the line item.
* @property bool $proration Whether this is a proration.
* @property null|\Stripe\StripeObject $proration_details Additional details for proration line items
* @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration.
* @property null|string $subscription The subscription that the invoice item pertains to, if any.
* @property string $subscription_item The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription.
* @property null|\Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
* @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
* @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 string $type A string identifying the type of the source of this line item, either an <code>invoiceitem</code> or a <code>subscription</code>.
* @property bool $unified_proration For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item.
*/
class InvoiceLineItem extends ApiResource
{

View File

@ -17,6 +17,7 @@ namespace Stripe\Issuing;
* @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 total amount that was authorized or rejected. This amount is in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property bool $approved Whether the authorization has been approved.
* @property string $authorization_method How the card details were provided.
* @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization.
@ -30,11 +31,11 @@ namespace Stripe\Issuing;
* @property \Stripe\StripeObject $merchant_data
* @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 null|\Stripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an <code>issuing_authorization.request</code> webhook.
* @property \Stripe\StripeObject[] $request_history History of every time the authorization was approved/denied (whether approved/denied by you directly or by Stripe based on your <code>spending_controls</code>). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization or partial capture</a>, you can look at this field to see the previous states of the authorization.
* @property \Stripe\StripeObject[] $request_history History of every time <code>pending_request</code> was approved/denied, either by you directly or by Stripe (e.g. based on your <code>spending_controls</code>). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization</a>, you can look at this field to see the previous requests for the authorization.
* @property string $status The current status of the authorization in its lifecycle.
* @property \Stripe\Issuing\Transaction[] $transactions List of <a href="https://stripe.com/docs/api/issuing/transactions">transactions</a> associated with this authorization.
* @property \Stripe\StripeObject $verification_data
* @property null|string $wallet What, if any, digital wallet was used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
* @property null|string $wallet The digital wallet used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
*/
class Authorization extends \Stripe\ApiResource
{
@ -50,7 +51,7 @@ class Authorization extends \Stripe\ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Authorization the approved authorization
* @return \Stripe\Issuing\Authorization the approved authorization
*/
public function approve($params = null, $opts = null)
{
@ -67,7 +68,7 @@ class Authorization extends \Stripe\ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Authorization the declined authorization
* @return \Stripe\Issuing\Authorization the declined authorization
*/
public function decline($params = null, $opts = null)
{

View File

@ -29,6 +29,7 @@ namespace Stripe\Issuing;
* @property \Stripe\StripeObject $spending_controls
* @property string $status Whether authorizations can be approved on this card.
* @property string $type The type of the card.
* @property null|\Stripe\StripeObject $wallets Information relating to digital wallets (like Apple Pay and Google Pay).
*/
class Card extends \Stripe\ApiResource
{

View File

@ -22,7 +22,7 @@ namespace Stripe\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 $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 $name The cardholder's name. This will be printed on cards issued to them.
* @property null|string $phone_number The cardholder's phone number.
* @property null|string $phone_number The cardholder's phone number. This is required for all cardholders who will be creating EU cards. See the <a href="https://stripe.com/docs/issuing/3d-secure#when-is-3d-secure-applied">3D Secure documentation</a> for more details.
* @property \Stripe\StripeObject $requirements
* @property null|\Stripe\StripeObject $spending_controls Rules that control spending across this cardholder's cards. Refer to our <a href="https://stripe.com/docs/issuing/controls/spending-controls">documentation</a> for more details.
* @property string $status Specifies whether to permit authorizations on this cardholder's cards.

View File

@ -5,10 +5,9 @@
namespace Stripe\Issuing;
/**
* As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can <a
* href="https://stripe.com/docs/issuing/purchases/disputes">dispute</a>
* transactions that you do not recognize, suspect to be fraudulent, or have some
* other issue.
* As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can dispute
* transactions that the cardholder does not recognize, suspects to be fraudulent,
* or has other issues with.
*
* Related guide: <a
* href="https://stripe.com/docs/issuing/purchases/disputes">Disputing
@ -16,8 +15,14 @@ namespace Stripe\Issuing;
*
* @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\BalanceTransaction[] $balance_transactions List of balance transactions associated with this dispute.
* @property int $amount Disputed amount. Usually the amount of the <code>transaction</code>, but can differ (usually because of currency fluctuation).
* @property null|\Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with the dispute.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency The currency the <code>transaction</code> was made in.
* @property \Stripe\StripeObject $evidence
* @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 $status Current status of the dispute.
* @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed.
*/
class Dispute extends \Stripe\ApiResource
@ -28,4 +33,21 @@ class Dispute extends \Stripe\ApiResource
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Issuing\Dispute the submited dispute
*/
public function submit($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/submit';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@ -17,12 +17,14 @@ namespace Stripe\Issuing;
* @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 transaction amount, which will be reflected in your balance. This amount is in your currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property null|string|\Stripe\Issuing\Authorization $authorization The <code>Authorization</code> object that led to this transaction.
* @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the <a href="https://stripe.com/docs/api/balance_transactions">balance transaction</a> associated with this transaction.
* @property string|\Stripe\Issuing\Card $card The card used to make this transaction.
* @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this transaction belongs.
* @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|string|\Stripe\Issuing\Dispute $dispute If you've disputed the transaction, the ID of the 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 int $merchant_amount The amount that the merchant will receive, denominated in <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. It will be different from <code>amount</code> if the merchant is taking payment in a different currency.
* @property string $merchant_currency The currency with which the merchant is taking payment.
@ -30,6 +32,7 @@ namespace Stripe\Issuing;
* @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 null|\Stripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant.
* @property string $type The nature of the transaction.
* @property null|string $wallet The digital wallet used for this transaction. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
*/
class Transaction extends \Stripe\ApiResource
{

View File

@ -9,12 +9,12 @@ 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_subtotal Total before any discounts or taxes is applied.
* @property null|int $amount_total Total after discounts and taxes.
* @property int $amount_subtotal Total before any discounts or taxes are applied.
* @property int $amount_total Total after discounts and taxes.
* @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 $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name.
* @property \Stripe\StripeObject[] $discounts The discounts applied to the line item.
* @property \Stripe\Price $price <p>Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. <a href="https://stripe.com/docs/api#products">Products</a> help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.</p><p>For example, you might have a single &quot;gold&quot; product that has prices for $10/month, $100/year, and €9 once.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a>, <a href="https://stripe.com/docs/billing/invoices/create">create an invoice</a>, and more about <a href="https://stripe.com/docs/billing/prices-guide">products and prices</a>.</p>
* @property null|\Stripe\Price $price The price used to generate the line item.
* @property null|int $quantity The quantity of products being purchased.
* @property \Stripe\StripeObject[] $taxes The taxes applied to the line item.
*/

View File

@ -10,8 +10,8 @@ namespace Stripe;
* create, retrieve, and pay individual orders, as well as list all orders. Orders
* are identified by a unique, random ID.
*
* Related guide: <a href="https://stripe.com/docs/orders">Tax, Shipping, and
* Inventory</a>.
* Related guide: <a href="https://stripe.com/docs/orders-legacy">Tax, Shipping,
* and Inventory</a>.
*
* @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.
@ -27,8 +27,8 @@ namespace Stripe;
* @property string $external_coupon_code External coupon code to load for this order.
* @property \Stripe\OrderItem[] $items List of items constituting the order. An order can have up to 25 items.
* @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 null|\Stripe\Collection $returns A list of returns that have taken place for this order.
* @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\Collection<\Stripe\OrderReturn> $returns A list of returns that have taken place for this order.
* @property null|string $selected_shipping_method The shipping method that is currently selected for this order, if any. If present, it is equal to one of the <code>id</code>s of shipping methods in the <code>shipping_methods</code> array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method.
* @property null|\Stripe\StripeObject $shipping The shipping address for the order. Present if the order is for goods to be shipped.
* @property null|\Stripe\StripeObject[] $shipping_methods A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it.
@ -68,7 +68,7 @@ class Order extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Order the paid order
* @return \Stripe\Order the paid order
*/
public function pay($params = null, $opts = null)
{

View File

@ -22,14 +22,16 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
* @property int $amount_capturable Amount that can be captured from this PaymentIntent.
* @property \Stripe\StripeObject $amount_details
* @property int $amount_received Amount that was collected by this PaymentIntent.
* @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the PaymentIntent.
* @property null|int $application_fee_amount The amount of the application fee (if any) for the resulting payment. See the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a> for details.
* @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a>.
* @property null|\Stripe\StripeObject $automatic_payment_methods Settings to configure compatible payment methods from the <a href="https://dashboard.stripe.com/settings/payment_methods">Stripe Dashboard</a>
* @property null|int $canceled_at Populated when <code>status</code> is <code>canceled</code>, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch.
* @property null|string $cancellation_reason Reason for cancellation of this PaymentIntent, either user-provided (<code>duplicate</code>, <code>fraudulent</code>, <code>requested_by_customer</code>, or <code>abandoned</code>) or generated by Stripe internally (<code>failed_invoice</code>, <code>void_invoice</code>, or <code>automatic</code>).
* @property string $capture_method Controls when the funds will be captured from the customer's account.
* @property \Stripe\Collection $charges Charges that were created by this PaymentIntent, if any.
* @property null|string $client_secret <p>The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete a payment from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. 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/payments/accept-a-payment">accept a payment</a> and learn about how <code>client_secret</code> should be handled.</p>
* @property \Stripe\Collection<\Stripe\Charge> $charges Charges that were created by this PaymentIntent, if any.
* @property null|string $client_secret <p>The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete a payment from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. 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/payments/accept-a-payment?ui=elements">accept a payment</a> and learn about how <code>client_secret</code> should be handled.</p>
* @property string $confirmation_method
* @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>.
@ -44,11 +46,12 @@ namespace Stripe;
* @property null|string|\Stripe\PaymentMethod $payment_method ID of the payment method used in this PaymentIntent.
* @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for this PaymentIntent.
* @property string[] $payment_method_types The list of payment method types (e.g. card) that this PaymentIntent is allowed to use.
* @property null|\Stripe\StripeObject $processing If present, this property tells you about the processing state of the payment.
* @property null|string $receipt_email Email address that the receipt for the resulting payment will be sent to. If <code>receipt_email</code> is specified for a payment in live mode, a receipt will be sent regardless of your <a href="https://dashboard.stripe.com/account/emails">email settings</a>.
* @property null|string|\Stripe\Review $review ID of the review associated with this PaymentIntent, if any.
* @property null|string $setup_future_usage <p>Indicates that you intend to make future payments with this PaymentIntent's payment method.</p><p>Providing this parameter will <a href="https://stripe.com/docs/payments/save-during-payment">attach the payment method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be <a href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer after the transaction completes.</p><p>When processing card payments, Stripe also uses <code>setup_future_usage</code> to dynamically optimize your payment flow and comply with regional legislation and network rules, such as <a href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.</p>
* @property null|\Stripe\StripeObject $shipping Shipping information for this PaymentIntent.
* @property null|string|\Stripe\StripeObject $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied.
* @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied.
* @property null|string $statement_descriptor For non-card charges, you can use this value as the complete description that appears on your customers statements. Must contain at least one letter, maximum 22 characters.
* @property null|string $statement_descriptor_suffix Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor thats set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
* @property string $status Status of this PaymentIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>requires_capture</code>, <code>canceled</code>, or <code>succeeded</code>. Read more about each PaymentIntent <a href="https://stripe.com/docs/payments/intents#intent-statuses">status</a>.
@ -62,6 +65,7 @@ class PaymentIntent extends ApiResource
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Search;
use ApiOperations\Update;
const STATUS_CANCELED = 'canceled';
@ -78,7 +82,24 @@ class PaymentIntent extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentIntent the canceled payment intent
* @return \Stripe\PaymentIntent the applied payment intent
*/
public function applyCustomerBalance($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/apply_customer_balance';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\PaymentIntent the canceled payment intent
*/
public function cancel($params = null, $opts = null)
{
@ -95,7 +116,7 @@ class PaymentIntent extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentIntent the captured payment intent
* @return \Stripe\PaymentIntent the captured payment intent
*/
public function capture($params = null, $opts = null)
{
@ -112,7 +133,7 @@ class PaymentIntent extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentIntent the confirmed payment intent
* @return \Stripe\PaymentIntent the confirmed payment intent
*/
public function confirm($params = null, $opts = null)
{
@ -122,4 +143,53 @@ class PaymentIntent extends ApiResource
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\PaymentIntent the incremented payment intent
*/
public function incrementAuthorization($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/increment_authorization';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\PaymentIntent the verified payment intent
*/
public function verifyMicrodeposits($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/verify_microdeposits';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<PaymentIntent> the payment intent search results
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/payment_intents/search';
return self::_searchResource($url, $params, $opts);
}
}

View File

@ -0,0 +1,70 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe;
/**
* A payment link is a shareable URL that will take your customers to a hosted
* payment page. A payment link can be shared and used multiple times.
*
* When a customer opens a payment link it will open a new <a
* href="https://stripe.com/docs/api/checkout/sessions">checkout session</a> to
* render the payment page. You can use <a
* href="https://stripe.com/docs/api/events/types#event_types-checkout.session.completed">checkout
* session events</a> to track payments through payment links.
*
* Related guide: <a
* href="https://stripe.com/docs/payments/payment-links/api">Payment Links API</a>
*
* @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 bool $active Whether the payment link's <code>url</code> is active. If <code>false</code>, customers visiting the URL will be shown a page saying that the link has been deactivated.
* @property \Stripe\StripeObject $after_completion
* @property bool $allow_promotion_codes Whether user redeemable promotion codes are enabled.
* @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account.
* @property null|float $application_fee_percent This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account.
* @property \Stripe\StripeObject $automatic_tax
* @property string $billing_address_collection Configuration for collecting the customer's billing address.
* @property \Stripe\Collection<\Stripe\LineItem> $line_items The line items representing what is being sold.
* @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 null|string|\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details.
* @property null|string[] $payment_method_types The list of payment method types that customers can use. When <code>null</code>, Stripe will dynamically show relevant payment methods you've enabled in your <a href="https://dashboard.stripe.com/settings/payment_methods">payment method settings</a>.
* @property \Stripe\StripeObject $phone_number_collection
* @property null|\Stripe\StripeObject $shipping_address_collection Configuration for collecting the customer's shipping address.
* @property null|\Stripe\StripeObject $subscription_data When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use <code>subscription_data</code>.
* @property null|\Stripe\StripeObject $transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
* @property string $url The public URL that can be shared with customers.
*/
class PaymentLink extends ApiResource
{
const OBJECT_NAME = 'payment_link';
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
const BILLING_ADDRESS_COLLECTION_AUTO = 'auto';
const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required';
/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\PaymentLink> list of LineItems
*/
public static function allLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@ -5,11 +5,11 @@
namespace Stripe;
/**
* PaymentMethod objects represent your customer's payment instruments. They can be
* used with <a
* PaymentMethod objects represent your customer's payment instruments. You can use
* them with <a
* href="https://stripe.com/docs/payments/payment-intents">PaymentIntents</a> to
* collect payments or saved to Customer objects to store instrument details for
* future payments.
* collect payments or save them to Customer objects to store instrument details
* for future payments.
*
* Related guides: <a
* href="https://stripe.com/docs/payments/payment-methods">Payment Methods</a> and
@ -18,25 +18,37 @@ 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 \Stripe\StripeObject $acss_debit
* @property \Stripe\StripeObject $afterpay_clearpay
* @property \Stripe\StripeObject $alipay
* @property \Stripe\StripeObject $au_becs_debit
* @property \Stripe\StripeObject $bacs_debit
* @property \Stripe\StripeObject $bancontact
* @property \Stripe\StripeObject $billing_details
* @property \Stripe\StripeObject $boleto
* @property \Stripe\StripeObject $card
* @property \Stripe\StripeObject $card_present
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\Stripe\Customer $customer The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.
* @property \Stripe\StripeObject $customer_balance
* @property \Stripe\StripeObject $eps
* @property \Stripe\StripeObject $fpx
* @property \Stripe\StripeObject $giropay
* @property \Stripe\StripeObject $grabpay
* @property \Stripe\StripeObject $ideal
* @property \Stripe\StripeObject $interac_present
* @property \Stripe\StripeObject $klarna
* @property \Stripe\StripeObject $konbini
* @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 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 \Stripe\StripeObject $oxxo
* @property \Stripe\StripeObject $p24
* @property \Stripe\StripeObject $paynow
* @property \Stripe\StripeObject $sepa_debit
* @property \Stripe\StripeObject $sofort
* @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
* @property \Stripe\StripeObject $us_bank_account
* @property \Stripe\StripeObject $wechat_pay
*/
class PaymentMethod extends ApiResource
{
@ -53,7 +65,7 @@ class PaymentMethod extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentMethod the attached payment method
* @return \Stripe\PaymentMethod the attached payment method
*/
public function attach($params = null, $opts = null)
{
@ -70,7 +82,7 @@ class PaymentMethod extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentMethod the detached payment method
* @return \Stripe\PaymentMethod the detached payment method
*/
public function detach($params = null, $opts = null)
{

View File

@ -7,10 +7,10 @@ namespace Stripe;
/**
* A <code>Payout</code> object is created when you receive funds from Stripe, or
* when you initiate a payout to either a bank account or debit card of a <a
* href="/docs/connect/payouts">connected Stripe account</a>. You can retrieve
* individual payouts, as well as list all payouts. Payouts are made on <a
* href="/docs/payouts#payout-schedule">varying schedules</a>, depending on your
* country and industry.
* href="/docs/connect/bank-debit-card-payouts">connected Stripe account</a>. You
* can retrieve individual payouts, as well as list all payouts. Payouts are made
* on <a href="/docs/connect/manage-payout-schedule">varying schedules</a>,
* depending on your country and industry.
*
* Related guide: <a href="https://stripe.com/docs/payouts">Receiving Payouts</a>.
*
@ -23,13 +23,15 @@ namespace Stripe;
* @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|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|string|\Stripe\StripeObject $destination ID of the bank account or card the payout was sent to.
* @property null|string|\Stripe\BankAccount|\Stripe\Card $destination ID of the bank account or card the payout was sent to.
* @property null|string|\Stripe\BalanceTransaction $failure_balance_transaction If the payout failed or was canceled, this will be the ID of the balance transaction that reversed the initial balance transaction, and puts the funds from the failed payout back in your balance.
* @property null|string $failure_code Error code explaining reason for payout failure if available. See <a href="https://stripe.com/docs/api#payout_failures">Types of payout failures</a> for a list of failure codes.
* @property null|string $failure_message Message to user further explaining reason for payout failure if available.
* @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 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 $method The method used to send this payout, which can be <code>standard</code> or <code>instant</code>. <code>instant</code> is only supported for payouts to debit cards. (See <a href="https://stripe.com/blog/instant-payouts-for-marketplaces">Instant payouts for marketplaces</a> for more information.)
* @property null|string|\Stripe\Payout $original_payout If the payout reverses another, this is the ID of the original payout.
* @property null|string|\Stripe\Payout $reversed_by If the payout was reversed, this is the ID of the payout that reverses this payout.
* @property string $source_type The source balance this payout came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>.
* @property null|string $statement_descriptor Extra information about a payout to be displayed on the user's bank statement.
* @property string $status Current status of the payout: <code>paid</code>, <code>pending</code>, <code>in_transit</code>, <code>canceled</code> or <code>failed</code>. A payout is <code>pending</code> until it is submitted to the bank, when it becomes <code>in_transit</code>. The status then changes to <code>paid</code> if the transaction goes through, or to <code>failed</code> or <code>canceled</code> (within 5 business days). Some failed payouts may initially show as <code>paid</code> but then change to <code>failed</code>.
@ -76,7 +78,7 @@ class Payout extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Payout the canceled payout
* @return \Stripe\Payout the canceled payout
*/
public function cancel($params = null, $opts = null)
{
@ -86,4 +88,21 @@ class Payout extends ApiResource
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Payout the reversed payout
*/
public function reverse($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/reverse';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@ -7,6 +7,14 @@ namespace Stripe;
/**
* This is an object representing a person associated with a Stripe account.
*
* A platform cannot access a Standard or Express account's persons after the
* account starts onboarding, such as after generating an account link for the
* account. See the <a
* href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a>
* or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding
* documentation</a> for information about platform pre-filling and account
* onboarding steps.
*
* Related guide: <a
* href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling
* Identity Verification with the API</a>.
@ -23,6 +31,8 @@ namespace Stripe;
* @property null|string $first_name The person's first name.
* @property null|string $first_name_kana The Kana variation of the person's first name (Japan only).
* @property null|string $first_name_kanji The Kanji variation of the person's first name (Japan only).
* @property string[] $full_name_aliases A list of alternate names or aliases that the person is known by.
* @property null|\Stripe\StripeObject $future_requirements Information about the upcoming new requirements for this person, including what information needs to be collected, and by when.
* @property null|string $gender The person's gender (International regulations require either &quot;male&quot; or &quot;female&quot;).
* @property bool $id_number_provided Whether the person's <code>id_number</code> was provided.
* @property null|string $last_name The person's last name.
@ -30,8 +40,10 @@ namespace Stripe;
* @property null|string $last_name_kanji The Kanji variation of the person's last name (Japan only).
* @property null|string $maiden_name The person's maiden name.
* @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 null|string $nationality The country where the person is a national.
* @property null|string $phone The person's phone number.
* @property string $political_exposure Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
* @property \Stripe\StripeObject $registered_address
* @property \Stripe\StripeObject $relationship
* @property null|\Stripe\StripeObject $requirements Information about the requirements for this person, including what information needs to be collected, and by when.
* @property bool $ssn_last_4_provided Whether the last four digits of the person's Social Security number have been provided (U.S. only).

View File

@ -22,24 +22,24 @@ namespace Stripe;
* Related guides: <a
* href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
* a subscription</a> and more about <a
* href="https://stripe.com/docs/billing/prices-guide">products and prices</a>.
* href="https://stripe.com/docs/products-prices/overview">products and prices</a>.
*
* @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 bool $active Whether the plan can be used for new purchases.
* @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans of <code>usage_type=metered</code>. Allowed values are <code>sum</code> for summing up all usage during a period, <code>last_during_period</code> for using the last usage record reported within a period, <code>last_ever</code> for using the last usage record ever (across period bounds) or <code>max</code> which uses the usage record with the maximum reported usage during a period. Defaults to <code>sum</code>.
* @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible.
* @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.
* @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if <code>billing_scheme=per_unit</code>.
* @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if <code>billing_scheme=per_unit</code>.
* @property string $billing_scheme Describes how to compute the price per period. Either <code>per_unit</code> or <code>tiered</code>. <code>per_unit</code> indicates that the fixed amount (specified in <code>amount</code>) will be charged per unit in <code>quantity</code> (for plans with <code>usage_type=licensed</code>), or per unit of total usage (for plans with <code>usage_type=metered</code>). <code>tiered</code> indicates that the unit pricing will be computed using a tiering strategy as defined using the <code>tiers</code> and <code>tiers_mode</code> attributes.
* @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 $interval The frequency at which a subscription is billed. One of <code>day</code>, <code>week</code>, <code>month</code> or <code>year</code>.
* @property int $interval_count The number of intervals (specified in the <code>interval</code> attribute) between subscription billings. For example, <code>interval=month</code> and <code>interval_count=3</code> bills every 3 months.
* @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 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|string $nickname A brief description of the plan, hidden from customers.
* @property null|string|\Stripe\Product $product The product whose pricing this plan determines.
* @property null|\Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
* @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
* @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows.
* @property null|\Stripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>.
* @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using <a href="https://stripe.com/docs/api#create_subscription-trial_from_plan"><code>trial_from_plan=true</code></a>.

View File

@ -20,8 +20,8 @@ namespace Stripe;
* href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
* a subscription</a>, <a
* href="https://stripe.com/docs/billing/invoices/create">create an invoice</a>,
* and more about <a href="https://stripe.com/docs/billing/prices-guide">products
* and prices</a>.
* and more about <a
* href="https://stripe.com/docs/products-prices/overview">products and prices</a>.
*
* @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.
@ -30,17 +30,18 @@ namespace Stripe;
* @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 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 $lookup_key A lookup key used to retrieve prices dynamically from a static string.
* @property null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
* @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 null|string $nickname A brief description of the plan, hidden from customers.
* @property null|string $nickname A brief description of the price, hidden from customers.
* @property string|\Stripe\Product $product The ID of the product this price is associated with.
* @property null|\Stripe\StripeObject $recurring The recurring components of a price such as <code>interval</code> and <code>usage_type</code>.
* @property null|string $tax_behavior Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of <code>inclusive</code>, <code>exclusive</code>, or <code>unspecified</code>. Once specified as either <code>inclusive</code> or <code>exclusive</code>, it cannot be changed.
* @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
* @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows.
* @property null|\Stripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>.
* @property string $type One of <code>one_time</code> or <code>recurring</code> depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
* @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible.
* @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.
* @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if <code>billing_scheme=per_unit</code>.
* @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if <code>billing_scheme=per_unit</code>.
*/
class Price extends ApiResource
{
@ -49,14 +50,34 @@ class Price extends ApiResource
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Search;
use ApiOperations\Update;
const BILLING_SCHEME_PER_UNIT = 'per_unit';
const BILLING_SCHEME_TIERED = 'tiered';
const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive';
const TAX_BEHAVIOR_INCLUSIVE = 'inclusive';
const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified';
const TIERS_MODE_GRADUATED = 'graduated';
const TIERS_MODE_VOLUME = 'volume';
const TYPE_ONE_TIME = 'one_time';
const TYPE_RECURRING = 'recurring';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<Price> the price search results
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/prices/search';
return self::_searchResource($url, $params, $opts);
}
}

View File

@ -9,14 +9,16 @@ namespace Stripe;
* For example, you might offer a Standard and Premium version of your goods or
* service; each version would be a separate Product. They can be used in
* conjunction with <a href="https://stripe.com/docs/api#prices">Prices</a> to
* configure pricing in Checkout and Subscriptions.
* configure pricing in Payment Links, Checkout, and Subscriptions.
*
* Related guides: <a
* href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
* a subscription</a> or accept <a
* href="https://stripe.com/docs/payments/checkout/client#create-products">one-time
* payments with Checkout</a> and more about <a
* href="https://stripe.com/docs/billing/prices-guide">Products and Prices</a>
* a subscription</a>, <a
* href="https://stripe.com/docs/payments/payment-links/overview">share a Payment
* Link</a>, <a
* href="https://stripe.com/docs/payments/accept-a-payment#create-product-prices-upfront">accept
* payments with Checkout</a>, and more about <a
* href="https://stripe.com/docs/products-prices/overview">Products and Prices</a>
*
* @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.
@ -25,18 +27,20 @@ namespace Stripe;
* @property null|string $caption A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of <code>type=good</code>.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string[] $deactivate_on An array of connect application identifiers that cannot purchase this product. Only applicable to products of <code>type=good</code>.
* @property null|string|\Stripe\Price $default_price The ID of the <a href="https://stripe.com/docs/api/prices">Price</a> object that is the default price for this product.
* @property null|string $description The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
* @property string[] $images A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
* @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 $name The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own <code>package_dimensions</code>. Only applicable to products of <code>type=good</code>.
* @property null|bool $shippable Whether this product is a shipped good. Only applicable to products of <code>type=good</code>.
* @property string $name The product's name, meant to be displayable to the customer.
* @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes.
* @property null|bool $shippable Whether this product is shipped (i.e., physical goods).
* @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used.
* @property null|string|\Stripe\TaxCode $tax_code A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID.
* @property string $type The type of the product. The product is either of type <code>good</code>, which is eligible for use with Orders and SKUs, or <code>service</code>, which is eligible for use with Subscriptions and Plans.
* @property null|string $unit_label A label that represents units of this product in Stripe and on customers receipts and invoices. When set, this will be included in associated invoice line item descriptions.
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
* @property null|string $url A URL of a publicly-accessible webpage for this product. Only applicable to products of <code>type=good</code>.
* @property null|string $url A URL of a publicly-accessible webpage for this product.
*/
class Product extends ApiResource
{
@ -46,8 +50,24 @@ class Product extends ApiResource
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Search;
use ApiOperations\Update;
const TYPE_GOOD = 'good';
const TYPE_SERVICE = 'service';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<Product> the product search results
*/
public static function search($params = null, $opts = null)
{
$url = '/v1/products/search';
return self::_searchResource($url, $params, $opts);
}
}

View File

@ -12,13 +12,13 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property bool $active Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
* @property string $code The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
* @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#invoices">invoices</a> or <a href="https://stripe.com/docs/api#create_order-coupon">orders</a>. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a>.
* @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#invoices">invoices</a> or <a href="https://stripe.com/docs/api#create_order_legacy-coupon">orders</a>. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a>.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\Stripe\Customer $customer The customer that this promotion code can be used by.
* @property null|int $expires_at Date at which the promotion code can no longer be redeemed.
* @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 promotion code can be redeemed.
* @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 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 \Stripe\StripeObject $restrictions
* @property int $times_redeemed Number of times this promotion code has been used.
*/

View File

@ -0,0 +1,171 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe;
/**
* A Quote is a way to model prices that you'd like to provide to a customer. Once
* accepted, it will automatically create an invoice, subscription or subscription
* schedule.
*
* @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_subtotal Total before any discounts or taxes are applied.
* @property int $amount_total Total after discounts and taxes are applied.
* @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the quote.
* @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote.
* @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote.
* @property \Stripe\StripeObject $automatic_tax
* @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to <code>charge_automatically</code>.
* @property \Stripe\StripeObject $computed
* @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://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|string|\Stripe\Customer $customer The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
* @property (string|\Stripe\TaxRate)[] $default_tax_rates The tax rates applied to this quote.
* @property null|string $description A description that will be displayed on the quote PDF.
* @property (string|\Stripe\Discount)[] $discounts The discounts applied to this quote.
* @property int $expires_at The date on which the quote will be canceled if in <code>open</code> or <code>draft</code> status. Measured in seconds since the Unix epoch.
* @property null|string $footer A footer that will be displayed on the quote PDF.
* @property null|\Stripe\StripeObject $from_quote Details of the quote that was cloned. See the <a href="https://stripe.com/docs/quotes/clone">cloning documentation</a> for more details.
* @property null|string $header A header that will be displayed on the quote PDF.
* @property null|string|\Stripe\Invoice $invoice The invoice that was created from this quote.
* @property null|\Stripe\StripeObject $invoice_settings All invoices will be billed using the specified settings.
* @property \Stripe\Collection<\Stripe\LineItem> $line_items A list of items the customer is being quoted 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.
* @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 null|string $number A unique number that identifies this particular quote. This number is assigned once the quote is <a href="https://stripe.com/docs/quotes/overview#finalize">finalized</a>.
* @property null|string|\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details.
* @property string $status The status of the quote.
* @property \Stripe\StripeObject $status_transitions
* @property null|string|\Stripe\Subscription $subscription The subscription that was created or updated from this quote.
* @property \Stripe\StripeObject $subscription_data
* @property null|string|\Stripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote.
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this quote belongs to.
* @property \Stripe\StripeObject $total_details
* @property null|\Stripe\StripeObject $transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
*/
class Quote extends ApiResource
{
const OBJECT_NAME = 'quote';
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
const STATUS_ACCEPTED = 'accepted';
const STATUS_CANCELED = 'canceled';
const STATUS_DRAFT = 'draft';
const STATUS_OPEN = 'open';
/**
* @param callable $readBodyChunkCallable
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function pdf($readBodyChunkCallable, $params = null, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
if (null === $opts->apiBase) {
$opts->apiBase = Stripe::$apiUploadBase;
}
$url = $this->instanceUrl() . '/pdf';
$this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts);
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the accepted quote
*/
public function accept($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/accept';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the canceled quote
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the finalized quote
*/
public function finalizeQuote($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/finalize';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Quote> list of LineItems
*/
public static function allComputedUpfrontLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/computed_upfront_line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Quote> list of LineItems
*/
public static function allLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@ -19,6 +19,7 @@ namespace Stripe\Radar;
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $fraud_type The type of fraud labelled by the issuer. One of <code>card_never_received</code>, <code>fraudulent_card_application</code>, <code>made_with_counterfeit_card</code>, <code>made_with_lost_card</code>, <code>made_with_stolen_card</code>, <code>misc</code>, <code>unauthorized_use_of_card</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 string|\Stripe\PaymentIntent $payment_intent ID of the Payment Intent this early fraud warning is for, optionally expanded.
*/
class EarlyFraudWarning extends \Stripe\ApiResource
{

View File

@ -17,8 +17,8 @@ namespace Stripe\Radar;
* @property string $alias The name of the value list for use in rules.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $created_by The name or email address of the user who created this value list.
* @property string $item_type The type of items in the value list. One of <code>card_fingerprint</code>, <code>card_bin</code>, <code>email</code>, <code>ip_address</code>, <code>country</code>, <code>string</code>, or <code>case_sensitive_string</code>.
* @property \Stripe\Collection $list_items List of items contained within this value list.
* @property string $item_type The type of items in the value list. One of <code>card_fingerprint</code>, <code>card_bin</code>, <code>email</code>, <code>ip_address</code>, <code>country</code>, <code>string</code>, <code>case_sensitive_string</code>, or <code>customer_id</code>.
* @property \Stripe\Collection<\Stripe\Radar\ValueListItem> $list_items List of items contained within this value list.
* @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 $name The name of the value list.

View File

@ -19,7 +19,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|\Stripe\BankAccount $active_account Hash describing the current account on the recipient, if there is one.
* @property null|\Stripe\Collection $cards
* @property null|\Stripe\Collection<\Stripe\Card> $cards
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\Stripe\Card $default_card The default card to use for creating transfers to this recipient.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.

View File

@ -21,7 +21,9 @@ namespace Stripe;
* @property string $description An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only)
* @property string|\Stripe\BalanceTransaction $failure_balance_transaction If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction.
* @property string $failure_reason If the refund failed, the reason for refund failure if known. Possible values are <code>lost_or_stolen_card</code>, <code>expired_or_canceled_card</code>, or <code>unknown</code>.
* @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 $instructions_email Email to which refund instructions, if required, are sent to.
* @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 \Stripe\StripeObject $next_action
* @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that was refunded.
* @property null|string $reason Reason for the refund, either user-provided (<code>duplicate</code>, <code>fraudulent</code>, or <code>requested_by_customer</code>) or generated by Stripe internally (<code>expired_uncaptured_charge</code>).
* @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this refund.
@ -43,6 +45,7 @@ class Refund extends ApiResource
const FAILURE_REASON_UNKNOWN = 'unknown';
const REASON_DUPLICATE = 'duplicate';
const REASON_EXPIRED_UNCAPTURED_CHARGE = 'expired_uncaptured_charge';
const REASON_FRAUDULENT = 'fraudulent';
const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer';
@ -55,4 +58,21 @@ class Refund extends ApiResource
* @deprecated use FAILURE_REASON_EXPIRED_OR_CANCELED_CARD instead
*/
const FAILURE_REASON = 'expired_or_canceled_card';
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Refund the canceled refund
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@ -12,17 +12,17 @@ namespace Stripe\Reporting;
* href="https://stripe.com/docs/reporting/statements/api">API Access to
* Reports</a>.
*
* Note that reports can only be run based on your live-mode data (not test-mode
* data), and thus related requests must be made with a <a
* Note that certain report types can only be run based on your live-mode data (not
* test-mode data), and will error when queried without a <a
* href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.
*
* @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|string $error If something should go wrong during the run, a message about the failure (populated when <code>status=failed</code>).
* @property bool $livemode Always <code>true</code>: reports can only be run on live-mode data.
* @property bool $livemode <code>true</code> if the report is run on live mode data and <code>false</code> if it is run on test mode data.
* @property \Stripe\StripeObject $parameters
* @property string $report_type The ID of the <a href="https://stripe.com/docs/reporting/statements/api#report-types">report type</a> to run, such as <code>&quot;balance.summary.1&quot;</code>.
* @property string $report_type The ID of the <a href="https://stripe.com/docs/reports/report-types">report type</a> to run, such as <code>&quot;balance.summary.1&quot;</code>.
* @property null|\Stripe\File $result The file object representing the result of the report run (populated when <code>status=succeeded</code>).
* @property string $status Status of this report run. This will be <code>pending</code> when the run is initially created. When the run finishes, this will be set to <code>succeeded</code> and the <code>result</code> field will be populated. Rarely, we may encounter an error, at which point this will be set to <code>failed</code> and the <code>error</code> field will be populated.
* @property null|int $succeeded_at Timestamp at which this run successfully finished (populated when <code>status=succeeded</code>). Measured in seconds since the Unix epoch.

View File

@ -12,8 +12,8 @@ namespace Stripe\Reporting;
* documentation</a> for those Report Type IDs, along with required and optional
* parameters.
*
* Note that reports can only be run based on your live-mode data (not test-mode
* data), and thus related requests must be made with a <a
* Note that certain report types can only be run based on your live-mode data (not
* test-mode data), and will error when queried without a <a
* href="https://stripe.com/docs/keys#test-live-modes">live-mode API key</a>.
*
* @property string $id The <a href="https://stripe.com/docs/reporting/statements/api#available-report-types">ID of the Report Type</a>, such as <code>balance.summary.1</code>.
@ -21,6 +21,7 @@ namespace Stripe\Reporting;
* @property int $data_available_end Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch.
* @property int $data_available_start Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch.
* @property null|string[] $default_columns List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the <code>columns</code> parameter, this will be null.)
* @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 Human-readable name of the Report Type
* @property int $updated When this Report Type was latest updated. Measured in seconds since the Unix epoch.
* @property int $version Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas.

View File

@ -15,7 +15,7 @@ namespace Stripe;
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|string $billing_zip The ZIP or postal code of the card used, if applicable.
* @property null|string|\Stripe\Charge $charge The charge associated with this review.
* @property null|string $closed_reason The reason the review was closed, or null if it has not yet been closed. One of <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, or <code>disputed</code>.
* @property null|string $closed_reason The reason the review was closed, or null if it has not yet been closed. One of <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, <code>disputed</code>, or <code>redacted</code>.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $ip_address The IP address where the payment originated.
* @property null|\Stripe\StripeObject $ip_address_location Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address.
@ -23,7 +23,7 @@ namespace Stripe;
* @property bool $open If <code>true</code>, the review needs action.
* @property string $opened_reason The reason the review was opened. One of <code>rule</code> or <code>manual</code>.
* @property string|\Stripe\PaymentIntent $payment_intent The PaymentIntent ID associated with this review, if one exists.
* @property string $reason The reason the review is currently open or closed. One of <code>rule</code>, <code>manual</code>, <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, or <code>disputed</code>.
* @property string $reason The reason the review is currently open or closed. One of <code>rule</code>, <code>manual</code>, <code>approved</code>, <code>refunded</code>, <code>refunded_as_fraud</code>, <code>disputed</code>, or <code>redacted</code>.
* @property null|\Stripe\StripeObject $session Information related to the browsing session of the user who initiated the payment.
*/
class Review extends ApiResource
@ -53,7 +53,7 @@ class Review extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Review the approved review
* @return \Stripe\Review the approved review
*/
public function approve($params = null, $opts = null)
{

View File

@ -14,9 +14,6 @@ namespace Stripe;
*
* Can also be used to manage inventory.
*
* Related guide: <a href="https://stripe.com/docs/orders">Tax, Shipping, and
* Inventory</a>.
*
* @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 bool $active Whether the SKU is available for purchase.

View File

@ -0,0 +1,234 @@
<?php
namespace Stripe;
/**
* Search results for an API resource.
*
* This behaves similarly to <code>Collection</code> in that they both wrap
* around a list of objects and provide pagination. However the
* <code>SearchResult</code> object paginates by relying on a
* <code>next_page</code> token included in the response rather than using
* object IDs and a <code>starting_before</code>/<code>ending_after</code>
* parameter. Thus, <code>SearchResult</code> only supports forwards pagination.
*
* The {@see $total_count} property is only available when
* the `expand` parameter contains `total_count`.
*
* @template TStripeObject of StripeObject
* @template-implements \IteratorAggregate<TStripeObject>
*
* @property string $object
* @property string $url
* @property string $next_page
* @property int $total_count
* @property bool $has_more
* @property TStripeObject[] $data
*/
class SearchResult extends StripeObject implements \Countable, \IteratorAggregate
{
const OBJECT_NAME = 'search_result';
use ApiOperations\Request;
/** @var array */
protected $filters = [];
/**
* @return string the base URL for the given class
*/
public static function baseUrl()
{
return Stripe::$apiBase;
}
/**
* Returns the filters.
*
* @return array the filters
*/
public function getFilters()
{
return $this->filters;
}
/**
* Sets the filters, removing paging options.
*
* @param array $filters the filters
*/
public function setFilters($filters)
{
$this->filters = $filters;
}
#[\ReturnTypeWillChange]
public function offsetGet($k)
{
if (\is_string($k)) {
return parent::offsetGet($k);
}
$msg = "You tried to access the {$k} index, but SearchResult " .
'types only support string keys. (HINT: Search calls ' .
'return an object with a `data` (which is the data ' .
"array). You likely want to call ->data[{$k}])";
throw new Exception\InvalidArgumentException($msg);
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return SearchResult<TStripeObject>
*/
public function all($params = null, $opts = null)
{
self::_validateParams($params);
list($url, $params) = $this->extractPathAndUpdateParams($params);
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response, $opts);
if (!($obj instanceof \Stripe\SearchResult)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . \Stripe\SearchResult::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setFilters($params);
return $obj;
}
/**
* @return int the number of objects in the current page
*/
#[\ReturnTypeWillChange]
public function count()
{
return \count($this->data);
}
/**
* @return \ArrayIterator an iterator that can be used to iterate
* across objects in the current page
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->data);
}
/**
* @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.
*/
public function autoPagingIterator()
{
$page = $this;
while (true) {
foreach ($page as $item) {
yield $item;
}
$page = $page->nextPage();
if ($page->isEmpty()) {
break;
}
}
}
/**
* Returns an empty set of search results. This is returned from
* {@see nextPage()} when we know that there isn't a next page in order to
* replicate the behavior of the API when it attempts to return a page
* beyond the last.
*
* @param null|array|string $opts
*
* @return SearchResult
*/
public static function emptySearchResult($opts = null)
{
return SearchResult::constructFrom(['data' => []], $opts);
}
/**
* Returns true if the page object contains no element.
*
* @return bool
*/
public function isEmpty()
{
return empty($this->data);
}
/**
* Fetches the next page in the resource list (if there is one).
*
* This method will try to respect the limit of the current page. If none
* was given, the default limit will be fetched again.
*
* @param null|array $params
* @param null|array|string $opts
*
* @return SearchResult<TStripeObject>
*/
public function nextPage($params = null, $opts = null)
{
if (!$this->has_more) {
return static::emptySearchResult($opts);
}
$params = \array_merge(
$this->filters ?: [],
['page' => $this->next_page],
$params ?: []
);
return $this->all($params, $opts);
}
/**
* Gets the first item from the current page. Returns `null` if the current page is empty.
*
* @return null|TStripeObject
*/
public function first()
{
return \count($this->data) > 0 ? $this->data[0] : null;
}
/**
* Gets the last item from the current page. Returns `null` if the current page is empty.
*
* @return null|TStripeObject
*/
public function last()
{
return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null;
}
private function extractPathAndUpdateParams($params)
{
$url = \parse_url($this->url);
if (!isset($url['path'])) {
throw new Exception\UnexpectedValueException("Could not parse list url into parts: {$url}");
}
if (isset($url['query'])) {
// If the URL contains a query param, parse it out into $params so they
// don't interact weirdly with each other.
$query = [];
\parse_str($url['query'], $query);
$params = \array_merge($params ?: [], $query);
}
return [$url['path'], $params];
}
}

View File

@ -12,6 +12,11 @@ abstract class AbstractService
*/
protected $client;
/**
* @var \Stripe\StripeStreamingClientInterface
*/
protected $streamingClient;
/**
* Initializes a new instance of the {@link AbstractService} class.
*
@ -20,6 +25,7 @@ abstract class AbstractService
public function __construct($client)
{
$this->client = $client;
$this->streamingClient = $client;
}
/**
@ -32,6 +38,16 @@ abstract class AbstractService
return $this->client;
}
/**
* Gets the client used by this service to send requests.
*
* @return \Stripe\StripeStreamingClientInterface
*/
public function getStreamingClient()
{
return $this->streamingClient;
}
/**
* Translate null values to empty strings. For service methods,
* we interpret null as a request to unset the field, which
@ -59,11 +75,21 @@ abstract class AbstractService
return $this->getClient()->request($method, $path, static::formatParams($params), $opts);
}
protected function requestStream($method, $path, $readBodyChunkCallable, $params, $opts)
{
return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, static::formatParams($params), $opts);
}
protected function requestCollection($method, $path, $params, $opts)
{
return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts);
}
protected function requestSearchResult($method, $path, $params, $opts)
{
return $this->getClient()->requestSearchResult($method, $path, static::formatParams($params), $opts);
}
protected function buildPath($basePath, ...$ids)
{
foreach ($ids as $id) {

View File

@ -15,7 +15,7 @@ class AccountService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Account>
*/
public function all($params = null, $opts = null)
{
@ -33,7 +33,7 @@ class AccountService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Capability>
*/
public function allCapabilities($parentId, $params = null, $opts = null)
{
@ -49,7 +49,7 @@ class AccountService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\BankAccount|\Stripe\Card>
*/
public function allExternalAccounts($parentId, $params = null, $opts = null)
{
@ -67,7 +67,7 @@ class AccountService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Person>
*/
public function allPersons($parentId, $params = null, $opts = null)
{
@ -146,11 +146,12 @@ class AccountService extends \Stripe\Service\AbstractService
}
/**
* With <a href="/docs/connect">Connect</a>, you can delete Custom or Express
* accounts you manage.
* With <a href="/docs/connect">Connect</a>, you can delete accounts you manage.
*
* Accounts created using test-mode keys can be deleted at any time. Accounts
* created using live-mode keys can only be deleted once all balances are zero.
* Accounts created using test-mode keys can be deleted at any time. Standard
* accounts created using live-mode keys cannot be deleted. Custom or Express
* accounts created using live-mode keys can only be deleted once all balances are
* zero.
*
* If you want to delete your own account, use the <a
* href="https://dashboard.stripe.com/account">account information tab in your
@ -278,11 +279,11 @@ class AccountService extends \Stripe\Service\AbstractService
}
/**
* Updates a connected <a href="/docs/connect/accounts">Express or Custom
* account</a> by setting the values of the parameters passed. Any parameters not
* provided are left unchanged. Most parameters can be changed only for Custom
* accounts. (These are marked <strong>Custom Only</strong> below.) Parameters
* marked <strong>Custom and Express</strong> are supported by both account types.
* Updates a <a href="/docs/connect/accounts">connected account</a> by setting the
* values of the parameters passed. Any parameters not provided are left unchanged.
* Most parameters can be changed only for Custom accounts. (These are marked
* <strong>Custom Only</strong> below.) Parameters marked <strong>Custom and
* Express</strong> are not supported for Standard accounts.
*
* To update your own account, use the <a
* href="https://dashboard.stripe.com/account">Dashboard</a>. Refer to our <a
@ -320,10 +321,10 @@ class AccountService extends \Stripe\Service\AbstractService
}
/**
* Updates the metadata, account holder name, and account holder type of a bank
* account belonging to a <a href="/docs/connect/custom-accounts">Custom
* account</a>, and optionally sets it as the default for its currency. Other bank
* account details are not editable by design.
* Updates the metadata, account holder name, account holder type of a bank account
* belonging to a <a href="/docs/connect/custom-accounts">Custom account</a>, and
* optionally sets it as the default for its currency. Other bank account details
* are not editable by design.
*
* You can re-enable a disabled bank account by performing an update call without
* providing any arguments or changes.

View File

@ -14,7 +14,7 @@ class ApplePayDomainService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\ApplePayDomain>
*/
public function all($params = null, $opts = null)
{

View File

@ -15,7 +15,7 @@ class ApplicationFeeService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\ApplicationFee>
*/
public function all($params = null, $opts = null)
{
@ -35,7 +35,7 @@ class ApplicationFeeService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\ApplicationFeeRefund>
*/
public function allRefunds($parentId, $params = null, $opts = null)
{

View File

@ -19,7 +19,7 @@ class BalanceTransactionService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\BalanceTransaction>
*/
public function all($params = null, $opts = null)
{

View File

@ -7,6 +7,7 @@ namespace Stripe\Service\BillingPortal;
/**
* Service factory class for API resources in the BillingPortal namespace.
*
* @property ConfigurationService $configurations
* @property SessionService $sessions
*/
class BillingPortalServiceFactory extends \Stripe\Service\AbstractServiceFactory
@ -15,6 +16,7 @@ class BillingPortalServiceFactory extends \Stripe\Service\AbstractServiceFactory
* @var array<string, string>
*/
private static $classMap = [
'configurations' => ConfigurationService::class,
'sessions' => SessionService::class,
];

View File

@ -0,0 +1,73 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\BillingPortal;
class ConfigurationService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of configurations that describe the functionality of the customer
* portal.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\BillingPortal\Configuration>
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/billing_portal/configurations', $params, $opts);
}
/**
* Creates a configuration that describes the functionality and behavior of a
* PortalSession.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BillingPortal\Configuration
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/billing_portal/configurations', $params, $opts);
}
/**
* Retrieves a configuration that describes the functionality of the customer
* portal.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BillingPortal\Configuration
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts);
}
/**
* Updates a configuration that describes the functionality of the customer portal.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BillingPortal\Configuration
*/
public function update($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts);
}
}

View File

@ -15,7 +15,7 @@ class ChargeService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Charge>
*/
public function all($params = null, $opts = null)
{
@ -27,9 +27,10 @@ class ChargeService extends \Stripe\Service\AbstractService
* of the two-step payment flow, where first you <a href="#create_charge">created a
* charge</a> with the capture option set to false.
*
* Uncaptured payments expire exactly seven days after they are created. If they
* are not captured by that point in time, they will be marked as refunded and will
* no longer be capturable.
* Uncaptured payments expire a set number of days after they are created (<a
* href="/docs/charges/placing-a-hold">7 by default</a>). If they are not captured
* by that point in time, they will be marked as refunded and will no longer be
* capturable.
*
* @param string $id
* @param null|array $params
@ -82,6 +83,26 @@ class ChargeService extends \Stripe\Service\AbstractService
return $this->request('get', $this->buildPath('/v1/charges/%s', $id), $params, $opts);
}
/**
* Search for charges youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont use
* search in read-after-write flows where strict consistency is necessary. Under
* normal operating conditions, data is searchable in less than a minute.
* Occasionally, propagation of new or updated data can be up to an hour behind
* during outages. Search functionality is not available to merchants in India.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<\Stripe\Charge>
*/
public function search($params = null, $opts = null)
{
return $this->requestSearchResult('get', '/v1/charges/search', $params, $opts);
}
/**
* Updates the specified charge by setting the values of the parameters passed. Any
* parameters not provided will be left unchanged.

View File

@ -14,7 +14,7 @@ class SessionService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Checkout\Session>
*/
public function all($params = null, $opts = null)
{
@ -33,7 +33,7 @@ class SessionService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\LineItem>
*/
public function allLineItems($parentId, $params = null, $opts = null)
{
@ -55,6 +55,25 @@ class SessionService extends \Stripe\Service\AbstractService
return $this->request('post', '/v1/checkout/sessions', $params, $opts);
}
/**
* A Session can be expired when it is in one of these statuses: <code>open</code>.
*
* After it expires, a customer cant complete a Session and customers loading the
* Session see a message saying the Session is expired.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Checkout\Session
*/
public function expire($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/checkout/sessions/%s/expire', $id), $params, $opts);
}
/**
* Retrieves a Session object.
*

View File

@ -26,6 +26,8 @@ namespace Stripe\Service;
* @property ExchangeRateService $exchangeRates
* @property FileLinkService $fileLinks
* @property FileService $files
* @property FinancialConnections\FinancialConnectionsServiceFactory $financialConnections
* @property Identity\IdentityServiceFactory $identity
* @property InvoiceItemService $invoiceItems
* @property InvoiceService $invoices
* @property Issuing\IssuingServiceFactory $issuing
@ -34,25 +36,31 @@ namespace Stripe\Service;
* @property OrderReturnService $orderReturns
* @property OrderService $orders
* @property PaymentIntentService $paymentIntents
* @property PaymentLinkService $paymentLinks
* @property PaymentMethodService $paymentMethods
* @property PayoutService $payouts
* @property PlanService $plans
* @property PriceService $prices
* @property ProductService $products
* @property PromotionCodeService $promotionCodes
* @property QuoteService $quotes
* @property Radar\RadarServiceFactory $radar
* @property RefundService $refunds
* @property Reporting\ReportingServiceFactory $reporting
* @property ReviewService $reviews
* @property SetupAttemptService $setupAttempts
* @property SetupIntentService $setupIntents
* @property ShippingRateService $shippingRates
* @property Sigma\SigmaServiceFactory $sigma
* @property SkuService $skus
* @property SourceService $sources
* @property SubscriptionItemService $subscriptionItems
* @property SubscriptionService $subscriptions
* @property SubscriptionScheduleService $subscriptionSchedules
* @property TaxCodeService $taxCodes
* @property TaxRateService $taxRates
* @property Terminal\TerminalServiceFactory $terminal
* @property TestHelpers\TestHelpersServiceFactory $testHelpers
* @property TokenService $tokens
* @property TopupService $topups
* @property TransferService $transfers
@ -83,6 +91,8 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'exchangeRates' => ExchangeRateService::class,
'fileLinks' => FileLinkService::class,
'files' => FileService::class,
'financialConnections' => FinancialConnections\FinancialConnectionsServiceFactory::class,
'identity' => Identity\IdentityServiceFactory::class,
'invoiceItems' => InvoiceItemService::class,
'invoices' => InvoiceService::class,
'issuing' => Issuing\IssuingServiceFactory::class,
@ -91,25 +101,31 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'orderReturns' => OrderReturnService::class,
'orders' => OrderService::class,
'paymentIntents' => PaymentIntentService::class,
'paymentLinks' => PaymentLinkService::class,
'paymentMethods' => PaymentMethodService::class,
'payouts' => PayoutService::class,
'plans' => PlanService::class,
'prices' => PriceService::class,
'products' => ProductService::class,
'promotionCodes' => PromotionCodeService::class,
'quotes' => QuoteService::class,
'radar' => Radar\RadarServiceFactory::class,
'refunds' => RefundService::class,
'reporting' => Reporting\ReportingServiceFactory::class,
'reviews' => ReviewService::class,
'setupAttempts' => SetupAttemptService::class,
'setupIntents' => SetupIntentService::class,
'shippingRates' => ShippingRateService::class,
'sigma' => Sigma\SigmaServiceFactory::class,
'skus' => SkuService::class,
'sources' => SourceService::class,
'subscriptionItems' => SubscriptionItemService::class,
'subscriptions' => SubscriptionService::class,
'subscriptionSchedules' => SubscriptionScheduleService::class,
'taxCodes' => TaxCodeService::class,
'taxRates' => TaxRateService::class,
'terminal' => Terminal\TerminalServiceFactory::class,
'testHelpers' => TestHelpers\TestHelpersServiceFactory::class,
'tokens' => TokenService::class,
'topups' => TopupService::class,
'transfers' => TransferService::class,

View File

@ -14,7 +14,7 @@ class CountrySpecService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\CountrySpec>
*/
public function all($params = null, $opts = null)
{

View File

@ -14,7 +14,7 @@ class CouponService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Coupon>
*/
public function all($params = null, $opts = null)
{

View File

@ -14,7 +14,7 @@ class CreditNoteService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\CreditNote>
*/
public function all($params = null, $opts = null)
{
@ -32,7 +32,7 @@ class CreditNoteService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\CreditNoteLineItem>
*/
public function allLines($parentId, $params = null, $opts = null)
{
@ -98,11 +98,11 @@ class CreditNoteService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\CreditNote
* @return \Stripe\Collection<\Stripe\CreditNote>
*/
public function previewLines($params = null, $opts = null)
{
return $this->request('get', '/v1/credit_notes/preview/lines', $params, $opts);
return $this->requestCollection('get', '/v1/credit_notes/preview/lines', $params, $opts);
}
/**

View File

@ -15,7 +15,7 @@ class CustomerService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Customer>
*/
public function all($params = null, $opts = null)
{
@ -24,7 +24,7 @@ class CustomerService extends \Stripe\Service\AbstractService
/**
* Returns a list of transactions that updated the customers <a
* href="/docs/api/customers/object#customer_object-balance"><code>balance</code></a>.
* href="/docs/billing/customer/balance">balances</a>.
*
* @param string $parentId
* @param null|array $params
@ -32,13 +32,29 @@ class CustomerService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\CustomerBalanceTransaction>
*/
public function allBalanceTransactions($parentId, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts);
}
/**
* Returns a list of PaymentMethods for a given Customer.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Customer>
*/
public function allPaymentMethods($id, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/payment_methods', $id), $params, $opts);
}
/**
* List sources for a specified customer.
*
@ -48,7 +64,7 @@ class CustomerService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source>
*/
public function allSources($parentId, $params = null, $opts = null)
{
@ -64,7 +80,7 @@ class CustomerService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\TaxId>
*/
public function allTaxIds($parentId, $params = null, $opts = null)
{
@ -87,8 +103,8 @@ class CustomerService extends \Stripe\Service\AbstractService
}
/**
* Creates an immutable transaction that updates the customers <a
* href="/docs/api/customers/object#customer_object-balance"><code>balance</code></a>.
* Creates an immutable transaction that updates the customers credit <a
* href="/docs/billing/customer/balance">balance</a>.
*
* @param string $parentId
* @param null|array $params
@ -103,6 +119,26 @@ class CustomerService extends \Stripe\Service\AbstractService
return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts);
}
/**
* Retrieve funding instructions for a customer cash balance. If funding
* instructions do not yet exist for the customer, new funding instructions will be
* created. If funding instructions have already been created for a given customer,
* the same funding instructions will be retrieved. In other words, we will return
* the same funding instructions each time.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Customer
*/
public function createFundingInstructions($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/customers/%s/funding_instructions', $id), $params, $opts);
}
/**
* When you create a new credit card, you must specify a customer or recipient on
* which to create it.
@ -207,8 +243,7 @@ class CustomerService extends \Stripe\Service\AbstractService
}
/**
* Retrieves the details of an existing customer. You need only supply the unique
* customer identifier that was returned upon customer creation.
* Retrieves a Customer object.
*
* @param string $id
* @param null|array $params
@ -224,8 +259,8 @@ class CustomerService extends \Stripe\Service\AbstractService
}
/**
* Retrieves a specific transaction that updated the customers <a
* href="/docs/api/customers/object#customer_object-balance"><code>balance</code></a>.
* Retrieves a specific customer balance transaction that updated the customers <a
* href="/docs/billing/customer/balance">balances</a>.
*
* @param string $parentId
* @param string $id
@ -241,6 +276,22 @@ class CustomerService extends \Stripe\Service\AbstractService
return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts);
}
/**
* Retrieves a customers cash balance.
*
* @param string $parentId
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\cash_balance
*/
public function retrieveCashBalance($parentId, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
}
/**
* Retrieve a specified source for a given customer.
*
@ -275,6 +326,26 @@ class CustomerService extends \Stripe\Service\AbstractService
return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts);
}
/**
* Search for customers youve previously created using Stripes <a
* href="/docs/search#search-query-language">Search Query Language</a>. Dont use
* search in read-after-write flows where strict consistency is necessary. Under
* normal operating conditions, data is searchable in less than a minute.
* Occasionally, propagation of new or updated data can be up to an hour behind
* during outages. Search functionality is not available to merchants in India.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<\Stripe\Customer>
*/
public function search($params = null, $opts = null)
{
return $this->requestSearchResult('get', '/v1/customers/search', $params, $opts);
}
/**
* Updates the specified customer by setting the values of the parameters passed.
* Any parameters not provided will be left unchanged. For example, if you pass the
@ -304,7 +375,7 @@ class CustomerService extends \Stripe\Service\AbstractService
}
/**
* Most customer balance transaction fields are immutable, but you may update its
* Most credit balance transaction fields are immutable, but you may update its
* <code>description</code> and <code>metadata</code>.
*
* @param string $parentId
@ -321,6 +392,22 @@ class CustomerService extends \Stripe\Service\AbstractService
return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts);
}
/**
* Updates a customers cash balance.
*
* @param string $parentId
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\cash_balance
*/
public function updateCashBalance($parentId, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
}
/**
* @param string $parentId
* @param string $id

View File

@ -14,7 +14,7 @@ class DisputeService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Dispute>
*/
public function all($params = null, $opts = null)
{

View File

@ -18,7 +18,7 @@ class EventService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\Event>
*/
public function all($params = null, $opts = null)
{

View File

@ -15,7 +15,7 @@ class ExchangeRateService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\ExchangeRate>
*/
public function all($params = null, $opts = null)
{

View File

@ -14,7 +14,7 @@ class FileLinkService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\FileLink>
*/
public function all($params = null, $opts = null)
{

View File

@ -16,7 +16,7 @@ class FileService extends \Stripe\Service\AbstractService
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
* @return \Stripe\Collection<\Stripe\File>
*/
public function all($params = null, $opts = null)
{

View File

@ -0,0 +1,58 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\FinancialConnections;
class AccountService extends \Stripe\Service\AbstractService
{
/**
* Disables your access to a Financial Connections <code>Account</code>. You will
* no longer be able to access data associated with the account (e.g. balances,
* transactions).
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\FinancialConnections\Account
*/
public function disconnect($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/disconnect', $id), $params, $opts);
}
/**
* Refreshes the data associated with a Financial Connections <code>Account</code>.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\FinancialConnections\Account
*/
public function refresh($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/refresh', $id), $params, $opts);
}
/**
* Retrieves the details of an Financial Connections <code>Account</code>.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\FinancialConnections\Account
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/financial_connections/accounts/%s', $id), $params, $opts);
}
}

View File

@ -0,0 +1,27 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Service\FinancialConnections;
/**
* Service factory class for API resources in the FinancialConnections namespace.
*
* @property AccountService $accounts
* @property SessionService $sessions
*/
class FinancialConnectionsServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'accounts' => AccountService::class,
'sessions' => SessionService::class,
];
protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}

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